Components (Properties)¶
Agent()
dataclass
¶
Marker component for agents (player‑controlled entities).
Appearance(name, priority=0, icon=False, background=False)
dataclass
¶
Rendering appearance properties.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Appearance name. Names supported by the built-in image map: none, boots, box, coin, core, door, exit, floor, gem, ghost, human, key, lava, lock, monster, portal, shield, spike, wall. |
priority |
int
|
Integer priority used for layering selection. |
icon |
bool
|
If True this entity may render as a small corner icon. |
background |
bool
|
If True this entity may render as a background tile. |
Blocking()
dataclass
¶
Marker component for blocking entities (e.g., walls, obstacles).
Collectible()
dataclass
¶
Marker component for collectible entities (e.g., items that can be picked up). If combined with rewardable, collecting the entity grants a reward. If combined with required, collecting the entity is a requirement for level completion if the objective of the level includes collecting required items.
Collidable()
dataclass
¶
Marker component for collidable entities (e.g., portal entry).
Cost(amount)
dataclass
¶
Marker component for entities that impose a cost.
Attributes:
| Name | Type | Description |
|---|---|---|
amount |
int
|
Positive integer cost. |
Damage(amount)
dataclass
¶
Marker component for damaging entities.
Attributes:
| Name | Type | Description |
|---|---|---|
amount |
int
|
Positive integer damage amount. |
Dead()
dataclass
¶
Marker component for dead entities.
Exit()
dataclass
¶
Marker component for exit points.
Health(current_health, max_health)
dataclass
¶
Health component.
Attributes:
| Name | Type | Description |
|---|---|---|
current_health |
int
|
Current health points. |
max_health |
int
|
Maximum health points. |
Inventory(item_ids)
dataclass
¶
Inventory component.
Attributes:
| Name | Type | Description |
|---|---|---|
item_ids |
PSet[EntityID]
|
Set of EntityIDs representing items in the inventory. |
Key(key_id)
dataclass
¶
Key component.
Attributes:
| Name | Type | Description |
|---|---|---|
key_id |
str
|
Identifier string used to unlock matching locked entities. |
LethalDamage()
dataclass
¶
Marker component for lethal damage sources.
Locked(key_id='')
dataclass
¶
Locked property component.
Attributes:
| Name | Type | Description |
|---|---|---|
key_id |
str
|
Identifier string used to unlock this entity. If empty, may mean "locked with no key" or generic lock. |
Moving(direction, on_collision='stop', speed=1)
dataclass
¶
Autonomous movement component.
Attributes:
| Name | Type | Description |
|---|---|---|
direction |
Direction
|
Direction of movement ("up", "down", "left", or "right"). |
on_collision |
CollisionBehavior
|
Behavior when a collision occurs ("bounce" or "stop"). |
speed |
int
|
Number of steps to move per tick. |
vector |
tuple[int, int]
|
Computed (dx, dy) movement vector based on direction. |
Pathfinding(target=None, type=PathfindingType.PATH)
dataclass
¶
Pathfinding property component.
Attributes:
| Name | Type | Description |
|---|---|---|
target |
EntityID | None
|
Optional EntityID of the target entity to path toward. If None, there is no active target. |
type |
PathfindingType
|
Strategy: |
Portal(pair_entity)
dataclass
¶
Portal property component.
Attributes:
| Name | Type | Description |
|---|---|---|
pair_entity |
int
|
Entity ID of the paired portal. |
Position(x, y)
dataclass
¶
Grid position component.
Attributes:
| Name | Type | Description |
|---|---|---|
x |
int
|
X-coordinate on the grid. |
y |
int
|
Y-coordinate on the grid. |
Pushable()
dataclass
¶
Marker component for pushable entities (e.g., boxes).
Requirable()
dataclass
¶
Marker component for requirable entities.
Rewardable(amount)
dataclass
¶
Marker component for rewardable entities.
Attributes:
| Name | Type | Description |
|---|---|---|
amount |
int
|
The reward amount granted upon interaction. |