From cdda8a2ffd91177b72ebd29ca1dadfe00aca646a Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Mon, 2 Aug 2021 21:58:25 -0300 Subject: [PATCH] characterdeath --- .../BarotraumaClient/ClientSource/Screens/MainMenuScreen.cs | 3 ++- .../BarotraumaServer/ServerSource/Networking/ChatMessage.cs | 2 +- .../BarotraumaShared/SharedSource/Characters/Character.cs | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Barotrauma/BarotraumaClient/ClientSource/Screens/MainMenuScreen.cs b/Barotrauma/BarotraumaClient/ClientSource/Screens/MainMenuScreen.cs index dcb4ae206..b75b8e123 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/Screens/MainMenuScreen.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/Screens/MainMenuScreen.cs @@ -955,7 +955,8 @@ namespace Barotrauma { FileName = filename, Arguments = arguments, -#if !DEBUG + //#if !DEBUG +#if false CreateNoWindow = true, UseShellExecute = false, WindowStyle = ProcessWindowStyle.Hidden diff --git a/Barotrauma/BarotraumaServer/ServerSource/Networking/ChatMessage.cs b/Barotrauma/BarotraumaServer/ServerSource/Networking/ChatMessage.cs index 227781587..50a463902 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Networking/ChatMessage.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Networking/ChatMessage.cs @@ -193,7 +193,7 @@ namespace Barotrauma.Networking int length = 1 + //(byte)ServerNetObject.CHAT_MESSAGE 2 + //(UInt16)NetStateID 1 + //(byte)Type - Encoding.UTF8.GetBytes(Text).Length + 2; + (Text == null ? 0 : Encoding.UTF8.GetBytes(Text).Length) + 2; if (SenderClient != null) { diff --git a/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs b/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs index 1e7a4d476..ff4095636 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Characters/Character.cs @@ -3748,6 +3748,10 @@ namespace Barotrauma GameMain.NetworkMember.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status }); } +#if SERVER + GameMain.Lua.hook.Call("characterDeath", new MoonSharp.Interpreter.DynValue[] { MoonSharp.Interpreter.UserData.Create(this) }); +#endif + isDead = true; ApplyStatusEffects(ActionType.OnDeath, 1.0f);