From abd612c15799f604e671e83dc7c410ed2b44185f Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Thu, 25 Jun 2026 15:40:48 -0400 Subject: slop refactor --- internal/object/object.go | 68 +++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 38 deletions(-) (limited to 'internal/object/object.go') diff --git a/internal/object/object.go b/internal/object/object.go index f7a0e7b..8d1e02e 100644 --- a/internal/object/object.go +++ b/internal/object/object.go @@ -1,44 +1,34 @@ package object -import "thehouseoficarus/internal/action" +import "thehouseoficarus/internal/behavior" type UseInteraction struct { - Item string `yaml:"item_id"` - Condition *action.Condition `yaml:"condition"` - Message string `yaml:"message"` - Action *action.NodeAction `yaml:"action"` + Item string `yaml:"item_id"` + Condition *behavior.Condition `yaml:"condition"` + Message string `yaml:"message"` + Action *behavior.NodeAction `yaml:"action"` } type ObjectDef struct { - ID string `yaml:"id"` - Name string `yaml:"name"` - Aliases []string `yaml:"aliases"` - Color string `yaml:"color"` - Hidden bool `yaml:"hidden"` - InRoomDescription string `yaml:"inroom_description"` - RemovalItem string `yaml:"removal_item"` - Description string `yaml:"description"` - Descriptions []ConditionalDesc `yaml:"descriptions,omitempty"` - UseInteractions []UseInteraction `yaml:"use_interactions"` - StealTable string `yaml:"steal_table"` - StealLevel int `yaml:"steal_level"` - StealXP int `yaml:"steal_xp"` - StealSpeed float64 `yaml:"steal_speed"` - GuardMob string `yaml:"guard_mob"` + ID string `yaml:"id"` + Name string `yaml:"name"` + Aliases []string `yaml:"aliases"` + Color string `yaml:"color"` + Hidden bool `yaml:"hidden"` + InRoomDescription string `yaml:"inroom_description"` + RemovalItem string `yaml:"removal_item"` + Description behavior.DescList `yaml:"description"` + UseInteractions []UseInteraction `yaml:"use_interactions"` + StealTable string `yaml:"steal_table"` + StealLevel int `yaml:"steal_level"` + StealXP int `yaml:"steal_xp"` + StealSpeed float64 `yaml:"steal_speed"` + GuardMob string `yaml:"guard_mob"` - Gather *action.GatherConfig `yaml:"gather,omitempty"` - Talk *action.TalkConfig `yaml:"talk,omitempty"` - Use *action.UseConfig `yaml:"use,omitempty"` - Safespot *SafespotConfig `yaml:"safespot,omitempty"` -} - -// ConditionalDesc is a description variant gated by a condition. They are -// evaluated in order per-looker; the first whose condition passes (or has no -// condition) wins. If a def has Descriptions but none match for a given player, -// the object is treated as absent for that player. -type ConditionalDesc struct { - Text string `yaml:"text"` - Condition *action.Condition `yaml:"condition"` + Gather *behavior.GatherConfig `yaml:"gather,omitempty"` + Talk *behavior.TalkConfig `yaml:"talk,omitempty"` + Use *behavior.UseConfig `yaml:"use,omitempty"` + Safespot *SafespotConfig `yaml:"safespot,omitempty"` } type SafespotConfig struct { @@ -58,11 +48,13 @@ type SafespotLevel struct { DegradeMessage string `yaml:"degrade_message"` } -func (d *ObjectDef) IsGatherable() bool { return d.Gather != nil } -func (d *ObjectDef) IsTalkable() bool { return d.Talk != nil } -func (d *ObjectDef) IsUsable() bool { return d.Use != nil } -func (d *ObjectDef) IsSafespot() bool { return d.Safespot != nil } -func (d *ObjectDef) IsInteractable() bool { return d.Gather != nil || d.Talk != nil || d.Use != nil || d.Safespot != nil } +func (d *ObjectDef) IsGatherable() bool { return d.Gather != nil } +func (d *ObjectDef) IsTalkable() bool { return d.Talk != nil } +func (d *ObjectDef) IsUsable() bool { return d.Use != nil } +func (d *ObjectDef) IsSafespot() bool { return d.Safespot != nil } +func (d *ObjectDef) IsInteractable() bool { + return d.Gather != nil || d.Talk != nil || d.Use != nil || d.Safespot != nil +} func (d *ObjectDef) BehaviorType() string { switch { -- cgit v1.2.3