- Moved all console commands to their respective services and added via injector service.
- Fixed LuaCs IsCsEnabled prompt not working. - Add settings profiles support.
This commit is contained in:
@@ -4240,28 +4240,8 @@ namespace Barotrauma
|
||||
var result = GameMain.LuaCs.LuaScriptManagementService.DoString(string.Join(" ", args));
|
||||
GameMain.LuaCs.Logger.LogResults(result.ToResult());
|
||||
}));
|
||||
|
||||
commands.Add(new Command("cl_reloadlua|cl_reloadcs|cl_reloadluacs", "Re-initializes the LuaCs environment.", (string[] args) =>
|
||||
{
|
||||
GameMain.LuaCs.EventService.PublishEvent<IEventReloadAllPackages>(sub => sub.OnReloadAllPackages());
|
||||
}));
|
||||
|
||||
commands.Add(new Command("cl_toggleluadebug", "Toggles the MoonSharp Debug Server.", (string[] args) =>
|
||||
{
|
||||
int port = 41912;
|
||||
|
||||
if (args.Length > 0)
|
||||
{
|
||||
int.TryParse(args[0], out port);
|
||||
}
|
||||
|
||||
throw new NotImplementedException();
|
||||
//GameMain.LuaCs.ToggleDebugger(port);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
|
||||
private static void ReloadWearables(Character character, int variant = 0)
|
||||
{
|
||||
foreach (var limb in character.AnimController.Limbs)
|
||||
|
||||
@@ -53,15 +53,39 @@ namespace Barotrauma
|
||||
|
||||
msg.Buttons[0].OnClicked = (GUIButton button, object obj) =>
|
||||
{
|
||||
this.IsCsEnabled = true;
|
||||
isCsValueChanged = true;
|
||||
return true;
|
||||
try
|
||||
{
|
||||
this.IsCsEnabled = true;
|
||||
isCsValueChanged = true;
|
||||
CoroutineManager.Invoke(() =>
|
||||
{
|
||||
if (CurrentRunState >= RunState.Running)
|
||||
{
|
||||
var currentRunState = CurrentRunState;
|
||||
SetRunState(RunState.LoadedNoExec);
|
||||
SetRunState(currentRunState);
|
||||
}
|
||||
}, 0f);
|
||||
return true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
msg.Close();
|
||||
}
|
||||
};
|
||||
|
||||
msg.Buttons[1].OnClicked = (GUIButton button, object obj) =>
|
||||
{
|
||||
this.IsCsEnabled = false;
|
||||
return true;
|
||||
try
|
||||
{
|
||||
// avoid a TOCTOU scenario.
|
||||
this.IsCsEnabled = false;
|
||||
return true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
msg.Close();
|
||||
}
|
||||
};
|
||||
|
||||
return isCsValueChanged;
|
||||
|
||||
Reference in New Issue
Block a user