This commit is contained in:
aozhiwei 2023-06-20 17:52:21 +08:00
parent d02976ac3e
commit f530ca115f

View File

@ -11,6 +11,7 @@
#include "airraid.h"
#include "car.h"
#include "incubator.h"
#include "mapinstance.h"
#include "cs_proto.pb.h"
@ -45,6 +46,26 @@ void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
float z = a8::XValue(cmds[3]).GetDouble();
GetMutablePos().FromGlmVec3(glm::vec3(x, y, z));
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;
for (int i = 0; i < 10; ++i) {
ok = room->map_instance->FindConnectableNearestPoint(center, 1.0f + 10 * i, point);
if (ok) {
break;
}
}
if (ok) {
room->map_instance->UnScale(point);
GetMutablePos().FromGlmVec3(point);
room->grid_service->MoveCreature(this);
}
}
} else if (cmd == "setmode") {
if (cmds.empty()) {
App::Instance()->UnSetFlag(20);