hook addition name case-insensitivity fix
This commit is contained in:
@@ -101,11 +101,5 @@ namespace Barotrauma
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//public static implicit operator bool(LuaResult res) => res.Bool();
|
|
||||||
//public static implicit operator float(LuaResult res) => res.Float();
|
|
||||||
//public static implicit operator string(LuaResult res) => res.String();
|
|
||||||
//public static implicit operator double(LuaResult res) => res.Double();
|
|
||||||
//public static implicit operator DynValue(LuaResult res) => res.DynValue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -310,6 +310,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Add(string name, string hookName, CsFunc hook, ACsMod owner = null)
|
public void Add(string name, string hookName, CsFunc hook, ACsMod owner = null)
|
||||||
{
|
{
|
||||||
|
name = name.ToLower();
|
||||||
|
|
||||||
|
LuaCsSetup.PrintLogMessage($"'{name}' | '{hookName}'");
|
||||||
if (name == null || hookName == null || hook == null) throw new ArgumentNullException("Names and Hook must not be null");
|
if (name == null || hookName == null || hook == null) throw new ArgumentNullException("Names and Hook must not be null");
|
||||||
|
|
||||||
if (!hookFunctions.ContainsKey(name))
|
if (!hookFunctions.ContainsKey(name))
|
||||||
@@ -362,21 +365,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public T Call<T>(string name, params object[] args)
|
public T Call<T>(string name, params object[] args)
|
||||||
{
|
{
|
||||||
if (
|
|
||||||
typeof(T) != typeof(object) &&
|
|
||||||
!name.StartsWith("gapOxygenUpdate") &&
|
|
||||||
!name.StartsWith("signal") &&
|
|
||||||
!name.StartsWith("statusEffect")
|
|
||||||
)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
if (GameMain.GameSession?.IsRunning == false && GameMain.IsSingleplayer)
|
if (GameMain.GameSession?.IsRunning == false && GameMain.IsSingleplayer)
|
||||||
//return null;
|
|
||||||
return default(T);
|
return default(T);
|
||||||
#endif
|
#endif
|
||||||
//if (GameMain.LuaCs == null) return null;
|
|
||||||
//if (name == null) return null;
|
|
||||||
if (GameMain.LuaCs == null) return default(T);
|
if (GameMain.LuaCs == null) return default(T);
|
||||||
if (name == null) return default(T);
|
if (name == null) return default(T);
|
||||||
if (args == null) { args = new object[] { }; }
|
if (args == null) { args = new object[] { }; }
|
||||||
@@ -384,10 +376,8 @@ namespace Barotrauma
|
|||||||
name = name.ToLower();
|
name = name.ToLower();
|
||||||
|
|
||||||
if (!hookFunctions.ContainsKey(name))
|
if (!hookFunctions.ContainsKey(name))
|
||||||
//return null;
|
|
||||||
return default(T);
|
return default(T);
|
||||||
|
|
||||||
//object lastResult = null;
|
|
||||||
T lastResult = default(T);
|
T lastResult = default(T);
|
||||||
|
|
||||||
if (hookFunctions.ContainsKey(name))
|
if (hookFunctions.ContainsKey(name))
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
private void PrintMessage(object message) => PrintMessageBase("[LUA] ", message, "nil");
|
private void PrintMessage(object message) => PrintMessageBase("[LUA] ", message, "nil");
|
||||||
public static void PrintCsMessage(object message) => PrintMessageBase("[CS] ", message, "Null");
|
public static void PrintCsMessage(object message) => PrintMessageBase("[CS] ", message, "Null");
|
||||||
|
public static void PrintLogMessage(object message) => PrintMessageBase("[LuaCs LOG] ", message, "Null");
|
||||||
|
|
||||||
public DynValue DoString(string code, Table globalContext = null, string codeStringFriendly = null)
|
public DynValue DoString(string code, Table globalContext = null, string codeStringFriendly = null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user