Skip to content

Commit

Permalink
feat: 50% chance to detonate when unpinned
Browse files Browse the repository at this point in the history
  • Loading branch information
Voomra committed May 13, 2024
1 parent b4c349a commit 74d865b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Content.Server/Sticky/Systems/StickySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Content.Shared.Sticky.Components;
using Content.Shared.Verbs;
using Robust.Shared.Containers;
using Robust.Shared.Random; //A-13 Detonation of C4 during detaching
using Robust.Shared.Utility;

namespace Content.Server.Sticky.Systems;
Expand All @@ -22,6 +23,7 @@ public sealed class StickySystem : EntitySystem
[Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
[Dependency] private readonly IRobustRandom _random = default!; //A-13 Detonation of C4 during detaching

private const string StickerSlotId = "stickers_container";

Expand Down Expand Up @@ -139,8 +141,12 @@ private void StartUnsticking(EntityUid uid, EntityUid user, StickyComponent? com
//A-13 Detonation of C4 during detaching start
if (TryComp<C4DetonationByUnstickComponent>(uid, out var c4Comp))
{
if (c4Comp.Detonation && TryComp<ActiveTimerTriggerComponent>(uid, out var activateComp))
if (c4Comp.Detonation
&& TryComp<ActiveTimerTriggerComponent>(uid, out var activateComp)
&& _random.NextFloat(0.0f, 1.0f) > 0.5f)
{
activateComp.TimeRemaining = 0;
}
}
//A-13 Detonation of C4 during detaching end

Expand Down

0 comments on commit 74d865b

Please sign in to comment.