Make Modular Grenades with Chemical payload respect their trigger delay (#39905)
* 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>
This commit is contained in:
@@ -150,7 +150,9 @@ public sealed class PayloadSystem : EntitySystem
|
|||||||
|
|
||||||
private void HandleChemicalPayloadTrigger(Entity<ChemicalPayloadComponent> entity, ref TriggerEvent args)
|
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
|
if (entity.Comp.BeakerSlotA.Item is not EntityUid beakerA
|
||||||
|| entity.Comp.BeakerSlotB.Item is not EntityUid beakerB
|
|| entity.Comp.BeakerSlotB.Item is not EntityUid beakerB
|
||||||
|| !TryComp(beakerA, out FitsInDispenserComponent? compA)
|
|| !TryComp(beakerA, out FitsInDispenserComponent? compA)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Content.Shared.Containers.ItemSlots;
|
using Content.Shared.Containers.ItemSlots;
|
||||||
|
using Content.Shared.Trigger.Systems;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Shared.Payload.Components;
|
namespace Content.Shared.Payload.Components;
|
||||||
@@ -14,6 +15,12 @@ public sealed partial class ChemicalPayloadComponent : Component
|
|||||||
|
|
||||||
[DataField("beakerSlotB", required: true)]
|
[DataField("beakerSlotB", required: true)]
|
||||||
public ItemSlot BeakerSlotB = new();
|
public ItemSlot BeakerSlotB = new();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The keys that will activate the chemical payload.
|
||||||
|
/// </summary>
|
||||||
|
[DataField]
|
||||||
|
public List<string> KeysIn = new() { TriggerSystem.DefaultTriggerKey };
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable, NetSerializable]
|
[Serializable, NetSerializable]
|
||||||
|
|||||||
Reference in New Issue
Block a user