Skip to content

five-on-it / packages/world/src/pieces / levelToPlacements

Function: levelToPlacements() ​

levelToPlacements(level): PiecePlacement[]

Defined in: packages/world/src/pieces.ts:1197

Turns level data into placements, one per placed mesh, road, nail strip, spawn point, dummy, door, ladder, lift, sheet of water, manhole, bascule, substation, container, camera, NPC, vehicle spawner, garage, shop and district area (named district-<name>-<n>) plus the ground, so that placementsToLevel gives the same level back: a placed block mesh becomes its block (the hidden slope under stairs is dropped: the treads carry the flight), a two-point road becomes a road slab (pitched to its climb), a kit piece keeps its source name. A road with more points than two has no block to come back as and is refused: it belongs to a kit piece the scene must hold.

Parameters ​

level ​

LevelData

Returns ​

PiecePlacement[]