From e0baf7a85cd90db4a99f904771764a9a680072c7 Mon Sep 17 00:00:00 2001 From: Boondorl Date: Mon, 16 Jun 2025 10:26:36 -0400 Subject: [PATCH] Added OnRevive virtual Called when a monster is resurrected (allows resetting properties without needing an event handler). --- src/playsim/p_mobj.cpp | 4 ++++ wadsrc/static/zscript/actors/actor.zs | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 115c1495f..072afdd3c 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -8485,6 +8485,10 @@ void AActor::Revive() Level->total_monsters++; } + IFOVERRIDENVIRTUALPTRNAME(this, NAME_Actor, OnRevive) + { + VMCallVoid(func, this); + } // [ZZ] resurrect hook Level->localEventManager->WorldThingRevived(this); } diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index dc0892a3a..0bc9ee76f 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -595,6 +595,9 @@ class Actor : Thinker native return true; } + // Called after an Actor has been resurrected. + virtual void OnRevive() {} + // Called when an actor is to be reflected by a disc of repulsion. // Returns true to continue normal blast processing. virtual bool SpecialBlastHandling (Actor source, double strength)