Zone.Entities read-only outside Zone: Admit and Remove are the only membership writers

Entities is a MemberView with no mutating member; Admit installs the death watch with the
membership and refuses a member already present, Remove takes it away with the membership.
The Reset and duplicate-Add bypass paths of the death watch cannot be spelled any more.
Tests move to Admit/Remove; Admit also activates, so the explicit Activate calls that followed
a raw Add are dropped. Unity call sites route through Zone.Remove.

Builds: unverified at this commit (verified in the job at the head).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-13 02:13:43 +02:00
commit fa911f2d85
50 changed files with 206 additions and 320 deletions

View file

@ -95,8 +95,7 @@ public sealed class FireControlTests : IDisposable
weapons[i] = ship.Equipment.Single(e => e.EquippableItem == gun);
}
zone.Entities.Add(ship);
ship.Activate();
zone.Admit(ship, piloted: false);
return (items, ship, weapons);
}
@ -195,8 +194,7 @@ public sealed class FireControlTests : IDisposable
// gun so the target is a real, ordinarily-constructed ship rather than a workaround-shaped one.
var targetGunRef = items.ItemData.RefOf<ItemData>(items.ItemData.GetByName<GearData>("Gun"));
Assert.True(target.TryEquip(new EquippableItem { Data = targetGunRef, Durability = 1, Lot = 1 }, new int2(0, 0)));
zone.Entities.Add(target);
target.Activate();
zone.Admit(target, piloted: false);
shooter.Position = float3.zero;
target.Position = targetPosition;