diff --git a/Content.Server/Gatherable/Components/GatherableComponent.cs b/Content.Server/Gatherable/Components/GatherableComponent.cs index 5480f4404f..8eb593fd13 100644 --- a/Content.Server/Gatherable/Components/GatherableComponent.cs +++ b/Content.Server/Gatherable/Components/GatherableComponent.cs @@ -1,6 +1,5 @@ -using Content.Shared.EntityList; +using Content.Shared.EntityTable.EntitySelectors; using Content.Shared.Whitelist; -using Robust.Shared.Prototypes; namespace Content.Server.Gatherable.Components; @@ -25,11 +24,13 @@ public sealed partial class GatherableComponent : Component /// - Tag1 /// - Tag2 /// loot: - /// Tag1: LootTableID1 - /// Tag2: LootTableID2 + /// Tag1: !type:NestedSelector + /// tableId: LootTableID1 + /// Tag2: !type:NestedSelector + /// tableId: LootTableID2 /// [DataField] - public Dictionary>? Loot = new(); + public Dictionary? Loot = new(); /// /// Random shift of the appearing entity during gathering diff --git a/Content.Server/Gatherable/GatherableSystem.cs b/Content.Server/Gatherable/GatherableSystem.cs index b939b098cb..7563abcc0d 100644 --- a/Content.Server/Gatherable/GatherableSystem.cs +++ b/Content.Server/Gatherable/GatherableSystem.cs @@ -1,25 +1,25 @@ using Content.Server.Destructible; using Content.Server.Gatherable.Components; +using Content.Shared.EntityTable; using Content.Shared.Interaction; using Content.Shared.Tag; using Content.Shared.Weapons.Melee.Events; using Content.Shared.Whitelist; using Robust.Server.GameObjects; using Robust.Shared.Audio.Systems; -using Robust.Shared.Prototypes; using Robust.Shared.Random; namespace Content.Server.Gatherable; public sealed partial class GatherableSystem : EntitySystem { - [Dependency] private readonly IPrototypeManager _proto = default!; [Dependency] private readonly IRobustRandom _random = default!; [Dependency] private readonly DestructibleSystem _destructible = default!; [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly TagSystem _tagSystem = default!; [Dependency] private readonly TransformSystem _transform = default!; [Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!; + [Dependency] private readonly EntityTableSystem _entityTable = default!; public override void Initialize() { @@ -76,8 +76,7 @@ public sealed partial class GatherableSystem : EntitySystem if (gatherer != null && !_tagSystem.HasTag(gatherer.Value, tag)) continue; } - var getLoot = _proto.Index(table); - var spawnLoot = getLoot.GetSpawns(_random); + var spawnLoot = _entityTable.GetSpawns(table); foreach (var loot in spawnLoot) { var spawnPos = pos.Offset(_random.NextVector2(component.GatherOffset)); diff --git a/Content.Shared/EntityList/EntityLootTablePrototype.cs b/Content.Shared/EntityList/EntityLootTablePrototype.cs deleted file mode 100644 index 0c1f77afdc..0000000000 --- a/Content.Shared/EntityList/EntityLootTablePrototype.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.Collections.Immutable; -using Content.Shared.Storage; -using Robust.Shared.Prototypes; -using Robust.Shared.Random; - -namespace Content.Shared.EntityList; - -[Prototype] -public sealed partial class EntityLootTablePrototype : IPrototype -{ - [IdDataField] - public string ID { get; private set; } = default!; - - [DataField("entries")] - public ImmutableList Entries = ImmutableList.Empty; - - /// - public List GetSpawns(IRobustRandom random) - { - return EntitySpawnCollection.GetSpawns(Entries, random); - } -} diff --git a/Resources/Prototypes/Entities/Objects/Misc/spaceshroom.yml b/Resources/Prototypes/Entities/Objects/Misc/spaceshroom.yml index c6d27dba67..29e5e54d04 100644 --- a/Resources/Prototypes/Entities/Objects/Misc/spaceshroom.yml +++ b/Resources/Prototypes/Entities/Objects/Misc/spaceshroom.yml @@ -24,7 +24,9 @@ components: - Hands loot: - All: SpaceshroomGather + All: !type:GroupSelector + children: + - id: FoodSpaceshroom - type: Damageable damageContainer: StructuralInorganic damageModifierSet: Wood @@ -37,13 +39,6 @@ - !type:DoActsBehavior acts: [ "Destruction" ] -- type: entityLootTable - id: SpaceshroomGather - entries: - - id: FoodSpaceshroom - amount: 1 - maxAmount: 1 - - type: entity name: spaceshroom parent: FoodProduceBase diff --git a/Resources/Prototypes/LootTables/suspicion_loot_table.yml b/Resources/Prototypes/LootTables/suspicion_loot_table.yml deleted file mode 100644 index 58414f3d28..0000000000 --- a/Resources/Prototypes/LootTables/suspicion_loot_table.yml +++ /dev/null @@ -1,148 +0,0 @@ -# These will be spawned randomly around the station -- type: entityLootTable - id: SuspicionRule - entries: - - id: WeaponRifleAk - amount: 0 - maxAmount: 5 - - id: WeaponRifleM90GrenadeLauncher - amount: 0 - maxAmount: 5 - - id: WeaponRifleLecter - amount: 0 - maxAmount: 5 - - id: WeaponPistolViper - amount: 0 - maxAmount: 5 - - id: WeaponPistolCobra - amount: 0 - maxAmount: 5 - - id: WeaponPistolMk58 - amount: 0 - maxAmount: 5 - - id: ButchCleaver - maxAmount: 5 - - id: Pickaxe - maxAmount: 5 - - id: Spear - maxAmount: 5 - - id: ToolboxEmergency - maxAmount: 5 - - id: CrowbarRed - maxAmount: 5 - - id: Stunbaton - maxAmount: 10 - - - id: WeaponRevolverDeckard - amount: 0 - maxAmount: 5 - - id: WeaponRevolverInspector - amount: 0 - maxAmount: 5 - - id: WeaponRevolverMateba - amount: 0 - maxAmount: 5 - - - id: WeaponShotgunBulldog - amount: 0 - maxAmount: 5 - - id: WeaponShotgunDoubleBarreled - amount: 0 - maxAmount: 5 - - id: WeaponShotgunEnforcer - amount: 0 - maxAmount: 5 - - id: WeaponShotgunKammerer - amount: 0 - maxAmount: 5 - - id: WeaponShotgunSawn - amount: 0 - maxAmount: 5 - - id: WeaponShotgunHandmade - amount: 0 - maxAmount: 5 - - - id: WeaponSubMachineGunAtreides - amount: 0 - maxAmount: 5 - - id: WeaponSubMachineGunC20r - amount: 0 - maxAmount: 5 - - id: WeaponSubMachineGunWt550 - amount: 0 - maxAmount: 5 - - - id: WeaponSniperMosin - amount: 0 - maxAmount: 5 - - id: WeaponSniperHristov - amount: 0 - maxAmount: 5 - - id: WeaponLaserGun - amount: 0 - maxAmount: 1 - - id: WeaponLaserCannon - amount: 0 - maxAmount: 1 - - id: WeaponXrayCannon - amount: 0 - maxAmount: 2 - - id: WeaponDisabler - amount: 0 - maxAmount: 4 - - - id: WeaponLauncherChinaLake - prob: 0.30 - maxAmount: 3 - - - id: WeaponLauncherRocket - prob: 0.20 - maxAmount: 3 - - - id: LidSalami - amount: 0 - maxAmount: 10 - - - id: ExGrenade - prob: 0.10 - amount: 0 - maxAmount: 2 - - - id: GrenadeFlashBang - - id: SyndieMiniBomb - prob: 0.05 - amount: 0 - maxAmount: 5 - - - id: GrenadeFlash - - id: GrenadeBlast - - id: GrenadeFrag - - id: GrenadeBaton - - id: SoapSyndie - amount: 0 - maxAmount: 3 - - - # Spawn a bunch of ammo around! - - id: MagazineRifle - maxAmount: 15 - - id: MagazineCaselessRifle - maxAmount: 15 - - id: MagazineCaselessRifle10x24 - maxAmount: 15 - - id: MagazinePistolCaselessRifle - maxAmount: 15 - - id: MagazineLightRifle - maxAmount: 15 - - id: MagazineShotgun - maxAmount: 15 - - id: MagazinePistol - maxAmount: 15 - - id: MagazinePistolHighCapacity - maxAmount: 15 - - id: MagazinePistolSubMachineGun - maxAmount: 15 - - id: CartridgeRocket - maxAmount: 15 - - id: GrenadeFrag - maxAmount: 15