diff --git a/src/playsim/p_interaction.cpp b/src/playsim/p_interaction.cpp index 60b6f30597..8d3e5022b2 100644 --- a/src/playsim/p_interaction.cpp +++ b/src/playsim/p_interaction.cpp @@ -244,7 +244,16 @@ void ClientObituary (AActor *self, AActor *inflictor, AActor *attacker, int dmgf { if (attacker == self) { - message = "$OB_KILLEDSELF"; + messagename = "$OB_KILLEDSELF"; + + IFVIRTUALPTR(self, AActor, GetSelfObituary) + { + VMValue params[] = { self, inflictor, mod.GetIndex() }; + VMReturn rett(&ret); + VMCall(func, params, countof(params), &rett, 1); + if (ret.IsNotEmpty()) message = ret.GetChars(); + } + } else { diff --git a/wadsrc/static/zscript/actors/actor.zs b/wadsrc/static/zscript/actors/actor.zs index a2e587cd82..8981857017 100644 --- a/wadsrc/static/zscript/actors/actor.zs +++ b/wadsrc/static/zscript/actors/actor.zs @@ -287,6 +287,7 @@ class Actor : Thinker native meta String Obituary; // Player was killed by this actor meta String HitObituary; // Player was killed by this actor in melee + meta String SelfObituary; // Player killed himself using this actor meta double DeathHeight; // Height on normal death meta double BurnHeight; // Height on burning death meta int GibHealth; // Negative health below which this monster dies an extreme death @@ -313,6 +314,7 @@ class Actor : Thinker native Property prefix: none; Property Obituary: Obituary; Property HitObituary: HitObituary; + Property SelfObituary: SelfObituary; Property MeleeDamage: MeleeDamage; Property MeleeSound: MeleeSound; Property MissileHeight: MissileHeight; @@ -693,6 +695,11 @@ class Actor : Thinker native } return Obituary; } + + virtual String GetSelfObituary(Actor inflictor, Name mod) + { + return SelfObituary; + } virtual int OnDrain(Actor victim, int damage, Name dmgtype) { diff --git a/wadsrc/static/zscript/actors/player/player.zs b/wadsrc/static/zscript/actors/player/player.zs index 6bfb583446..22454dc657 100644 --- a/wadsrc/static/zscript/actors/player/player.zs +++ b/wadsrc/static/zscript/actors/player/player.zs @@ -317,6 +317,22 @@ class PlayerPawn : Actor return message; } } + + override String GetSelfObituary(Actor inflictor, Name mod) + { + String message; + + if (inflictor && inflictor != self) + { + message = inflictor.GetSelfObituary(inflictor, mod); + } + if (message.Length() == 0) + { + message = SelfObituary; + } + + return message; + } //---------------------------------------------------------------------------- //