KosmosisDire / TeammateRevive

A simple Risk of Rain 2 mod that allows teammates to revive their fallen colleagues.
4 stars 9 forks source link

Fix for compatibility with ShowDeathCause #16

Closed DestroyedClone closed 2 years ago

DestroyedClone commented 2 years ago

Replaced "return" with 'else' statement from "hook_OnPlayerCharacterDeath", preventing methods that run on it from running.

TeammateRevival hooks before the original method, then calls return at the end of marking a valid player as dead. I'm assuming the return is to skip the death message in chat? Anyways, this doesn't call orig, causing methods that hook after OnPlayerCharacterDeath to not run.

            On.RoR2.GlobalEventManager.OnPlayerCharacterDeath += (orig, self, damageReport, networkUser) =>
            {
                // I wanted to remove this initially, but this would cause any mod added before ShowDeathCause
                // in the execution cycle that relied on OnPlayerCharacterDeath to not fire.
                orig(self, damageReport, networkUser);

https://github.com/NotTsunami/ShowDeathCause/blob/master/ShowDeathCause/ShowDeathCause.cs#L20-L24

Although, I'm not sure how well this performs as I only did a single cursory test

KosmosisDire commented 2 years ago

Thank you for catching that! This will be built and uploaded in the next update which will probably be in a few weeks once it's ready.

As far as whether it works, I don't see why it wouldn't and I think it also should not cause problems regardless.