Added popups telling you to run CSharp when joining a server with CSharp mods enabled but without the Cs package

This commit is contained in:
EvilFactory
2022-12-29 15:13:18 -03:00
parent c665d3e9c7
commit 82934cf9ed
3 changed files with 77 additions and 4 deletions
@@ -1,6 +1,5 @@
using System;
using System.IO;
using System.Collections.Generic;
using MoonSharp.Interpreter;
using MoonSharp.Interpreter.Interop;
using System.Runtime.CompilerServices;
@@ -65,6 +64,14 @@ namespace Barotrauma
public CsScriptLoader CsScriptLoader { get; private set; }
public LuaCsSetupConfig Config { get; private set; }
private bool ShouldRunCs
{
get
{
return GetPackage(CsForBarotraumaId, false, true) != null || Config.ForceCsScripting;
}
}
public LuaCsSetup()
{
Hook = new LuaCsHook(this);
@@ -260,13 +267,13 @@ namespace Barotrauma
}
}
public void Initialize()
public void Initialize(bool forceEnableCs = false)
{
Stop();
LuaCsLogger.LogMessage("Lua! Version " + AssemblyInfo.GitRevision);
bool csActive = GetPackage(CsForBarotraumaId, false, true) != null || Config.ForceCsScripting;
bool csActive = ShouldRunCs || forceEnableCs;
LuaScriptLoader = new LuaScriptLoader();
LuaScriptLoader.ModulePaths = new string[] { };