Add checks for various complex interactions (#37246)
* Prevent toggling radiation collectors * Prevent resisting locks * Prevent unbuckling others, early exit before doafter * Prevent camera and camera router setup * Prevent rotating and flipping * Also prevent adding the unbuckle verb. * Revert ResistLocker changes * Prevent emitter tampering * Also prevent lock verb * Prevent toggling welders * Prevent gun open/close bolt, rack and switch mode * Prevent toggling stun batons
This commit is contained in:
@@ -25,7 +25,6 @@ namespace Content.Server.Stunnable.Systems
|
||||
SubscribeLocalEvent<StunbatonComponent, ExaminedEvent>(OnExamined);
|
||||
SubscribeLocalEvent<StunbatonComponent, SolutionContainerChangedEvent>(OnSolutionChange);
|
||||
SubscribeLocalEvent<StunbatonComponent, StaminaDamageOnHitAttemptEvent>(OnStaminaHitAttempt);
|
||||
SubscribeLocalEvent<StunbatonComponent, ItemToggleActivateAttemptEvent>(TryTurnOn);
|
||||
SubscribeLocalEvent<StunbatonComponent, ChargeChangedEvent>(OnChargeChanged);
|
||||
}
|
||||
|
||||
@@ -52,8 +51,10 @@ namespace Content.Server.Stunnable.Systems
|
||||
}
|
||||
}
|
||||
|
||||
private void TryTurnOn(Entity<StunbatonComponent> entity, ref ItemToggleActivateAttemptEvent args)
|
||||
protected override void TryTurnOn(Entity<StunbatonComponent> entity, ref ItemToggleActivateAttemptEvent args)
|
||||
{
|
||||
base.TryTurnOn(entity, ref args);
|
||||
|
||||
if (!TryComp<BatteryComponent>(entity, out var battery) || battery.CurrentCharge < entity.Comp.EnergyPerUse)
|
||||
{
|
||||
args.Cancelled = true;
|
||||
|
||||
Reference in New Issue
Block a user