From 69d8757ad983697cdc9182fdcc1cdb612a77fb41 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 10 Jun 2026 04:44:31 -0400 Subject: feat: yaml architecture for complex object interaction --- internal/world/room.go | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'internal/world') diff --git a/internal/world/room.go b/internal/world/room.go index 6c2d0e3..58fa82b 100644 --- a/internal/world/room.go +++ b/internal/world/room.go @@ -1,6 +1,9 @@ package world -import "gopkg.in/yaml.v3" +import ( + "gopkg.in/yaml.v3" + "thirdcollapse/internal/action" +) type ExitDir string @@ -44,9 +47,9 @@ type SpawnDef struct { } type ExitDef struct { - Room int `yaml:"room"` - Condition *ExitCondition `yaml:"condition"` - BlockedMessage string `yaml:"blocked_message"` + Room int `yaml:"room"` + Condition *action.Condition `yaml:"condition"` + BlockedMessage string `yaml:"blocked_message"` } func (e *ExitDef) UnmarshalYAML(value *yaml.Node) error { @@ -62,12 +65,6 @@ func (e *ExitDef) UnmarshalYAML(value *yaml.Node) error { return value.Decode((*raw)(e)) } -type ExitCondition struct { - Flag string `yaml:"flag"` - Value any `yaml:"value"` - Not bool `yaml:"not"` -} - type Room struct { ID int `yaml:"id"` Name string `yaml:"name"` @@ -81,8 +78,8 @@ type Room struct { } type EnterStep struct { - Message string `yaml:"message"` - Condition *ExitCondition `yaml:"condition"` + Message string `yaml:"message"` + Condition *action.Condition `yaml:"condition"` } type RoomObject struct { -- cgit v1.2.3