From 9d4b799db4868bcab291b83599ff088763cd4ed6 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 24 Jun 2026 20:58:25 -0400 Subject: feat: new type of non-violent 'combat': work --- internal/world/room.go | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'internal/world/room.go') diff --git a/internal/world/room.go b/internal/world/room.go index 752ec41..2441c30 100644 --- a/internal/world/room.go +++ b/internal/world/room.go @@ -48,6 +48,8 @@ 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"` } func (e *ExitDef) UnmarshalYAML(value *yaml.Node) error { @@ -67,11 +69,18 @@ type Room struct { ID int `yaml:"id"` Name string `yaml:"name"` Description string `yaml:"description"` + Descriptions []RoomDesc `yaml:"descriptions,omitempty"` Exits map[ExitDir]ExitDef `yaml:"exits"` Objects []RoomObject `yaml:"objects"` 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 { @@ -94,8 +103,19 @@ func (rm *RoomMob) UnmarshalYAML(value *yaml.Node) error { } type EnterStep struct { - Message string `yaml:"message"` - Condition *action.Condition `yaml:"condition"` + 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"` +} + +// IsTimed reports whether the step carries cutscene semantics: a tick delay or +// a flag mutation. A room whose qualifying on_enter steps are all non-timed is +// printed synchronously; any timed step turns the sequence into a scheduled +// cutscene. +func (e EnterStep) IsTimed() bool { + return e.Delay > 0 || len(e.SetFlags) > 0 || len(e.SetPlayerFlags) > 0 } type RoomObject struct { -- cgit v1.2.3