]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Move vending restocks to EntityTableContainerFills (#41442)
authorSnappingOpossum <snappingopossum@outlook.com>
Fri, 21 Nov 2025 20:51:32 +0000 (07:51 +1100)
committerGitHub <noreply@github.com>
Fri, 21 Nov 2025 20:51:32 +0000 (20:51 +0000)
* Move vending restocks to EntityTableContainerFills

* Glad I can actually see that fail now

* I could of just gone back to checking all the containers but nooo had to be stubborn

* Apply changes from code review

Content.IntegrationTests/Tests/VendingMachineRestockTest.cs
Resources/Prototypes/Catalog/Fills/Crates/vending.yml

index 01770fe10798aa21fa9292cf695518eb4d706c43..7835ccad3e914ccd02e4f469597d0f74c939d695 100644 (file)
@@ -3,11 +3,13 @@ using System.Collections.Generic;
 using Content.Server.VendingMachines;
 using Content.Server.Wires;
 using Content.Shared.Cargo.Prototypes;
+using Content.Shared.Containers;
 using Content.Shared.Damage;
 using Content.Shared.Damage.Prototypes;
 using Content.Shared.Damage.Systems;
+using Content.Shared.EntityTable;
 using Content.Shared.Prototypes;
-using Content.Shared.Storage.Components;
+using Content.Shared.Storage.EntitySystems;
 using Content.Shared.VendingMachines;
 using Content.Shared.Wires;
 using Robust.Shared.GameObjects;
@@ -115,6 +117,7 @@ namespace Content.IntegrationTests.Tests
 
             var prototypeManager = server.ResolveDependency<IPrototypeManager>();
             var compFact = server.ResolveDependency<IComponentFactory>();
+            var entityTable = server.EntMan.System<EntityTableSystem>();
 
             await server.WaitAssertion(() =>
             {
@@ -134,17 +137,23 @@ namespace Content.IntegrationTests.Tests
                     restocks.Add(proto.ID);
                 }
 
-                // Collect all the prototypes with StorageFills referencing those entities.
+                // Collect all the prototypes with EntityTableContainerFills referencing those entities.
                 foreach (var proto in prototypeManager.EnumeratePrototypes<EntityPrototype>())
                 {
-                    if (!proto.TryGetComponent<StorageFillComponent>(out var storage, compFact))
+                    if (!proto.TryGetComponent<EntityTableContainerFillComponent>(out var storage, compFact))
+                        continue;
+
+                    var containers = storage.Containers;
+
+                    if (!containers.TryGetValue(SharedEntityStorageSystem.ContainerName, out var container)) // We only care about this container type.
                         continue;
 
                     List<string> restockStore = new();
-                    foreach (var spawnEntry in storage.Contents)
+
+                    foreach (var spawnEntry in entityTable.GetSpawns(container))
                     {
-                        if (spawnEntry.PrototypeId != null && restocks.Contains(spawnEntry.PrototypeId))
-                            restockStore.Add(spawnEntry.PrototypeId);
+                        if (restocks.Contains(spawnEntry))
+                            restockStore.Add(spawnEntry);
                     }
 
                     if (restockStore.Count > 0)
@@ -153,7 +162,7 @@ namespace Content.IntegrationTests.Tests
 
                 // Iterate through every CargoProduct and make sure each
                 // prototype with a restock component is referenced in a
-                // purchaseable entity with a StorageFill.
+                // purchaseable entity with an EntityTableContianerFill.
                 foreach (var proto in prototypeManager.EnumeratePrototypes<CargoProductPrototype>())
                 {
                     if (restockStores.ContainsKey(proto.Product))
index 378f8cb75884b0ed0ca265d9a1a86d84aed31cc4..f59fed6ebf21ad54e3726140ea99da86c7e35583 100644 (file)
@@ -4,9 +4,10 @@
   name: Booze-O-Mat restock crate
   description: Contains a restock box for the Booze-O-Mat.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockBooze
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockBooze
 
 - type: entity
   id: CrateVendingMachineRestockChefvendFilled
   name: ChefVend restock crate
   description: Contains a restock box for the ChefVend.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockChefvend
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockChefvend
 
 - type: entity
   id: CrateVendingMachineRestockClothesFilled
   name: clothing restock crate
   description: Contains a restock box for the clothes vending machines.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockClothes
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockClothes
 
 - type: entity
   id: CrateVendingMachineRestockAutoDrobeFilled
   name: AutoDrobe restock crate
   description: Contains a restock box for the AutoDrobe.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockCostumes
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockCostumes
 
 - type: entity
   id: CrateVendingMachineRestockCondimentStationFilled
   name: condiment station restock crate
   description: Contains a restock box for the condiment station.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockCondimentStation
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockCondimentStation
 
 - type: entity
   id: CrateVendingMachineRestockDinnerwareFilled
   name: Plasteel Chef restock crate
   description: Contains a restock box for the Plasteel Chef vending machine.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockDinnerware
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockDinnerware
 
 - type: entity
   id: CrateVendingMachineRestockEngineeringFilled
   name: EngiVend restock crate
   description: Contains a restock box for the EngiVend. Also supports the YouTool.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockEngineering
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockEngineering
 
 - type: entity
   id: CrateVendingMachineRestockGamesFilled
   name: Good Clean Fun restock crate
   description: Contains a restock box for the Good Clean Fun vending machine.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockGames
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockGames
 
 - type: entity
   id: CrateVendingMachineRestockHotDrinksFilled
   name: Solar's Best restock crate
   description: Contains two restock boxes for Solar's Best Hot Drinks vending machine.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockHotDrinks
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockHotDrinks
         amount: 2
 
 - type: entity
   name: NanoMed restock crate
   description: Contains a restock box, compatible with the NanoMed and NanoMedPlus.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockMedical
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockMedical
 
 - type: entity
   id: CrateVendingMachineRestockChemVendFilled
   name: ChemVend restock crate
   description: Contains a restock box for the ChemVend.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockChemVend
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockChemVend
 
 - type: entity
   id: CrateVendingMachineRestockNutriMaxFilled
   name: NutriMax restock crate
   description: Contains a restock box for the NutriMax vending machine.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockNutriMax
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockNutriMax
 
 - type: entity
   id: CrateVendingMachineRestockPTechFilled
   name: PTech restock crate
   description: Contains a restock box for the PTech bureaucracy dispenser.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockPTech
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockPTech
 
 - type: entity
   id: CrateVendingMachineRestockRobustSoftdrinksFilled
   name: beverage vendor restock crate
   description: Contains restock boxes for beverage vending machines.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockRobustSoftdrinks
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockRobustSoftdrinks
         amount: 2
 
 - type: entity
   name: Salvage restock crate
   description: Contains a restock box for the salvage vendor.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockSalvageEquipment
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockSalvageEquipment
 
 - type: entity
   id: CrateVendingMachineRestockSecTechFilled
   name: SecTech restock crate
   description: Contains a restock box for the SecTech vending machine.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockSecTech
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockSecTech
 
 - type: entity
   id: CrateVendingMachineRestockSeedsFilled
   name: MegaSeed restock crate
   description: Contains a restock box for the MegaSeed vending machine.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockSeeds
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockSeeds
 
 - type: entity
   id: CrateVendingMachineRestockSmokesFilled
   name: ShadyCigs restock crate
   description: Contains two restock boxes for the ShadyCigs vending machine.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockSmokes
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockSmokes
         amount: 2
 
 - type: entity
   name: Vendomat restock crate
   description: Contains a restock box for a Vendomat vending machine.
   components:
-  - type: StorageFill
-    contents:
-    - id: VendingMachineRestockVendomat
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockVendomat
 
 - type: entity
   id: CrateVendingMachineRestockRoboticsFilled
   name: Robotech Deluxe restock crate
   description: Contains a restock box for a Robotech Deluxe vending machine.
   components:
-  - type: StorageFill
-    contents:
-    - id: VendingMachineRestockRobotics
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockRobotics
 
 - type: entity
   id: CrateVendingMachineRestockTankDispenserFilled
   name: tank dispenser restock crate
   description: Contains a restock box for an Engineering or Atmospherics tank dispenser.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockTankDispenser
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockTankDispenser
 
 - type: entity
   id: CrateVendingMachineRestockHappyHonkFilled
   name: Happy Honk restock crate
   description: Contains a restock box for a happy honk dispenser.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockHappyHonk
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockHappyHonk
         amount: 2
 
 - type: entity
   name: Getmore Chocolate Corp restock crate
   description: Contains a restock box for a Getmore Chocolate Corp dispenser.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockGetmoreChocolateCorp
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockGetmoreChocolateCorp
         amount: 2
 
 - type: entity
   name: Chang restock crate
   description: Contains a restock box for a Mr. Chang dispenser.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockChang
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockChang
         amount: 2
 
 - type: entity
   name: Discount Dans restock crate
   description: Contains a restock box for a Discount Dan's dispenser.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockDiscountDans
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockDiscountDans
         amount: 2
 
 - type: entity
   name: Donut restock crate
   description: Contains a restock box for a Monkin' Donuts dispenser.
   components:
-  - type: StorageFill
-    contents:
-      - id: VendingMachineRestockDonut
+  - type: EntityTableContainerFill
+    containers:
+      entity_storage:
+        id: VendingMachineRestockDonut
         amount: 2