System: collectible¶
Collectible system.
Resolves item/effect pickups and reward scoring when an entity occupies the same tile as collectible entities. The system supports three pickup flows:
- Effect pickup (power-up): adds an effect entity's ID to the entity's
Statusif the effect is valid and not expired. - Inventory pickup: inserts keys, coins, cores, etc. into the entity's
Inventory(non-effect collectibles). - Reward scoring: applies immediate score changes for entities bearing a
Rewardablecomponent (whether or not they are effect/inventory pickups) and removes them.
Collected entities are removed from position and collectible maps.
The system is idempotent for a given state+entity pairing.
collectible_system(state, entity_id)
¶
Process collectible pickups for a single entity.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state
|
State
|
Current immutable state. |
required |
entity_id
|
EntityID
|
Entity performing collection (typically an agent). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
State |
State
|
Updated state with inventory/status/score changes applied and collected entities removed. |