mud/src/mudlib/thing.py
Jared Miller 5a0c1b2151
Fix dataclass equality causing duplicate items in move_to
Objects were comparing by value instead of identity, causing
list.remove() to remove the wrong object when moving items with
identical attributes. Set eq=False on all dataclasses to use
identity-based comparison.
2026-02-14 01:39:45 -05:00

21 lines
543 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(eq=False)
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)