From ac66a39cd02a8e940c359810526dd4d82ac7dde7 Mon Sep 17 00:00:00 2001 From: Voomra Date: Mon, 6 May 2024 16:05:06 +0300 Subject: [PATCH 1/8] =?UTF-8?q?feat:=20=D1=83=D0=B2=D0=B5=D0=BB=D0=B8?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=BE=20=D0=B2=D1=80=D0=B5=D0=BC=D1=8F=20?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D1=80=D0=B5=D0=BF=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20C4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml index 62f81fa5466..730545000ed 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml @@ -72,6 +72,8 @@ - type: HolidayRsiSwap sprite: festive: Objects/Weapons/Bombs/c4gift.rsi + - type: Sticky + unstickDelay: 10 - type: entity name: seismic charge From ce23be23de20c66c0f1480263af671c4b6f0de49 Mon Sep 17 00:00:00 2001 From: Voomra Date: Tue, 7 May 2024 18:21:05 +0300 Subject: [PATCH 2/8] =?UTF-8?q?feat:=20=D0=B4=D0=B5=D1=82=D0=BE=D0=BD?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20C4=20=D0=BF=D1=80=D0=B8=20=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D1=80=D0=B5=D0=BF=D0=BB=D0=B5=D0=BD=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Server/Sticky/Systems/StickySystem.cs | 12 +++++ .../C4/C4DetonationByUnstickComponent.cs | 23 ++++++++ .../Voomra/C4/C4DetonationByUnstickSystem.cs | 52 +++++++++++++++++++ .../Objects/Weapons/Bombs/plastic.yml | 1 + 4 files changed, 88 insertions(+) create mode 100644 Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickComponent.cs create mode 100644 Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs diff --git a/Content.Server/Sticky/Systems/StickySystem.cs b/Content.Server/Sticky/Systems/StickySystem.cs index effe1b72f71..b55be81247c 100644 --- a/Content.Server/Sticky/Systems/StickySystem.cs +++ b/Content.Server/Sticky/Systems/StickySystem.cs @@ -1,7 +1,9 @@ using Content.Server.Popups; using Content.Server.Sticky.Components; using Content.Server.Sticky.Events; +using Content.Shared.Andromeda.Voomra.C4; using Content.Shared.DoAfter; +using Content.Shared.Explosion.Components; using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Sticky; @@ -133,6 +135,16 @@ private void StartUnsticking(EntityUid uid, EntityUid user, StickyComponent? com return; var delay = (float) component.UnstickDelay.TotalSeconds; + + if (TryComp(uid, out var c4Comp)) + { + if (c4Comp.Detonation && TryComp(uid, out var activateComp)) + { + activateComp.TimeRemaining = 0; + } + + } + if (delay > 0) { // show message to user diff --git a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickComponent.cs b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickComponent.cs new file mode 100644 index 00000000000..546d6bb860d --- /dev/null +++ b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickComponent.cs @@ -0,0 +1,23 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Andromeda.Voomra.C4; + +/// +/// Компонент-маркер для детонации C4 при попытке открепить её +/// +/// +[RegisterComponent, NetworkedComponent] +public sealed partial class C4DetonationByUnstickComponent : Component +{ + /// + /// Альтернатива устаревшему IComponent.Owner + /// + [ViewVariables] + public EntityUid Owner2 { get; set; } = EntityUid.Invalid; + + /// + /// Флаг детонации при попытке снятия + /// + [ViewVariables] + public bool Detonation { get; set; } = false; +} diff --git a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs new file mode 100644 index 00000000000..2ef6144a1fb --- /dev/null +++ b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs @@ -0,0 +1,52 @@ +using Content.Shared.Administration.Logs; +using Content.Shared.Database; +using Content.Shared.Verbs; + +namespace Content.Shared.Andromeda.Voomra.C4; + +/// +/// Система управления детонированием C4 при попытке открепить её +/// +/// /// +public sealed class C4DetonationByUnstickSystem : EntitySystem +{ + [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; + // [Dependency] private readonly ILogManager _log = default!; + // private ISawmill _sawmill = default!; + + public override void Initialize() + { + base.Initialize(); + // _sawmill = _log.GetSawmill(GetType().Name); + + SubscribeLocalEvent(OnComponentInit); + SubscribeLocalEvent(OnComponentRemove); + SubscribeLocalEvent>(OnGetAltVerbs); + } + + private void OnComponentInit(EntityUid uid, C4DetonationByUnstickComponent component, ComponentInit args) + { + component.Owner2 = uid; + } + + private void OnComponentRemove(EntityUid uid, C4DetonationByUnstickComponent component, ComponentRemove args) + { + component.Owner2 = EntityUid.Invalid; + } + + private void OnGetAltVerbs(EntityUid uid, C4DetonationByUnstickComponent component, GetVerbsEvent args) + { + args.Verbs.Add(new AlternativeVerb + { + Text = $"Детонация при попытке снятия: {(component.Detonation ? "ВКЛ" : "ВЫКЛ")}", + Act = () => DoAltVerbs(component, args.User) + }); + } + + private void DoAltVerbs(C4DetonationByUnstickComponent component, EntityUid user) + { + component.Detonation = !component.Detonation; + // _adminLogger.Add(LogType.Verb, verb.Impact, $"{ToPrettyString(user):user} {executionText} the [{verbText:verb}] verb targeting {ToPrettyString(target):target}"); + _adminLogger.Add(LogType.Verb, $"{ToPrettyString(user):user} {(component.Detonation ? "ВКЛЮЧИЛ" : "ВЫКЛЮЧИЛ")} детонацию С4 при её снятии"); + } +} diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml index 730545000ed..1163d8ea753 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml @@ -74,6 +74,7 @@ festive: Objects/Weapons/Bombs/c4gift.rsi - type: Sticky unstickDelay: 10 + - type: C4DetonationByUnstick - type: entity name: seismic charge From a25cdd86f17b11d4751cc508a1d7a6d9b9331456 Mon Sep 17 00:00:00 2001 From: Voomra Date: Tue, 7 May 2024 20:39:22 +0300 Subject: [PATCH 3/8] =?UTF-8?q?style:=20=D0=BC=D0=B5=D1=82=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BF=D0=B0=D1=82=D1=87=D0=B5=D0=B9=20A-13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Content.Server/Sticky/Systems/StickySystem.cs | 3 ++- .../Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Content.Server/Sticky/Systems/StickySystem.cs b/Content.Server/Sticky/Systems/StickySystem.cs index b55be81247c..afd02afa6c9 100644 --- a/Content.Server/Sticky/Systems/StickySystem.cs +++ b/Content.Server/Sticky/Systems/StickySystem.cs @@ -136,14 +136,15 @@ private void StartUnsticking(EntityUid uid, EntityUid user, StickyComponent? com var delay = (float) component.UnstickDelay.TotalSeconds; + //A-13 Детонация C4 при откреплении start if (TryComp(uid, out var c4Comp)) { if (c4Comp.Detonation && TryComp(uid, out var activateComp)) { activateComp.TimeRemaining = 0; } - } + //A-13 Детонация C4 при откреплении end if (delay > 0) { diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml index 1163d8ea753..a4e3e0fcfbf 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml @@ -74,7 +74,7 @@ festive: Objects/Weapons/Bombs/c4gift.rsi - type: Sticky unstickDelay: 10 - - type: C4DetonationByUnstick + - type: C4DetonationByUnstick #A-13 Детонация C4 при откреплении - type: entity name: seismic charge From a86475f4994a49d4a4b30f4395c575a804ba4bef Mon Sep 17 00:00:00 2001 From: Voomra Date: Tue, 7 May 2024 20:43:16 +0300 Subject: [PATCH 4/8] remove: comments --- .../Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs index 2ef6144a1fb..1d9c1b3ced1 100644 --- a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs +++ b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs @@ -11,13 +11,10 @@ namespace Content.Shared.Andromeda.Voomra.C4; public sealed class C4DetonationByUnstickSystem : EntitySystem { [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; - // [Dependency] private readonly ILogManager _log = default!; - // private ISawmill _sawmill = default!; public override void Initialize() { base.Initialize(); - // _sawmill = _log.GetSawmill(GetType().Name); SubscribeLocalEvent(OnComponentInit); SubscribeLocalEvent(OnComponentRemove); @@ -46,7 +43,6 @@ private void OnGetAltVerbs(EntityUid uid, C4DetonationByUnstickComponent compone private void DoAltVerbs(C4DetonationByUnstickComponent component, EntityUid user) { component.Detonation = !component.Detonation; - // _adminLogger.Add(LogType.Verb, verb.Impact, $"{ToPrettyString(user):user} {executionText} the [{verbText:verb}] verb targeting {ToPrettyString(target):target}"); _adminLogger.Add(LogType.Verb, $"{ToPrettyString(user):user} {(component.Detonation ? "ВКЛЮЧИЛ" : "ВЫКЛЮЧИЛ")} детонацию С4 при её снятии"); } } From 0eb6bf15061ed35278c7b9b825b5270f34475892 Mon Sep 17 00:00:00 2001 From: Voomra Date: Tue, 7 May 2024 21:28:28 +0300 Subject: [PATCH 5/8] fix: translation of comments according to Lemird's request, everything in the code must be in English --- Content.Server/Sticky/Systems/StickySystem.cs | 4 ++-- .../Andromeda/Voomra/C4/C4DetonationByUnstickComponent.cs | 6 +++--- .../Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs | 2 +- .../Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Content.Server/Sticky/Systems/StickySystem.cs b/Content.Server/Sticky/Systems/StickySystem.cs index afd02afa6c9..c429a95653d 100644 --- a/Content.Server/Sticky/Systems/StickySystem.cs +++ b/Content.Server/Sticky/Systems/StickySystem.cs @@ -136,7 +136,7 @@ private void StartUnsticking(EntityUid uid, EntityUid user, StickyComponent? com var delay = (float) component.UnstickDelay.TotalSeconds; - //A-13 Детонация C4 при откреплении start + //A-13 Detonation of C4 during detaching start if (TryComp(uid, out var c4Comp)) { if (c4Comp.Detonation && TryComp(uid, out var activateComp)) @@ -144,7 +144,7 @@ private void StartUnsticking(EntityUid uid, EntityUid user, StickyComponent? com activateComp.TimeRemaining = 0; } } - //A-13 Детонация C4 при откреплении end + //A-13 Detonation of C4 during detaching end if (delay > 0) { diff --git a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickComponent.cs b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickComponent.cs index 546d6bb860d..08704f722d0 100644 --- a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickComponent.cs +++ b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickComponent.cs @@ -3,20 +3,20 @@ namespace Content.Shared.Andromeda.Voomra.C4; /// -/// Компонент-маркер для детонации C4 при попытке открепить её +/// A marker component for detonating C4 when trying to detach it /// /// [RegisterComponent, NetworkedComponent] public sealed partial class C4DetonationByUnstickComponent : Component { /// - /// Альтернатива устаревшему IComponent.Owner + /// An alternative to the outdated IComponent.Owner /// [ViewVariables] public EntityUid Owner2 { get; set; } = EntityUid.Invalid; /// - /// Флаг детонации при попытке снятия + /// The detonation flag when trying to remove /// [ViewVariables] public bool Detonation { get; set; } = false; diff --git a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs index 1d9c1b3ced1..fbb8407d3a7 100644 --- a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs +++ b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs @@ -5,7 +5,7 @@ namespace Content.Shared.Andromeda.Voomra.C4; /// -/// Система управления детонированием C4 при попытке открепить её +/// Detonation control system C4 when trying to detach it /// /// /// public sealed class C4DetonationByUnstickSystem : EntitySystem diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml index a4e3e0fcfbf..9b1c8f24ee6 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml @@ -74,7 +74,7 @@ festive: Objects/Weapons/Bombs/c4gift.rsi - type: Sticky unstickDelay: 10 - - type: C4DetonationByUnstick #A-13 Детонация C4 при откреплении + - type: C4DetonationByUnstick #A-13 Detonation of C4 during detaching - type: entity name: seismic charge From b9f76e1c8821d7b80ca6865ea8100f14db42f309 Mon Sep 17 00:00:00 2001 From: Voomra Date: Tue, 7 May 2024 21:29:47 +0300 Subject: [PATCH 6/8] fix: translating messages all messages have been moved to localization files --- .../Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs | 4 +++- Resources/Locale/ru-RU/Andromeda/c4-detonation-by-unstick.ftl | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 Resources/Locale/ru-RU/Andromeda/c4-detonation-by-unstick.ftl diff --git a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs index fbb8407d3a7..6d41411915d 100644 --- a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs +++ b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs @@ -35,7 +35,9 @@ private void OnGetAltVerbs(EntityUid uid, C4DetonationByUnstickComponent compone { args.Verbs.Add(new AlternativeVerb { - Text = $"Детонация при попытке снятия: {(component.Detonation ? "ВКЛ" : "ВЫКЛ")}", + Text = Loc.GetString("verb-c4-detonation-by-unstick", ("status", component.Detonation + ? Loc.GetString("verb-c4-detonation-by-unstick-status-on") + : Loc.GetString("verb-c4-detonation-by-unstick-status-off"))), Act = () => DoAltVerbs(component, args.User) }); } diff --git a/Resources/Locale/ru-RU/Andromeda/c4-detonation-by-unstick.ftl b/Resources/Locale/ru-RU/Andromeda/c4-detonation-by-unstick.ftl new file mode 100644 index 00000000000..07e322e9f2a --- /dev/null +++ b/Resources/Locale/ru-RU/Andromeda/c4-detonation-by-unstick.ftl @@ -0,0 +1,3 @@ +verb-c4-detonation-by-unstick = Детонация при попытке снятия: {$status} +verb-c4-detonation-by-unstick-status-off = ВЫКЛ +verb-c4-detonation-by-unstick-status-on = ВКЛ From 1e72d267b516c7b54a0fefbbf450d37ebf3c9b82 Mon Sep 17 00:00:00 2001 From: Voomra Date: Tue, 7 May 2024 21:30:54 +0300 Subject: [PATCH 7/8] refac: remove unnecessary code --- Content.Server/Sticky/Systems/StickySystem.cs | 2 -- .../Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs | 9 ++------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Content.Server/Sticky/Systems/StickySystem.cs b/Content.Server/Sticky/Systems/StickySystem.cs index c429a95653d..37339323528 100644 --- a/Content.Server/Sticky/Systems/StickySystem.cs +++ b/Content.Server/Sticky/Systems/StickySystem.cs @@ -140,9 +140,7 @@ private void StartUnsticking(EntityUid uid, EntityUid user, StickyComponent? com if (TryComp(uid, out var c4Comp)) { if (c4Comp.Detonation && TryComp(uid, out var activateComp)) - { activateComp.TimeRemaining = 0; - } } //A-13 Detonation of C4 during detaching end diff --git a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs index 6d41411915d..33274961855 100644 --- a/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs +++ b/Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs @@ -1,5 +1,3 @@ -using Content.Shared.Administration.Logs; -using Content.Shared.Database; using Content.Shared.Verbs; namespace Content.Shared.Andromeda.Voomra.C4; @@ -10,8 +8,6 @@ namespace Content.Shared.Andromeda.Voomra.C4; /// /// public sealed class C4DetonationByUnstickSystem : EntitySystem { - [Dependency] private readonly ISharedAdminLogManager _adminLogger = default!; - public override void Initialize() { base.Initialize(); @@ -38,13 +34,12 @@ private void OnGetAltVerbs(EntityUid uid, C4DetonationByUnstickComponent compone Text = Loc.GetString("verb-c4-detonation-by-unstick", ("status", component.Detonation ? Loc.GetString("verb-c4-detonation-by-unstick-status-on") : Loc.GetString("verb-c4-detonation-by-unstick-status-off"))), - Act = () => DoAltVerbs(component, args.User) + Act = () => DoAltVerbs(component) }); } - private void DoAltVerbs(C4DetonationByUnstickComponent component, EntityUid user) + private void DoAltVerbs(C4DetonationByUnstickComponent component) { component.Detonation = !component.Detonation; - _adminLogger.Add(LogType.Verb, $"{ToPrettyString(user):user} {(component.Detonation ? "ВКЛЮЧИЛ" : "ВЫКЛЮЧИЛ")} детонацию С4 при её снятии"); } } From fb441893205e5a5e137021198ff790dc940a1991 Mon Sep 17 00:00:00 2001 From: Voomra Date: Tue, 7 May 2024 21:35:18 +0300 Subject: [PATCH 8/8] fix: patch marker from A-13 --- Content.Server/Sticky/Systems/StickySystem.cs | 4 ++-- .../Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Content.Server/Sticky/Systems/StickySystem.cs b/Content.Server/Sticky/Systems/StickySystem.cs index 37339323528..32c8287d897 100644 --- a/Content.Server/Sticky/Systems/StickySystem.cs +++ b/Content.Server/Sticky/Systems/StickySystem.cs @@ -1,9 +1,9 @@ using Content.Server.Popups; using Content.Server.Sticky.Components; using Content.Server.Sticky.Events; -using Content.Shared.Andromeda.Voomra.C4; +using Content.Shared.Andromeda.Voomra.C4; //A-13 Detonation of C4 during detaching using Content.Shared.DoAfter; -using Content.Shared.Explosion.Components; +using Content.Shared.Explosion.Components; //A-13 Detonation of C4 during detaching using Content.Shared.Hands.EntitySystems; using Content.Shared.Interaction; using Content.Shared.Sticky; diff --git a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml index 9b1c8f24ee6..b1f8d9cca61 100644 --- a/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml +++ b/Resources/Prototypes/Entities/Objects/Weapons/Bombs/plastic.yml @@ -72,9 +72,11 @@ - type: HolidayRsiSwap sprite: festive: Objects/Weapons/Bombs/c4gift.rsi + #A-13 Detonation of C4 during detaching start - type: Sticky unstickDelay: 10 - - type: C4DetonationByUnstick #A-13 Detonation of C4 during detaching + - type: C4DetonationByUnstick + #A-13 Detonation of C4 during detaching end - type: entity name: seismic charge