1
This commit is contained in:
parent
e438ca145e
commit
562e26ee75
@ -7,32 +7,21 @@
|
||||
|
||||
#include "creature.h"
|
||||
#include "room.h"
|
||||
#include "mapinstance.h"
|
||||
|
||||
void PullToWalkableBuff::Activate()
|
||||
{
|
||||
if (!owner->CollisonDetection()) {
|
||||
return;
|
||||
}
|
||||
glm::vec3 move_dir = owner->GetMoveDir();
|
||||
if (std::abs(move_dir.x) > FLT_EPSILON ||
|
||||
std::abs(move_dir.y) > FLT_EPSILON
|
||||
) {
|
||||
Position old_pos = owner->GetPos();
|
||||
for (int i = 1; i < 2000; i += 5) {
|
||||
// 999
|
||||
#if 1
|
||||
#else
|
||||
owner->SetPos(old_pos + move_dir * i);
|
||||
#endif
|
||||
if (!owner->CollisonDetection()) {
|
||||
owner->room->grid_service->MoveCreature(owner);
|
||||
return;
|
||||
}
|
||||
}
|
||||
owner->FindLocation();
|
||||
} else {
|
||||
owner->FindLocation();
|
||||
glm::vec3 center = owner->GetPos().ToGlmVec3();
|
||||
owner->room->map_instance->Scale(center);
|
||||
glm::vec3 point;
|
||||
bool ok = owner->room->map_instance->FindNearestPoint(center, 2, point);
|
||||
if (!ok) {
|
||||
abort();
|
||||
}
|
||||
owner->room->map_instance->UnScale(point);
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
owner->GetMutablePos().FromGlmVec3(point);
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
}
|
||||
|
||||
void PullToWalkableBuff::Deactivate()
|
||||
|
Loading…
x
Reference in New Issue
Block a user