Skip to content

Commit

Permalink
c4 tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
13lackHawk committed May 21, 2024
1 parent 2904339 commit 7210c75
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Content.Server/Sticky/Systems/StickySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ private void StartUnsticking(EntityUid uid, EntityUid user, StickyComponent? com
{
if (c4Comp.Detonation
&& TryComp<ActiveTimerTriggerComponent>(uid, out var activateComp)
&& _random.NextFloat(0.0f, 1.0f) > 0.5f)
&& _random.NextFloat(0.0f, 1.0f) > 0.25f)
{
activateComp.TimeRemaining = 0;
}
Expand Down
13 changes: 11 additions & 2 deletions Content.Shared/Andromeda/Voomra/C4/C4DetonationByUnstickSystem.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Content.Shared.Examine;
using Content.Shared.Explosion.Components;
using Content.Shared.Popups;
using Content.Shared.Verbs;

namespace Content.Shared.Andromeda.Voomra.C4;
Expand All @@ -10,6 +11,8 @@ namespace Content.Shared.Andromeda.Voomra.C4;
/// /// <seealso cref="T:Content.Shared.Andromeda.Voomra.C4.C4DetonationByUnstickComponent"/>
public sealed class C4DetonationByUnstickSystem : EntitySystem
{
[Dependency] private readonly SharedPopupSystem _popupSystem = default!;

public override void Initialize()
{
base.Initialize();
Expand Down Expand Up @@ -40,13 +43,19 @@ 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)
Act = () => DoAltVerbs(component, uid, args.User)
});
}

private void DoAltVerbs(C4DetonationByUnstickComponent component)
private void DoAltVerbs(C4DetonationByUnstickComponent component, EntityUid c4, EntityUid user)
{
component.Detonation = !component.Detonation;
//есть странный баг: сообщение отображается задвоенно, словно popup вызывается дважды
_popupSystem.PopupEntity(
component.Detonation
? Loc.GetString("popup-c4-detonation-by-unstick-on")
: Loc.GetString("popup-c4-detonation-by-unstick-off"),
c4, user);
}

private void OnExamined(EntityUid uid, C4DetonationByUnstickComponent component, ExaminedEvent args)
Expand Down
3 changes: 3 additions & 0 deletions Resources/Locale/ru-RU/Andromeda/c4-detonation-by-unstick.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ verb-c4-detonation-by-unstick-status-off = ВЫКЛ
verb-c4-detonation-by-unstick-status-on = ВКЛ
examine-c4-detonation-by-unstick = [color=red]Детонирует при попытке открепить[/color]
popup-c4-detonation-by-unstick-off = НЕ детонирует при попытке открепить
popup-c4-detonation-by-unstick-on = Детонирует при попытке открепить

0 comments on commit 7210c75

Please sign in to comment.