Fix SDKHook_[Use|Spawn|GetMaxHealth] callback result value handling#1872
Fix SDKHook_[Use|Spawn|GetMaxHealth] callback result value handling#1872peace-maker merged 3 commits intomasterfrom
Conversation
The returned result of the last callback in the list was used instead of the highest value. This differs from the behavior of the other hooks.
The returned result of the last callback in the list was used instead of the highest value. This differs from the behavior of the other hooks.
The returned result of the last callback in the list was used instead of the highest value. This differs from the behavior of the other hooks. The returned health is only changed if no other plugin wants to block the callback.
|
Hopefully wasn't when I did the vectorization. Are you sure this goes far enough? Plugin_Stop doesn't appear to be implemented. There was a patch for this to use fwdsys, but preserving the behaviour in one of the callbacks wasn't consistent so I think it died in a branch. |
|
You're right, I didn't touch breaking the loop on Plugin_Stop yet. I wanted to check how fwdsys does it first. Do you remember which hook was a special snowflake when switching to private forwards? |
I think it's all of them with an action that doesn't break in a loop (I just looked, it's a fairly sizeable chunk). Right now you can return Handled or Stop and it will still spin through all the callbacks. The concession in 2014~ was that there's already too much code out there to tolerate the breakage. There may have been something else as well where Handled was False and Stop was true, but it's cold and I didn't see it. (Et_Ignore Vs Et_Event still was a behaviour change) |
The returned result of the last callback in the list was used instead of the highest value. This differs from the behavior of the other hooks.
The
GetMaxHealthhook has an outparam. I've changed the return value handling to only return the changed value ifPl_Changedwas the highest value a plugin wanted. If some plugin returnedPl_Handledit returns the original value. This is similar to theTraceAttackhook handling.Fixes #1870