Added legacy overload of AddCommand for mod compat.
This commit is contained in:
@@ -446,6 +446,26 @@ namespace Barotrauma.LuaCs
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddCommand(string name, LuaCsAction onExecute, LuaCsFunc getValidArgs = null, bool isCheat = false)
|
||||||
|
{
|
||||||
|
_consoleCommands.RegisterCommand(name, "",
|
||||||
|
(string[] args) =>
|
||||||
|
{
|
||||||
|
onExecute(new object[] { args });
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
if (getValidArgs == null) { return null; }
|
||||||
|
var validArgs = getValidArgs();
|
||||||
|
if (validArgs is DynValue luaValue)
|
||||||
|
{
|
||||||
|
return luaValue.ToObject<string[][]>();
|
||||||
|
}
|
||||||
|
return (string[][])validArgs;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public bool IsDisposed => throw new NotImplementedException();
|
public bool IsDisposed => throw new NotImplementedException();
|
||||||
|
|
||||||
public void AssignOnExecute(string names, object onExecute) => DebugConsole.AssignOnExecute(names, (string[] args) =>
|
public void AssignOnExecute(string names, object onExecute) => DebugConsole.AssignOnExecute(names, (string[] args) =>
|
||||||
|
|||||||
Reference in New Issue
Block a user