Remove all uses of the Cs Package now that we don't need it anymore

LuaCs Settings no longer uses LuaCsConfig
Cs Package is no longer is used for enabling CSharp Scripting (except for dedicated server, to not make those people confused)
Added popups for when you have CSharp mods enabled but don't have CSharp enabled when going to singleplayer/multiplayer
This commit is contained in:
EvilFactory
2024-03-19 19:03:32 -03:00
parent 4079e0ef65
commit b3ac01cb22
6 changed files with 68 additions and 57 deletions
@@ -179,7 +179,7 @@ namespace Barotrauma.Tutorials
public void Start()
{
GameMain.LuaCs.Initialize();
GameMain.LuaCs.CheckInitialize();
GameMain.Instance.ShowLoading(Loading());
ObjectiveManager.ResetObjectives();
@@ -19,12 +19,12 @@ namespace Barotrauma
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Force Enable CSharp")
{
Selected = GameMain.LuaCs.Config.ForceCsScripting,
ToolTip = "This forces CSharp Scripting to be always enabled regardless if you have the package or not.",
Selected = GameMain.LuaCs.Config.EnableCsScripting,
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.Config.ForceCsScripting = tick.Selected;
GameMain.LuaCs.UpdateConfig();
GameMain.LuaCs.Config.EnableCsScripting = tick.Selected;
GameMain.LuaCs.WriteSettings();
return true;
}
@@ -37,7 +37,7 @@ namespace Barotrauma
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.Config.TreatForcedModsAsNormal = tick.Selected;
GameMain.LuaCs.UpdateConfig();
GameMain.LuaCs.WriteSettings();
return true;
}
@@ -50,7 +50,7 @@ namespace Barotrauma
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.Config.PreferToUseWorkshopLuaSetup = tick.Selected;
GameMain.LuaCs.UpdateConfig();
GameMain.LuaCs.WriteSettings();
return true;
}
@@ -63,7 +63,7 @@ namespace Barotrauma
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.Config.DisableErrorGUIOverlay = tick.Selected;
GameMain.LuaCs.UpdateConfig();
GameMain.LuaCs.WriteSettings();
return true;
}
@@ -76,7 +76,7 @@ namespace Barotrauma
OnSelected = (GUITickBox tick) =>
{
GameMain.LuaCs.Config.HideUserNames = tick.Selected;
GameMain.LuaCs.UpdateConfig();
GameMain.LuaCs.WriteSettings();
return true;
}
@@ -25,19 +25,12 @@ namespace Barotrauma
}
}
if (csharpMods.Count == 0 || ShouldRunCs || GameMain.Client == null)
if (csharpMods.Count == 0 || ShouldRunCs)
{
Initialize();
return;
}
if (GameMain.Client.IsServerOwner)
{
new GUIMessageBox("", "You have CSharp mods enabled but don't have the Cs For Barotrauma package enabled, those mods might not work.");
Initialize();
return;
}
StringBuilder sb = new StringBuilder();
foreach (ContentPackage cp in csharpMods)
@@ -52,6 +45,13 @@ namespace Barotrauma
}
}
if (GameMain.Client == null || GameMain.Client.IsServerOwner)
{
new GUIMessageBox("", $"You have CSharp mods enabled but don't have the CSharp Scripting enabled, those mods might not work, go to the Main Menu, click on LuaCs Settings and check Enable CSharp Scripting.\n\n{sb}");
Initialize();
return;
}
GUIMessageBox msg = new GUIMessageBox(
"Confirm",
$"This server has the following CSharp mods installed: \n{sb}\nDo you wish to run them? Cs mods are not sandboxed so make sure you trust these mods.",
@@ -1235,7 +1235,7 @@ namespace Barotrauma
return;
}
GameMain.LuaCs.Initialize();
GameMain.LuaCs.CheckInitialize();
selectedSub = new SubmarineInfo(Path.Combine(SaveUtil.TempPath, selectedSub.Name + ".sub"));
@@ -1252,7 +1252,7 @@ namespace Barotrauma
{
if (string.IsNullOrWhiteSpace(saveFile)) return;
GameMain.LuaCs.Initialize();
GameMain.LuaCs.CheckInitialize();
try
{
@@ -1345,7 +1345,7 @@ namespace Barotrauma
{
Select(enableAutoSave: true);
GameMain.LuaCs.Initialize();
GameMain.LuaCs.CheckInitialize();
}
public void Select(bool enableAutoSave = true)