- Fixed creatures being able to sever non-severable limb joints (which caused syncing issues when the waist->torso joint of a humanoid was severed).

- The server creates an entity event when a joint is severed.
- Made joints severable by default.
This commit is contained in:
Joonas Rikkonen
2017-09-21 17:50:24 +03:00
parent dd86b5745a
commit 8c3c689596
6 changed files with 26 additions and 8 deletions
@@ -1,4 +1,5 @@
using FarseerPhysics;
using Barotrauma.Networking;
using FarseerPhysics;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Dynamics.Contacts;
using FarseerPhysics.Dynamics.Joints;
@@ -388,7 +389,7 @@ namespace Barotrauma
limb2Pos = ConvertUnits.ToSimUnits(limb2Pos);
LimbJoint joint = new LimbJoint(Limbs[limb1ID], Limbs[limb2ID], limb1Pos, limb2Pos);
joint.CanBeSevered = ToolBox.GetAttributeBool(subElement, "canbesevered", false);
joint.CanBeSevered = ToolBox.GetAttributeBool(subElement, "canbesevered", true);
if (subElement.Attribute("lowerlimit") != null)
{
@@ -522,6 +523,11 @@ namespace Barotrauma
public void SeverLimbJoint(LimbJoint limbJoint)
{
if (!limbJoint.CanBeSevered)
{
return;
}
limbJoint.IsSevered = true;
limbJoint.Enabled = false;
@@ -536,6 +542,11 @@ namespace Barotrauma
limb.IsSevered = true;
}
}
if (GameMain.Server != null)
{
GameMain.Server.CreateEntityEvent(character, new object[] { NetEntityEvent.Type.Status });
}
}
private void GetConnectedLimbs(List<Limb> connectedLimbs, List<LimbJoint> checkedJoints, Limb limb)