From cacd926182d35966d311bc99c3a82332e8bf4625 Mon Sep 17 00:00:00 2001
From: Meta Vens
Date: Sun, 18 Oct 2026 01:59:06 +0200
Subject: [PATCH] ZoneGenerator.Place: Settle recurses into each placed child;
the queue, its guard and the settled set are deleted
Co-Authored-By: Claude Opus 5.5
---
Assets/Scripts/ServerShared/ZoneGenerator.cs | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/Assets/Scripts/ServerShared/ZoneGenerator.cs b/Assets/Scripts/ServerShared/ZoneGenerator.cs
index 6f8347fc9..82a2355e9 100644
--- a/Assets/Scripts/ServerShared/ZoneGenerator.cs
+++ b/Assets/Scripts/ServerShared/ZoneGenerator.cs
@@ -647,7 +647,6 @@ public static class ZoneGenerator
}
}
- var settled = new HashSet(); // ring members, settled by their node so the ring is judged on their final masses
var chordCap = new Dictionary(); // a ring member's children stay within .2 of the nearest partner's chord
void Settle(GeneratorPlanet node)
{
@@ -660,11 +659,12 @@ public static class ZoneGenerator
if (WellMass(node) > 0)
{
PlaceChildren(node.Children.ToList(), () => RocheMargin * Roche(WellMass(node)), upper, node);
+ foreach (var child in node.Children.ToList()) Settle(child);
return;
}
var ring = node.Children.Where(c => c.Ring && WellMass(c) > 0).ToList();
- if (ring.Count == 0) return;
+ if (ring.Count == 0) { foreach (var child in node.Children.ToList()) Settle(child); return; }
var heavy = ring.OrderByDescending(c => c.Mass).First();
var ringDistance = Math.Min(.5f * cap, share * reach / (GravityField.Beta * GravityField.Beta * (1 + GravityField.RingReach)));
PlaceChildren(node.Children.Where(c => !ring.Contains(c)).ToList(),
@@ -674,7 +674,6 @@ public static class ZoneGenerator
member.Distance = ringDistance;
chordCap[member] = .2f * 2 * ringDistance * sin(PI / ring.Count);
Settle(member);
- settled.Add(member);
}
// A member's mass is final only once it has settled (its own overflowing children fold into it).
if (ringDistance < RocheMargin * Roche(ring.Max(c => c.Mass)))
@@ -683,17 +682,12 @@ public static class ZoneGenerator
node.Empty = false;
node.Mass = 0;
foreach (var child in node.Children.ToList()) Fold(child, node);
+ return;
}
+ foreach (var child in node.Children.Where(c => !ring.Contains(c)).ToList()) Settle(child);
}
- var queue = new Queue();
- queue.Enqueue(root);
- while (queue.Count > 0)
- {
- var node = queue.Dequeue();
- if (!settled.Contains(node)) Settle(node);
- foreach (var child in node.Children) queue.Enqueue(child);
- }
+ Settle(root);
}
}