- Made Package loading conditional on resources being available.

- Made States registration use named parameters.
- Changed IPluginManagementService interface to better suit expected return results.
This commit is contained in:
MapleWheels
2026-01-23 13:48:01 -05:00
committed by Maplewheels
parent 15e0a2bd10
commit 6e66a3114a
9 changed files with 136 additions and 76 deletions
@@ -19,55 +19,55 @@ namespace Barotrauma
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Enable CSharp Scripting")
{
Selected = GameMain.LuaCs.IsCsEnabled?.Value ?? false,
Selected = GameMain.LuaCs.IsCsEnabled,
ToolTip = "This enables CSharp Scripting for mods to use, WARNING: CSharp is NOT sandboxed, be careful with what mods you download.",
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.IsCsEnabled?.TrySetValue(tick.Selected);
GameMain.LuaCs.IsCsEnabled = tick.Selected;
return true;
}
};
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Treat Forced Mods As Normal")
{
Selected = GameMain.LuaCs.TreatForcedModsAsNormal?.Value ?? false,
Selected = GameMain.LuaCs.TreatForcedModsAsNormal,
ToolTip = "This makes mods that were setup to run even when disabled to only run when enabled.",
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.TreatForcedModsAsNormal?.TrySetValue(tick.Selected);
GameMain.LuaCs.TreatForcedModsAsNormal = tick.Selected;
return true;
}
};
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Prefer To Use Workshop Lua Setup")
{
Selected = GameMain.LuaCs.PreferToUseWorkshopLuaSetup?.Value ?? false,
Selected = GameMain.LuaCs.PreferToUseWorkshopLuaSetup,
ToolTip = "This makes Lua look first for the Lua/LuaSetup.lua located in the Workshop package instead of the one located locally.",
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.PreferToUseWorkshopLuaSetup?.TrySetValue(tick.Selected);
GameMain.LuaCs.PreferToUseWorkshopLuaSetup = tick.Selected;
return true;
}
};
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Disable Error GUI Overlay")
{
Selected = GameMain.LuaCs.DisableErrorGUIOverlay?.Value ?? false,
Selected = GameMain.LuaCs.DisableErrorGUIOverlay,
ToolTip = "",
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.DisableErrorGUIOverlay?.TrySetValue(tick.Selected);
GameMain.LuaCs.DisableErrorGUIOverlay = tick.Selected;
return true;
}
};
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Hide usernames In Error Logs")
{
Selected = GameMain.LuaCs.HideUserNamesInLogs?.Value ?? false,
Selected = GameMain.LuaCs.HideUserNamesInLogs,
ToolTip = "Hides the operating system username when displaying error logs (eg your username on windows).",
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.HideUserNamesInLogs?.TrySetValue(tick.Selected);
GameMain.LuaCs.HideUserNamesInLogs = tick.Selected;
return true;
}
};
@@ -15,7 +15,7 @@ namespace Barotrauma
{
public void AddToGUIUpdateList()
{
if (!DisableErrorGUIOverlay.Value)
if (!DisableErrorGUIOverlay)
{
LuaCsLogger.AddToGUIUpdateList();
}
@@ -28,7 +28,7 @@ namespace Barotrauma
public bool CheckCsEnabled()
{
// fast exit if enabled or unavailable.
if (this.IsCsEnabled?.Value ?? true )
if (this.IsCsEnabled)
{
return false;
}
@@ -60,14 +60,14 @@ namespace Barotrauma
msg.Buttons[0].OnClicked = (GUIButton button, object obj) =>
{
this.IsCsEnabled.TrySetValue(true);
this.IsCsEnabled = true;
isCsValueChanged = true;
return true;
};
msg.Buttons[1].OnClicked = (GUIButton button, object obj) =>
{
this.IsCsEnabled.TrySetValue(false);
this.IsCsEnabled = false;
return true;
};