This commit is contained in:
aozhiwei 2023-06-26 14:31:09 +08:00
parent c2356b57b9
commit 9e0351ff12
3 changed files with 9 additions and 3 deletions

View File

@ -48,9 +48,6 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
room->grid_service->MoveCreature(this);
{
glm::vec3 center = GetPos().ToGlmVec3();
#if 0
room->map_instance->PtInHouse(GetPos().ToGlmVec3(), center);
#endif
room->map_instance->Scale(center);
glm::vec3 point;
bool ok = false;
@ -378,6 +375,11 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
&xtimer_attacher);
} else if (cmd == "fast_forward") {
room->GMFastForward();
} else if (cmd == "findpath" && cmds.size() >= 3) {
float x = a8::XValue(cmds[1]).GetDouble();
float y = a8::XValue(cmds[2]).GetDouble();
float z = a8::XValue(cmds[3]).GetDouble();
GetMovement()->FindPath(glm::vec3(x, y, z), 10);
}
#ifdef DEBUG
a8::XPrintf("exec_cmd:%s\n", {cmd});

View File

@ -242,6 +242,7 @@ bool Movement::FindPath(const glm::vec3& target_pos, float distance)
last_pos = pos;
}
is_find_path_ = true;
}
return !paths.empty();
}

View File

@ -184,6 +184,9 @@ void Player::InternalUpdate(int delta_time)
moving = false;
}
}
if (GetMovement()->IsFindPath()) {
moving = true;
}
if (moving) {
UpdateMoving();
}