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)
¶
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. |