1
This commit is contained in:
parent
e438ca145e
commit
562e26ee75
@ -7,32 +7,21 @@
|
|||||||
|
|
||||||
#include "creature.h"
|
#include "creature.h"
|
||||||
#include "room.h"
|
#include "room.h"
|
||||||
|
#include "mapinstance.h"
|
||||||
|
|
||||||
void PullToWalkableBuff::Activate()
|
void PullToWalkableBuff::Activate()
|
||||||
{
|
{
|
||||||
if (!owner->CollisonDetection()) {
|
glm::vec3 center = owner->GetPos().ToGlmVec3();
|
||||||
return;
|
owner->room->map_instance->Scale(center);
|
||||||
}
|
glm::vec3 point;
|
||||||
glm::vec3 move_dir = owner->GetMoveDir();
|
bool ok = owner->room->map_instance->FindNearestPoint(center, 2, point);
|
||||||
if (std::abs(move_dir.x) > FLT_EPSILON ||
|
if (!ok) {
|
||||||
std::abs(move_dir.y) > FLT_EPSILON
|
abort();
|
||||||
) {
|
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
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()
|
void PullToWalkableBuff::Deactivate()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user