EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Feature Requests (https://www.eqemulator.org/forums/forumdisplay.php?f=612)
-   -   NPC Door Opening Modification (https://www.eqemulator.org/forums/showthread.php?t=41946)

Figback65 06-19-2018 03:58 PM

NPC Door Opening Modification
 
Hey all,


The new change where NPCs open doors is great! But i am looking to modify/change it to submit/post for others who want the change whatever route this/i/we go with it.

The door opening needs a few more paramaters and seeing them placed in NPC_types would be great. As in, dooropen_prox, dooropen 0/1. Alot of zones that have pathways near doors or NPCs that path by doors and not THROUGH them, hit that proximity range and doors just open for no need. It would be nice to have the default option of dooropen 1 in npc_types so they by default all open doors but able to turn it off so the npcs that walk by a door wont open it. Or/And adjust the proximity. Having dooropen column is also flexible for style if people want classic or new choice.

Ive been looking through the code trying to find the proximity setting for this. Any pointers to the location of it? I can start working on it if i can find it lol.
"NPC's now open doors within proximity given the door doesn't have locked requirements"

Thank you

Figback65 06-19-2018 04:03 PM

Oops i think i just found it, any verification? mob_ai.cpp
line 1060-1092

Code:

        if (moving) {
                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;

                                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);
                                }
                        }
                }
        }



All times are GMT -4. The time now is 08:40 PM.

Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.