From 4205b174c90f181b966844cb34eab43314d46de2 Mon Sep 17 00:00:00 2001 From: Jared Miller Date: Sat, 14 Feb 2026 12:33:00 -0500 Subject: [PATCH] Add item tags to Thing model Tags enable categorizing items for boundary checks and other systems. Added tags field to Thing and ThingTemplate, updated load and spawn functions to handle tags from TOML definitions. --- src/mudlib/thing.py | 1 + src/mudlib/things.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/mudlib/thing.py b/src/mudlib/thing.py index 54cca75..6336f5f 100644 --- a/src/mudlib/thing.py +++ b/src/mudlib/thing.py @@ -20,3 +20,4 @@ class Thing(Object): portable: bool = True aliases: list[str] = field(default_factory=list) readable_text: str = "" + tags: list[str] = field(default_factory=list) diff --git a/src/mudlib/things.py b/src/mudlib/things.py index 6c81771..5ea25b8 100644 --- a/src/mudlib/things.py +++ b/src/mudlib/things.py @@ -30,6 +30,7 @@ class ThingTemplate: # Verb handlers (verb_name -> module:function reference) verbs: dict[str, str] = field(default_factory=dict) readable_text: str = "" + tags: list[str] = field(default_factory=list) # Module-level registry @@ -61,6 +62,7 @@ def load_thing_template(path: Path) -> ThingTemplate: locked=data.get("locked", False), verbs=data.get("verbs", {}), readable_text=data.get("readable_text", ""), + tags=data.get("tags", []), ) @@ -89,6 +91,7 @@ def spawn_thing( portable=template.portable, aliases=list(template.aliases), readable_text=template.readable_text, + tags=list(template.tags), capacity=template.capacity, closed=template.closed, locked=template.locked, @@ -103,6 +106,7 @@ def spawn_thing( portable=template.portable, aliases=list(template.aliases), readable_text=template.readable_text, + tags=list(template.tags), location=location, x=x, y=y,