Skip to content

System: push

Push interaction system.

Entities that attempt to move into a tile occupied by a pushable entity will attempt to push that entity one tile further in the same direction, provided the destination tile is unblocked.

compute_destination(state, current_pos, next_pos)

Compute push destination given current and occupant next positions.

Parameters:

Name Type Description Default
state State

Current immutable state.

required
current_pos Position

Position of the entity initiating the push.

required
next_pos Position

Position of the entity being pushed.

required

push_system(state, ctx, eid, next_pos)

Attempt to push all pushable entities at next_pos.

Parameters:

Name Type Description Default
state State

Current immutable state.

required
ctx StepContext

Current step context.

required
eid EntityID

Entity initiating the push (must have a position).

required
next_pos Position

Adjacent position the entity is trying to move into.

required

Returns:

Name Type Description
State State

Updated state after applying any pushes.

StepContext StepContext

Updated step context after applying any pushes.