EW 3 fix: a contact is hostile on the observer's own permission, with tests for trespass through Zone.Update

Entity.IsHostileTo read other.PresencePermitted in its claimed-owner term where the spec and map S2
say the observer's own, so a trespasser never held the owner's patrol hostile. Tests: the trespasser
(player or not) holds the patrol hostile and its guns are not safed, a permitted neutral does not,
a ship tracked in open space turns hostile on entering the Critical area through ticks (pins the
per-tick stance refresh), and a third party does not treat a trespasser as hostile (pins the owner gate).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-17 08:10:29 +02:00
commit ac5cbcc51b
2 changed files with 119 additions and 1 deletions

View file

@ -1262,7 +1262,7 @@ public abstract class Entity
if (!_telemetry.TryGetValue(other, out var claimed)) return false;
var owner = Zone.GalaxyZone.Owner;
if (owner == null) return false;
return (claimed == owner && !(other.PresencePermitted?.Value ?? true)) || (Faction == owner && BelievesTrespassing(other));
return (claimed == owner && !(PresencePermitted?.Value ?? true)) || (Faction == owner && BelievesTrespassing(other));
}
// The faction `subject`'s telemetry claimed when this observer first tracked it; false while the contact is unknown.