System: movement¶
Player (agent) movement system.
Attempts to move the controlled agent to next_pos applying effect logic:
- If the agent has an active Phasing effect (consuming a usage/time limit) it ignores blocking components entirely.
- Otherwise the move is allowed only if destination is in-bounds and not blocked by Blocking/Pushable/Collidable entities (push handling occurs in a separate system before this is called).
Returns the original State if movement is not possible; otherwise a new
State with updated position (and possibly decremented usage limits).
movement_system(state, entity_id, next_pos)
¶
Move agent one tile if allowed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
Current state. |
required |
entity_id
|
EntityID
|
Agent entity id (ignored if not an agent). |
required |
next_pos
|
Position
|
Desired destination position. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
State |
State
|
Same state if blocked / invalid or updated with new position. |