Request Passive listener hooks

Discussion in 'Feature Suggestions' started by LazyMammal, Mar 28, 2014.

  1. I would like to have a hook function that is called when a player interacts with a door. I'm aware of CanOpenDoor but my plugin does not attempt to decide if a player is allowed to open a door.

    My plugin simply takes note that a door was opened and then closes the door 5 seconds later.

    Plugins like mine that try to use CanOpenDoor passively are in conflict with the plugins that use CanOpenDoor to actively return true when permission is granted to open a door. Returning anything other than nil stops the cascade to the next plugin.

    Considering my usage, I'd like to be able to use OnDoorToggle but it is handled directly by Oxide CORE.

    So if possible I would like to see something called OnDoorListener or similar. The idea would be that all plugins that handle OnDoorListener would return nil. This would ensure that all passive plugins would be given the opportunity to run when a door event occurs.

    At this time the only workaround that I know is for passive hook handlers to name the script file starting with a zero (e.g. "0-doorcloser.lua"). This is an inelegant hack that is not guaranteed to work in future releases of Oxide CORE.
     
  2. @LazyMammal, here's my proposed solution - feedback welcome :)
     
    Last edited by a moderator: Feb 26, 2015
  3. Cool. I have only glanced at it but it looks like it does even more than I was hoping for!
     
  4. You can now hook actively into OnDoorToggleFail(), which gives you the reason for failure (incorrect code, or not owned/shared), which may be useful for some scripts as well.

    Alternatively, you can hook passively (no need for return values) into OnDoorToggleAttempt or OnDoorToggleSuccess, which should aid both in your use case, and in further functionality people haven't even thought of yet ;)
     
    Last edited by a moderator: Feb 26, 2015