Fix asteroid UI determinism (#23661)

This commit is contained in:
metalgearsloth
2024-01-07 15:21:05 +11:00
committed by GitHub
parent 3452521021
commit d0f51def1a

View File

@@ -28,7 +28,6 @@ public abstract partial class SharedSalvageSystem
if (seed % 2 == 0) if (seed % 2 == 0)
{ {
var config = _asteroidConfigs[rand.Next(_asteroidConfigs.Count)]; var config = _asteroidConfigs[rand.Next(_asteroidConfigs.Count)];
var layerRand = new System.Random(seed);
var configProto = _proto.Index(config); var configProto = _proto.Index(config);
var layers = new Dictionary<string, int>(); var layers = new Dictionary<string, int>();
@@ -37,10 +36,13 @@ public abstract partial class SharedSalvageSystem
{ {
switch (layer) switch (layer)
{ {
case BiomePostGen:
rand.Next();
break;
case BiomeMarkerLayerPostGen marker: case BiomeMarkerLayerPostGen marker:
for (var i = 0; i < marker.Count; i++) for (var i = 0; i < marker.Count; i++)
{ {
var proto = _proto.Index(marker.MarkerTemplate).Pick(layerRand); var proto = _proto.Index(marker.MarkerTemplate).Pick(rand);
var layerCount = layers.GetOrNew(proto); var layerCount = layers.GetOrNew(proto);
layerCount++; layerCount++;
layers[proto] = layerCount; layers[proto] = layerCount;