Documentation
¶
Overview ¶
Package unit is an entity on a board: the cell it is At, how it moves over the cells and what it weighs (a Mover) and where it stands at a step as a rule gets it (Standing, with its Heading, so a rule's board.Ahead(n) turns to the cells in front of it; its words Fallen where its domain may not be, StandingOn a cell under an effect, OnKind a cell of a kind). Entered and Airborne are markers of the board's States every unit carries: on for the step a unit came into another cell, and while it is in the air.
Footprint is how many cells a side a unit's box takes, past a cell holding it with room to spare (an even side rounded up to an odd one on a hex grid); Place is where the unit stands on the footprint laid from a cell, LaidFrom that cell's point from where it stands.
Vocabulary ¶
Moments, for a role's rules: Standing (every unit a step; places board.Around and board.Ahead; its words Fallen, StandingOn, OnKind).
Index ¶
- Constants
- func DomainAt(movers []Mover, i int) cell.Domain
- func Fallen() cond.Word[Standing]
- func Footprint(g grid.Grid, size geom.Vec) int
- func LaidFrom(g grid.Grid, size, p geom.Vec) geom.Vec
- func Offset(g grid.Grid, cells int) geom.Vec
- func OnKind(k cell.Kind) cond.Word[Standing]
- func Place(g grid.Grid, size geom.Vec, c cell.ID) geom.Vec
- func StandingOn(e effect.Effect) cond.Word[Standing]
- type At
- type Mover
- type Standing
- type States
Constants ¶
const Airborne tag.Tag[States] = 1
Airborne is on while a unit is in the air, put on and off by whoever carries it there (plugins/gravity). A unit in the air has not fallen in where it is over.
const AirborneName = "unit.airborne"
AirborneName is the name Airborne is defined under, as the saves know it.
const Entered tag.Tag[States] = 0
Entered is on for the step a unit's At changed: put on by whoever moves it into another cell, taken off by the board as its next pass begins.
const EnteredName = "unit.entered"
EnteredName is the name Entered is defined under, as the saves know it.
Variables ¶
This section is empty.
Functions ¶
func DomainAt ¶
DomainAt is the domain of the i-th entity of a chunk whose Mover column may be absent.
func Fallen ¶
Fallen is the word of a unit that has fallen in where its domain may not be: a hole, water on foot — with its feet down at the cell's ground, never in the air over it nor on a deck over it.
func Footprint ¶ added in v0.14.0
Footprint is how many cells a side the box of size of a unit on g takes: one for a box no bigger than a cell; past it the fewest, two at least, whose side holds its longer side with room to spare, slack for collision. On a grid no direction of which leaves through a corner, a hex one, an even side has no window and is rounded up to an odd one.
func LaidFrom ¶ added in v0.14.0
LaidFrom is a point of the cell the footprint of a unit is laid from, its box of size and its middle at p: p back by its Offset.
func Offset ¶ added in v0.14.0
Offset is how far off the middle of the cell its footprint is laid from a unit of a footprint cells a side stands: half a cell right and down for an even side, on the corner its middle cells share; none for an odd one, whose footprint is laid round its cell.
Types ¶
type At ¶
At is the cell an entity on the board stands in, kept by whoever moves it, and Next the cell it steps into next, set by whoever leads it: its own cell for a step within it, 0 while nobody leads it.
type Mover ¶
type Mover struct {
Domain cell.Domain
Lift float32
Clearance float32
Ceiling float32
// Weight is how heavy it is in kg, for the floors it stands on (cell.Floor.Load); 0 any bears.
Weight float32
}
Mover says which domains an entity moves in and how far above the ground it keeps (Lift), the least it keeps over it (Clearance) and the highest over sea level it climbs to (Ceiling; 0 none). An entity on the board without one moves on Land.
type Standing ¶
type Standing struct {
ID uid.UID64
Cell cell.ID
Kind cell.Kind
States tag.Tags[effect.States] // the effects on the cell now: frozen over, snowed under
Box geom.AABB
Heading geom.Vec // the way the unit faces (Vel.Dir), standing or not; zero facing nowhere
Domain cell.Domain
Airborne bool // in the air over the cell, not on it
Feet float32 // where its feet stand; -Inf for one carrying no Z
Level float32 // the cell's ground, under its decks
Reach float32 // how high it steps
}
Standing is where an entity on the board stands this tick: the cell under its centre, its kind and the effects on it, the entity's box and the domains it moves in (Land without a Mover).