Scene

Group
player
Methods
20
Fields
None

Getting one

client:getScene()
client:getTopLevelWorldView():getScene()

Methods

MethodReturnsDescription
getTiles(){{{ n: number, [number]: Tile? }}}Every tile, [plane][x][y] (1-based in Luau: getTiles()[plane + 1][x + 1][y + 1]), nil where there is none. The same array until the s…
getExtendedTiles(){{{ n: number, [number]: Tile? }}}Every tile of the extended scene, [plane][x + 40][y + 40] (184 a side). The client builds no tiles past the 104-tile scene, so the ring a…
getTile(number, number, number)Tile?One tile, the one getTiles()[plane + 1][x + 1][y + 1] holds, at (plane, x, y) (0-based scene coordinates), or nil, without building t…
getWorldViewId()numberThe id of the world view the scene belongs to.
getBaseX()numberThe world x of scene tile (0, 0).
getBaseY()numberThe world y of scene tile (0, 0).
isInstance()booleanWhether the scene is an instance.
getInstanceTemplateChunks(){{{number}}}The instance template chunks, as WorldView:getInstanceTemplateChunks().
getMapRegions(){number}The map regions the scene covers, ascending.
getTileHeights(){{{number}}}The tile corner heights, [plane][x][y]. A copy.
setRoofsHidden(boolean)()Hide every roof above the local player's plane (true, what the game's own "hide roofs" setting does) or stop asking (false): the client…
setMinLevel(number)()Draw the scene from minLevel up: the planes below it are not drawn (to hide the planes below the local player, set its plane before each…
setDrawDistance(number)()Draw the scene out to drawDistance tiles from the camera: the scene's own draw distance, through the client's setter (it tells the render…
getDrawDistance()number?The scene's draw distance in tiles, the value setDrawDistance writes: what the client draws out to now (25..90), set by the player's own…
getOverrideHue()numberThe hue (0..63) of the colour override the client draws this scene's models with, -1 while there is none. A world entity's scene has one wh…
getOverrideSaturation()numberThe saturation (0..7) of the scene's colour override, -1 while there is none (getOverrideHue).
getOverrideLuminance()numberThe luminance (0..127) of the scene's colour override, -1 while there is none (getOverrideHue).
getOverrideAmount()numberHow strongly the scene's colour override applies (127 while a world entity is hidden for an overlap), 0 while there is none (`getOverrideHu…
getSkybox()Model?The skybox the client draws behind the scene, centred on the camera, before anything else: the model the server's skybox id names, lit as t…
equals(any)booleanWhether other equals this Scene, as == answers it (false for a value of another class).

Returned by

MethodReturnsDescription
Client.getSceneSceneThe top-level world view's scene.
PreMapLoad.getSceneSceneThe scene being loaded.
WorldView.getSceneSceneIts scene.

Method details

getTiles

getTiles: (Scene) -> {{{ n: number, [number]: Tile? }}}

Every tile, [plane][x][y] (1-based in Luau: getTiles()[plane + 1][x + 1][y + 1]), nil where there is none. The same array until the scene is rebuilt: the first call in a scene builds a handle per tile (about 43k, a millisecond), later ones answer it at once. Use getTile for a few. To find objects by id, walking this array in Luau takes milliseconds a scene: scene:objects():ids(ids):collect() walks it in Rust.

getExtendedTiles

getExtendedTiles: (Scene) -> {{{ n: number, [number]: Tile? }}}

Every tile of the extended scene, [plane][x + 40][y + 40] (184 a side). The client builds no tiles past the 104-tile scene, so the ring around it is nil. The same array until the scene is rebuilt, as getTiles().

getTile

getTile: (Scene, number, number, number) -> Tile?

One tile, the one getTiles()[plane + 1][x + 1][y + 1] holds, at (plane, x, y) (0-based scene coordinates), or nil, without building the whole array.

getBaseX

getBaseX: (Scene) -> number

The world x of scene tile (0, 0).

getBaseY

getBaseY: (Scene) -> number

The world y of scene tile (0, 0).

getMapRegions

getMapRegions: (Scene) -> {number}

The map regions the scene covers, ascending.

getTileHeights

getTileHeights: (Scene) -> {{{number}}}

The tile corner heights, [plane][x][y]. A copy.

setRoofsHidden

setRoofsHidden: (Scene, boolean) -> ()

Hide every roof above the local player's plane (true, what the game's own "hide roofs" setting does) or stop asking (false): the client has one roof rule, a plane cutoff, so per-roof modes are not available. Held per plugin until it asks otherwise or stops, and roofs stay hidden while any plugin asks. Does nothing on a client whose table has the render callbacks off.

setMinLevel

setMinLevel: (Scene, number) -> ()

Draw the scene from minLevel up: the planes below it are not drawn (to hide the planes below the local player, set its plane before each frame). The scene's own lowest drawn level, which the client's software (SD) draw reads every frame and its low detail sets when a region loads; a level past the scene's planes draws nothing. In HD the client draws from what it built when the region loaded, and reads the level only then. Game thread only; raises for a level below 0, before the world view has a scene, and on a client whose table does not place the scene.

setDrawDistance

setDrawDistance: (Scene, number) -> ()

Draw the scene out to drawDistance tiles from the camera: the scene's own draw distance, through the client's setter (it tells the renderer and works out what is visible again), clamped to the client's 25..90. Called while a frame is drawn (from an overlay's render or BeforeRender), it applies at the start of the next client cycle; a distance the scene already has is not set again. The game sets its own back when the player changes the draw distance option. Game thread only; raises before the world view has a scene and on a client whose table does not place the scene.

getDrawDistance

getDrawDistance: (Scene) -> number?

The scene's draw distance in tiles, the value setDrawDistance writes: what the client draws out to now (25..90), set by the player's own draw distance option or by a plugin. Read it before changing it to put it back. A setDrawDistance made inside a draw applies at the start of the next client cycle, and this answers the old value until then. nil before the world view has a scene. Raises on a client whose table does not place the scene, rather than answer.

getOverrideHue

getOverrideHue: (Scene) -> number

The hue (0..63) of the colour override the client draws this scene's models with, -1 while there is none. A world entity's scene has one while the entity is hidden for an overlap (WorldEntity:isHiddenForOverlap()); the top level's never does. Raises on a client whose table does not place the client's field, rather than answer "none".

getOverrideSaturation

getOverrideSaturation: (Scene) -> number

The saturation (0..7) of the scene's colour override, -1 while there is none (getOverrideHue).

getOverrideLuminance

getOverrideLuminance: (Scene) -> number

The luminance (0..127) of the scene's colour override, -1 while there is none (getOverrideHue).

getOverrideAmount

getOverrideAmount: (Scene) -> number

How strongly the scene's colour override applies (127 while a world entity is hidden for an overlap), 0 while there is none (getOverrideHue).

getSkybox

getSkybox: (Scene) -> Model?

The skybox the client draws behind the scene, centred on the camera, before anything else: the model the server's skybox id names, lit as the client lights it (a copy); nil while there is none, which is every scene but the top level's, and the top level's until the server sends one. While the client draws in HD (its skybox is then a model of the HD classes) this is the SD model built from the same id and lighting; that build is made by the client, on its thread.

equals

equals: (Scene, any) -> boolean

Whether other equals this Scene, as == answers it (false for a value of another class).