working rebase

This commit is contained in:
Oiltanker
2022-04-15 21:35:01 +03:00
parent e4ea88d598
commit 56a0d4b1e1
7 changed files with 15 additions and 15 deletions
@@ -7,14 +7,14 @@ namespace Barotrauma
{ {
public static void Check() public static void Check()
{ {
if (!File.Exists(LuaSetup.VERSION_FILE)) { return; } if (!File.Exists(LuaCsSetup.VERSION_FILE)) { return; }
ContentPackage luaCsPackage = LuaSetup.GetPackage(); ContentPackage luaCsPackage = LuaCsSetup.GetPackage();
string luaCsPath = Path.GetDirectoryName(luaCsPackage.Path); string luaCsPath = Path.GetDirectoryName(luaCsPackage.Path);
if (luaCsPackage == null) { return; } if (luaCsPackage == null) { return; }
string clientVersion = File.ReadAllText(LuaSetup.VERSION_FILE); string clientVersion = File.ReadAllText(LuaCsSetup.VERSION_FILE);
string workshopVersion = luaCsPackage.ModVersion; string workshopVersion = luaCsPackage.ModVersion;
if (clientVersion == workshopVersion) { return; } if (clientVersion == workshopVersion) { return; }
@@ -39,7 +39,7 @@ namespace Barotrauma
File.Copy(Path.Combine(luaCsPath, "Binary", file), file, true); File.Copy(Path.Combine(luaCsPath, "Binary", file), file, true);
} }
File.WriteAllText(LuaSetup.VERSION_FILE, workshopVersion); File.WriteAllText(LuaCsSetup.VERSION_FILE, workshopVersion);
} }
catch (Exception e) catch (Exception e)
{ {
@@ -442,7 +442,7 @@ namespace Barotrauma
} }
}; };
string version = File.Exists(LuaSetup.VERSION_FILE) ? File.ReadAllText(LuaSetup.VERSION_FILE) : "Github"; string version = File.Exists(LuaCsSetup.VERSION_FILE) ? File.ReadAllText(LuaCsSetup.VERSION_FILE) : "Github";
new GUITextBlock(new RectTransform(new Point(300, 30), Frame.RectTransform, Anchor.TopLeft) { AbsoluteOffset = new Point(10, 10) }, $"Using LuaCsForBarotrauma revision {AssemblyInfo.GitRevision} version {version}", Color.Red) new GUITextBlock(new RectTransform(new Point(300, 30), Frame.RectTransform, Anchor.TopLeft) { AbsoluteOffset = new Point(10, 10) }, $"Using LuaCsForBarotrauma revision {AssemblyInfo.GitRevision} version {version}", Color.Red)
{ {
@@ -525,7 +525,7 @@ namespace Barotrauma
#region Selection #region Selection
public override void Select() public override void Select()
{ {
GameMain.Lua.Stop(); GameMain.LuaCs.Stop();
if (WorkshopItemsToUpdate.Any()) if (WorkshopItemsToUpdate.Any())
{ {
@@ -90,7 +90,7 @@ namespace Barotrauma
.Where(p => p != null).ToArray()); .Where(p => p != null).ToArray());
} }
GameMain.NetLobbyScreen.Select(); GameMain.NetLobbyScreen.Select();
GameMain.Lua.Initialize(); GameMain.LuaCs.Initialize();
return; return;
} }
@@ -299,7 +299,7 @@ namespace Barotrauma
ContentPackageManager.EnabledPackages.SetRegular(regularPackages); ContentPackageManager.EnabledPackages.SetRegular(regularPackages);
GameMain.NetLobbyScreen.Select(); GameMain.NetLobbyScreen.Select();
GameMain.Lua.Initialize(); GameMain.LuaCs.Initialize();
} }
} }
} }
@@ -1049,7 +1049,7 @@ namespace Barotrauma
GameMain.SubEditorScreen.Select(); GameMain.SubEditorScreen.Select();
}; };
GameMain.Lua.Initialize(); GameMain.LuaCs.Initialize();
return true; return true;
} }
@@ -1319,7 +1319,7 @@ namespace Barotrauma
public void Select(bool enableAutoSave = true) public void Select(bool enableAutoSave = true)
{ {
GameMain.Lua.Stop(); GameMain.LuaCs.Stop();
base.Select(); base.Select();
@@ -1253,7 +1253,7 @@ namespace Barotrauma
commands.Add(new Command("install_cl_lua", "Installs client-Side Lua into your client.", (string[] args) => commands.Add(new Command("install_cl_lua", "Installs client-Side Lua into your client.", (string[] args) =>
{ {
ContentPackage luaPackage = LuaCsSetup.GetLuaPackage(); ContentPackage luaPackage = LuaCsSetup.GetPackage();
if (luaPackage == null) if (luaPackage == null)
{ {
@@ -1283,11 +1283,11 @@ namespace Barotrauma
File.Copy(Path.Combine(path, "Binary", file), file, true); File.Copy(Path.Combine(path, "Binary", file), file, true);
} }
File.WriteAllText(LuaSetup.VERSION_FILE, luaPackage.ModVersion); File.WriteAllText(LuaCsSetup.VERSION_FILE, luaPackage.ModVersion);
} }
catch (UnauthorizedAccessException e) catch (UnauthorizedAccessException e)
{ {
GameMain.Lua.PrintError("You seem to already have Client Side Lua installed, if you are trying to reinstall, make sure uninstall it first (mainmenu button located top left)."); GameMain.LuaCs.PrintError("You seem to already have Client Side Lua installed, if you are trying to reinstall, make sure uninstall it first (mainmenu button located top left).");
return; return;
} }
@@ -1832,7 +1832,7 @@ namespace Barotrauma.Networking
IsDownloading = FileSender.ActiveTransfers.Any(t => t.Connection == client.Connection) IsDownloading = FileSender.ActiveTransfers.Any(t => t.Connection == client.Connection)
}; };
GameMain.Lua.hook.Call("writeClientList.modifyTempClientData", c, client, tempClientData, outmsg); GameMain.LuaCs.Hook.Call("writeClientList.modifyTempClientData", c, client, tempClientData, outmsg);
outmsg.Write(tempClientData); outmsg.Write(tempClientData);
outmsg.WritePadBits(); outmsg.WritePadBits();
@@ -118,7 +118,7 @@ namespace Barotrauma
} }
#if SERVER #if SERVER
private void PrintError(object message) => PrintErrorBase("[SV LUA ERROR] ", message, "nil"); public void PrintError(object message) => PrintErrorBase("[SV LUA ERROR] ", message, "nil");
public static void PrintCsError(object message) => PrintErrorBase("[SV CS ERROR] ", message, "Null"); public static void PrintCsError(object message) => PrintErrorBase("[SV CS ERROR] ", message, "Null");
public static void PrintBothError(object message) => PrintErrorBase("[SV ERROR] ", message, "Null"); public static void PrintBothError(object message) => PrintErrorBase("[SV ERROR] ", message, "Null");
#else #else