From 63ef6c82cb05350307f4bab208cda102348c90eb Mon Sep 17 00:00:00 2001 From: jimmyl <70376633+mc-oofert@users.noreply.github.com> Date: Sun, 29 Aug 2021 20:03:37 +0200 Subject: [PATCH 1/3] characterdeath with killer and killing affliction why this wasnt already a feature i do not know --- .../BarotraumaServer/ServerSource/Characters/Character.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaServer/ServerSource/Characters/Character.cs b/Barotrauma/BarotraumaServer/ServerSource/Characters/Character.cs index 6fd98ff74..a405200b1 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Characters/Character.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Characters/Character.cs @@ -27,7 +27,7 @@ namespace Barotrauma GameServer.Log(GameServer.CharacterLogName(this) + " has died (Cause of death: " + causeOfDeath + ")", ServerLog.MessageType.Attack); } } - + GameMain.Lua.hook.Call("characterDeath", new MoonSharp.Interpreter.DynValue[] { MoonSharp.Interpreter.UserData.Create(this),MoonSharp.Interpreter.UserData.Create(causeOfDeath.Killer),MoonSharp.Interpreter.UserData.Create(causeOfDeathAffliction) }); healthUpdateTimer = 0.0f; if (CauseOfDeath.Killer != null && CauseOfDeath.Killer.IsTraitor && CauseOfDeath.Killer != this) From f212631e1a157eaba619de47def50862a64179d1 Mon Sep 17 00:00:00 2001 From: jimmyl <70376633+mc-oofert@users.noreply.github.com> Date: Sun, 29 Aug 2021 20:06:00 +0200 Subject: [PATCH 2/3] remove characterdeath from shared --- .../BarotraumaShared/SharedSource/Characters/Character.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs index 78c479787..377b54c9e 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs @@ -3808,10 +3808,6 @@ namespace Barotrauma GameMain.GameSession.KillCharacter(this); } - -#if SERVER - GameMain.Lua.hook.Call("characterDeath", new object[] { this }); -#endif } partial void KillProjSpecific(CauseOfDeathType causeOfDeath, Affliction causeOfDeathAffliction, bool log); From 67dd27f4feaedc5c4f20b497ce686d170b267dd8 Mon Sep 17 00:00:00 2001 From: jimmyl <70376633+mc-oofert@users.noreply.github.com> Date: Sun, 29 Aug 2021 20:40:07 +0200 Subject: [PATCH 3/3] made changes as suggested by evilfactory --- .../BarotraumaServer/ServerSource/Characters/Character.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaServer/ServerSource/Characters/Character.cs b/Barotrauma/BarotraumaServer/ServerSource/Characters/Character.cs index a405200b1..f605e430a 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Characters/Character.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Characters/Character.cs @@ -27,7 +27,7 @@ namespace Barotrauma GameServer.Log(GameServer.CharacterLogName(this) + " has died (Cause of death: " + causeOfDeath + ")", ServerLog.MessageType.Attack); } } - GameMain.Lua.hook.Call("characterDeath", new MoonSharp.Interpreter.DynValue[] { MoonSharp.Interpreter.UserData.Create(this),MoonSharp.Interpreter.UserData.Create(causeOfDeath.Killer),MoonSharp.Interpreter.UserData.Create(causeOfDeathAffliction) }); + GameMain.Lua.hook.Call("characterDeath", new object[] { this,causeOfDeathAffliction }); healthUpdateTimer = 0.0f; if (CauseOfDeath.Killer != null && CauseOfDeath.Killer.IsTraitor && CauseOfDeath.Killer != this)