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:
@@ -362,7 +362,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
|||||||
var loadedMarkers = component.LoadedMarkers;
|
var loadedMarkers = component.LoadedMarkers;
|
||||||
var spawnSet = new HashSet<Vector2i>();
|
var spawnSet = new HashSet<Vector2i>();
|
||||||
var spawns = new List<Vector2i>();
|
var spawns = new List<Vector2i>();
|
||||||
var frontier = new Queue<Vector2i>();
|
var frontier = new ValueList<Vector2i>();
|
||||||
|
|
||||||
foreach (var (layer, chunks) in markers)
|
foreach (var (layer, chunks) in markers)
|
||||||
{
|
{
|
||||||
@@ -426,11 +426,14 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BFS search
|
// BFS search
|
||||||
frontier.Enqueue(point);
|
frontier.Add(point);
|
||||||
var groupCount = layerProto.GroupCount;
|
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);
|
var enumerator = grid.GetAnchoredEntitiesEnumerator(node);
|
||||||
|
|
||||||
if (enumerator.MoveNext(out _))
|
if (enumerator.MoveNext(out _))
|
||||||
@@ -463,7 +466,7 @@ public sealed partial class BiomeSystem : SharedBiomeSystem
|
|||||||
if (!spawnSet.Contains(neighbor))
|
if (!spawnSet.Contains(neighbor))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
frontier.Enqueue(neighbor);
|
frontier.Add(neighbor);
|
||||||
// Rather than doing some uggo remove check on the list we'll defer it until later
|
// Rather than doing some uggo remove check on the list we'll defer it until later
|
||||||
spawnSet.Remove(neighbor);
|
spawnSet.Remove(neighbor);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,6 +205,15 @@ public sealed class SpawnSalvageMissionJob : Job<bool>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle loot
|
// Handle loot
|
||||||
|
// We'll always add this loot if possible
|
||||||
|
foreach (var lootProto in _prototypeManager.EnumeratePrototypes<SalvageLootPrototype>())
|
||||||
|
{
|
||||||
|
if (!lootProto.Guaranteed)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
await SpawnDungeonLoot(dungeon, lootProto, mapUid, grid, random, reservedTiles);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var (loot, count) in mission.Loot)
|
foreach (var (loot, count) in mission.Loot)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < count; i++)
|
for (var i = 0; i < count; i++)
|
||||||
|
|||||||
@@ -12,6 +12,11 @@ public sealed class SalvageLootPrototype : IPrototype
|
|||||||
{
|
{
|
||||||
[IdDataField] public string ID { get; } = default!;
|
[IdDataField] public string ID { get; } = default!;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Should this loot always spawn if possible. Used for stuff such as ore.
|
||||||
|
/// </summary>
|
||||||
|
[DataField("guaranteed")] public bool Guaranteed;
|
||||||
|
|
||||||
[DataField("desc")] public string Description = string.Empty;
|
[DataField("desc")] public string Description = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ public abstract class SharedSalvageSystem : EntitySystem
|
|||||||
mods.Add(time.Description);
|
mods.Add(time.Description);
|
||||||
}
|
}
|
||||||
|
|
||||||
var loots = GetLoot(config, _proto.EnumeratePrototypes<SalvageLootPrototype>().ToList(), GetDifficulty(difficulty), seed);
|
var loots = GetLoot(config, _proto.EnumeratePrototypes<SalvageLootPrototype>().Where(o => !o.Guaranteed).ToList(), GetDifficulty(difficulty), seed);
|
||||||
return new SalvageMission(seed, difficulty, dungeon.ID, faction.ID, config, biome.ID, light?.Color, duration, loots, mods);
|
return new SalvageMission(seed, difficulty, dungeon.ID, faction.ID, config, biome.ID, light?.Color, duration, loots, mods);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
id: OreTin
|
id: OreTin
|
||||||
proto: WallRockTin
|
proto: WallRockTin
|
||||||
entityMask: WallRock
|
entityMask: WallRock
|
||||||
maxCount: 5
|
maxCount: 15
|
||||||
groupCount: 10
|
groupCount: 10
|
||||||
radius: 4
|
radius: 4
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
id: OreGold
|
id: OreGold
|
||||||
proto: WallRockGold
|
proto: WallRockGold
|
||||||
entityMask: WallRock
|
entityMask: WallRock
|
||||||
maxCount: 5
|
maxCount: 15
|
||||||
groupCount: 5
|
groupCount: 5
|
||||||
radius: 4
|
radius: 4
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
id: OreSilver
|
id: OreSilver
|
||||||
proto: WallRockSilver
|
proto: WallRockSilver
|
||||||
entityMask: WallRock
|
entityMask: WallRock
|
||||||
maxCount: 5
|
maxCount: 15
|
||||||
groupCount: 5
|
groupCount: 5
|
||||||
radius: 4
|
radius: 4
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
id: OrePlasma
|
id: OrePlasma
|
||||||
proto: WallRockPlasma
|
proto: WallRockPlasma
|
||||||
entityMask: WallRock
|
entityMask: WallRock
|
||||||
maxCount: 2
|
maxCount: 6
|
||||||
groupCount: 5
|
groupCount: 5
|
||||||
radius: 4
|
radius: 4
|
||||||
|
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
id: OreUranium
|
id: OreUranium
|
||||||
proto: WallRockUranium
|
proto: WallRockUranium
|
||||||
entityMask: WallRock
|
entityMask: WallRock
|
||||||
maxCount: 2
|
maxCount: 6
|
||||||
groupCount: 5
|
groupCount: 5
|
||||||
radius: 4
|
radius: 4
|
||||||
|
|
||||||
@@ -49,6 +49,6 @@
|
|||||||
id: OreBananium
|
id: OreBananium
|
||||||
proto: WallRockBananium
|
proto: WallRockBananium
|
||||||
entityMask: WallRock
|
entityMask: WallRock
|
||||||
maxCount: 2
|
maxCount: 6
|
||||||
groupCount: 5
|
groupCount: 5
|
||||||
radius: 4
|
radius: 4
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
- type: salvageLoot
|
- type: salvageLoot
|
||||||
id: OreTin
|
id: OreTin
|
||||||
desc: Veins of steel
|
desc: Veins of steel
|
||||||
|
guaranteed: true
|
||||||
loots:
|
loots:
|
||||||
- !type:BiomeMarkerLoot
|
- !type:BiomeMarkerLoot
|
||||||
proto: OreTin
|
proto: OreTin
|
||||||
@@ -63,6 +64,7 @@
|
|||||||
- type: salvageLoot
|
- type: salvageLoot
|
||||||
id: OreGold
|
id: OreGold
|
||||||
desc: Veins of gold ore
|
desc: Veins of gold ore
|
||||||
|
guaranteed: true
|
||||||
loots:
|
loots:
|
||||||
- !type:BiomeMarkerLoot
|
- !type:BiomeMarkerLoot
|
||||||
proto: OreGold
|
proto: OreGold
|
||||||
@@ -70,6 +72,7 @@
|
|||||||
- type: salvageLoot
|
- type: salvageLoot
|
||||||
id: OreSilver
|
id: OreSilver
|
||||||
desc: Veins of silver ore
|
desc: Veins of silver ore
|
||||||
|
guaranteed: true
|
||||||
loots:
|
loots:
|
||||||
- !type:BiomeMarkerLoot
|
- !type:BiomeMarkerLoot
|
||||||
proto: OreSilver
|
proto: OreSilver
|
||||||
@@ -78,6 +81,7 @@
|
|||||||
- type: salvageLoot
|
- type: salvageLoot
|
||||||
id: OrePlasma
|
id: OrePlasma
|
||||||
desc: Veins of plasma ore
|
desc: Veins of plasma ore
|
||||||
|
guaranteed: true
|
||||||
loots:
|
loots:
|
||||||
- !type:BiomeMarkerLoot
|
- !type:BiomeMarkerLoot
|
||||||
proto: OrePlasma
|
proto: OrePlasma
|
||||||
@@ -85,6 +89,7 @@
|
|||||||
- type: salvageLoot
|
- type: salvageLoot
|
||||||
id: OreUranium
|
id: OreUranium
|
||||||
desc: Veins of uranium ore
|
desc: Veins of uranium ore
|
||||||
|
guaranteed: true
|
||||||
loots:
|
loots:
|
||||||
- !type:BiomeMarkerLoot
|
- !type:BiomeMarkerLoot
|
||||||
proto: OreUranium
|
proto: OreUranium
|
||||||
|
|||||||
@@ -2,46 +2,32 @@
|
|||||||
- type: ore
|
- type: ore
|
||||||
id: OreSteel
|
id: OreSteel
|
||||||
oreEntity: SteelOre1
|
oreEntity: SteelOre1
|
||||||
minOreYield: 3
|
|
||||||
maxOreYield: 7
|
|
||||||
|
|
||||||
- type: ore
|
- type: ore
|
||||||
id: OreSpaceQuartz
|
id: OreSpaceQuartz
|
||||||
oreEntity: SpaceQuartz1
|
oreEntity: SpaceQuartz1
|
||||||
minOreYield: 3
|
|
||||||
maxOreYield: 7
|
|
||||||
|
|
||||||
# Medium yields
|
# Medium yields
|
||||||
- type: ore
|
- type: ore
|
||||||
id: OreGold
|
id: OreGold
|
||||||
oreEntity: GoldOre1
|
oreEntity: GoldOre1
|
||||||
minOreYield: 2
|
|
||||||
maxOreYield: 5
|
|
||||||
|
|
||||||
- type: ore
|
- type: ore
|
||||||
id: OreSilver
|
id: OreSilver
|
||||||
oreEntity: SilverOre1
|
oreEntity: SilverOre1
|
||||||
minOreYield: 2
|
|
||||||
maxOreYield: 5
|
|
||||||
|
|
||||||
# Low yields
|
# Low yields
|
||||||
- type: ore
|
- type: ore
|
||||||
id: OrePlasma
|
id: OrePlasma
|
||||||
oreEntity: PlasmaOre1
|
oreEntity: PlasmaOre1
|
||||||
minOreYield: 1
|
|
||||||
maxOreYield: 3
|
|
||||||
|
|
||||||
- type: ore
|
- type: ore
|
||||||
id: OreUranium
|
id: OreUranium
|
||||||
oreEntity: UraniumOre1
|
oreEntity: UraniumOre1
|
||||||
minOreYield: 1
|
|
||||||
maxOreYield: 3
|
|
||||||
|
|
||||||
- type: ore
|
- type: ore
|
||||||
id: OreBananium
|
id: OreBananium
|
||||||
oreEntity: BananiumOre1
|
oreEntity: BananiumOre1
|
||||||
minOreYield: 1
|
|
||||||
maxOreYield: 3
|
|
||||||
|
|
||||||
- type: weightedRandom
|
- type: weightedRandom
|
||||||
id: RandomOreDistributionStandard
|
id: RandomOreDistributionStandard
|
||||||
|
|||||||
Reference in New Issue
Block a user