Skip to content

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

Function: placementsToLevel() ​

placementsToLevel(placements, library?): LevelData

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

Turns placements into level data, in a deterministic order (placed meshes by kind, then natural name, then position; roads, spawns, strips and dummies by name). Blocks are known by their source's name (block:<kind>); any other source must be in library. Throws a BlockError naming the node for anything the level format cannot hold: no ground or more than one, a ground that is not centred and square, a pitched ramp, stairs, strip or terrain, a scaled spawn or dummy, stairs without an integer number of steps, a road scaled in height, pitched upright or with lanes that are not whole numbers (at least one forward, none or more back) or a speed that is not positive, a piece without a size, a source nobody knows, a pitched door, a scaled or pitched container, a container of a kind there is none of or holding what is no item, a pickup holding nothing, a lock that is no tag, a scaled or pitched camera or NPC spawner, a camera's sweep beyond a half turn or a range or period that is not positive, an NPC of a role there is none of, with a weapon's name that is no name, pockets of what is no item, a patrol that is no list of points or a turn beyond a half turn; a scaled or pitched vehicle spawner, one naming no class, an owner there is none of, a locked other than 1 or 0, a negative respawn or a key that is no tag; a pitched garage, or one whose price is not a whole number (−1 for none); a spawn point of a role there is none of, a door of a kind there is none of, an NPC's schedule that is no list of hours, a driver without a vehicle class or a refuge that is no point; a scaled or pitched shop, or one selling nothing or what is no item; a pitched district block, one naming no district or with a title, a theme or pedestrians that are none, or the blocks of one district disagreeing on them. A district's blocks join into one district, its areas in the order of their names, the districts by name.

Parameters ​

placements ​

readonly PiecePlacement[]

library? ​

PieceLibrary = {}

Returns ​

LevelData