diff --git a/Subsurface/Source/Characters/Animation/Ragdoll.cs b/Subsurface/Source/Characters/Animation/Ragdoll.cs index 85a93559e..b3f1a19ab 100644 --- a/Subsurface/Source/Characters/Animation/Ragdoll.cs +++ b/Subsurface/Source/Characters/Animation/Ragdoll.cs @@ -1256,7 +1256,7 @@ namespace Barotrauma //use simple interpolation for other players' characters and characters that can't move if (character.MemState.Count > 0) { - if (character.MemState[0].Interact == null) + if (character.MemState[0].Interact == null || character.MemState[0].Interact.Removed) { character.DeselectCharacter(); character.SelectedConstruction = null; @@ -1348,7 +1348,7 @@ namespace Barotrauma //the entity we're interacting with doesn't match the server's if (localPos.Interact != serverPos.Interact) { - if (serverPos.Interact == null) + if (serverPos.Interact == null || serverPos.Interact.Removed) { character.DeselectCharacter(); character.SelectedConstruction = null; diff --git a/Subsurface/Source/Characters/Character.cs b/Subsurface/Source/Characters/Character.cs index f4d3a59d5..e12eed995 100644 --- a/Subsurface/Source/Characters/Character.cs +++ b/Subsurface/Source/Characters/Character.cs @@ -440,7 +440,7 @@ namespace Barotrauma { get { - return isDead || Stun > 0.0f || LockHands || IsUnconscious; + return isDead || Stun > 0.0f || LockHands || IsUnconscious || Removed; } } @@ -932,7 +932,7 @@ namespace Barotrauma if (selectedConstruction != null && IsKeyDown(InputType.Aim)) selectedConstruction.SecondaryUse(deltaTime, this); } - if (selectedCharacter!=null) + if (selectedCharacter != null) { if (Vector2.DistanceSquared(selectedCharacter.WorldPosition, WorldPosition) > 90000.0f || !selectedCharacter.CanBeSelected) { @@ -1123,10 +1123,13 @@ namespace Barotrauma public void DeselectCharacter() { if (selectedCharacter == null) return; - - foreach (Limb limb in selectedCharacter.AnimController.Limbs) + + if (SelectedCharacter.AnimController != null) { - if (limb.pullJoint != null) limb.pullJoint.Enabled = false; + foreach (Limb limb in selectedCharacter.AnimController.Limbs) + { + if (limb.pullJoint != null) limb.pullJoint.Enabled = false; + } } selectedCharacter = null;