Vehicle stun/sleep immunity fix (#18962)

* Fix stuns on vehicles

* Unicycle 1984

* Fix sleeping and driving

* Discard that too
This commit is contained in:
Doru991
2023-08-13 10:13:19 +03:00
committed by GitHub
parent ef740601f0
commit a554ad24e1
3 changed files with 12 additions and 1 deletions

View File

@@ -131,6 +131,16 @@ public abstract partial class SharedBuckleSystem
private void OnBuckleStandAttempt(EntityUid uid, BuckleComponent component, StandAttemptEvent args) 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<VehicleComponent>(buckle, out _))
return;
}
if (component.Buckled) if (component.Buckled)
args.Cancel(); args.Cancel();
} }

View File

@@ -20,6 +20,7 @@ using System.Numerics;
using Content.Shared.Mobs.Systems; using Content.Shared.Mobs.Systems;
using Robust.Shared.Physics.Components; using Robust.Shared.Physics.Components;
using Robust.Shared.Physics.Systems; using Robust.Shared.Physics.Systems;
using Content.Shared.Bed.Sleep;
namespace Content.Shared.Movement.Systems namespace Content.Shared.Movement.Systems
{ {
@@ -123,6 +124,7 @@ namespace Content.Shared.Movement.Systems
if (RelayTargetQuery.TryGetComponent(uid, out var relayTarget)) if (RelayTargetQuery.TryGetComponent(uid, out var relayTarget))
{ {
if (_mobState.IsIncapacitated(relayTarget.Source) || if (_mobState.IsIncapacitated(relayTarget.Source) ||
TryComp<SleepingComponent>(relayTarget.Source, out _) ||
!MoverQuery.TryGetComponent(relayTarget.Source, out var relayedMover)) !MoverQuery.TryGetComponent(relayTarget.Source, out var relayedMover))
{ {
canMove = false; canMove = false;

View File

@@ -374,7 +374,6 @@
description: It only has one wheel! description: It only has one wheel!
components: components:
- type: Vehicle - type: Vehicle
useHand: false
northOver: true northOver: true
southOver: true southOver: true
northOverride: -0.15 northOverride: -0.15