]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Multiple items in loadouts (#33193)
authorEd <96445749+TheShuEd@users.noreply.github.com>
Tue, 24 Dec 2024 00:24:19 +0000 (03:24 +0300)
committerGitHub <noreply@github.com>
Tue, 24 Dec 2024 00:24:19 +0000 (01:24 +0100)
* loadouts update

* Update loadout_groups.yml

* darts to candles

* Update Resources/Prototypes/Loadouts/dummy_entities.yml

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Client/Lobby/UI/Loadouts/LoadoutContainer.xaml.cs
Content.Shared/Clothing/LoadoutSystem.cs
Content.Shared/Preferences/Loadouts/LoadoutPrototype.cs
Resources/Prototypes/Loadouts/Miscellaneous/trinkets.yml
Resources/Prototypes/Loadouts/dummy_entities.yml [new file with mode: 0644]
Resources/Prototypes/Loadouts/loadout_groups.yml
Resources/Textures/Objects/Misc/candles.rsi/loadout.png [new file with mode: 0644]
Resources/Textures/Objects/Misc/candles.rsi/meta.json

index 36f0772d784e5db6c0da0e62821d8236fdeb30cb..2ab40fb37d40c7ab850810250a3de72f1e5058bf 100644 (file)
@@ -36,17 +36,18 @@ public sealed partial class LoadoutContainer : BoxContainer
 
         if (_protoManager.TryIndex(proto, out var loadProto))
         {
-            var ent = _entManager.System<LoadoutSystem>().GetFirstOrNull(loadProto);
+            var ent = loadProto.DummyEntity ?? _entManager.System<LoadoutSystem>().GetFirstOrNull(loadProto);
 
-            if (ent != null)
-            {
-                _entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace);
-                Sprite.SetEntity(_entity);
+            if (ent == null)
+                return;
 
-                var spriteTooltip = new Tooltip();
-                spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription));
-                TooltipSupplier = _ => spriteTooltip;
-            }
+            _entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace);
+            Sprite.SetEntity(_entity);
+
+            var spriteTooltip = new Tooltip();
+            spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription));
+
+            TooltipSupplier = _ => spriteTooltip;
         }
     }
 
index 2a686efd4fffc73d46c4dbcc2c14598f22e9ccd0..93b0abfd8209a21e46cacd32ce872028f3738ec5 100644 (file)
@@ -90,6 +90,9 @@ public sealed class LoadoutSystem : EntitySystem
 
     public string GetName(LoadoutPrototype loadout)
     {
+        if (loadout.DummyEntity is not null && _protoMan.TryIndex<EntityPrototype>(loadout.DummyEntity, out var proto))
+            return proto.Name;
+
         if (_protoMan.TryIndex(loadout.StartingGear, out var gear))
         {
             return GetName(gear);
index a570b61d89e442c05fe0c1aa544f3e7c2af971ef..1533b605ac93a5f76c7274f689e54b1a4503dc43 100644 (file)
@@ -17,6 +17,12 @@ public sealed partial class LoadoutPrototype : IPrototype, IEquipmentLoadout
      * You can either use an existing StartingGearPrototype or specify it inline to avoid bloating yaml.
      */
 
+    /// <summary>
+    /// An entity whose sprite, name and description is used for display in the interface. If null, tries to get the proto of the item from gear (if it is a single item).
+    /// </summary>
+    [DataField]
+    public EntProtoId? DummyEntity;
+
     [DataField]
     public ProtoId<StartingGearPrototype>? StartingGear;
 
index 79fee8bf0df32400245371740c76e286a7e80029..b4e2cecf8b1cef06ea0b46aad1bca194d95d746a 100644 (file)
@@ -28,7 +28,7 @@
     back:
     - ClothingNeckHeadphones
 
-# Plushies
+# Toys
 - type: loadout
   id: PlushieLizard
   storage:
     back:
     - PlushieSpaceLizard
 
+- type: loadout
+  id: ThreeCandles
+  dummyEntity: LoadoutDummyCandles
+  storage:
+    back:
+    - CandleRed
+    - CandleBlue
+    - CandleGreenSmall
+
 # Smokeables
 - type: loadout
   id: Lighter
diff --git a/Resources/Prototypes/Loadouts/dummy_entities.yml b/Resources/Prototypes/Loadouts/dummy_entities.yml
new file mode 100644 (file)
index 0000000..69b54bd
--- /dev/null
@@ -0,0 +1,9 @@
+- type: entity
+  id: LoadoutDummyCandles
+  categories: [ HideSpawnMenu ]
+  name: three candles
+  description: A set of three colorful candles for secret rituals!
+  components:
+  - type: Sprite
+    sprite: Objects/Misc/candles.rsi
+    state: loadout
\ No newline at end of file
index 89bf38fef5f6a1b3cb7484b483e9011121ac710d..990c6f41bb17be9ca4cee3a79560696bc32f999a 100644 (file)
@@ -10,6 +10,7 @@
   - Headphones
   - PlushieLizard
   - PlushieSpaceLizard
+  - ThreeCandles
   - Lighter
   - CigPackGreen
   - CigPackRed
diff --git a/Resources/Textures/Objects/Misc/candles.rsi/loadout.png b/Resources/Textures/Objects/Misc/candles.rsi/loadout.png
new file mode 100644 (file)
index 0000000..daa98a3
Binary files /dev/null and b/Resources/Textures/Objects/Misc/candles.rsi/loadout.png differ
index 9432ffae8bdbaeb187015847cc5dbeb3811dcca2..f5fa5b10fdb3e18b9d37ad3368243664283b1a60 100644 (file)
@@ -10,6 +10,9 @@
     {
       "name": "stand-small"
     },
+    {
+      "name": "loadout"
+    },
     {
       "name": "stand-big"
     },