Allow C4's auto-starting when stickied quality to be toggled (#10434)

This commit is contained in:
Veritius
2022-08-14 15:48:02 +10:00
committed by GitHub
parent f69fb1d9ce
commit 51fa58673a
4 changed files with 35 additions and 1 deletions

View File

@@ -38,5 +38,11 @@ namespace Content.Server.Explosion.Components
/// </summary>
[DataField("startOnStick")]
public bool StartOnStick;
/// <summary>
/// Allows changing the start-on-stick quality.
/// </summary>
[DataField("canToggleStartOnStick")]
public bool AllowToggleStartOnStick;
}
}

View File

@@ -87,6 +87,15 @@ public sealed partial class TriggerSystem
},
});
}
if (component.AllowToggleStartOnStick)
{
args.Verbs.Add(new AlternativeVerb()
{
Text = Loc.GetString("verb-toggle-start-on-stick"),
Act = () => ToggleStartOnStick(uid, args.User, component)
});
}
}
private void CycleDelay(OnUseTimerTriggerComponent component, EntityUid user)
@@ -116,6 +125,20 @@ public sealed partial class TriggerSystem
}
}
private void ToggleStartOnStick(EntityUid grenade, EntityUid user, OnUseTimerTriggerComponent comp)
{
if (comp.StartOnStick)
{
comp.StartOnStick = false;
_popupSystem.PopupEntity(Loc.GetString("popup-start-on-stick-off"), grenade, Filter.Entities(user));
}
else
{
comp.StartOnStick = true;
_popupSystem.PopupEntity(Loc.GetString("popup-start-on-stick-on"), grenade, Filter.Entities(user));
}
}
private void OnTimerUse(EntityUid uid, OnUseTimerTriggerComponent component, UseInHandEvent args)
{
if (args.Handled) return;

View File

@@ -6,3 +6,7 @@ verb-trigger-timer-cycle = Cycle Time Delay
examine-trigger-timer = The timer is set to {$time} seconds.
popup-trigger-timer-set = Timer set to {$time} seconds.
verb-toggle-start-on-stick = Toggle auto-activation
popup-start-on-stick-off = The device will no longer activate automatically when planted
popup-start-on-stick-on = The device will now activate automatically when planted

View File

@@ -16,6 +16,7 @@
initialBeepDelay: 0
beepSound: /Audio/Machines/Nuke/general_beep.ogg
startOnStick: true
canToggleStartOnStick: true
- type: TriggerOnSignal
- type: SignalReceiver
- type: Sticky