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