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.
This commit is contained in:
parent
b5c5542792
commit
4205b174c9
2 changed files with 5 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue