aboutsummaryrefslogtreecommitdiff
path: root/internal/world/room.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/world/room.go')
-rw-r--r--internal/world/room.go52
1 files changed, 23 insertions, 29 deletions
diff --git a/internal/world/room.go b/internal/world/room.go
index 2441c30..71a36ed 100644
--- a/internal/world/room.go
+++ b/internal/world/room.go
@@ -2,7 +2,7 @@ package world
import (
"gopkg.in/yaml.v3"
- "thehouseoficarus/internal/action"
+ "thehouseoficarus/internal/behavior"
)
type ExitDir string
@@ -17,12 +17,12 @@ const (
)
var ExitAliases = map[string]ExitDir{
- "n": North,
- "s": South,
- "e": East,
- "w": West,
- "u": Up,
- "d": Down,
+ "n": North,
+ "s": South,
+ "e": East,
+ "w": West,
+ "u": Up,
+ "d": Down,
}
var OppositeExit = map[ExitDir]ExitDir{
@@ -45,11 +45,11 @@ type SpawnDef struct {
}
type ExitDef struct {
- Room int `yaml:"room"`
- Condition *action.Condition `yaml:"condition"`
- BlockedMessage string `yaml:"blocked_message"`
- SetFlags map[string]any `yaml:"set_flags"`
- SetPlayerFlags map[string]any `yaml:"set_player_flags"`
+ Room int `yaml:"room"`
+ Condition *behavior.Condition `yaml:"condition"`
+ BlockedMessage string `yaml:"blocked_message"`
+ SetFlags map[string]any `yaml:"set_flags"`
+ SetPlayerFlags map[string]any `yaml:"set_player_flags"`
}
func (e *ExitDef) UnmarshalYAML(value *yaml.Node) error {
@@ -68,24 +68,18 @@ func (e *ExitDef) UnmarshalYAML(value *yaml.Node) error {
type Room struct {
ID int `yaml:"id"`
Name string `yaml:"name"`
- Description string `yaml:"description"`
- Descriptions []RoomDesc `yaml:"descriptions,omitempty"`
+ Description behavior.DescList `yaml:"description"`
Exits map[ExitDir]ExitDef `yaml:"exits"`
Objects []RoomObject `yaml:"objects"`
- ItemSpawns []SpawnDef `yaml:"item_spawns"`
+ ItemSpawns []SpawnDef `yaml:"item_spawns"`
Mobs []RoomMob `yaml:"mobs"`
OnEnter []EnterStep `yaml:"on_enter"`
Hazard string `yaml:"hazard"`
}
-type RoomDesc struct {
- Text string `yaml:"text"`
- Condition *action.Condition `yaml:"condition"`
-}
-
type RoomMob struct {
- ID string `yaml:"id"`
- WanderRooms []int `yaml:"wander_rooms"`
+ ID string `yaml:"id"`
+ WanderRooms []int `yaml:"wander_rooms"`
WanderInterval float64 `yaml:"wander_interval"`
}
@@ -103,11 +97,11 @@ func (rm *RoomMob) UnmarshalYAML(value *yaml.Node) error {
}
type EnterStep struct {
- Message string `yaml:"message"`
- Condition *action.Condition `yaml:"condition"`
- Delay int `yaml:"delay"`
- SetFlags map[string]any `yaml:"set_flags"`
- SetPlayerFlags map[string]any `yaml:"set_player_flags"`
+ Message string `yaml:"message"`
+ Condition *behavior.Condition `yaml:"condition"`
+ Delay int `yaml:"delay"`
+ SetFlags map[string]any `yaml:"set_flags"`
+ SetPlayerFlags map[string]any `yaml:"set_player_flags"`
}
// IsTimed reports whether the step carries cutscene semantics: a tick delay or
@@ -119,7 +113,7 @@ func (e EnterStep) IsTimed() bool {
}
type RoomObject struct {
- ID string `yaml:"id"`
- WanderRooms []int `yaml:"wander_rooms"`
+ ID string `yaml:"id"`
+ WanderRooms []int `yaml:"wander_rooms"`
WanderInterval float64 `yaml:"wander_interval"`
}