Added legacy overload of AddCommand for mod compat.

This commit is contained in:
MapleWheels
2026-04-13 12:02:16 -04:00
parent a40e54f4e4
commit addd3f7a45

View File

@@ -445,6 +445,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();