Fix entering noclip when a locker is closed over a buckled entity and the chair is then deleted

This commit is contained in:
DrSmugleaf
2020-07-04 14:10:37 +02:00
parent 0f16b9b8f1
commit 47118e8301

View File

@@ -212,8 +212,12 @@ namespace Content.Server.GameObjects.Components.Mobs
.PlayFromEntity(strap.UnbuckleSound, Owner);
}
Owner.Transform.DetachParent();
Owner.Transform.WorldRotation = BuckledTo.Owner.Transform.WorldRotation;
if (Owner.Transform.Parent == BuckledTo.Owner.Transform)
{
Owner.Transform.DetachParent();
Owner.Transform.WorldRotation = BuckledTo.Owner.Transform.WorldRotation;
}
BuckledTo = null;
if (Owner.TryGetComponent(out AppearanceComponent appearance))
@@ -268,12 +272,12 @@ namespace Content.Server.GameObjects.Components.Mobs
base.Startup();
BuckleStatus();
}
public override void OnRemove()
{
base.OnRemove();
if (BuckledTo != null && BuckledTo.Owner.TryGetComponent(out StrapComponent strap))
if (BuckledTo != null &&
BuckledTo.Owner.TryGetComponent(out StrapComponent strap))
{
strap.Remove(this);
}