aboutsummaryrefslogtreecommitdiff
path: root/internal/object
diff options
context:
space:
mode:
Diffstat (limited to 'internal/object')
-rw-r--r--internal/object/item.go4
-rw-r--r--internal/object/object.go48
2 files changed, 36 insertions, 16 deletions
diff --git a/internal/object/item.go b/internal/object/item.go
index 4959a22..7c682a4 100644
--- a/internal/object/item.go
+++ b/internal/object/item.go
@@ -3,7 +3,7 @@ package object
import (
"strings"
- "thehouseoficarus/internal/world"
+ "thehouseoficarus/internal/action"
)
type EquipSlot string
@@ -105,5 +105,5 @@ func (d *ItemDef) MatchesName(input string) bool {
if strings.ToLower(d.Name) == lower {
return true
}
- return world.WordPrefixMatch(lower, d.Name)
+ return action.WordPrefixMatch(lower, d.Name)
}
diff --git a/internal/object/object.go b/internal/object/object.go
index 8c4c752..4d8db69 100644
--- a/internal/object/object.go
+++ b/internal/object/object.go
@@ -10,18 +10,38 @@ type UseInteraction struct {
}
type ObjectDef struct {
- ID string `yaml:"id"`
- Name string `yaml:"name"`
- Color string `yaml:"color"`
- BehaviorID string `yaml:"behavior"`
- Hidden bool `yaml:"hidden"`
- InRoomDescription string `yaml:"inroom_description"`
- RemovalItem string `yaml:"removal_item"`
- Description string `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"`
+ ID string `yaml:"id"`
+ Name string `yaml:"name"`
+ Color string `yaml:"color"`
+ Hidden bool `yaml:"hidden"`
+ InRoomDescription string `yaml:"inroom_description"`
+ RemovalItem string `yaml:"removal_item"`
+ Description string `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"`
+}
+
+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) IsInteractable() bool { return d.Gather != nil || d.Talk != nil || d.Use != nil }
+
+func (d *ObjectDef) BehaviorType() string {
+ switch {
+ case d.Gather != nil:
+ return "gather"
+ case d.Talk != nil:
+ return "talk"
+ case d.Use != nil:
+ return "use"
+ }
+ return ""
}