aboutsummaryrefslogtreecommitdiff
path: root/internal/object
diff options
context:
space:
mode:
Diffstat (limited to 'internal/object')
-rw-r--r--internal/object/object.go5
-rw-r--r--internal/object/object_test.go13
-rw-r--r--internal/object/store.go1
3 files changed, 17 insertions, 2 deletions
diff --git a/internal/object/object.go b/internal/object/object.go
index 376f4be..e0a5b16 100644
--- a/internal/object/object.go
+++ b/internal/object/object.go
@@ -70,8 +70,9 @@ func (d *ObjectDef) BehaviorType() string {
return "gather"
case d.Talk != nil:
return "talk"
- case d.Safespot != nil:
- return "safespot"
}
+ // Safespot (and any other passive/use-driven object) is not an ActionType
+ // verb. Returning a non-ActionType string here would make the verb gate in
+ // startAction reject "use"-style verbs against it.
return ""
}
diff --git a/internal/object/object_test.go b/internal/object/object_test.go
new file mode 100644
index 0000000..251dc61
--- /dev/null
+++ b/internal/object/object_test.go
@@ -0,0 +1,13 @@
+package object
+
+import "testing"
+
+// TestBehaviorTypeSafespotIsNotActionType: BehaviorType must not return
+// "safespot" (it is not a behavior.ActionType), or the generic verb gate
+// treats a safespot-only object as an unknown action type.
+func TestBehaviorTypeSafespotIsNotActionType(t *testing.T) {
+ def := &ObjectDef{Safespot: &SafespotConfig{}}
+ if got := def.BehaviorType(); got != "" {
+ t.Fatalf("BehaviorType(safespot-only) = %q, want empty", got)
+ }
+}
diff --git a/internal/object/store.go b/internal/object/store.go
index ee154cf..e974186 100644
--- a/internal/object/store.go
+++ b/internal/object/store.go
@@ -77,6 +77,7 @@ func (s *ObjectStore) IDSet() map[string]bool {
func (s *ObjectStore) Reload(dataDir string) {
s.mu.Lock()
defer s.mu.Unlock()
+ s.dataDir = dataDir
s.cache = make(map[string]*ObjectDef)
s.pathIndex = behavior.BuildPathIndex(filepath.Join(dataDir, "objects"))
}