move LuaPlayer and CreateVector to a separate compatibility lua file
This commit is contained in:
@@ -75,89 +75,5 @@ namespace Barotrauma
|
||||
|
||||
public void AssignOnClientRequestExecute(string names, object onExecute) => DebugConsole.AssignOnClientRequestExecute(names, (Client a, Vector2 b, string[] c) => { env.CallFunction(onExecute, new object[] { a, b, c }); });
|
||||
}
|
||||
|
||||
|
||||
// TODO: REMOVE
|
||||
partial class LuaPlayer
|
||||
{
|
||||
|
||||
public static List<Character> GetAllCharacters()
|
||||
{
|
||||
return Character.CharacterList;
|
||||
}
|
||||
|
||||
public static List<Client> GetAllClients()
|
||||
{
|
||||
return GameMain.Server.ConnectedClients;
|
||||
}
|
||||
|
||||
public static CharacterInfo CreateCharacterInfo(string speciesName, string name = "", JobPrefab jobPrefab = null, string ragdollFileName = null, int variant = 0, Rand.RandSync randSync = Rand.RandSync.Unsynced, string npcIdentifier = "")
|
||||
{
|
||||
return new CharacterInfo(speciesName, name, name, jobPrefab, ragdollFileName, variant, randSync, npcIdentifier);
|
||||
}
|
||||
|
||||
public static void SetClientCharacter(Client client, Character character)
|
||||
{
|
||||
GameMain.Server.SetClientCharacter(client, character);
|
||||
}
|
||||
|
||||
public static void SetCharacterTeam(Character character, int team)
|
||||
{
|
||||
character.TeamID = (CharacterTeamType)team;
|
||||
}
|
||||
|
||||
public static void SetClientTeam(Client character, int team)
|
||||
{
|
||||
character.TeamID = (CharacterTeamType)team;
|
||||
}
|
||||
|
||||
public static void Kick(Client client, string reason = "")
|
||||
{
|
||||
GameMain.Server.KickClient(client.Connection, reason);
|
||||
}
|
||||
|
||||
public static void Ban(Client client, string reason = "", bool range = false, float seconds = -1)
|
||||
{
|
||||
if (seconds == -1)
|
||||
{
|
||||
GameMain.Server.BanClient(client, reason, range, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
GameMain.Server.BanClient(client, reason, range, TimeSpan.FromSeconds(seconds));
|
||||
}
|
||||
}
|
||||
|
||||
public static void UnbanPlayer(string player, string endpoint)
|
||||
{
|
||||
GameMain.Server.UnbanPlayer(player, endpoint);
|
||||
|
||||
}
|
||||
|
||||
public static void SetSpectatorPos(Client client, Vector2 pos)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void SetRadioRange(Character character, float range)
|
||||
{
|
||||
if (character.Inventory == null) { return; }
|
||||
|
||||
foreach (Item item in character.Inventory.AllItems)
|
||||
{
|
||||
if (item == null) { continue; }
|
||||
|
||||
if (item.Name == "Headset")
|
||||
{
|
||||
item.GetComponent<Items.Components.WifiComponent>().Range = range;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckPermission(Client client, ClientPermissions permissions)
|
||||
{
|
||||
return client.Permissions.HasFlag(permissions);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,21 +22,6 @@ namespace Barotrauma
|
||||
|
||||
partial class LuaSetup
|
||||
{
|
||||
private static Vector2 CreateVector2(float x, float y)
|
||||
{
|
||||
return new Vector2(x, y);
|
||||
}
|
||||
|
||||
private static Vector3 CreateVector3(float x, float y, float z)
|
||||
{
|
||||
return new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
private static Vector4 CreateVector4(float x, float y, float z, float w)
|
||||
{
|
||||
return new Vector4(x, y, z, w);
|
||||
}
|
||||
|
||||
partial class LuaUserData
|
||||
{
|
||||
public static Type GetType(string typeName)
|
||||
@@ -112,11 +97,6 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public partial class LuaPlayer
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public partial class LuaGame
|
||||
{
|
||||
LuaSetup env;
|
||||
|
||||
@@ -317,7 +317,6 @@ namespace Barotrauma
|
||||
game = new LuaGame(this);
|
||||
networking = new LuaNetworking(this);
|
||||
|
||||
UserData.RegisterType<LuaPlayer>();
|
||||
UserData.RegisterType<LuaHook>();
|
||||
UserData.RegisterType<LuaGame>();
|
||||
UserData.RegisterType<LuaRandom>();
|
||||
@@ -350,7 +349,6 @@ namespace Barotrauma
|
||||
lua.Globals["load"] = (Func<string, Table, string, DynValue>)LoadString;
|
||||
|
||||
lua.Globals["LuaUserData"] = UserData.CreateStatic<LuaUserData>();
|
||||
lua.Globals["Player"] = new LuaPlayer();
|
||||
lua.Globals["Game"] = game;
|
||||
lua.Globals["Hook"] = hook;
|
||||
lua.Globals["Random"] = new LuaRandom();
|
||||
@@ -358,11 +356,6 @@ namespace Barotrauma
|
||||
lua.Globals["File"] = UserData.CreateStatic<LuaFile>();
|
||||
lua.Globals["Networking"] = networking;
|
||||
|
||||
// obsolete
|
||||
lua.Globals["CreateVector2"] = (Func<float, float, Vector2>)CreateVector2;
|
||||
lua.Globals["CreateVector3"] = (Func<float, float, float, Vector3>)CreateVector3;
|
||||
lua.Globals["CreateVector4"] = (Func<float, float, float, float, Vector4>)CreateVector4;
|
||||
|
||||
#if SERVER
|
||||
|
||||
#elif CLIENT
|
||||
|
||||
Reference in New Issue
Block a user