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:
@@ -1,6 +1,7 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Numerics;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Shared.Cuffs.Components;
|
||||
using Content.Shared.Database;
|
||||
@@ -32,6 +33,7 @@ public abstract partial class SharedBuckleSystem
|
||||
public static ProtoId<AlertCategoryPrototype> BuckledAlertCategory = "Buckled";
|
||||
|
||||
[Dependency] private readonly EntityWhitelistSystem _whitelistSystem = default!;
|
||||
[Dependency] private readonly ActionBlockerSystem _actionBlocker = default!;
|
||||
|
||||
private void InitializeBuckle()
|
||||
{
|
||||
@@ -516,8 +518,14 @@ public abstract partial class SharedBuckleSystem
|
||||
if (_gameTiming.CurTime < buckle.Comp.BuckleTime + buckle.Comp.Delay)
|
||||
return false;
|
||||
|
||||
if (user != null && !_interaction.InRangeUnobstructed(user.Value, strap.Owner, buckle.Comp.Range, popup: popup))
|
||||
return false;
|
||||
if (user != null)
|
||||
{
|
||||
if (!_interaction.InRangeUnobstructed(user.Value, strap.Owner, buckle.Comp.Range, popup: popup))
|
||||
return false;
|
||||
|
||||
if (user.Value != buckle.Owner && !_actionBlocker.CanComplexInteract(user.Value))
|
||||
return false;
|
||||
}
|
||||
|
||||
var unbuckleAttempt = new UnbuckleAttemptEvent(strap, buckle!, user, popup);
|
||||
RaiseLocalEvent(buckle, ref unbuckleAttempt);
|
||||
|
||||
Reference in New Issue
Block a user