From c705ae942573984784ef501bf8198f61f5206ddd Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Thu, 9 Jul 2026 05:27:10 -0400 Subject: refactor: simplify yaml, remove support for old scalar fields --- internal/behavior/behavior.go | 18 +----------------- internal/behavior/desc.go | 19 ------------------- 2 files changed, 1 insertion(+), 36 deletions(-) (limited to 'internal/behavior') diff --git a/internal/behavior/behavior.go b/internal/behavior/behavior.go index 69b91cd..58b5e6b 100644 --- a/internal/behavior/behavior.go +++ b/internal/behavior/behavior.go @@ -1,7 +1,5 @@ package behavior -import "gopkg.in/yaml.v3" - type GatherConfig struct { Skill string `yaml:"skill"` Tools []string `yaml:"tools"` @@ -106,8 +104,7 @@ func (s StepAction) IsTimed() bool { } // SpawnMobConfig configures a transient mob spawned by a trigger or on_enter -// step. It accepts either a bare string (the mob id) or a full map at -// unmarshal time. +// step. The mob id is required; other fields are optional. type SpawnMobConfig struct { ID string `yaml:"id"` OwnerOnly bool `yaml:"owner_only"` @@ -116,19 +113,6 @@ type SpawnMobConfig struct { DespawnTicks float64 `yaml:"despawn_ticks"` } -func (s *SpawnMobConfig) UnmarshalYAML(value *yaml.Node) error { - if value.Kind == yaml.ScalarNode { - var id string - if err := value.Decode(&id); err != nil { - return err - } - s.ID = id - return nil - } - type raw SpawnMobConfig - return value.Decode((*raw)(s)) -} - // ShopConfig is a root-level mob property (mob YAML `shop:`). Buy prices are // always 100% of the item's value; sell prices follow the OSRS store formula: // diff --git a/internal/behavior/desc.go b/internal/behavior/desc.go index ca4bf69..f6dbaf3 100644 --- a/internal/behavior/desc.go +++ b/internal/behavior/desc.go @@ -1,27 +1,8 @@ package behavior -import "gopkg.in/yaml.v3" - type DescVariant struct { Text string `yaml:"text"` Condition *Condition `yaml:"condition,omitempty"` } type DescList []DescVariant - -func (dl *DescList) UnmarshalYAML(value *yaml.Node) error { - if value.Kind == yaml.ScalarNode { - var s string - if err := value.Decode(&s); err != nil { - return err - } - *dl = DescList{{Text: s}} - return nil - } - var entries []DescVariant - if err := value.Decode(&entries); err != nil { - return err - } - *dl = entries - return nil -} -- cgit v1.2.3