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) } }) }