[Doors] Add door blacklist (#3516)

* [Doors] Add door blacklist

* Renaming to simplify
This commit is contained in:
Chris Miles
2023-07-30 01:35:44 -05:00
committed by GitHub
parent 14fe396510
commit ddac326239
5 changed files with 77 additions and 46 deletions
+1 -46
View File
@@ -981,52 +981,7 @@ void Mob::AI_Process() {
if (moving && CanOpenDoors()) {
if (AI_scan_door_open_timer->Check()) {
auto &door_list = entity_list.GetDoorsList();
for (auto itr : door_list) {
Doors *door = itr.second;
if (door->GetKeyItem()) {
continue;
}
if (door->GetLockpick()) {
continue;
}
if (door->IsDoorOpen()) {
continue;
}
if (door->GetTriggerDoorID() > 0) {
auto trigger_door = entity_list.GetDoorsByDoorID(door->GetTriggerDoorID());
if (trigger_door) {
if (Strings::RemoveNumbers(door->GetDoorName()) !=
Strings::RemoveNumbers(trigger_door->GetDoorName())) {
continue;
}
}
}
if (door->GetDoorParam() > 0) {
continue;
}
float distance = DistanceSquared(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(m_Position.z - door->GetPosition().z) > 10) {
continue;
}
door->ForceOpen(this);
}
}
HandleDoorOpen();
}
}