Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detail OnPlayerDeath event #37

Closed
RestoreMonarchy opened this issue Mar 8, 2021 · 1 comment
Closed

Detail OnPlayerDeath event #37

RestoreMonarchy opened this issue Mar 8, 2021 · 1 comment

Comments

@RestoreMonarchy
Copy link

Hey,

When I was trying to fix my plugin I noticed that since last Rocket and Unturned update on 5th March OnPlayerDeath and OnPlayerDied events are called at the same time (they replicate Unturned native PlayerLife.onPlayerDied event).

Before this update OnPlayerDeath (tellDeath) was always called before OnPlayerDied (tellDied), so we could access player inventory before it was dropped (tellDead triggers PlayerLife.onLifeUpdated event which is used then by PlayerInventory to clear items when player dies).

This causes all plugins that look through player inventory when he died stop working.

I think OnPlayerDeath event should be called separately from OnPlayerDied and before native onLifeUpdated event trigger. Maybe it would be a good idea to add a native event for Unturned onBeforePlayerDied, since using triggerSend is deprecated.

internal static void InternalOnPlayerDied(PlayerLife sender, EDeathCause cause, ELimb limb, CSteamID instigator)

Thanks

@SDGNelson
Copy link
Member

Hmm interesting case. tellDeath was only sent to owner for UI purposes, so it is unfortunate plugins were depending on it that way. I will add a pre-death event for this in the next update.

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

No branches or pull requests

2 participants