]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
EntityLootTable deleted (#37604)
authorRed <96445749+TheShuEd@users.noreply.github.com>
Mon, 19 May 2025 09:53:29 +0000 (12:53 +0300)
committerGitHub <noreply@github.com>
Mon, 19 May 2025 09:53:29 +0000 (19:53 +1000)
Content.Server/Gatherable/Components/GatherableComponent.cs
Content.Server/Gatherable/GatherableSystem.cs
Content.Shared/EntityList/EntityLootTablePrototype.cs [deleted file]
Resources/Prototypes/Entities/Objects/Misc/spaceshroom.yml
Resources/Prototypes/LootTables/suspicion_loot_table.yml [deleted file]

index 5480f4404fc2798426b470078f78856840e316b1..8eb593fd135ef9e6e9bc2f4ebe7e3a6afba17e4e 100644 (file)
@@ -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
     /// </summary>
     [DataField]
-    public Dictionary<string, ProtoId<EntityLootTablePrototype>>? Loot = new();
+    public Dictionary<string, EntityTableSelector>? Loot = new();
 
     /// <summary>
     /// Random shift of the appearing entity during gathering
index b939b098cbbe63d5c0dbf8df02574f50165f0aee..7563abcc0d11f817708cd04a8323e091ade3d5c4 100644 (file)
@@ -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 (file)
index 0c1f77a..0000000
+++ /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<EntitySpawnEntry> Entries = ImmutableList<EntitySpawnEntry>.Empty;
-
-    /// <inheritdoc cref="EntitySpawnCollection.GetSpawns"/>
-    public List<string> GetSpawns(IRobustRandom random)
-    {
-        return EntitySpawnCollection.GetSpawns(Entries, random);
-    }
-}
index c6d27dba67de381c0163930901b8a94055f656ca..29e5e54d041b9931de4f727bd140972cdb1a87f8 100644 (file)
@@ -24,7 +24,9 @@
         components:
           - Hands
       loot:
-        All: SpaceshroomGather
+        All: !type:GroupSelector
+          children:
+          - id: FoodSpaceshroom
     - type: Damageable
       damageContainer: StructuralInorganic
       damageModifierSet: Wood
             - !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 (file)
index 58414f3..0000000
+++ /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