diff options
| author | historia <[not public]> | 2026-06-10 04:44:31 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-10 04:44:31 -0400 |
| commit | 69d8757ad983697cdc9182fdcc1cdb612a77fb41 (patch) | |
| tree | 348c26d1f6defe3aef64f5aa9e7cefed0e764214 /internal/world/room.go | |
| parent | a226d72e51eecb768b13600303f73483118d9104 (diff) | |
| download | thehouseoficarus-69d8757ad983697cdc9182fdcc1cdb612a77fb41.tar.gz | |
feat: yaml architecture for complex object interaction
Diffstat (limited to 'internal/world/room.go')
| -rw-r--r-- | internal/world/room.go | 21 |
1 files changed, 9 insertions, 12 deletions
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 { |
