northwood-studios / NwPluginAPI

Official server-side plugin system for SCP: Secret Laboratory game.
GNU Lesser General Public License v3.0
81 stars 46 forks source link

[13.1] PlayerDamageEvent is inverted #209

Closed SrLicht closed 1 year ago

SrLicht commented 1 year ago

Due to an error in the invocation of the Event ev.Player is target and ev.Target is attacker...

https://github.com/northwood-studios/NwPluginAPI/blob/6583ad4076d6048650029bcf178bf2acde4acd67/NwPluginAPI/Events/Args/Player/PlayerDamageEvent.cs#L19

public bool DealDamage(DamageHandlerBase handler)
{
    if (this._hub.characterClassManager.GodMode)
    {
        return false;
    }

    IDamageHandlerProcessingRole damageHandlerProcessingRole = this._hub.roleManager.CurrentRole as IDamageHandlerProcessingRole;
    if (damageHandlerProcessingRole != null)
    {
        handler = damageHandlerProcessingRole.ProcessDamageHandler(handler);
    }

    AttackerDamageHandler attackerDamageHandler = handler as AttackerDamageHandler;
    if (attackerDamageHandler != null)
    {
        if (!EventManager.ExecuteEvent(new PlayerDamageEvent(this._hub, attackerDamageHandler.Attacker.Hub, handler)))
        {
            return false;
        }
    }
    else if (!EventManager.ExecuteEvent(new PlayerDamageEvent(this._hub, null, handler)))
    {
        return false;
    }

    // Rest of the code...
}
ced777ric commented 1 year ago

We are aware of this issue and will be addressed in a hotfix as mentioned before in the NWApi discord.

SrLicht commented 1 year ago

We are aware of this issue and will be addressed in a hotfix as mentioned before in the NWApi discord.

I know, I just did it to let others know the bug exists.