diff options
Diffstat (limited to 'internal/world/room.go')
| -rw-r--r-- | internal/world/room.go | 21 |
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"` |
