Skip to content

Commit

Permalink
prevent shock collar clock (#665)
Browse files Browse the repository at this point in the history
Co-authored-by: deltanedas <@deltanedas:kde.org>
  • Loading branch information
deltanedas authored Jan 13, 2024
1 parent 893e025 commit a4dd72a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Content.Server/Nyanotrasen/Item/ShockCollar/ShockCollarSystem.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Content.Shared.Mobs.Components;
using Content.Shared.Timing;
using Content.Server.Explosion.EntitySystems; // Why is trigger under explosions by the way? Even doors already use it.
using Content.Server.Electrocution;
using Robust.Shared.Containers;
Expand All @@ -9,6 +10,8 @@ public sealed partial class ShockCollarSystem : EntitySystem
{
[Dependency] private readonly SharedContainerSystem _container = default!;
[Dependency] private readonly ElectrocutionSystem _electrocutionSystem = default!;
[Dependency] private readonly UseDelaySystem _useDelay = default!;

public override void Initialize()
{
base.Initialize();
Expand All @@ -25,6 +28,13 @@ private void OnTrigger(EntityUid uid, ShockCollarComponent component, TriggerEve
if (!HasComp<MobStateComponent>(containerEnt)) // If it's not a mob we don't care
return;

// DeltaV: prevent clocks from instantly killing people
TryComp<UseDelayComponent>(uid, out var useDelay);
if (_useDelay.ActiveDelay(uid, useDelay))
return;

_useDelay.BeginDelay(uid, useDelay);

_electrocutionSystem.TryDoElectrocution(containerEnt, null, 5, TimeSpan.FromSeconds(2), true);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
parent: ClothingNeckBase
id: ShockCollar
name: shock collar
description: Shocking. Placeholder sprite.
description: Shocking. # DeltaV: sprite is fine
components:
- type: Sprite
sprite: Nyanotrasen/Clothing/Neck/Misc/shock.rsi
- type: Clothing
sprite: Nyanotrasen/Clothing/Neck/Misc/shock.rsi
- type: ShockCollar
- type: UseDelay
delay: 3 # DeltaV: prevent clocks instakilling people
- type: TriggerOnSignal
- type: DeviceNetwork
deviceNetId: Wireless
Expand Down

0 comments on commit a4dd72a

Please sign in to comment.