Skip to main content
Verticopolis engineGitHub

Module layout

Module layout 

Source
Expand description

Every slot and record width of the view’s frame and structural snapshot, by name. Decode both with these, such as frame[header::MONEY], never with bare numbers. super::layout_json hands the same tables over as JSON, with the state, weather, mode and calendar codes, for a host in another language.

Modules§

car
The slots of one car, counted from the car’s start.
header
The dynamic frame’s header slots, one name each. UNLOCKED holds the unlocked kinds as a bitmask by kind code in one double, with more than 32 bits in use: read bit k as Math.floor(mask / 2 ** k) % 2, since JavaScript’s bitwise operators cut a number to 32 bits. FRAME_SEQ counts the reader’s frames from 1: a host that sees it skip a number missed a frame, and asks for a full one before it applies another. DAY through WEEKEND_DAYS are the clock’s readings on the tower’s calendar (the day count, the day of the week, the weekend flag as 0 or 1, the quarter and the year, all counted from 0) and the calendar’s week and weekend lengths in days, so a host shows dates without doing the date arithmetic. BOMB_SEARCH_SEQ is 0 while no bomb search runs and otherwise moves with every change to it, so a host rereads the search only when it moved.
person
The slots of a drawn person’s record.
room
The slots of a room in the structural snapshot.
run
The slots of a run of floor or lobby tiles: COUNT tiles of one kind and width side by side on one floor, the k-th at X + k * WIDTH, every one with the same frame fields.
shaft
The slots of a transport in the structural snapshot, before its SKIPS skipped floors.
structure
The structural snapshot’s header slots. HIGHEST_FLOOR and LOWEST_FLOOR are the highest and lowest floor any unit stands on (1 on an empty tower), the bounds the camera reads; MODE and CALENDAR are the game mode and the Modern calendar, by the codes in MODES and CALENDARS; SCENE_SEED is the founding seed the scenery derives from (so the scenery stays the same across saves), fixed for a tower’s life.
transport
The slots of a transport’s record in the dynamic frame: ID and CARS, then CARS car records.
unit
The slots of a changed room’s record: its slot in the structural snapshot’s room list, then its frame fields.

Constants§

CAR_RECORD
Slots of each car.
HEADER
Slots of the dynamic frame’s header.
PERSON_RECORD
Slots of a person record.
ROOM_RECORD
Slots of a room record in the structural snapshot.
RUN_RECORD
Slots of a run record.
SHAFT_FIXED
Slots of a shaft record before its skipped floors.
STRUCTURE_HEADER
Slots of the structural snapshot’s header.
TRANSPORT_FIXED
Slots of a transport record before its cars.
UNIT_RECORD
Slots of a room record in the dynamic frame.
VIEW_LAYOUT_VERSION
The version of the view’s layout. It goes up when a slot moves, a width changes, or a slot or code changes meaning.

Functions§

layout_json
The layout as a value: the version, every table’s slots and width, the codes (kinds, unit and person states, weather, modes, calendars) and the metadata record’s fields. A kind’s code is its index in kinds (the catalog’s order, Kind as usize), and names holds each kind’s catalog name, which is a unit’s label when a full metadata listing leaves the unit out.