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
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -435,9 +435,12 @@ public abstract partial class SharedBuckleSystem
if (HasComp<SleepingComponent>(buckleUid) && buckleUid == userUid)
return false;
// If the strap is a vehicle and the rider is not the person unbuckling, return.
if (TryComp<VehicleComponent>(strapUid, out var vehicle) &&
vehicle.Rider != userUid)
// 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) && vehicle.Rider != userUid && !_mobState.IsIncapacitated(buckleUid))
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;
}