aboutsummaryrefslogtreecommitdiff
path: root/internal/world/room.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-11 04:46:27 -0400
committerhistoria <[not public]>2026-06-11 08:58:37 +0000
commit1b9e2da3b3c438d8dc53d3489725dd5ba0022777 (patch)
tree62264f24420bf4cfaa734942c65cc8dd45ba3d3b /internal/world/room.go
parent06c02a697e5daf8832a462de5970dd4c0e13a02c (diff)
downloadthehouseoficarus-1b9e2da3b3c438d8dc53d3489725dd5ba0022777.tar.gz
feat: web client, get/drop updates and fixes
Diffstat (limited to 'internal/world/room.go')
-rw-r--r--internal/world/room.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/internal/world/room.go b/internal/world/room.go
index 58fa82b..46fb876 100644
--- a/internal/world/room.go
+++ b/internal/world/room.go
@@ -73,10 +73,29 @@ type Room struct {
Exits map[ExitDir]ExitDef `yaml:"exits"`
Objects []RoomObject `yaml:"objects"`
Spawns []SpawnDef `yaml:"spawns"`
- Mobs []string `yaml:"mobs"`
+ Mobs []RoomMob `yaml:"mobs"`
OnEnter []EnterStep `yaml:"on_enter"`
}
+type RoomMob struct {
+ ID string `yaml:"id"`
+ WanderRooms []int `yaml:"wander_rooms"`
+ WanderInterval int `yaml:"wander_interval"`
+}
+
+func (rm *RoomMob) UnmarshalYAML(value *yaml.Node) error {
+ if value.Kind == yaml.ScalarNode {
+ var s string
+ if err := value.Decode(&s); err != nil {
+ return err
+ }
+ rm.ID = s
+ return nil
+ }
+ type raw RoomMob
+ return value.Decode((*raw)(rm))
+}
+
type EnterStep struct {
Message string `yaml:"message"`
Condition *action.Condition `yaml:"condition"`