diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs index 9c8c9991e..c139166dc 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/LuaCsSetup.cs @@ -29,7 +29,12 @@ namespace Barotrauma private static LuaCsSetup _luaCsSetup; public static LuaCsSetup Instance => _luaCsSetup ??= new LuaCsSetup(); - + + /// + /// The index of the last Vanilla command. + /// + public static int DebugConsoleCommandVanillaIndex { get; private set; } + private LuaCsSetup() { if (_luaCsSetup != null) @@ -37,6 +42,8 @@ namespace Barotrauma throw new Exception("Tried to create another LuaCsSetup instance"); } + DebugConsoleCommandVanillaIndex = DebugConsole.Commands.Count; + // == startup _servicesProvider = SetupServicesProvider(); _runStateMachine = SetupStateMachine(); @@ -395,6 +402,11 @@ namespace Barotrauma EventService.PublishEvent(static p => p.OnServerConnected()); } #endif + +#if SERVER + GameMain.Server.ServerSettings.LoadClientPermissions(); +#endif + CurrentRunState = RunState.Running; } diff --git a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/HarmonyEventPatchesService.cs b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/HarmonyEventPatchesService.cs index 2e5f3994d..b92fe7a4e 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/HarmonyEventPatchesService.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/LuaCs/_Services/HarmonyEventPatchesService.cs @@ -28,16 +28,12 @@ internal class HarmonyEventPatchesService : ISystem private static ILoggerService _loggerService; private readonly Harmony Harmony; - private static int debugConsoleCommandVanillaIndex; - public HarmonyEventPatchesService(IEventService eventService, ILoggerService loggerService) { _eventService = eventService; _loggerService = loggerService; Harmony = new Harmony("LuaCsForBarotrauma.Events"); Patch(); - - debugConsoleCommandVanillaIndex = DebugConsole.Commands.Count; } private void Patch() @@ -169,7 +165,7 @@ internal class HarmonyEventPatchesService : ISystem { DebugConsole.Command c = DebugConsole.FindCommand(command.Value); - if (DebugConsole.Commands.IndexOf(c) >= debugConsoleCommandVanillaIndex) + if (DebugConsole.Commands.IndexOf(c) >= LuaCsSetup.DebugConsoleCommandVanillaIndex) { __result = true; return false;