User-controlled monsters can damage structures from outside the sub
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
|
||||
<limb id = "3" width="13" height="45" mass = "6" ignorecollisions="true" flip="true" impacttolerance="50.0">
|
||||
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="65,131,36,50" depth="0.15" origin="0.4,0.5"/>
|
||||
<attack range="120" duration="0.5" damage="30" stun="0.1" bleedingdamage="3" structuredamage="50" damagetype="slash" torque="-20" targetforce="-30"/>
|
||||
<attack range="120" duration="0.5" damage="30" stun="0.1" bleedingdamage="3" structuredamage="50" damagetype="slash" force="20" torque="-20" targetforce="-30"/>
|
||||
</limb>
|
||||
|
||||
<limb id = "4" width="11" height="34" mass = "4" type="RightLeg" flip="true">
|
||||
|
||||
@@ -763,19 +763,39 @@ namespace Barotrauma
|
||||
attackPos,
|
||||
AnimController.Limbs.Select(l => l.body.FarseerBody).ToList(),
|
||||
Physics.CollisionCharacter | Physics.CollisionWall);
|
||||
|
||||
|
||||
IDamageable attackTarget = null;
|
||||
if (body != null)
|
||||
{
|
||||
if (body.UserData is IDamageable)
|
||||
{
|
||||
attackTarget = (IDamageable)body.UserData;
|
||||
}
|
||||
else if (body.UserData is Limb)
|
||||
{
|
||||
attackTarget = ((Limb)body.UserData).character;
|
||||
}
|
||||
attackPos = Submarine.LastPickedPosition;
|
||||
|
||||
if (body != null && body.UserData is Submarine)
|
||||
{
|
||||
var sub = ((Submarine)body.UserData);
|
||||
|
||||
body = Submarine.PickBody(
|
||||
attackLimb.SimPosition - ((Submarine)body.UserData).SimPosition,
|
||||
attackPos - ((Submarine)body.UserData).SimPosition,
|
||||
AnimController.Limbs.Select(l => l.body.FarseerBody).ToList(),
|
||||
Physics.CollisionWall);
|
||||
|
||||
if (body != null)
|
||||
{
|
||||
attackPos = Submarine.LastPickedPosition + sub.SimPosition;
|
||||
attackTarget = body.UserData as IDamageable;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (body.UserData is IDamageable)
|
||||
{
|
||||
attackTarget = (IDamageable)body.UserData;
|
||||
}
|
||||
else if (body.UserData is Limb)
|
||||
{
|
||||
attackTarget = ((Limb)body.UserData).character;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
attackLimb.UpdateAttack(deltaTime, attackPos, attackTarget);
|
||||
|
||||
@@ -499,7 +499,8 @@ namespace Barotrauma
|
||||
float dist = ConvertUnits.ToDisplayUnits(Vector2.Distance(SimPosition, attackPosition));
|
||||
|
||||
AttackTimer += deltaTime;
|
||||
body.ApplyTorque(Mass * character.AnimController.Dir * attack.Torque);
|
||||
|
||||
body.ApplyTorque(Mass * character.AnimController.Dir * attack.Torque);
|
||||
|
||||
if (dist < attack.Range * 0.5f)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user