aboutsummaryrefslogtreecommitdiff
path: root/internal/world/trigger_store.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-09 05:27:10 -0400
committerhistoria <[not public]>2026-07-09 05:27:10 -0400
commitc705ae942573984784ef501bf8198f61f5206ddd (patch)
treec964066f3a244002bf75cb50a877630f46496f81 /internal/world/trigger_store.go
parent74153c7814fc4cef988066ef04e38731a943bc12 (diff)
downloadthehouseoficarus-c705ae942573984784ef501bf8198f61f5206ddd.tar.gz
refactor: simplify yaml, remove support for old scalar fields
Diffstat (limited to 'internal/world/trigger_store.go')
-rw-r--r--internal/world/trigger_store.go24
1 files changed, 2 insertions, 22 deletions
diff --git a/internal/world/trigger_store.go b/internal/world/trigger_store.go
index 04d77f4..e50ae81 100644
--- a/internal/world/trigger_store.go
+++ b/internal/world/trigger_store.go
@@ -9,6 +9,7 @@ import (
"gopkg.in/yaml.v3"
"thehouseoficarus/internal/behavior"
+ "thehouseoficarus/internal/engine"
)
type TriggerStore struct {
@@ -262,7 +263,7 @@ func (ts *TriggerStore) valueMatches(want, got any) bool {
if want == nil {
return true
}
- return valuesEqual(want, got)
+ return engine.ValuesEqual(want, got)
}
func (ts *TriggerStore) SnapshotPlayerSeqs() []*PlayerTriggerSeq {
@@ -311,27 +312,6 @@ func (ts *TriggerStore) AllGlobalTriggers() []*TriggerDef {
return out
}
-func valuesEqual(a, b any) bool {
- ai, aok := numericValue(a)
- bi, bok := numericValue(b)
- if aok && bok {
- return ai == bi
- }
- return a == b
-}
-
-func numericValue(v any) (float64, bool) {
- switch x := v.(type) {
- case int:
- return float64(x), true
- case int64:
- return float64(x), true
- case float64:
- return x, true
- }
- return 0, false
-}
-
func (ts *TriggerStore) AllRoomTriggers() map[int][]*TriggerDef {
ts.mu.Lock()
defer ts.mu.Unlock()