From a554ad24e1421fd2730475736b6a4492f0969b26 Mon Sep 17 00:00:00 2001 From: Doru991 <75124791+Doru991@users.noreply.github.com> Date: Sun, 13 Aug 2023 10:13:19 +0300 Subject: [PATCH] Vehicle stun/sleep immunity fix (#18962) * Fix stuns on vehicles * Unicycle 1984 * Fix sleeping and driving * Discard that too --- Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs | 10 ++++++++++ .../Movement/Systems/SharedMoverController.cs | 2 ++ .../Entities/Objects/Vehicles/buckleable.yml | 1 - 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs index ac55b647e5..13a00dd5a1 100644 --- a/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs +++ b/Content.Shared/Buckle/SharedBuckleSystem.Buckle.cs @@ -131,6 +131,16 @@ public abstract partial class SharedBuckleSystem private void OnBuckleStandAttempt(EntityUid uid, BuckleComponent component, StandAttemptEvent args) { + //Let entities stand back up while on vehicles so that they can be knocked down when slept/stunned + //This prevents an exploit that allowed people to become partially invulnerable to stuns + //while on vehicles + + if (component.BuckledTo != null) + { + var buckle = component.BuckledTo; + if (TryComp(buckle, out _)) + return; + } if (component.Buckled) args.Cancel(); } diff --git a/Content.Shared/Movement/Systems/SharedMoverController.cs b/Content.Shared/Movement/Systems/SharedMoverController.cs index b115e55465..4082c3212b 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.cs @@ -20,6 +20,7 @@ using System.Numerics; using Content.Shared.Mobs.Systems; using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Systems; +using Content.Shared.Bed.Sleep; namespace Content.Shared.Movement.Systems { @@ -123,6 +124,7 @@ namespace Content.Shared.Movement.Systems if (RelayTargetQuery.TryGetComponent(uid, out var relayTarget)) { if (_mobState.IsIncapacitated(relayTarget.Source) || + TryComp(relayTarget.Source, out _) || !MoverQuery.TryGetComponent(relayTarget.Source, out var relayedMover)) { canMove = false; diff --git a/Resources/Prototypes/Entities/Objects/Vehicles/buckleable.yml b/Resources/Prototypes/Entities/Objects/Vehicles/buckleable.yml index 5228acc1cf..f59b6f9398 100644 --- a/Resources/Prototypes/Entities/Objects/Vehicles/buckleable.yml +++ b/Resources/Prototypes/Entities/Objects/Vehicles/buckleable.yml @@ -374,7 +374,6 @@ description: It only has one wheel! components: - type: Vehicle - useHand: false northOver: true southOver: true northOverride: -0.15