Stance follows the telemetry claim: pin it, and correct the Hated test's comment

StanceFollowsTheClaimNotTheLiveFaction changes ships' actual factions after they were tracked; reading other.Faction in the Hated
branch instead of the claim now fails it (verified by mutation). HatedIsKillOnSightInAnOwnerlessZone no longer claims that kill.

Note on the previous commit's catalog re-save: besides the 16 Faction schema ids, the records' Places arrays gained persisted element
ids, which the payload comparison (element ids not serialised in it) did not show. Accepted low resave-payload-claim-loose. The player
arm of GetFactionRelationship needs an entity to regard: follow-up regard-player-arm.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-11-20 15:13:37 +01:00
commit ae0f6f3463

View file

@ -462,7 +462,7 @@ public sealed class IffAndCombatTests : IDisposable
}
// Hated is kill on sight in any zone, owned or not, once the claim is received with the track; it is directed, so B's stance
// toward A reads B's map. Kills: no Hated branch; reading the regarded side's map; reading other.Faction instead of the claim.
// toward A reads B's map. Kills: no Hated branch; reading the regarded side's map.
[Fact]
public void HatedIsKillOnSightInAnOwnerlessZone()
{
@ -528,4 +528,28 @@ public sealed class IffAndCombatTests : IDisposable
Assert.False(ship.IsHostileTo(stranger));
}
// Stance follows the faction the contact claimed when it was tracked, not the faction it flies now. Kills: reading other.Faction
// instead of the telemetry claim.
[Fact]
public void StanceFollowsTheClaimNotTheLiveFaction()
{
var (items, zone) = BuildWorld();
var (a, b) = Rivals(items, zone, FactionRelationship.Hated);
var other = new Faction { Name = "C" };
items.ItemData.Upsert(other);
var neutral = NewShip(items, zone, other);
Detect(a, b);
Detect(a, neutral);
Assert.True(a.IsHostileTo(b));
Assert.False(a.IsHostileTo(neutral));
var hated = b.Faction;
b.Faction = other; // each keeps what it claimed when tracked, until it is claimed again
neutral.Faction = hated;
Assert.True(a.IsHostileTo(b));
Assert.False(a.IsHostileTo(neutral));
}
}