Skip to content

Add a OnPlayerRunCmdPre forward#1760

Merged
Headline merged 6 commits intoalliedmodders:masterfrom
neko-pm:OnPlayerRunCmdPre
Apr 25, 2022
Merged

Add a OnPlayerRunCmdPre forward#1760
Headline merged 6 commits intoalliedmodders:masterfrom
neko-pm:OnPlayerRunCmdPre

Conversation

@neko-pm
Copy link
Contributor

@neko-pm neko-pm commented Apr 24, 2022

As requested in this issue #1759, adds a OnPlayerRunCmdPre forward for use with certain plugins which want access to unmodified usercmds.

The name isn't ideal, but after a little discussion in the Discord, we've not been able to come up with anything better.

I'm also a little unsure if hasUsercmdsPreFwds and hasUsercmdsFwds are the correct formatting for the new varaibles.

I don't have an easy means to test this right now, so the changes are currently untested.

Closes #1759

neko-pm added 3 commits April 24, 2022 14:43
Addition of OnPlayerRunCmdPre forward
Only call forwards if they are required
Add missing bracket
neko-pm added 3 commits April 24, 2022 18:42
remove unnecessary note from the include
correct the return type
constify arrays
@asherkin
Copy link
Member

asherkin commented Apr 25, 2022

I was about to merge this, but I wonder if we need a feature capability for it existing? There doesn't appear to be a way to detect if a forward has been registered (which is probably sane - there is no guarantee they'd be called), but it seems like it would be important in this case for plugins that want to support both 1.10 and 1.11.

@Headline
Copy link
Member

Headline commented Apr 25, 2022

There doesn't appear to be a way to detect if a forward has been registered

IMO this is merge-able with the understanding that we know a forward isn't registered if it's never called, by the time OPRC is called a plugin would be able to tell if the Pre variant was fired, with authors able to maintain bcompat if they wish through a simple boolean flag.

If we'd like to go the extra step and add the feature I'm not opposed, but it may be less important here

@Headline Headline merged commit b057580 into alliedmodders:master Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: OnPlayerRunCmdPre

4 participants