(3340f2f90) Don't do impact damage to structures in Structure.OnWallCollision. Impact damage was disabled when a character hits the sub from the outside (implemented in SubmarineBody), but should've been done here as well.

This commit is contained in:
Joonas Rikkonen
2019-04-29 21:05:21 +03:00
parent 69c4b9a74f
commit 33747a63b0
6 changed files with 50 additions and 50 deletions
@@ -635,29 +635,14 @@ namespace Barotrauma
var character = ((Limb)f2.Body.UserData).character;
if (character.DisableImpactDamageTimer > 0.0f || ((Limb)f2.Body.UserData).Mass < 100.0f) return true;
}
if (!Prefab.Platform && Prefab.StairDirection == Direction.None)
{
Vector2 pos = ConvertUnits.ToDisplayUnits(f2.Body.Position);
int section = FindSectionIndex(pos);
if (section > -1)
{
Vector2 normal = contact.Manifold.LocalNormal;
float impact = Vector2.Dot(f2.Body.LinearVelocity, -normal) * f2.Body.Mass * 0.1f;
if (impact < 10.0f) return true;
#if CLIENT
SoundPlayer.PlayDamageSound("StructureBlunt", impact, SectionPosition(section, true), tags: Tags);
#endif
AddDamage(section, impact);
}
}
OnImpactProjSpecific(f1, f2, contact);
return true;
}
partial void OnImpactProjSpecific(Fixture f1, Fixture f2, Contact contact);
public WallSection GetSection(int sectionIndex)
{
if (sectionIndex < 0 || sectionIndex >= Sections.Length) return null;