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

@ -1058,16 +1058,29 @@ void Mob::AI_Process() {
auto &door_list = entity_list.GetDoorsList(); auto &door_list = entity_list.GetDoorsList();
for (auto itr : door_list) { for (auto itr : door_list) {
Doors* door = itr.second; Doors *door = itr.second;
if (door->IsDoorOpen()) { if (door->GetKeyItem())
continue; continue;
}
float distance = DistanceSquared(this->m_Position, door->GetPosition()); if (door->GetLockpick())
continue;
if (door->IsDoorOpen())
continue;
float distance = DistanceSquared(this->m_Position, door->GetPosition());
float distance_scan_door_open = 20; float distance_scan_door_open = 20;
if (distance <= (distance_scan_door_open * distance_scan_door_open)) { 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); door->ForceOpen(this);
} }
} }