This commit is contained in:
aozhiwei 2024-01-12 13:50:28 +08:00
parent 7339526263
commit cf51132072

View File

@ -170,6 +170,25 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
hum->GetMutablePos().FromGlmVec3(GetPos().ToGlmVec3());
room->grid_service->MoveCreature(hum);
}
} else if (cmd == "findhero" && cmds.size() >= 2) {
int hero_id = a8::XValue(cmds[1]);
bool found = false;
room->TraverseHumanList
(
[this, hero_id, &found] (Human* hum) -> bool
{
if (!hum->dead && hum->GetHeroMeta()->id() == hero_id) {
hum->GetMovement()->ClearPath();
hum->GetMutablePos().FromGlmVec3(GetPos().ToGlmVec3());
room->grid_service->MoveCreature(hum);
found = true;
return false;
}
return true;
});
if (!found) {
SendDebugMsg(a8::Format("not found", {}));
}
} else if (cmd == "find_teammate") {
GetTeam()->TraverseMembers
(