1
This commit is contained in:
parent
d02976ac3e
commit
f530ca115f
@ -11,6 +11,7 @@
|
|||||||
#include "airraid.h"
|
#include "airraid.h"
|
||||||
#include "car.h"
|
#include "car.h"
|
||||||
#include "incubator.h"
|
#include "incubator.h"
|
||||||
|
#include "mapinstance.h"
|
||||||
|
|
||||||
#include "cs_proto.pb.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();
|
float z = a8::XValue(cmds[3]).GetDouble();
|
||||||
GetMutablePos().FromGlmVec3(glm::vec3(x, y, z));
|
GetMutablePos().FromGlmVec3(glm::vec3(x, y, z));
|
||||||
room->grid_service->MoveCreature(this);
|
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") {
|
} else if (cmd == "setmode") {
|
||||||
if (cmds.empty()) {
|
if (cmds.empty()) {
|
||||||
App::Instance()->UnSetFlag(20);
|
App::Instance()->UnSetFlag(20);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user