Strong attacks can sever limbs (railguns now cut crawlers in half and threshers can rip off limbs)

This commit is contained in:
Joonas Rikkonen
2017-06-13 18:20:57 +03:00
parent 12731a8137
commit 65db119158
16 changed files with 237 additions and 154 deletions
@@ -638,6 +638,19 @@ namespace Barotrauma
if (isDead)
{
msg.Write((byte)causeOfDeath);
List<int> severedJointIndices = new List<int>();
for (int i = 0; i < AnimController.LimbJoints.Length; i++)
{
if (AnimController.LimbJoints[i] != null && AnimController.LimbJoints[i].IsSevered)
{
severedJointIndices.Add(i);
}
}
msg.Write((byte)severedJointIndices.Count);
foreach (int jointIndex in severedJointIndices)
{
msg.Write((byte)jointIndex);
}
}
else
{
@@ -677,6 +690,7 @@ namespace Barotrauma
if (isDead)
{
causeOfDeath = (CauseOfDeath)msg.ReadByte();
byte severedLimbCount = msg.ReadByte();
if (causeOfDeath == CauseOfDeath.Pressure)
{
Implode(true);
@@ -685,6 +699,11 @@ namespace Barotrauma
{
Kill(causeOfDeath, true);
}
for (int i = 0; i < severedLimbCount; i++)
{
int severedJointIndex = msg.ReadByte();
AnimController.SeverLimbJoint(AnimController.LimbJoints[severedJointIndex]);
}
}
else
{