GameMain.LuaCs is no more
This commit is contained in:
@@ -223,7 +223,7 @@ namespace Barotrauma
|
||||
|
||||
private static bool IsCommandPermitted(Identifier command, GameClient client)
|
||||
{
|
||||
if (GameMain.LuaCs.Game.IsCustomCommandPermitted(command)) { return true; }
|
||||
if (LuaCsSetup.Instance.Game.IsCustomCommandPermitted(command)) { return true; }
|
||||
|
||||
switch (command.Value.ToLowerInvariant())
|
||||
{
|
||||
@@ -4231,14 +4231,14 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameMain.LuaCs.CurrentRunState != RunState.Running)
|
||||
if (LuaCsSetup.Instance.CurrentRunState != RunState.Running)
|
||||
{
|
||||
ThrowError("LuaCs not initialized, use the console command cl_reloadluacs to force initialization.");
|
||||
return;
|
||||
}
|
||||
|
||||
var result = GameMain.LuaCs.LuaScriptManagementService.DoString(string.Join(" ", args));
|
||||
GameMain.LuaCs.Logger.LogResults(result.ToResult());
|
||||
var result = LuaCsSetup.Instance.LuaScriptManagementService.DoString(string.Join(" ", args));
|
||||
LuaCsSetup.Instance.Logger.LogResults(result.ToResult());
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -415,7 +415,7 @@ namespace Barotrauma
|
||||
if (GameMain.IsSingleplayer)
|
||||
{
|
||||
bool? should = null;
|
||||
GameMain.LuaCs.EventService.PublishEvent<IEventChatMessage>(x => should = x.OnChatMessage(message.Text, message.SenderClient, message.Type, message) ?? should);
|
||||
LuaCsSetup.Instance.EventService.PublishEvent<IEventChatMessage>(x => should = x.OnChatMessage(message.Text, message.SenderClient, message.Type, message) ?? should);
|
||||
if (should != null && should.Value) { return; }
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,6 @@ namespace Barotrauma
|
||||
{
|
||||
class GameMain : Game
|
||||
{
|
||||
private static LuaCsSetup _luaCs;
|
||||
public static LuaCsSetup LuaCs => _luaCs ??= new LuaCsSetup();
|
||||
public static bool ShowFPS;
|
||||
public static bool ShowPerf;
|
||||
public static bool DebugDraw;
|
||||
@@ -298,7 +296,7 @@ namespace Barotrauma
|
||||
|
||||
Window.FileDropped += OnFileDropped;
|
||||
|
||||
LuaCs.GetType();
|
||||
LuaCsSetup.Instance.GetType();
|
||||
}
|
||||
|
||||
public static void ExecuteAfterContentFinishedLoading(Action action)
|
||||
@@ -1296,10 +1294,9 @@ namespace Barotrauma
|
||||
CreatureMetrics.Save();
|
||||
try
|
||||
{
|
||||
if (_luaCs is not null)
|
||||
if (LuaCsSetup.Instance is not null)
|
||||
{
|
||||
_luaCs.Dispose();
|
||||
_luaCs = null;
|
||||
LuaCsSetup.Instance.Dispose();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
@@ -19,33 +19,33 @@ namespace Barotrauma
|
||||
|
||||
new GUITickBox(new RectTransform(new Vector2(0.8f, 0.1f), list.Content.RectTransform), "Enable CSharp Scripting")
|
||||
{
|
||||
Selected = GameMain.LuaCs.IsCsEnabled,
|
||||
Selected = LuaCsSetup.Instance.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 = tick.Selected;
|
||||
LuaCsSetup.Instance.IsCsEnabled = 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,
|
||||
Selected = LuaCsSetup.Instance.DisableErrorGUIOverlay,
|
||||
ToolTip = "",
|
||||
OnSelected = (GUITickBox tick) =>
|
||||
{
|
||||
GameMain.LuaCs.DisableErrorGUIOverlay = tick.Selected;
|
||||
LuaCsSetup.Instance.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,
|
||||
Selected = LuaCsSetup.Instance.HideUserNamesInLogs,
|
||||
ToolTip = "Hides the operating system username when displaying error logs (eg your username on windows).",
|
||||
OnSelected = (GUITickBox tick) =>
|
||||
{
|
||||
GameMain.LuaCs.HideUserNamesInLogs = tick.Selected;
|
||||
LuaCsSetup.Instance.HideUserNamesInLogs = tick.Selected;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -3004,7 +3004,7 @@ namespace Barotrauma.Networking
|
||||
public override void AddChatMessage(ChatMessage message)
|
||||
{
|
||||
bool? should = null;
|
||||
GameMain.LuaCs.EventService.PublishEvent<IEventChatMessage>(x => should = x.OnChatMessage(message.Text, message.SenderClient, message.Type, message) ?? should);
|
||||
LuaCsSetup.Instance.EventService.PublishEvent<IEventChatMessage>(x => should = x.OnChatMessage(message.Text, message.SenderClient, message.Type, message) ?? should);
|
||||
if (should != null && should.Value) { return; }
|
||||
|
||||
if (string.IsNullOrEmpty(message.Text)) { return; }
|
||||
|
||||
Reference in New Issue
Block a user