aboutsummaryrefslogtreecommitdiff
path: root/internal/object/object.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/object/object.go')
-rw-r--r--internal/object/object.go48
1 files changed, 34 insertions, 14 deletions
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 ""
}