Skip to content

Option to fire on death animation#879

Open
DarockObama wants to merge 5 commits intopajlads:masterfrom
DarockObama:Option-to-fire-on-death-animation
Open

Option to fire on death animation#879
DarockObama wants to merge 5 commits intopajlads:masterfrom
DarockObama:Option-to-fire-on-death-animation

Conversation

@DarockObama
Copy link
Copy Markdown

Summary

Added an option in the deathSection to fire the death notification on corresponding animations instead of ActorDeath.

When enabled, the handlenotify() method will simply be bypassed inside the onActorDeath() method and will be performed on death animation instead. This approach will prevent some rare false positives where the player reaches 0 hp, but doesn't actually die. All other events that trigger this notifier (onGameMessage and onScript) will remain the same.

@iProdigy iProdigy added this to the 1.12.1 milestone Feb 18, 2026
@iProdigy iProdigy self-assigned this Feb 18, 2026
Copy link
Copy Markdown
Member

@iProdigy iProdigy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some quick comments to get the ball rolling on this review

Comment thread src/main/java/dinkplugin/notifiers/DeathNotifier.java Outdated
Comment thread src/main/java/dinkplugin/notifiers/DeathNotifier.java Outdated
Comment thread src/main/java/dinkplugin/DinkPluginConfig.java Outdated
Comment thread src/main/java/dinkplugin/DinkPluginConfig.java Outdated
Comment thread src/main/java/dinkplugin/DinkPluginConfig.java Outdated
handleNotify(null);

if (self || actor.getActor() == lastTarget.get())
lastTarget = new WeakReference<>(null);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if self and config.notifyOnAnim(), we don't want to clear lastTarget since the animation event comes later. then we can clear lastTarget from within onAnimationChanged

one remaining concern is interactions might change between time of ActorDeath & AnimationChanged, so killer detection may also be worse

boolean self = client.getLocalPlayer() == actor.getActor();

if (self && isEnabled())
if (self && isEnabled() && !config.notifyOnAnim())
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not critical for this PR but: if we wanted to avoid delayed screenshot, we could capture now & use later (or destroy if unused for x ticks)

@DarockObama
Copy link
Copy Markdown
Author

Made all the minor corrections.

For killer detection:
I made that within onActorDeath, only the case self && config.notifyOnAnim() is considered for updating lastTarget. Furthermore, lastTarget is updated within onDeathAnimation in the case self && isDeath && config.notifyOnAnim().

I'll need some more time to figure out how to hold on to and use/destroy the screenshot.

@iProdigy
Copy link
Copy Markdown
Member

I'll need some more time to figure out how to hold on to and use/destroy the screenshot.

The trade notifier has similar logic you can look at: https://github.com/pajlads/DinkPlugin/blob/master/src/main/java/dinkplugin/notifiers/TradeNotifier.java#L127

again: not a requirement for this PR (i'd care more about resolving the killer at ActorDeath & holding onto that info)

@iProdigy iProdigy removed this from the 1.12.2 milestone Apr 15, 2026
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

Successfully merging this pull request may close these issues.

2 participants