Skip to content

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:

  1. Effect pickup (power-up): adds an effect entity's ID to the entity's Status if the effect is valid and not expired.
  2. Inventory pickup: inserts keys, coins, cores, etc. into the entity's Inventory (non-effect collectibles).
  3. Reward scoring: applies immediate score changes for entities bearing a Rewardable component (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.