From 727c4096595cf589658c59d83a8fcf226b1b1888 Mon Sep 17 00:00:00 2001
From: Meta Vens
Date: Sun, 18 Oct 2026 17:33:11 +0200
Subject: [PATCH] Pin the dice of a zone without a run seed at their
pre-run-seed values
A zone with no galaxy and a zone of a save written before run-seed (seed 0)
drop the items and scatter the mines they did at eb27ced1; values computed
at that base.
Co-Authored-By: Claude Sonnet 5.5
---
tests/Aetheria.Shared.Tests/LootTests.cs | 25 ++++++++++++++++++
tests/Aetheria.Shared.Tests/MineTests.cs | 32 ++++++++++++++++--------
2 files changed, 47 insertions(+), 10 deletions(-)
diff --git a/tests/Aetheria.Shared.Tests/LootTests.cs b/tests/Aetheria.Shared.Tests/LootTests.cs
index ae47f6b32..e8a5016a7 100644
--- a/tests/Aetheria.Shared.Tests/LootTests.cs
+++ b/tests/Aetheria.Shared.Tests/LootTests.cs
@@ -238,6 +238,31 @@ public sealed class LootTests : IDisposable
Assert.True(Differ(first, DropsAt("Other dice", 7)));
}
+ // Pinned at eb27ced1, before run-seed: a zone with no galaxy, and a zone of a save written before run-seed (seed 0),
+ // roll on the zone's name alone and drop exactly what they dropped.
+ [Theory]
+ [InlineData(false)]
+ [InlineData(true)]
+ public void AZoneWithoutARunSeedKeepsItsDrops(bool restoredFromAnOldSave)
+ {
+ var drops = restoredFromAnOldSave ? DropsAt("Dice", 0) : Released(KillInNewLab("Dice"), 0);
+ Assert.Equal(new[] { "Spare", "Orex7", "Spare" }, drops.Select(d => d.Item));
+ Assert.All(drops, d => Assert.Equal(new float2(31, -17), d.Position));
+ var velocities = new[] { float2(-17.977364f, 17.372805f), float2(-5.908107f, 24.291857f), float2(-24.228783f, -6.1616626f) };
+ for (var i = 0; i < velocities.Length; i++)
+ {
+ Assert.Equal(velocities[i].x, drops[i].Velocity.x, 3);
+ Assert.Equal(velocities[i].y, drops[i].Velocity.y, 3);
+ }
+ }
+
+ private Lab KillInNewLab(string zoneName)
+ {
+ var lab = Build(zoneName);
+ Kill(Spawn(lab, float3(31, 0, -17)));
+ return lab;
+ }
+
[Fact]
public void GearDropsByProbabilityCargoAlways()
{
diff --git a/tests/Aetheria.Shared.Tests/MineTests.cs b/tests/Aetheria.Shared.Tests/MineTests.cs
index 24269af1a..137d3f84a 100644
--- a/tests/Aetheria.Shared.Tests/MineTests.cs
+++ b/tests/Aetheria.Shared.Tests/MineTests.cs
@@ -690,19 +690,31 @@ public sealed class MineTests : IDisposable
[Fact]
public void ANewGameScattersMinesDifferently()
{
- float2 LaunchAt(uint runSeed)
- {
- var lab = Build(spread: 40f, velocity: 5f, layerFaction: A, runSeed: runSeed);
- var atLay = default(KinematicBody);
- using var sub = lab.Zone.Mines.ObserveAdd().Subscribe(e => atLay = e.Value.Body);
- lab.Layer.Direction = normalize(float2(1, 2));
- LayOne(lab);
- return atLay.Velocity;
- }
-
Assert.NotEqual(LaunchAt(1), LaunchAt(2));
}
+ private float2 LaunchAt(uint? runSeed)
+ {
+ var lab = Build(spread: 40f, velocity: 5f, layerFaction: A, runSeed: runSeed);
+ var atLay = default(KinematicBody);
+ using var sub = lab.Zone.Mines.ObserveAdd().Subscribe(e => atLay = e.Value.Body);
+ lab.Layer.Direction = normalize(float2(1, 2));
+ LayOne(lab);
+ return atLay.Velocity;
+ }
+
+ // Pinned at eb27ced1, before run-seed: a zone with no galaxy, and a zone of a save written before run-seed (seed 0),
+ // scatter their mines on the zone's name alone.
+ [Theory]
+ [InlineData(false)]
+ [InlineData(true)]
+ public void AZoneWithoutARunSeedKeepsItsMineScatter(bool restoredFromAnOldSave)
+ {
+ var velocity = LaunchAt(restoredFromAnOldSave ? 0u : (uint?) null);
+ Assert.Equal(3.2546253f, velocity.x, 3);
+ Assert.Equal(3.795711f, velocity.y, 3);
+ }
+
[Fact]
public void TheLaunchAngleIsTheMinesOwnDice()
{