Ore tweaks (#16930)

- Guaranteed spawns in salvage
- Triple vein count
- Made it so rocks only drop 1 as it's kinda whacky (I believe they still convert differently to bars).
This commit is contained in:
metalgearsloth
2023-05-31 13:40:36 +10:00
committed by GitHub
parent 72d5ffb94c
commit ed1ff4df06
7 changed files with 33 additions and 25 deletions

View File

@@ -362,7 +362,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
var loadedMarkers = component.LoadedMarkers;
var spawnSet = new HashSet<Vector2i>();
var spawns = new List<Vector2i>();
var frontier = new Queue<Vector2i>();
var frontier = new ValueList<Vector2i>();
foreach (var (layer, chunks) in markers)
{
@@ -426,11 +426,14 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
}
// BFS search
frontier.Enqueue(point);
frontier.Add(point);
var groupCount = layerProto.GroupCount;
while (frontier.TryDequeue(out var node) && groupCount > 0)
while (frontier.Count > 0 && groupCount > 0)
{
var frontierIndex = _random.Next(frontier.Count);
var node = frontier[frontierIndex];
frontier.RemoveSwap(frontierIndex);
var enumerator = grid.GetAnchoredEntitiesEnumerator(node);
if (enumerator.MoveNext(out _))
@@ -463,7 +466,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
if (!spawnSet.Contains(neighbor))
continue;
frontier.Enqueue(neighbor);
frontier.Add(neighbor);
// Rather than doing some uggo remove check on the list we'll defer it until later
spawnSet.Remove(neighbor);
}