(1036993d3) Adjusted motion detector in autodoors

This commit is contained in:
Joonas Rikkonen
2019-05-06 11:22:02 +03:00
parent 30620ed059
commit e4adc47dad
12 changed files with 264 additions and 50 deletions
@@ -674,8 +674,6 @@ namespace Barotrauma
velocity -= ((Submarine)f2.Body.UserData).Velocity;
}
if (character.Submarine == null && f2.Body.UserData is Submarine) velocity -= ((Submarine)f2.Body.UserData).Velocity;
float impact = Vector2.Dot(velocity, -normal);
if (f1.Body == Collider.FarseerBody || !Collider.Enabled)
{
@@ -694,6 +692,11 @@ namespace Barotrauma
character.AddDamage(impactPos, new List<Affliction>() { AfflictionPrefab.InternalDamage.Instantiate((impact - ImpactTolerance) * 10.0f) }, 0.0f, true);
strongestImpact = Math.Max(strongestImpact, impact - ImpactTolerance);
character.ApplyStatusEffects(ActionType.OnImpact, 1.0f);
//briefly disable impact damage
//otherwise the character will take damage multiple times when for example falling,
//because we use the velocity of the collider to determine the impact
//(i.e. the character would take damage until the collider hits the floor and stops)
character.DisableImpactDamageTimer = 0.25f;
}
}
}