cleanup
This commit is contained in:
@@ -1,22 +0,0 @@
|
|||||||
using Barotrauma;
|
|
||||||
using MoonSharp.Interpreter;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace Barotrauma
|
|
||||||
{
|
|
||||||
partial class LuaCsSetup {
|
|
||||||
public class CsLua
|
|
||||||
{
|
|
||||||
private LuaCsSetup setup;
|
|
||||||
public Table Globals { get; private set; }
|
|
||||||
|
|
||||||
public CsLua(LuaCsSetup setup)
|
|
||||||
{
|
|
||||||
this.setup = setup;
|
|
||||||
Globals = setup.lua.Globals;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DynValue DoString(string code) => setup.lua.DoString(code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -255,10 +255,10 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static MethodInfo miPatchPrefix = typeof(LuaCsHook).GetMethod("PatchPrefix", BindingFlags.NonPublic | BindingFlags.Static);
|
private static readonly MethodInfo miPatchPrefix = typeof(LuaCsHook).GetMethod("PatchPrefix", BindingFlags.NonPublic | BindingFlags.Static);
|
||||||
private static MethodInfo miPatchPostfix = typeof(LuaCsHook).GetMethod("PatchPostfix", BindingFlags.NonPublic | BindingFlags.Static);
|
private static readonly MethodInfo miPatchPostfix = typeof(LuaCsHook).GetMethod("PatchPostfix", BindingFlags.NonPublic | BindingFlags.Static);
|
||||||
private static MethodInfo miPatchPrefixWithReturn = typeof(LuaCsHook).GetMethod("PatchPrefixWithReturn", BindingFlags.NonPublic | BindingFlags.Static);
|
private static readonly MethodInfo miPatchPrefixWithReturn = typeof(LuaCsHook).GetMethod("PatchPrefixWithReturn", BindingFlags.NonPublic | BindingFlags.Static);
|
||||||
private static MethodInfo miPatchPostfixWithReturn = typeof(LuaCsHook).GetMethod("PatchPostfixWithReturn", BindingFlags.NonPublic | BindingFlags.Static);
|
private static readonly MethodInfo miPatchPostfixWithReturn = typeof(LuaCsHook).GetMethod("PatchPostfixWithReturn", BindingFlags.NonPublic | BindingFlags.Static);
|
||||||
|
|
||||||
private static MethodInfo ResolveMethod(string className, string methodName, string[] parameterNames)
|
private static MethodInfo ResolveMethod(string className, string methodName, string[] parameterNames)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,8 +67,6 @@ namespace Barotrauma
|
|||||||
private LuaRequire require { get; set; }
|
private LuaRequire require { get; set; }
|
||||||
|
|
||||||
public CsScriptLoader CsScriptLoader { get; private set; }
|
public CsScriptLoader CsScriptLoader { get; private set; }
|
||||||
public CsLua Lua { get; private set; }
|
|
||||||
|
|
||||||
public LuaCsSetupConfig Config { get; private set; }
|
public LuaCsSetupConfig Config { get; private set; }
|
||||||
|
|
||||||
public LuaCsSetup()
|
public LuaCsSetup()
|
||||||
@@ -335,7 +333,6 @@ namespace Barotrauma
|
|||||||
PerformanceCounter = new LuaCsPerformanceCounter();
|
PerformanceCounter = new LuaCsPerformanceCounter();
|
||||||
LuaScriptLoader = null;
|
LuaScriptLoader = null;
|
||||||
lua = null;
|
lua = null;
|
||||||
Lua = null;
|
|
||||||
CsScript = null;
|
CsScript = null;
|
||||||
Config = null;
|
Config = null;
|
||||||
|
|
||||||
@@ -359,7 +356,10 @@ namespace Barotrauma
|
|||||||
using (var file = File.Open(configFileName, FileMode.Open, FileAccess.Read))
|
using (var file = File.Open(configFileName, FileMode.Open, FileAccess.Read))
|
||||||
Config = LuaCsConfig.Load<LuaCsSetupConfig>(file);
|
Config = LuaCsConfig.Load<LuaCsSetupConfig>(file);
|
||||||
}
|
}
|
||||||
else Config = new LuaCsSetupConfig();
|
else
|
||||||
|
{
|
||||||
|
Config = new LuaCsSetupConfig();
|
||||||
|
}
|
||||||
|
|
||||||
bool csActive = GetPackage("CsForBarotrauma", false, true) != null;
|
bool csActive = GetPackage("CsForBarotrauma", false, true) != null;
|
||||||
|
|
||||||
@@ -372,7 +372,6 @@ namespace Barotrauma
|
|||||||
lua.Options.DebugPrint = PrintMessage;
|
lua.Options.DebugPrint = PrintMessage;
|
||||||
lua.Options.ScriptLoader = LuaScriptLoader;
|
lua.Options.ScriptLoader = LuaScriptLoader;
|
||||||
lua.Options.CheckThreadAccess = false;
|
lua.Options.CheckThreadAccess = false;
|
||||||
Lua = new CsLua(this);
|
|
||||||
CsScript = new CsScriptRunner(this);
|
CsScript = new CsScriptRunner(this);
|
||||||
|
|
||||||
require = new LuaRequire(lua);
|
require = new LuaRequire(lua);
|
||||||
@@ -437,22 +436,7 @@ namespace Barotrauma
|
|||||||
Config.FirstTimeCsWarning = false;
|
Config.FirstTimeCsWarning = false;
|
||||||
UpdateConfig();
|
UpdateConfig();
|
||||||
|
|
||||||
Timer.Wait((args) => PrintCsError(@"
|
DebugConsole.AddWarning("Cs package active! Cs mods are NOT sandboxed, use it at your own risk!");
|
||||||
----==== ====----
|
|
||||||
|
|
||||||
WARNING!
|
|
||||||
-- -- -- -- -- --
|
|
||||||
!Cs Package Enabled!
|
|
||||||
|
|
||||||
Cs Mods are questionably
|
|
||||||
sandboxed, as they have
|
|
||||||
access to reflection, due to
|
|
||||||
modding needs.
|
|
||||||
|
|
||||||
USE ON YOUR OWN RISK!
|
|
||||||
|
|
||||||
----==== ====----
|
|
||||||
"), 200);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CsScriptLoader = new CsScriptLoader(this);
|
CsScriptLoader = new CsScriptLoader(this);
|
||||||
|
|||||||
Reference in New Issue
Block a user