separated Lua source by client, server and shared

github desktop bugged
This commit is contained in:
Evil Factory
2021-09-15 12:59:19 -03:00
parent 5678f81326
commit 4075e71f7a
12 changed files with 750 additions and 612 deletions
@@ -3096,6 +3096,22 @@ namespace Barotrauma
NewMessage("Level seed: " + Level.Loaded.Seed);
}
});
commands.Add(new Command("lua_cl", "lua_cl: runs a string on the client", (string[] args) =>
{
if (GameMain.Client != null)
GameMain.Lua.DoString(string.Join(" ", args));
else
ThrowError("Client not connected to any server.");
}));
commands.Add(new Command("reloadlua_cl", "reloads lua on the client", (string[] args) =>
{
if (GameMain.Client != null)
GameMain.Lua.Initialize();
else
ThrowError("Client not connected to any server.");
}));
}
private static void ReloadWearables(Character character, int variant = 0)
@@ -23,6 +23,8 @@ namespace Barotrauma
{
class GameMain : Game
{
public static LuaSetup Lua;
public static bool ShowFPS = false;
public static bool ShowPerf = false;
public static bool DebugDraw;
@@ -210,6 +212,8 @@ namespace Barotrauma
Config = new GameSettings();
Lua = new LuaSetup();
Md5Hash.LoadCache();
ConsoleArguments = args;
@@ -393,6 +393,8 @@ namespace Barotrauma.Networking
{
GameMain.NetLobbyScreen.ChatInput.Enabled = true;
}
GameMain.Lua.Initialize();
};
clientPeer.OnRequestPassword = (int salt, int retries) =>
{
@@ -2690,6 +2692,8 @@ namespace Barotrauma.Networking
public override void Disconnect()
{
GameMain.Lua.Stop();
allowReconnect = false;
if (clientPeer is SteamP2PClientPeer || clientPeer is SteamP2POwnerPeer)