HazardField

Group
scene
Methods
8
Fields
None

Getting one

scene:hazardField(…)

Methods

MethodReturnsDescription
now()numberThe absolute tick of the field's first layer.
horizonTicks()numberHow many ticks ahead it answers for.
blocked(WorldPoint, number, HazardGroups?, boolean?)booleanWhether a tile is impassable at a tick.
cost(WorldPoint, number)numberExtra entry cost for a tile at a tick, summed over every costing source.
firstBlocked(WorldPoint, number, number, HazardGroups?, boolean?)number?The first tick in a range at which a tile is impassable: nil is safe to WAIT on for the whole range, as opposed to running through it.
inReach(WorldPoint, HazardGroups?)booleanWhether a group EVER reaches a tile across the horizon: "am I standing in the corridor", asked without caring when.
groupsAt(WorldPoint, number){ number }Which groups block a tile at a tick.
blockedTiles(number, HazardGroups?){ WorldPoint }Every tile a group blocks at a tick. For an overlay, not a hot path.

Returned by

MethodReturnsDescription
SceneDomain.hazardFieldHazardField?Expand a set of scheduled hazards over the scene: which tiles are lethal on which ticks.

Method details

now

now: (HazardField) -> number

The absolute tick of the field's first layer.

blocked

blocked: (HazardField, WorldPoint, number, HazardGroups?, boolean?) -> boolean

Whether a tile is impassable at a tick.

tile
The tile.
tick
Absolute tick.
groups
One group, an array of groups, or omitted for all.
graced
Whether the mover is inside a grace window.

cost

cost: (HazardField, WorldPoint, number) -> number

Extra entry cost for a tile at a tick, summed over every costing source.

tile
The tile.
tick
Absolute tick.

firstBlocked

firstBlocked: (HazardField, WorldPoint, number, number, HazardGroups?, boolean?) -> number?

The first tick in a range at which a tile is impassable: nil is safe to WAIT on for the whole range, as opposed to running through it.

tile
The tile.
from
First tick.
to
Last tick.
groups
One group, an array of groups, or omitted for all.
graced
Whether the mover is inside a grace window.
Returns
nil when it is clear for the whole range.

inReach

inReach: (HazardField, WorldPoint, HazardGroups?) -> boolean

Whether a group EVER reaches a tile across the horizon: "am I standing in the corridor", asked without caring when.

tile
The tile.
groups
One group, an array of groups, or omitted for all.