World

Associated namespace: sm.world

A userdata object representing a world in the game.

Values:

Functions:

Operations:

OperationDescription
World == WorldChecks 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:

TypeNameDescription
WorldworldThe world that should be removed.

getId(world)

Returns the id of a world.

Parameters:

TypeNameDescription
WorldworldThe world.

Returns:

TypeDescription
integerThe world's id.

isIndoor(world)

Returns true if the world is an indoor world.

Parameters:

TypeNameDescription
WorldworldThe world.

Returns:

TypeDescription
booleanTrue 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:

TypeNameDescription
WorldworldThe world.
integerxCell X position.
integeryCell Y Position.
PlayerplayerA player to load for, can be nil.
stringcallback=nilLua function to call when cell is loaded. Callback parameters are ( world, x, y, player, params, handle )
anyparams=nilParameter object passed to the callback.
refref=nilScript ref to callback object.

Returns:

TypeDescription
integerHandle 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:

TypeNameDescription
WorldworldThe world.
integerxCell X position.
integeryCell Y Position.
stringcallback=nilLua function to call when cell is reloaded. Callback parameters are ( world, x, y, result ) (Optional)
refref=nilScript 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:

TypeNameDescription
WorldworldThe world.
anydataAny 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:

TypeNameDescription
WorldworldThe world.
Vec3positionThe world position of the sphere.
numberradiusThe radius of the sphere.
numberstrength=1.0The strength of the modification. (Optional)