1
This commit is contained in:
parent
7838ebdbc4
commit
e070f8df3b
@ -7,6 +7,7 @@
|
|||||||
#include "app.h"
|
#include "app.h"
|
||||||
#include "ability.h"
|
#include "ability.h"
|
||||||
#include "movement.h"
|
#include "movement.h"
|
||||||
|
#include "android.h"
|
||||||
|
|
||||||
#include "cs_proto.pb.h"
|
#include "cs_proto.pb.h"
|
||||||
|
|
||||||
@ -14,6 +15,7 @@
|
|||||||
#include "mt/Text.h"
|
#include "mt/Text.h"
|
||||||
#include "mt/Param.h"
|
#include "mt/Param.h"
|
||||||
#include "mt/Buff.h"
|
#include "mt/Buff.h"
|
||||||
|
#include "mt/Robot.h"
|
||||||
|
|
||||||
void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
|
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());
|
hum->GetMutablePos().FromGlmVec3(GetPos().ToGlmVec3());
|
||||||
room->grid_service->MoveCreature(hum);
|
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) {
|
} else if (cmd == "getattr" && cmds.size() >= 2) {
|
||||||
int attr_id = a8::XValue(cmds[1]);
|
int attr_id = a8::XValue(cmds[1]);
|
||||||
float abs_val = GetAbility()->GetAttrAbs(attr_id);
|
float abs_val = GetAbility()->GetAttrAbs(attr_id);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user