Mining Fix (#10347)

This commit is contained in:
Nemanja
2022-08-05 23:16:17 -04:00
committed by GitHub
parent 064112a045
commit 6d88c6ba88
4 changed files with 23 additions and 19 deletions

View File

@@ -7,7 +7,7 @@ namespace Content.Server.Kitchen.Components
[RegisterComponent, Access(typeof(KitchenSpikeSystem))]
public sealed class KitchenSpikeComponent : SharedKitchenSpikeComponent
{
public List<string>? PrototypesToSpawn;
public List<string?>? PrototypesToSpawn;
// TODO: Spiking alive mobs? (Replace with uid) (deal damage to their limbs on spiking, kill on first butcher attempt?)
public string MeatSource1p = "?";

View File

@@ -15,7 +15,7 @@ public sealed class EntityLootTablePrototype : IPrototype
public ImmutableList<EntitySpawnEntry> Entries = ImmutableList<EntitySpawnEntry>.Empty;
/// <inheritdoc cref="EntitySpawnCollection.GetSpawns"/>
public List<string> GetSpawns(IRobustRandom? random = null)
public List<string?> GetSpawns(IRobustRandom? random = null)
{
return EntitySpawnCollection.GetSpawns(Entries, random);
}

View File

@@ -13,8 +13,8 @@ namespace Content.Shared.Storage;
public struct EntitySpawnEntry : IPopulateDefaultValues
{
[ViewVariables(VVAccess.ReadWrite)]
[DataField("id", required: true, customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string PrototypeId;
[DataField("id", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string? PrototypeId;
/// <summary>
/// The probability that an item will spawn. Takes decimal form so 0.05 is 5%, 0.50 is 50% etc.
@@ -83,12 +83,12 @@ public static class EntitySpawnCollection
/// <param name="entries">The entity spawn entries.</param>
/// <param name="random">Resolve param.</param>
/// <returns>A list of entity prototypes that should be spawned.</returns>
public static List<string> GetSpawns(IEnumerable<EntitySpawnEntry> entries,
public static List<string?> GetSpawns(IEnumerable<EntitySpawnEntry> entries,
IRobustRandom? random = null)
{
IoCManager.Resolve(ref random);
var spawned = new List<string>();
var spawned = new List<string?>();
var orGroupedSpawns = new Dictionary<string, OrGroup>();
// collect groups together, create singular items that pass probability

View File

@@ -1,43 +1,47 @@
- type: entityLootTable
id: MiningLootTable
entries:
- prob: 0.5 #null value, doesn't drop anything
orGroup: Asteroid
- id: SteelOre1
prob: 0.25
prob: 0.125
orGroup: Asteroid
- id: GoldOre1
prob: 0.05
prob: 0.025
orGroup: Asteroid
- id: SpaceQuartz1
prob: 0.20
orGroup: Asteroid
- id: PlasmaOre1
prob: 0.10
orGroup: Asteroid
- id: PlasmaOre1
prob: 0.05
orGroup: Asteroid
- id: SilverOre1
prob: 0.025
prob: 0.0125
orGroup: Asteroid
- id: UraniumOre1
prob: 0.025
prob: 0.0125
orGroup: Asteroid
- type: entityLootTable
id: MiningLootTableLowYield
entries:
- prob: 0.75 #null value, doesn't drop anything
orGroup: Asteroid
- id: SteelOre1
prob: 0.05
prob: 0.0125
orGroup: Asteroid
- id: GoldOre1
prob: 0.01
prob: 0.0025
orGroup: Asteroid
- id: SpaceQuartz1
prob: 0.05
prob: 0.0125
orGroup: Asteroid
- id: PlasmaOre1
prob: 0.025
prob: 0.00625
orGroup: Asteroid
- id: SilverOre1
prob: 0.02
prob: 0.005
orGroup: Asteroid
- id: UraniumOre1
prob: 0.02
prob: 0.005
orGroup: Asteroid