]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Make Modular Grenades with Chemical payload respect their trigger delay (#39905)
authorSerylis of Five <stormy-git@stormweyr.dk>
Tue, 26 Aug 2025 22:26:13 +0000 (00:26 +0200)
committerGitHub <noreply@github.com>
Tue, 26 Aug 2025 22:26:13 +0000 (00:26 +0200)
* adds `KeysIn` data field to `ChemicalPayloadComponent`

And check when handling chemical payloads that a trigger key exists.

* Update Content.Server/Payload/EntitySystems/PayloadSystem.cs

---------

Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
Content.Server/Payload/EntitySystems/PayloadSystem.cs
Content.Shared/Payload/Components/ChemicalPayloadComponent.cs

index 11e97c5b9355a6cd29e1e90a89bb1af24e69c617..542c3559d525ff55c426f05e3edbae33c35222d5 100644 (file)
@@ -150,7 +150,9 @@ public sealed class PayloadSystem : EntitySystem
 
     private void HandleChemicalPayloadTrigger(Entity<ChemicalPayloadComponent> entity, ref TriggerEvent args)
     {
-        // TODO: Adjust to the new trigger system
+        if (args.Key != null && !entity.Comp.KeysIn.Contains(args.Key))
+            return;
+
         if (entity.Comp.BeakerSlotA.Item is not EntityUid beakerA
             || entity.Comp.BeakerSlotB.Item is not EntityUid beakerB
             || !TryComp(beakerA, out FitsInDispenserComponent? compA)
index d00382ee84e5ac1dd445eeca2e81120018e7d07d..3b29d78777381928a03ed0275b79888bfb1ccc7a 100644 (file)
@@ -1,4 +1,5 @@
 using Content.Shared.Containers.ItemSlots;
+using Content.Shared.Trigger.Systems;
 using Robust.Shared.Serialization;
 
 namespace Content.Shared.Payload.Components;
@@ -14,6 +15,12 @@ public sealed partial class ChemicalPayloadComponent : Component
 
     [DataField("beakerSlotB", required: true)]
     public ItemSlot BeakerSlotB = new();
+
+    /// <summary>
+    /// The keys that will activate the chemical payload.
+    /// </summary>
+    [DataField]
+    public List<string> KeysIn = new() { TriggerSystem.DefaultTriggerKey };
 }
 
 [Serializable, NetSerializable]