Docs · area

area

5 area commands, generated from the engine's own registry — signatures, parameters and a worked example each. A does something command acts on the game; a needs x() one answers a confident wrong answer when its client hooks are missing.

area returns area
area(corner: tile, opposite: tile) -> area

A rectangle of the world between two corners. Either order: the corners are sorted, so an area built the wrong way round still contains something.

ParameterTypeWhat it does
cornerrequired tile one corner
oppositerequired tile the corner across from it
Example
let mine = area(tile(300, 550), tile(310, 560))
areaAround returns area
areaAround(centre: tile, radius: int) -> area

A square with this many tiles on every side of a point.

ParameterTypeWhat it does
centrerequired tile the middle
radiusrequired int how many tiles either side
Example
let nearby = areaAround(myTile(), 5)
areaCentre returns tile
areaCentre(of: area) -> tile

The tile in the middle. The same reading as the area's own .centre, which is the shorter way to write it.

ParameterTypeWhat it does
ofrequired area the rectangle
Example
walkTo(areaCentre(areaAround(myTile(), 4)))
areaContains returns bool
areaContains(within: area, spot: tile) -> bool

Whether a tile is inside a rectangle. The edges count as inside.

ParameterTypeWhat it does
withinrequired area the rectangle
spotrequired tile the place to test
Example
if areaContains(areaAround(myTile(), 3), myTile()) { print("yes") }
areaRandomTile returns tile
areaRandomTile(of: area) -> tile

Some tile inside the rectangle, different each time it is asked. A command rather than a property because it is not a reading of anything: two asks give two answers, and a property that did that would break every comparison written against it.

ParameterTypeWhat it does
ofrequired area the rectangle
Example
walkTo(areaRandomTile(areaAround(myTile(), 6)))