Skip to main content

Module layout

Module layout 

Source
Expand description

Simulated layout of the blocks of a formation.

The real size of a block depends on the units the game assigns to it, so this module simulates a deployment with a configurable number of units per block. Distances are in meters, and +Y is the front of the formation.

NOTE: how the game applies relative offsets hasn’t been confirmed in-game. This module assumes an offset is a gap measured from the parent’s edge, in the offset’s direction, and that a zero offset on an axis centers the block on its parent. If it turns out offsets are center-to-center, only place_relative and offset_for_center need to change.

Structs§

LayoutParams
Parameters of the simulated deployment used to compute a layout.
LayoutRect
Area covered by a block in the simulated layout.

Functions§

offset_for_center
Computes the offset that places a block closest to a target position, as the inverse of place_relative.
place_relative
Places a block relative to its parent.