From 0f23635f497eef8c5e60c3b466ebae797795077f Mon Sep 17 00:00:00 2001 From: Joonas Rikkonen Date: Wed, 10 Jan 2018 15:14:25 +0200 Subject: [PATCH] Fixed items disappearing client-side when the physics body of the item goes to sleep. --- Barotrauma/BarotraumaClient/Source/Items/Item.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Barotrauma/BarotraumaClient/Source/Items/Item.cs b/Barotrauma/BarotraumaClient/Source/Items/Item.cs index 3b57c72d0..f71eb7af5 100644 --- a/Barotrauma/BarotraumaClient/Source/Items/Item.cs +++ b/Barotrauma/BarotraumaClient/Source/Items/Item.cs @@ -470,7 +470,18 @@ namespace Barotrauma } else { - body.Enabled = false; + try + { + body.FarseerBody.Enabled = false; + } + catch (Exception e) + { + DebugConsole.ThrowError("Exception in PhysicsBody.Enabled = false (" + body.PhysEnabled + ")", e); + if (body.UserData != null) DebugConsole.NewMessage("PhysicsBody UserData: " + body.UserData.GetType().ToString(), Color.Red); + if (GameMain.World.ContactManager == null) DebugConsole.NewMessage("ContactManager is null!", Color.Red); + else if (GameMain.World.ContactManager.BroadPhase == null) DebugConsole.NewMessage("Broadphase is null!", Color.Red); + if (body.FarseerBody.FixtureList == null) DebugConsole.NewMessage("FixtureList is null!", Color.Red); + } } if ((newPosition - SimPosition).Length() > body.LinearVelocity.Length() * 2.0f)