Use WorkshopId instead and minor cleanup

This commit is contained in:
EvilFactory
2022-10-28 12:26:47 -03:00
parent 79b4edf7a8
commit 43810a3509
9 changed files with 340 additions and 324 deletions
@@ -3278,7 +3278,7 @@ namespace Barotrauma
const string CMD_CL_CS = "cl_cs";
commands.Add(new Command(CMD_CL_CS, $"{CMD_CL_CS}: runs a string on the client", (string[] args) =>
{
if (LuaCsSetup.GetPackage("CsForBarotrauma", false, true) == null) { return; }
if (LuaCsSetup.GetPackage(LuaCsSetup.CsForBarotraumaId, false, true) == null) { return; }
if (GameMain.Client != null && !GameMain.Client.HasPermission(ClientPermissions.ConsoleCommands))
{
@@ -59,7 +59,7 @@ namespace Barotrauma
{
if (!File.Exists(LuaCsSetup.VersionFile)) { return; }
ContentPackage luaPackage = LuaCsSetup.GetPackage("Lua For Barotrauma");
ContentPackage luaPackage = LuaCsSetup.GetPackage(LuaCsSetup.LuaForBarotraumaId);
string luaCsPath = Path.GetDirectoryName(luaPackage.Path);
if (luaPackage == null) { return; }
@@ -69,7 +69,7 @@ namespace Barotrauma
if (clientVersion == workshopVersion) { return; }
string additional = LuaCsSetup.GetPackage("CsForBarotrauma", false, true) == null ? "" : "Cs";
string additional = LuaCsSetup.GetPackage(LuaCsSetup.CsForBarotraumaId, false, true) == null ? "" : "Cs";
var msg = new GUIMessageBox($"Lua{additional} Update", $"Your Lua{additional} client version is different from the version found in the Lua{additional}ForBarotrauma workshop files. Do you want to update?\n\n Client Version: {clientVersion}\n Workshop Version: {workshopVersion}",
new LocalizedString[2] { TextManager.Get("Yes"), TextManager.Get("Cancel") });
@@ -400,7 +400,7 @@ namespace Barotrauma
}
};
#endif
string additional = LuaCsSetup.GetPackage("CsForBarotrauma", false, true) == null ? "" : "Cs";
string additional = LuaCsSetup.GetPackage(LuaCsSetup.CsForBarotraumaId, false, true) == null ? "" : "Cs";
new GUIButton(new RectTransform(new Point(300, 30), Frame.RectTransform, Anchor.TopLeft) { AbsoluteOffset = new Point(20, 50) },
$"Remove Client-Side Lua{additional}", style: "MainMenuGUIButton", color: GUIStyle.Red)