Entity
Functions
Include
function self.Include(File)
Parameter | Type | |
---|---|---|
File | filename without the extension. Make sure this file is within the 'libraries' folder of the mod. |
Entity.Include
Includes another lua file in this entity script.
Example
self.Include("file")
RegisterListener
function self.RegisterListener((int)MessageToListen , (function)Function to Call)
Parameter | Type | |
---|---|---|
MessageToListen | int |
The id of one of the messages available on the Messager. Example: Messager.Update |
Function to Call | function |
The function that should be called once this message is sent. |
Entity.RegisterListener
Registers for Messager messages.
Example
self.RegisterListener(Messager.Update,Test)
UnregisterListener
function self.UnregisterListener((int)MessageToStopListening)
Parameter | Type | |
---|---|---|
MessageToStopListening | int |
The id of one of the messages available on the Messager. Example: Messager.Update |
Entity.UnregisterListener
Unregister from Messager messages.
Example
self.UnregisterListener(Messager.Update)
ListenForNetworkCalls
function self.ListenForNetworkCalls()
Entity.ListenForNetworkCalls
Start listening for function calls from other players in the room.
Example
self.ListenForNetworkCalls()
StopListeningForNetworkCalls
function self.StopListeningForNetworkCalls()
Entity.StopListeningForNetworkCalls
Stop listening for function calls from other players in the room.
Example
self.StopListeningForNetworkCalls()
PreventTimePassing
function self.PreventTimePassing()
Entity.PreventTimePassing
Prevents time from progressing in the game
AllowTimePassing
function self.AllowTimePassing()
Entity.AllowTimePassing
Allows time from progressing in the game
AddLuaTrigger
function self.AddLuaTrigger((string)Trigger Name , (optional float)Radius, (optional bool)Auto, (optional bool)Locks Player, (optional bool)Is Secondary)
Parameter | Type | |
---|---|---|
Trigger Name | string |
Name of the trigger. |
Radius | optional float |
Radius the player has to be to be able to use the trigger. |
Auto | optional bool |
True if the trigger should automatically trigger when the player enters its radius. It's set to fale by default. |
Locks Player | optional bool |
True if this trigger should prevent the player from moving while it's in use. |
Is Secondary | optional bool |
Should this trigger prefer to be activated with the secondary button? Defaults to false. |
Entity.AddLuaTrigger
Adds a Lua Trigger to this entity. Check the documentation on TriggerActionLua to see how to override this trigger's calls.
Example
self.AddLuaTrigger("Custom Trigger",3)
RegisterEntityWithTag
function self.RegisterEntityWithTag((string)Tag)
Parameter | Type | |
---|---|---|
Tag | string |
Tag to register |
Entity.RegisterEntityWithTag
Registers a entity with a tag that can be retrieved later by other entities/scripts.
Example
self.RegisterEntityWithTag("trophy")
UnregisterEntityWithTag
function self.UnregisterEntityWithTag((string)Tag)
Parameter | Type | |
---|---|---|
Tag | string |
Tag to register |
Entity.UnregisterEntityWithTag
Unregisters a entity with a tag if it has been registered before.
Example
self.UnregisterEntityWithTag("trophy")
GetEntityWithTag
function self.GetEntityWithTag((string)Tag)
Parameter | Type | |
---|---|---|
Tag | string |
Tag to find |
Entity.GetEntityWithTag
Returns a single random entity with the specified tag.
Example
self.GetEntityWithTag("trophy")
GetEntitiesWithTag
function self.GetEntitiesWithTag((string)Tag)
Parameter | Type | |
---|---|---|
Tag | string |
Tag to find |
Entity.GetEntitiesWithTag
Returns a list of entities with the specified tag.
Example
self.GetEntitiesWithTag("trophy")
CallFunctionOnOthers
function self.CallFunctionOnOthers((string)Function Name , (parameters)Other Parameters)
Parameter | Type | |
---|---|---|
Function Name | string |
Function name as a string |
Other Parameters | parameters |
Other parameters to call on this function. Can only take Numbers, Booleans, Strings, Simple Tables. When in doubt if it's a type that is acceptable send it as a json. |
Entity.CallFunctionOnOthers
Call a function on other players in the room. Make sure the script that will receive the function has called self.ListenForNetworkCalls()
before.
Example
self.CallFunctionOnOthers("Test","This is a test")
CallFunctionOnEveryone
function self.CallFunctionOnEveryone((string)Function Name , (parameters)Other Parameters)
Parameter | Type | |
---|---|---|
Function Name | string |
Function name as a string |
Other Parameters | parameters |
Other parameters to call on this function. Can only take Numbers, Booleans, Strings, Simple Tables. When in doubt if it's a type that is acceptable send it as a json. |
Entity.CallFunctionOnEveryone
Call a function on all players in the room including your own. Make sure the script that will receive the function has called self.ListenForNetworkCalls()
before.
Example
self.CallFunctionOnEveryone("Test","This is a test")
CallFunctionOnHost
function self.CallFunctionOnHost((string)Function Name , (parameters)Other Parameters)
Parameter | Type | |
---|---|---|
Function Name | string |
Function name as a string |
Other Parameters | parameters |
Other parameters to call on this function. Can only take Numbers, Booleans, Strings, Simple Tables. When in doubt if it's a type that is acceptable send it as a json. |
Entity.CallFunctionOnHost
Call a function on the host of the room. Make sure the script that will receive the function has called self.ListenForNetworkCalls()
before.
Example
self.CallFunctionOnHost("Test","This is a test")
CallFunctionOnPlayerWithID
function self.CallFunctionOnPlayerWithID((int)Player ID , (string)Function Name, (parameters)Other Parameters)
Parameter | Type | |
---|---|---|
Player ID | int |
ID of the player that should receive this call. |
Function Name | string |
Function name as a string |
Other Parameters | parameters |
Other parameters to call on this function. Can only take Numbers, Booleans, Strings, Simple Tables. When in doubt if it's a type that is acceptable send it as a json. |
Entity.CallFunctionOnPlayerWithID
Call a function on a player with a specific ID provided. Make sure the script that will receive the function has called self.ListenForNetworkCalls()
before.
Example
self.CallFunctionOnPlayerWithID(1,"Test","This is a test")