sdktools: Entity Output Hooks changes#1411
Conversation
Add to missing output hooks names having only Attacker as a output name. Learn more at sourcepawn branch. Fix return values type of natives to `bool` instead of `void`.
3a9dad3 to
3c79b77
Compare
|
Can you elaborate what issue you are trying to fix with this change, please? What's the use case? |
Does not hooks the entity Outputs related to the bomb because the name is stored in Activator (as "player" in this example).
|
|
I have to give my plugin clients this Pull Request for the plugin to work tied to these bomb outputs. |
|
@psychonic I'm really not qualified to review this, it looks okay from a cursory level but it's fundamentally changing the behaviour of |
|
@psychonic WDYT? |
asherkin
left a comment
There was a problem hiding this comment.
It would be good if you could make the changes to the testsuite plugin here, it make it a lot clearer what the problem is.
I don't totally feel comfortable that this is the correct fix here though, it seems rather heavyweight - it is possible this is the best fix, or the API needs correcting, but I think a bunch of reverse engineering investigation is required to nail down why these events are special.
Given the pain around output hooks already, I'd like to see a nice in-depth investigation.
| * @error Entity Outputs disabled. | ||
| */ | ||
| native void HookEntityOutput(const char[] classname, const char[] output, EntityOutput callback); | ||
| native bool HookEntityOutput(const char[] classname, const char[] output, EntityOutput callback); |
There was a problem hiding this comment.
No, but I'm not sure if it's correct to return a value of 1 when void
There was a problem hiding this comment.
It is fine, all natives internally return an int, void just tells plugins they don't need to care about what the return value is.
|
@asherkin, |
|
Looking at the outputinfo testsuite plugin and the cstrike15_src code and comparing HookEntityOutput("player", "OnBombBeginDefuse", OutputHook);
HookEntityOutput("player", "OnBombDefused", OutputHook);
HookEntityOutput("player", "OnBombDefuseAborted", OutputHook);shouldn't be HookEntityOutput("planted_c4", "OnBombBeginDefuse", OutputHook);
HookEntityOutput("planted_c4", "OnBombDefused", OutputHook);
HookEntityOutput("planted_c4", "OnBombDefuseAborted", OutputHook);? |
|
I also looked at HookEntityOutput("planted_c4", "OnBombBeginDefuse", OutputHook);but it didn't called. I started to find out and came across the problem of this Output name is in the |
|
Could you test it again on 1.11 where #1074 is fixed? The classname "player" being passed in instead of "planted_c4" would certainly explain why these code changes were required for it to be called - but it looks like the existing logic should all work with "planted_c4" (which would be the caller, but maybe there is some other hackery going on that the debug logging might reveal why it isn't matching). |
|
#1411 (comment) With this PR and |
|
I added more debugging with classnames and realized that the activator is Start EntityOutputManager::FindOutputName(): pOutput = 0xe4463c0, pActivator = 0xe445eb0, pCaller = 0xe2b3480
pCaller classname = "player"
pActivator classname = "planted_c4"
Found name by pActivator = "OnBombBeginDefuse"
L 06/21/2021 - 17:01:52: [outputtest.smx] [ENTOUTPUT] OnBombBeginDefuse |
|
Heh, I looked at the code again and you've found a bug in the game, they've accidentally flipped the params to FireOutput in the CPlantedC4 implementation, that definitely explains the behaviour here. |
|
I did a search of SDK2013 (and others) with |
|
I think can return the classname where was the Output found from |
|
It's probably worth getting some more input here, I'm not sure what makes sense - do you know of any game code or maps using any of these questionable events? After thinking about it a good while I'm probably leaning towards defining the SM-side stuff (classname, entity index for single hooks) as explicitly being the caller (whatever that is, normally the entity with the output, the player in this broken case) and leaving it up to plugins to deal with. It is slightly logically weird compared to the datatable, but it seems to make sense consistency wise. EDIT: That change looks sane if we want to go the route of trying to correct for it (but then the caller doesn't match what's expected?) - if going the other way we should also handle the caller entity being invalid, there is at least one where it is called with |
a0b05dc |
asherkin
left a comment
There was a problem hiding this comment.
Thanks for your patience here. I've had a really deep dive through the engine's output system and SM's output hooks and it looks like there are quite a few holes in how this has been implemented in SM - it is very heavily relying on convention of the common entities and I can see quite a few cases where it will be falling apart.
As this PR seems to move things in the right direction I'm gonna merge it into 1.11 (what this makes work won't get any more broken if we start handling outputs properly) - I've added a commit with a couple of little style tweaks, some notes about the design issues inline, and a slightly expanded test plugin.

Add to missing output hooks names having only Activator as a output name. Learn more at sourcepawn branch.
Fix return values type of natives to
boolinstead ofvoid.Bundle with Pull Request in SourcePawn branch.