public class WorldInfo : NetworkBehaviour

This is the class that facilitates the connection between Lua and MicroWorks/Unity.

It instantiates the world, loads scripts, handles RPCs, etc.


public LuaTable GetAllPlayers()

(Client/Server) Get a list of all players.

Returns: (LuaTable) The list of all players.


public LuaTable GetSortedPlayers()

(Client/Server) Get a list of all players, sorted by their score.

Returns: (LuaTable) The list of all sorted players.


public LuaTable GetAllActivePlayers()

(Client/Server) Get a list of all active players (not spectating).

Returns: (LuaTable) The list of all active players.


public int GetPlayerCount()

(Client/Server) Gets the amount of all players.

Returns: (int) Amount of players in the game.


public int GetActivePlayersCount()

(Client/Server) Gets the amount of players that are playing and not spectating.

Returns: (int) The amount of active players in the game.


public bool PlayerExists(uint id)

(Clients/Server) Checks whether a player is currently in the server by their network ID.

Arguments

Returns: (bool) Whether this player exists in the server.


public PlayerControllerWrapper GetPlayerByID(uint id)

(Client/Server) Get a player by their network ID.

Arguments

Returns: (PlayerController) The player with that ID.


public PlayerControllerWrapper GetLocalPlayer()

(Client) Get the local player.

Returns: (PlayerController) The current player operated by the client.


public PlayerControllerWrapper GetServerHost()

(Client/Server) Get the player that is hosting the server.

Returns: (PlayerController) The player hosting the server.


public bool IsAwaitingPlayers()

(Client/Server) Checks whether we are currently waiting for other players to load in.

Returns: (bool) Whether there are currently other players still loading in.


public void SendMessageToAll(string message, float time = 2f)

(Server) Send a message to be display on every client's HUD.

Arguments


public void ShowMessageLocal(string message, float time = 2f)

(Client) Show a message on this players screen.

Arguments


public void SendInfoChatMessageToAll(string message)

(Server) Send an "INFO" server chat message to all.

Arguments


public void SendInfoChatMessageLocal(string message)

(Client) Show a local "INFO" chat message.

Arguments


public MicrogameCoordinatorWrapper GetCoordinator()

(Client) Get the microgame coordinator.

Returns: (MicrogameCoordinator) The coordinator.


public float GetFrameTime()

(Client) Get the last delta frame time.

Returns: (float) The frame time.


public float GetCurrentTime()

(Client) Get the time since MicroWorks started.

Returns: (float) The time since MicroWorks started.


public double GetSynchronizedTime()

(Client/Server) Get the synchronized game time.

Returns: (float) The synchronized time.


public long GetHostTime()

(Client) Get the client computer time as a unix timestamp.

Returns: (long) The unix timestamp of the client's computer time.


public bool IsServer()

(Client/Server) Check if the local player is the server.

Returns: (bool) Whether the local player is the server.


public GameObjectWrapper FindObjectByName(string name)

(Client/Server) Searches for and returns an object corresponding to a provided name.

Arguments

Returns: (GameObject) The game object.


public object GetCVar(string name)

(Client) Get the value of a CVar.

Arguments

Returns: (many) The value of that CVar.


public string GetRandomString()

(Client) Get a random string.

Returns: (string) A random string.


public bool HasCheated()

(Client/Server) Check if this lobby has been tainted by cheats.

Returns: (bool) Whether this lobby is tainted.


public bool IsEditor()

(Client) Are we in the Unity Editor.

Returns: (bool) Always false in build.


public TransformWrapper AddSpawnPoint(LuaVector3 position, LuaQuaternion rotation)

(Server) Adds a spawn point.

Returns: (Transform) The spawn point.


public TransformWrapper GetRandomSpawnPoint()

(Server) Gets a random spawn point.

Returns: (Transform) The spawn point.


public LuaTable GetSpawnPoints()

(Server) Gets all the spawn points.

Returns: (table) The list of spawn points.


public void ReplaceSpawnPoints(LuaTable tbl)

(Server) Replaces all the spawn points.

Arguments


public object CreateEntity(EntityType type)

(Client) Creates an entity of a specified type.

Arguments

Returns: (many) The created entity.


public WeaponPickableWrapper CreateWeapon(string name, LuaVector3 pos)

(Server) Creates a weapon pickable.

Arguments

Returns: (WeaponPickable) The created weapon pickable.


public NetworkSpawnerWrapper CreateWeaponSpawner(string name, LuaVector3 pos, bool spawnOnStart = true)

(Server) Creates a weapon spawner.

Arguments

Returns: (NetworkSpawner) The created spawner.


public PDAWrapper GetPDA()

(Client) Get the PDA object.

Returns: (PDA) The PDA.


public string GetCurrentLevel()

(Client) Gets the name of the currently loaded level.

Returns: (string) The name of the level.


public bool IsInCustomLevel()

(Client) Returns whether the current level is a custom level.

Returns: (bool) Whether the current level is a custom level.


public CustomLevelManager GetCustomLevelManager()

(Client) Returns the custom level manager, if we are in a custom level.

Returns: (CustomLevelManager) The custom level manager.


public void Traverse(string levelName)

(Server) Causes everyone to move to a different scene.

Arguments