RevertClientProperty |
world:RevertClientProperty(string propertyName) |
Revert a property that's been changed on the client back to the server's value for it |
Client Only |
Raycast |
world:Raycast(Vector start, Vector end, Entity entityToIgnore, callback collisionCallback) |
Send a ray (line) from start position to end position, and call the collisionCallback with the entity that was hit and a HitResult structure if any Entity is hit along the way. Pass an entityToIgnore to tell it not to hit that one (for example ignore the player when doing a ray from a gun the player is holding). |
|
Raycast |
world:Raycast(Vector start, Vector end, table entitiesToIgnoreTable, callback collisionCallback) |
Send a ray (line) from start position to end position, and call the collisionCallback with the entity that was hit and a HitResult structure if any Entity is hit along the way. Pass an array of entities to ignore. |
|
Raycast |
world:Raycast(Vector start, Vector end, Entity entityToIgnore, bool highFidelityCollision, callback collisionCallback) |
Send a ray (line) from start position to end position, and call the collisionCallback with the entity that was hit and a HitResult structure if any Entity is hit along the way. Pass an entityToIgnore to tell it not to hit that one (for example ignore the player when doing a ray from a gun the player is holding). High fidelity collisions will ignore any collision with an entity's bounding box if it would not also collide with it's more complex inner collision |
|
Raycast |
world:Raycast(Vector start, Vector end, table entitiesToIgnoreTable, bool highFidelityCollision, callback collisionCallback) |
Send a ray (line) from start position to end position, and call the collisionCallback with the entity that was hit and a HitResult structure if any Entity is hit along the way. Pass an array of entities to ignore. High fidelity collisions will ignore any collision with an entity's bounding box if it would not also collide with it's more complex inner collision |
|
Find |
Entity world:Find(string name) |
Find a named Entity within the world. Generally an entity type property which is filled in in the editor is a better option. |
|
FindAll |
table world:FindAll() |
Return all entities in the world. Can be very slow. |
|
FindAll |
table world:FindAll(table derivedType) |
Return all entities in the world of the given type (Light, Mesh, etc). Can be very slow. |
|
FindAllScripts |
table world:FindAllScripts(string scriptName) |
Find all scripts named scriptName recursively in the world. Most often used where multiple scripts are used to simulate an array of structures. |
|
FindAllScripts |
table world:FindAllScripts(ScriptAsset templateRefScript) |
Find all scripts matching the script asset recursively in the world. Most often used where multiple scripts are used to simulate an array of structures. |
|
FindScript |
Script world:FindScript(string scriptName) |
Find any entity with a script named scriptName recursively in the world, returns the script if found. |
|
FindScript |
Script world:FindScript(ScriptAsset templateRefScript) |
Find any entity with a script matching the script asset recursively in the world, returns the script if found. |
|
FindTemplate |
Template world:FindTemplate(string name) |
Find a Template in the world by name. Returns nil if not found |
|
GetLocalUser |
User world:GetLocalUser() |
Get the User that this client is owned by. |
Client Only |
GetUsers |
table world:GetUsers() |
Get a table containing all the User entities within the current world. This works on the server or the client however the client version of the table might lag behind the server version. |
|
ForEachUser |
world:ForEachUser(callback callback, ... args) |
Call the given callback for each User with the User as the argument |
|
ApplyPointDamage |
world:ApplyPointDamage(number baseDamage, Vector rayStart, Vector direction, Entity fromEntity) |
Applies point damage to the first Entity that intersects the given ray. |
Server Only |
ApplyPointDamage |
world:ApplyPointDamage(number baseDamage, Vector rayStart, Vector direction, Entity fromEntity, table damageModifiers) |
Applies point damage to the first Entity that intersects the given ray. DamageModifiers is a table of { voxel = <voxelasset>, damageMultiplier = <number> } tables, and/or scripts that have voxel and damageMultiplier properties: { name = "voxel", type = "voxelasset" } and { name = "damageMultiplier", type = "number" }. damageModifiers = { { voxel = <voxelasset>, damageMultiplier = <number> }, { voxel = <voxelasset>, damageMultiplier = <number> }, <script>, <script> } |
Server Only |
ApplyRadialDamage |
world:ApplyRadialDamage(number baseDamage, Vector origin, number radius, number falloff, Entity fromEntity) |
Applies radial damage to all Entities within a radius of an origin. |
Server Only |
ApplyRadialDamage |
world:ApplyRadialDamage(number baseDamage, Vector origin, number radius, number falloff, Entity fromEntity, table damageModifiers) |
Applies radial damage to all Entities within a radius of an origin. DamageModifiers is a table of { voxel = <voxelasset>, damageMultiplier = <number> } tables, and/or scripts that have voxel and damageMultiplier properties: { name = "voxel", type = "voxelasset" } and { name = "damageMultiplier", type = "number" }. damageModifiers = { { voxel = <voxelasset>, damageMultiplier = <number> }, { voxel = <voxelasset>, damageMultiplier = <number> }, <script>, <script> } |
Server Only |
SetVoxelProperties |
world:SetVoxelProperties(table voxelPropertiesTable) |
Set the voxel properties of the world. VoxelProperties is a table of { voxel = <voxelasset>, health = <number>, healTime = <number> } tables, and/or scripts that have voxel, and optionally health and healTime properties: { name = "voxel", type = "voxelasset" }, { name = "health", type = "number", default = 100 }, { name = "healTime", type = "number", editor = "seconds", default = 3 }. voxelProperties = { { voxel = <voxelasset>, health = <number>, healTime = <number> }, { voxel = <voxelasset>, health = <number> }, { voxel = <voxelasset>, healTime = <number> }, <script>, <script> } Defaults are 100 for health, 3.0 for heal time. |
|
SetVoxelProperties |
world:SetVoxelProperties(table voxelPropertiesTable, number defaultMaxHealth, number defaultHealTime) |
Set the voxel properties of the world. VoxelProperties is a table of { voxel = <voxelasset>, health = <number>, healTime = <number> } tables, and/or scripts that have voxel, and optionally health and healTime properties: { name = "voxel", type = "voxelasset" }, { name = "health", type = "number", default = 100 }, { name = "healTime", type = "number", editor = "seconds", default = 3 }. voxelProperties = { { voxel = <voxelasset>, health = <number>, healTime = <number> }, { voxel = <voxelasset>, health = <number> }, { voxel = <voxelasset>, healTime = <number> }, <script>, <script> } Defaults are 100 for health, 3.0 for heal time, these can be modified in this version of the function. |
|
GetTimeOfDay |
number world:GetTimeOfDay() |
Get the time of day as a value between 0 and 1 |
|
Spawn |
Entity world:Spawn(Template templateAsset, Vector position, Rotation rotation) |
Spawn a new Entity from the template pointed at by templateAsset, at the given position and rotation. |
Server Only |
Spawn |
Entity world:Spawn(Template templateAsset, Locator locatorEntity) |
Spawn a new Entity from the template pointed at by templateAsset, at the given locator's position and rotation. |
Server Only |
BroadcastToScripts |
world:BroadcastToScripts(string eventName, ... args) |
Try calling eventName on all scripts of all Entities within the World. When called on the server it sends to server scripts only, if called on the client it will send to client scripts only. |
|
GetServerTime |
number world:GetServerTime() |
Get server up time in seconds (can be called on client or server) |
|
GetUTCTime |
number world:GetUTCTime() |
Gets unit time (number of seconds that have elapsed since Jan 1 1970). This has an issue that it will start to overflow 32-bits in 2038. |
|
GetGame |
world:GetGame(string gameIDString, callback callback) |
Asynchronously fetches the game profile for a given game ID, and passes the result to the callback. |
|
GetGames |
world:GetGames(string railName, callback callback) |
|
|
GetGames |
world:GetGames(table railNamesTable, callback callback) |
|
|
GetActiveChallenges |
table world:GetActiveChallenges() |
Gets the current active challenges Example result table: result = {} result[1] = {id = <ChallengeId>, name = <LocalisedName>, icon = <IconUrl>, count = <TotalCountToComplete>} result[2] = {id... |
|
PlayCameraShakeEffectAtLocation |
world:PlayCameraShakeEffectAtLocation(CameraShakeAsset cameraShake, number scale, Vector location, number innerRadius, number outerRadius, number falloff, bool orientToDirection) |
Play a camera shake effect at this location in the world with a scale multiplier |
|
PlayCameraShakeEffectAtLocation |
world:PlayCameraShakeEffectAtLocation(CameraShakeAsset cameraShake, Vector location, number innerRadius, number outerRadius, number falloff, bool orientToDirection) |
Play a camera shake effect at this location in the world |
|
GetWorldAsset |
WorldAsset world:GetWorldAsset() |
Returns the WorldAsset that's currently loaded |
|