Fixed camera shake continuing indefinitely if a character falls unconscious due to impact damage

This commit is contained in:
Joonas Rikkonen
2018-03-08 10:43:54 +02:00
parent 82dcbc3ae8
commit 4421c8a5de
@@ -80,6 +80,14 @@ namespace Barotrauma
ColliderIndex = Crouching ? 1 : 0; ColliderIndex = Crouching ? 1 : 0;
if (!Crouching && ColliderIndex == 1) Crouching = true; if (!Crouching && ColliderIndex == 1) Crouching = true;
//stun (= disable the animations) if the ragdoll receives a large enough impact
if (strongestImpact > 0.0f)
{
character.SetStun(MathHelper.Min(strongestImpact * 0.5f, 5.0f));
strongestImpact = 0.0f;
return;
}
if (!character.AllowInput) if (!character.AllowInput)
{ {
levitatingCollider = false; levitatingCollider = false;
@@ -95,15 +103,6 @@ namespace Barotrauma
return; return;
} }
//stun (= disable the animations) if the ragdoll receives a large enough impact
if (strongestImpact > 0.0f)
{
character.SetStun(MathHelper.Min(strongestImpact * 0.5f, 5.0f));
strongestImpact = 0.0f;
return;
}
//re-enable collider //re-enable collider
if (!Collider.Enabled) if (!Collider.Enabled)
{ {