Make sure NPC's don't open keyed or lockpick enabled doors - also make sure we are opening doors and not platforms above or below

This commit is contained in:
Akkadius 2018-05-11 00:14:24 -05:00
parent d504397593
commit 2c91d1db6e

View File

@ -1060,14 +1060,27 @@ void Mob::AI_Process() {
for (auto itr : door_list) {
Doors *door = itr.second;
if (door->IsDoorOpen()) {
if (door->GetKeyItem())
continue;
if (door->GetLockpick())
continue;
if (door->IsDoorOpen())
continue;
}
float distance = DistanceSquared(this->m_Position, door->GetPosition());
float distance_scan_door_open = 20;
if (distance <= (distance_scan_door_open * distance_scan_door_open)) {
/**
* Make sure we're opening a door within height relevance and not platforms
* above or below
*/
if (std::abs(this->m_Position.z - door->GetPosition().z) > 10)
continue;
door->ForceOpen(this);
}
}