Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add event handlers for common events #14

Open
pnwparksfan opened this issue Jul 7, 2016 · 0 comments
Open

Add event handlers for common events #14

pnwparksfan opened this issue Jul 7, 2016 · 0 comments
Labels

Comments

@pnwparksfan
Copy link

Copied from this API forum thread.

Some common issues have come up repeatedly in the LSPDFR plugin developers discord, and I think many of them could be solved with some particular additions to the LSPDFR API. Some of these are also just things I'd like to see for use in my own plugins. Anyways, I think it would be good to have a central list of feature requests, where plugin developers can discuss what they would use, and the LSPDFR developers can comment on what might be possible for future versions.

Right now, a lot of plugins run a bunch of loops in a bunch of gamefibers to detect things that LSPDFR knows about already. It's a big waste of resources, and inefficient from a programming perspective as well. I'd like to suggest adding a lot more event handlers in the next version of the LSPDFR API.

  • OnPedArrested(Ped suspect, Ped arresting_officer): An event for whenever a ped gets arrested. Event arguments should give the arrested ped, and the officer who arrested them. This would trigger for both arrests by the player and by the AI. Devs could distinguish by just checking if arresting_officer == Game.LocalPlayer.Character. I imagine this would reduce the overhead of plugins like Arrest Manager.
  • OnCalloutDisplayed, OnCalloutAccepted, OnCalloutDeclined, OnCalloutFinished. All of these should correspond to the equivalent methods in the LSPDFR base callout class, but would trigger for any callout, and would return some kind of callout info object or LHandle which could be used to retrieve information about the callout, like the name of the callout, current status, etc. I can see this being useful for a wide number of things... mods like Vocal Dispatch and Computer+ for example could get better integration. Ambient events could detect if a callout is active and behave differently.
  • OnPullover(LHandle pullover) and OnPulloverDriverStopped(LHandle pullover): For whenever a ped is pulled over (former), or pulled over and successfully stops (latter). Maybe also OnOfficerApproachDriver(LHandle pullover) which would trigger the first time you get the "Press E to interact with driver" prompt for a given pullover. You can already get the current pullover using the API, but you have to constantly call that method to detect when a pullover start. An event would let you trigger some behavior immediately when a pullover starts.
  • OnPursuitStarted(LHandle pursuit): Likewise, you can detect the current pursuit but need to loop to find out when one starts. This would reduce overhead for mods which wish to affect pursuit behavior.
  • OnPedStopped(Ped suspect): Would return the stopped ped when stopping a ped on foot, i.e. by pressing and holding E.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants