blob: 826a315c6f8ddc076ac629307f3732c2cd8f14f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package object
import "thehouseoficarus/internal/action"
type UseInteraction struct {
Item string `yaml:"item_id"`
Condition *action.Condition `yaml:"condition"`
Message string `yaml:"message"`
Action *action.NodeAction `yaml:"action"`
}
type ObjectDef struct {
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 ""
}
|