World
Associated namespace: sm.world
A userdata object representing a world in the game.
Values:
Functions:
Operations:
Operation | Description |
---|---|
World == World | Checks if two instances of World refer to the same World. |
id integer
Get:
Returns the id of a world.
destroy(world)
Server only
Destroys the given world. Can only be called from inside the Game script environment.
Parameters:
Type | Name | Description |
---|---|---|
World | world | The world that should be removed. |
getId(world)
Returns the id of a world.
Parameters:
Type | Name | Description |
---|---|---|
World | world | The world. |
Returns:
Type | Description |
---|---|
integer | The world's id. |
isIndoor(world)
Returns true if the world is an indoor world.
Parameters:
Type | Name | Description |
---|---|---|
World | world | The world. |
Returns:
Type | Description |
---|---|
boolean | True if indoor. |
loadCell(world, x, y, player, callback=nil, params=nil, ref=nil)
Server only
Load a cell for player. The cell will stay loaded until the player steps into the cell, or the cell is released with releaseCell (and no player is close enough to load the cell).
Parameters:
Type | Name | Description |
---|---|---|
World | world | The world. |
integer | x | Cell X position. |
integer | y | Cell Y Position. |
Player | player | A player to load for, can be nil. |
string | callback=nil | Lua function to call when cell is loaded. Callback parameters are ( world, x, y, player, params, handle ) |
any | params=nil | Parameter object passed to the callback. |
ref | ref=nil | Script ref to callback object. |
Returns:
Type | Description |
---|---|
integer | Handle to use when explicitly releasing cell. |
reloadCell(world, x, y, callback=nil, ref=nil)
Reload a cell. Callback result values, 0 means cell isnt active and wont be reloaded. 1 means success
Parameters:
Type | Name | Description |
---|---|---|
World | world | The world. |
integer | x | Cell X position. |
integer | y | Cell Y Position. |
string | callback=nil | Lua function to call when cell is reloaded. Callback parameters are ( world, x, y, result ) (Optional) |
ref | ref=nil | Script ref to callback object. (Optional) |
setTerrainScriptData(world, data)
Set data to pass on to the terrain generation script. If no data is set the terrain generation script receives the same data as the world script.
Parameters:
Type | Name | Description |
---|---|---|
World | world | The world. |
any | data | Any data, available to the terrain generation script as parameter 6 in the create callback. |
terrainSphereModification(world, position, radius, strength=1.0)
Server only
Modify destructable terrain with a sphere shape
Parameters:
Type | Name | Description |
---|---|---|
World | world | The world. |
Vec3 | position | The world position of the sphere. |
number | radius | The radius of the sphere. |
number | strength=1.0 | The strength of the modification. (Optional) |