aboutsummaryrefslogtreecommitdiff
path: root/internal/game/transport_safespot_regression_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 15:42:23 -0400
committerhistoria <[not public]>2026-09-18 15:42:23 -0400
commit67e01aab85607b9e601185c7d62dff576af3bb43 (patch)
tree059134b2434eba7c14aa9d89f48c5a475feb0312 /internal/game/transport_safespot_regression_test.go
parent7eab582d8a8ee2af1a6baae7baf0696c7005de2e (diff)
downloadthehouseoficarus-67e01aab85607b9e601185c7d62dff576af3bb43.tar.gz
fix: close map OOM, admin traversal, transport safespot, room rekey, and legacy payout recovery
Diffstat (limited to 'internal/game/transport_safespot_regression_test.go')
-rw-r--r--internal/game/transport_safespot_regression_test.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/internal/game/transport_safespot_regression_test.go b/internal/game/transport_safespot_regression_test.go
new file mode 100644
index 0000000..fe77994
--- /dev/null
+++ b/internal/game/transport_safespot_regression_test.go
@@ -0,0 +1,34 @@
+package game
+
+import "testing"
+
+// TestTransportClearsSafespot: the safespot predicates are room-agnostic, so a
+// transport that changes rooms without clearing cover grants melee/hazard
+// immunity in the destination and leaves a phantom occupant in the old room.
+// Every other teleport path clears it; the transport effect must too.
+func TestTransportClearsSafespot(t *testing.T) {
+ h := newHarness(t)
+ h.seedAccount("alice")
+ h.seedCharacter("alice", "alice")
+ sess, _ := h.connect("alice")
+
+ h.g.RunOnOwner(func() {
+ p := sess.Player
+ h.g.safespot.Set(p.Name, SafespotState{Active: true, ObjectDefID: "rock", ObjectIndex: 0, RoomID: p.RoomID})
+ if !h.g.isSafespotted(p.Name) {
+ t.Fatal("safespot not active before transport")
+ }
+
+ h.g.executeTransportEffect(sess, p, &ModDef{ID: "test_transport", Name: "test shuttle", Destination: 2})
+
+ if h.g.safespot.Has(p.Name) {
+ t.Fatal("safespot state survived transport; hazard/melee immunity persists in the destination")
+ }
+ if h.g.isSafespotted(p.Name) {
+ t.Fatal("player still counts as safespotted after transport")
+ }
+ if p.RoomID != 2 {
+ t.Fatalf("room after transport = %d, want 2", p.RoomID)
+ }
+ })
+}