Allow unbuckling incapacitated people from vehicles. Fix being able to unbuckle yourself while incapacitated (#21556)

* a

* review

* reviews????

* another fix!

* goofy

* Fix my own fuckup
This commit is contained in:
Vasilis
2023-11-16 03:39:04 +01:00
committed by GitHub
parent 0c70e95f5f
commit e804860da5

View File

@@ -435,9 +435,12 @@ public abstract partial class SharedBuckleSystem
if (HasComp<SleepingComponent>(buckleUid) && buckleUid == userUid) if (HasComp<SleepingComponent>(buckleUid) && buckleUid == userUid)
return false; return false;
// If the strap is a vehicle and the rider is not the person unbuckling, return. // If the strap is a vehicle and the rider is not the person unbuckling, return. Unless the rider is crit or dead.
if (TryComp<VehicleComponent>(strapUid, out var vehicle) && if (TryComp<VehicleComponent>(strapUid, out var vehicle) && vehicle.Rider != userUid && !_mobState.IsIncapacitated(buckleUid))
vehicle.Rider != userUid) return false;
// If the person is crit or dead in any kind of strap, return. This prevents people from unbuckling themselves while incapacitated.
if (_mobState.IsIncapacitated(buckleUid) && userUid == buckleUid)
return false; return false;
} }