From 2888383b8fdffd178381d071be213b2296a18fd6 Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Tue, 7 Sep 2021 17:32:20 -0300 Subject: [PATCH] moved lua initialization to be after the server is running --- Barotrauma/BarotraumaServer/ServerSource/GameMain.cs | 3 --- .../BarotraumaServer/ServerSource/Networking/GameServer.cs | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Barotrauma/BarotraumaServer/ServerSource/GameMain.cs b/Barotrauma/BarotraumaServer/ServerSource/GameMain.cs index 38f8886c7..7ad695ace 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/GameMain.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/GameMain.cs @@ -137,9 +137,6 @@ namespace Barotrauma NetLobbyScreen = new NetLobbyScreen(); CheckContentPackage(); - - Lua = new LuaSetup(); - } diff --git a/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs b/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs index ba9baf42a..c06305102 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Networking/GameServer.cs @@ -197,6 +197,8 @@ namespace Barotrauma.Networking #endif } + GameMain.Lua = new LuaSetup(); + TickRate = serverSettings.TickRate; Log("Server started", ServerLog.MessageType.ServerMessage); @@ -3842,7 +3844,8 @@ namespace Barotrauma.Networking { if (GameMain.Server == null || !GameMain.Server.ServerSettings.SaveServerLogs) { return; } - GameMain.Lua.hook.Call("serverLog", new object[] { line, messageType }); + if(GameMain.Lua != null) + GameMain.Lua.hook.Call("serverLog", new object[] { line, messageType }); GameMain.Server.ServerSettings.ServerLog.WriteLine(line, messageType);