RepairTools can do damage to characters by hitting the collider. Closes #299

This commit is contained in:
Joonas Rikkonen
2018-03-05 12:34:21 +02:00
parent 4e048b7895
commit 6ddcd65f18
2 changed files with 17 additions and 1 deletions
@@ -211,6 +211,7 @@ namespace Barotrauma.Items.Components
pickedPosition = Submarine.LastPickedPosition;
Structure targetStructure;
Character targetCharacter;
Limb targetLimb;
Item targetItem;
if ((targetStructure = (targetBody.UserData as Structure)) != null)
@@ -261,6 +262,19 @@ namespace Barotrauma.Items.Components
}
}
}
else if ((targetCharacter = (targetBody.UserData as Character)) != null)
{
targetCharacter.AddDamage(CauseOfDeath.Damage, -LimbFixAmount * degreeOfSuccess, user);
#if CLIENT
Vector2 particlePos = ConvertUnits.ToDisplayUnits(pickedPosition);
if (targetCharacter.Submarine != null) particlePos += targetCharacter.Submarine.DrawPosition;
foreach (var emitter in ParticleEmitterHitCharacter)
{
float particleAngle = item.body.Rotation + ((item.body.Dir > 0.0f) ? 0.0f : MathHelper.Pi);
emitter.Emit(deltaTime, particlePos, item.CurrentHull, particleAngle + MathHelper.Pi, -particleAngle + MathHelper.Pi);
}
#endif
}
else if ((targetLimb = (targetBody.UserData as Limb)) != null)
{
targetLimb.character.AddDamage(CauseOfDeath.Damage, -LimbFixAmount * degreeOfSuccess, user);