Thing is an Object subclass with description, portable flag, and aliases. Entity.can_accept() returns True for portable Things, enabling the containment model where entities carry items in their contents.
21 lines
533 B
Python
21 lines
533 B
Python
"""Thing — an item that can exist in zones or inventories."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, field
|
|
|
|
from mudlib.object import Object
|
|
|
|
|
|
@dataclass
|
|
class Thing(Object):
|
|
"""An item in the world.
|
|
|
|
Things can be on the ground (location=zone, with x/y) or carried
|
|
by an entity (location=entity, no x/y). The portable flag controls
|
|
whether entities can pick them up.
|
|
"""
|
|
|
|
description: str = ""
|
|
portable: bool = True
|
|
aliases: list[str] = field(default_factory=list)
|