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))] [RegisterComponent, Access(typeof(KitchenSpikeSystem))]
public sealed class KitchenSpikeComponent : SharedKitchenSpikeComponent 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?) // TODO: Spiking alive mobs? (Replace with uid) (deal damage to their limbs on spiking, kill on first butcher attempt?)
public string MeatSource1p = "?"; public string MeatSource1p = "?";

View File

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

View File

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

View File

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