From 275bb9204d32b83fa5f37887820bc6feaa7b274f Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Mon, 11 Jul 2022 21:03:50 -0300 Subject: [PATCH] `chatMessage` hook now works on singleplayer --- Barotrauma/BarotraumaClient/ClientSource/GUI/ChatBox.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Barotrauma/BarotraumaClient/ClientSource/GUI/ChatBox.cs b/Barotrauma/BarotraumaClient/ClientSource/GUI/ChatBox.cs index 114d62cdc..3371cd5b7 100644 --- a/Barotrauma/BarotraumaClient/ClientSource/GUI/ChatBox.cs +++ b/Barotrauma/BarotraumaClient/ClientSource/GUI/ChatBox.cs @@ -374,6 +374,12 @@ namespace Barotrauma public void AddMessage(ChatMessage message) { + if (GameMain.IsSingleplayer) + { + var should = GameMain.LuaCs.Hook.Call("chatMessage", message.Text, message.SenderClient, message.Type, message); + if (should != null && should.Value) { return; } + } + while (chatBox.Content.CountChildren > 60) { chatBox.RemoveChild(chatBox.Content.Children.First());