This commit is contained in:
aozhiwei 2023-04-12 17:24:41 +08:00
parent 7838ebdbc4
commit e070f8df3b

View File

@ -7,6 +7,7 @@
#include "app.h"
#include "ability.h"
#include "movement.h"
#include "android.h"
#include "cs_proto.pb.h"
@ -14,6 +15,7 @@
#include "mt/Text.h"
#include "mt/Param.h"
#include "mt/Buff.h"
#include "mt/Robot.h"
void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
{
@ -114,6 +116,26 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
hum->GetMutablePos().FromGlmVec3(GetPos().ToGlmVec3());
room->grid_service->MoveCreature(hum);
}
} else if (cmd == "randomobj" && cmds.size() >= 2) {
int weapon_id = a8::XValue(cmds[1]);
Human* target = nullptr;
room->TraverseHumanList
(
[weapon_id, &target] (Human* hum) mutable
{
if (hum->IsAndroid() && !hum->dead) {
if (hum->AsAndroid()->robot_meta->weapon_id() == weapon_id) {
target = hum;
return false;
}
}
return true;
});
if (target) {
target->GetMovement()->ClearPath();
target->GetMutablePos().FromGlmVec3(GetPos().ToGlmVec3());
room->grid_service->MoveCreature(target);
}
} else if (cmd == "getattr" && cmds.size() >= 2) {
int attr_id = a8::XValue(cmds[1]);
float abs_val = GetAbility()->GetAttrAbs(attr_id);