entityloottable conflicts fix

This commit is contained in:
Ed
2025-05-27 12:42:46 +03:00
parent d5fbdbdec0
commit f509f0e152
20 changed files with 110 additions and 174 deletions

View File

@@ -1,6 +1,7 @@
using System.Linq;
using Content.Shared._CP14.Farming.Components;
using Content.Shared.DoAfter;
using Content.Shared.EntityTable;
using Content.Shared.Interaction;
using Content.Shared.Maps;
using Content.Shared.Weapons.Melee.Events;
@@ -16,6 +17,7 @@ public abstract partial class CP14SharedFarmingSystem
[Dependency] private readonly SharedMapSystem _map = default!;
[Dependency] private readonly IGameTiming _timing = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly EntityTableSystem _entityTable = default!;
private void InitializeInteractions()
{
@@ -115,11 +117,8 @@ public abstract partial class CP14SharedFarmingSystem
if (used != null && !_tag.HasTag(used.Value, tag))
continue;
}
if (!_proto.TryIndex(table, out var getLoot))
continue;
var spawnLoot = getLoot.GetSpawns(_random);
var spawnLoot = _entityTable.GetSpawns(table);
foreach (var loot in spawnLoot)
{
var spawnPos = pos.Offset(_random.NextVector2(gatherable.Comp.GatherOffset));

View File

@@ -1,4 +1,5 @@
using Content.Shared.EntityList;
using Content.Shared.EntityTable.EntitySelectors;
using Content.Shared.Whitelist;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
@@ -31,7 +32,7 @@ public sealed partial class CP14PlantGatherableComponent : Component
/// Tag2: LootTableID2
/// </summary>
[DataField]
public Dictionary<string, ProtoId<EntityLootTablePrototype>>? Loot = new();
public Dictionary<string, EntityTableSelector>? Loot = new();
/// <summary>
/// Random shift of the appearing entity during gathering

View File

@@ -14,14 +14,11 @@
map: ["enum.PlantVisualLayers.Base"]
- type: CP14PlantGatherable
loot:
All: CP14GatherCabbage
- type: entityLootTable
id: CP14GatherCabbage
entries:
- id: CP14FoodCabbage
amount: 6
maxAmount: 8
- id: CP14SeedCabbage
amount: 1
maxAmount: 2
All: !type:AllSelector
children:
- id: CP14FoodCabbage
rolls: !type:RangeNumberSelector
range: 6, 8
- id: CP14SeedCabbage
rolls: !type:RangeNumberSelector
range: 1, 2

View File

@@ -16,14 +16,11 @@
map: ["enum.PlantVisualLayers.Base"]
- type: CP14PlantGatherable
loot:
All: CP14GatherCotton
- type: entityLootTable
id: CP14GatherCotton
entries:
- id: CP14Cotton
amount: 4
maxAmount: 6
- id: CP14SeedCotton
amount: 1
maxAmount: 2
All: !type:AllSelector
children:
- id: CP14Cotton
rolls: !type:RangeNumberSelector
range: 4, 6
- id: CP14SeedCotton
rolls: !type:RangeNumberSelector
range: 1, 2

View File

@@ -14,14 +14,11 @@
map: ["enum.PlantVisualLayers.Base"]
- type: CP14PlantGatherable
loot:
All: CP14GatherCucumber
- type: entityLootTable
id: CP14GatherCucumber
entries:
- id: CP14FoodCucumber
amount: 4
maxAmount: 8
- id: CP14SeedCucumber
amount: 0
maxAmount: 2
All: !type:AllSelector
children:
- id: CP14FoodCucumber
rolls: !type:RangeNumberSelector
range: 4, 6
- id: CP14SeedCucumber
rolls: !type:RangeNumberSelector
range: 0, 2

View File

@@ -14,11 +14,8 @@
map: ["enum.PlantVisualLayers.Base"]
- type: CP14PlantGatherable
loot:
All: CP14GatherOnion
- type: entityLootTable
id: CP14GatherOnion
entries:
- id: CP14FoodOnion
amount: 5
maxAmount: 8
All: !type:AllSelector
children:
- id: CP14GatherOnion
rolls: !type:RangeNumberSelector
range: 4, 6

View File

@@ -16,14 +16,11 @@
growthSteps: 5
- type: CP14PlantGatherable
loot:
All: CP14GatherPepper
- type: entityLootTable
id: CP14GatherPepper
entries:
- id: CP14FoodPepper
amount: 4
maxAmount: 8
- id: CP14SeedPepper
amount: 0
maxAmount: 2
All: !type:AllSelector
children:
- id: CP14FoodPepper
rolls: !type:RangeNumberSelector
range: 4, 6
- id: CP14SeedPepper
rolls: !type:RangeNumberSelector
range: 1, 2

View File

@@ -16,11 +16,8 @@
growthSteps: 5
- type: CP14PlantGatherable
loot:
All: CP14GatherPotato
- type: entityLootTable
id: CP14GatherPotato
entries:
- id: CP14FoodPotato
amount: 4
maxAmount: 8
All: !type:AllSelector
children:
- id: CP14FoodPotato
rolls: !type:RangeNumberSelector
range: 4, 6

View File

@@ -14,14 +14,11 @@
map: ["enum.PlantVisualLayers.Base"]
- type: CP14PlantGatherable
loot:
All: CP14GatherPumpkin
- type: entityLootTable
id: CP14GatherPumpkin
entries:
- id: CP14FoodPumpkin
amount: 4
maxAmount: 8
- id: CP14SeedPumpkin
amount: 1
maxAmount: 2
All: !type:AllSelector
children:
- id: CP14FoodPumpkin
rolls: !type:RangeNumberSelector
range: 4, 6
- id: CP14SeedPumpkin
rolls: !type:RangeNumberSelector
range: 1, 2

View File

@@ -16,14 +16,11 @@
growthSteps: 4
- type: CP14PlantGatherable
loot:
All: CP14GatherSage
- type: entityLootTable
id: CP14GatherSage
entries:
- id: CP14WildSage
amount: 4
maxAmount: 8
- id: CP14SeedSage
amount: 1
maxAmount: 2
All: !type:AllSelector
children:
- id: CP14WildSage
rolls: !type:RangeNumberSelector
range: 4, 6
- id: CP14SeedSage
rolls: !type:RangeNumberSelector
range: 1, 2

View File

@@ -14,14 +14,11 @@
map: ["enum.PlantVisualLayers.Base"]
- type: CP14PlantGatherable
loot:
All: CP14GatherTomatoes
- type: entityLootTable
id: CP14GatherTomatoes
entries:
- id: CP14FoodTomatoes
amount: 4
maxAmount: 8
- id: CP14SeedTomato
amount: 0
maxAmount: 2
All: !type:AllSelector
children:
- id: CP14FoodTomatoes
rolls: !type:RangeNumberSelector
range: 4, 6
- id: CP14SeedTomato
rolls: !type:RangeNumberSelector
range: 0, 2

View File

@@ -16,17 +16,14 @@
growthSteps: 5
- type: CP14PlantGatherable
loot:
All: CP14GatherWheat
All: !type:AllSelector
children:
- id: CP14Wheat
rolls: !type:RangeNumberSelector
range: 4, 6
- id: CP14SeedWheat
rolls: !type:RangeNumberSelector
range: 1, 2
- type: CP14WaveShader
speed: 2.8
dis: 4
- type: entityLootTable
id: CP14GatherWheat
entries:
- id: CP14Wheat
amount: 5
maxAmount: 8
- id: CP14SeedWheat
amount: 1
maxAmount: 2
dis: 4

View File

@@ -20,11 +20,6 @@
- type: CP14PlantGatherable
deleteAfterHarvest: true
loot:
All: CP14GatherBloodFlower
- type: entityLootTable
id: CP14GatherBloodFlower
entries:
- id: CP14BloodFlower
amount: 1
maxAmount: 1
All: !type:GroupSelector
children:
- id: CP14BloodFlower

View File

@@ -22,11 +22,6 @@
- type: CP14PlantGatherable
deleteAfterHarvest: true
loot:
All: CP14GatherBlueAmanita
- type: entityLootTable
id: CP14GatherBlueAmanita
entries:
- id: CP14BlueAmanita
amount: 1
maxAmount: 1
All: !type:GroupSelector
children:
- id: CP14BlueAmanita

View File

@@ -23,11 +23,6 @@
components:
- Hands
loot:
All: CP14GatherChromiumSlime
- type: entityLootTable
id: CP14GatherChromiumSlime
entries:
- id: CP14ChromiumSlime
amount: 1
maxAmount: 1
All: !type:GroupSelector
children:
- id: CP14BloodFlower

View File

@@ -22,11 +22,6 @@
- type: CP14PlantGatherable
deleteAfterHarvest: true
loot:
All: CP14GatherDayflin
- type: entityLootTable
id: CP14GatherDayflin
entries:
- id: CP14Dayflin
amount: 1
maxAmount: 2
All: !type:GroupSelector
children:
- id: CP14Dayflin

View File

@@ -23,14 +23,8 @@
- type: CP14PlantGatherable
deleteAfterHarvest: true
loot:
All: CP14GatherFlyAgaric
- type: entityLootTable
id: CP14GatherFlyAgaric
entries:
- id: CP14AgaricMushroom
amount: 1
maxAmount: 2
- id: CP14MobMonsterMyconideFlyagaric
amount: 1
prob: 0.08
All: !type:GroupSelector
children:
- id: CP14AgaricMushroom
- id: CP14MobMonsterMyconideFlyagaric
weight: 0.08

View File

@@ -26,14 +26,8 @@
- type: CP14PlantGatherable
deleteAfterHarvest: true
loot:
All: CP14GatherLumiMushroom
- type: entityLootTable
id: CP14GatherLumiMushroom
entries:
- id: CP14LumiMushroom
amount: 1
maxAmount: 1
- id: CP14MobMonsterMyconideLumish
amount: 1
prob: 0.08
All: !type:GroupSelector
children:
- id: CP14LumiMushroom
- id: CP14MobMonsterMyconideLumish
weight: 0.08

View File

@@ -107,7 +107,10 @@
- type: CP14PlantGatherable
deleteAfterHarvest: true
loot:
All: CP14GatherAirLily
All: !type:AllSelector
children:
- id: CP14AirLily
- id: CP14AirLily

View File

@@ -20,11 +20,6 @@
- type: CP14PlantGatherable
deleteAfterHarvest: true
loot:
All: CP14GatherWildSage
- type: entityLootTable
id: CP14GatherWildSage
entries:
- id: CP14WildSage
amount: 1
maxAmount: 1
All: !type:GroupSelector
children:
- id: CP14WildSage