Allow C4's auto-starting when stickied quality to be toggled (#10434)
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -5,4 +5,8 @@ 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.
|
||||
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
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
initialBeepDelay: 0
|
||||
beepSound: /Audio/Machines/Nuke/general_beep.ogg
|
||||
startOnStick: true
|
||||
canToggleStartOnStick: true
|
||||
- type: TriggerOnSignal
|
||||
- type: SignalReceiver
|
||||
- type: Sticky
|
||||
|
||||
Reference in New Issue
Block a user