From c959544c27789e59cbba618da11d30d4df1c4142 Mon Sep 17 00:00:00 2001 From: Voomra Date: Mon, 13 May 2024 20:28:10 +0300 Subject: [PATCH 1/3] fix: anyone could have "defused" it --- .../Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs index 33274961855..db1aa033335 100644 --- a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs +++ b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared.Explosion.Components; using Content.Shared.Verbs; namespace Content.Shared.Andromeda.Voomra.C4; @@ -29,6 +30,9 @@ private void OnComponentRemove(EntityUid uid, C4DetonationByUnstickComponent com private void OnGetAltVerbs(EntityUid uid, C4DetonationByUnstickComponent component, GetVerbsEvent args) { + if (HasComp(uid)) + return; + args.Verbs.Add(new AlternativeVerb { Text = Loc.GetString("verb-c4-detonation-by-unstick", ("status", component.Detonation From b4c349ab7d8d3df3f942a724e33c204cc053c0a6 Mon Sep 17 00:00:00 2001 From: Voomra Date: Mon, 13 May 2024 21:35:28 +0300 Subject: [PATCH 2/3] feat: information about the detonation status during detaching --- .../Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs | 8 ++++++++ .../Locale/ru-RU/Andromeda/c4-detonation-by-unstick.ftl | 2 ++ 2 files changed, 10 insertions(+) diff --git a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs index db1aa033335..90acdad21fd 100644 --- a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs +++ b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs @@ -1,3 +1,4 @@ +using Content.Shared.Examine; using Content.Shared.Explosion.Components; using Content.Shared.Verbs; @@ -16,6 +17,7 @@ public override void Initialize() SubscribeLocalEvent(OnComponentInit); SubscribeLocalEvent(OnComponentRemove); SubscribeLocalEvent>(OnGetAltVerbs); + SubscribeLocalEvent(OnExamined); } private void OnComponentInit(EntityUid uid, C4DetonationByUnstickComponent component, ComponentInit args) @@ -46,4 +48,10 @@ private void DoAltVerbs(C4DetonationByUnstickComponent component) { component.Detonation = !component.Detonation; } + + private void OnExamined(EntityUid uid, C4DetonationByUnstickComponent component, ExaminedEvent args) + { + if (component.Detonation) + args.PushMarkup(Loc.GetString("examine-c4-detonation-by-unstick")); + } } diff --git a/Resources/Locale/ru-RU/Andromeda/c4-detonation-by-unstick.ftl b/Resources/Locale/ru-RU/Andromeda/c4-detonation-by-unstick.ftl index 07e322e9f2a..5fbda53db22 100644 --- a/Resources/Locale/ru-RU/Andromeda/c4-detonation-by-unstick.ftl +++ b/Resources/Locale/ru-RU/Andromeda/c4-detonation-by-unstick.ftl @@ -1,3 +1,5 @@ verb-c4-detonation-by-unstick = Детонация при попытке снятия: {$status} verb-c4-detonation-by-unstick-status-off = ВЫКЛ verb-c4-detonation-by-unstick-status-on = ВКЛ + +examine-c4-detonation-by-unstick = [color=red]Детонирует при попытке открепить[/color] From 74d865b894354ec3213a9f6494ab5685b6d50575 Mon Sep 17 00:00:00 2001 From: Voomra Date: Mon, 13 May 2024 21:58:51 +0300 Subject: [PATCH 3/3] feat: 50% chance to detonate when unpinned --- Content.Server/Sticky/Systems/StickySystem.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Content.Server/Sticky/Systems/StickySystem.cs b/Content.Server/Sticky/Systems/StickySystem.cs index 32c8287d897..2d51ec323b8 100644 --- a/Content.Server/Sticky/Systems/StickySystem.cs +++ b/Content.Server/Sticky/Systems/StickySystem.cs @@ -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; @@ -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"; @@ -139,8 +141,12 @@ private void StartUnsticking(EntityUid uid, EntityUid user, StickyComponent? com //A-13 Detonation of C4 during detaching start if (TryComp(uid, out var c4Comp)) { - if (c4Comp.Detonation && TryComp(uid, out var activateComp)) + if (c4Comp.Detonation + && TryComp(uid, out var activateComp) + && _random.NextFloat(0.0f, 1.0f) > 0.5f) + { activateComp.TimeRemaining = 0; + } } //A-13 Detonation of C4 during detaching end