(b0f5305f2) Unstable v0.9.10.0

This commit is contained in:
Juan Pablo Arce
2020-05-22 08:21:34 -03:00
parent 3d2b7bcf63
commit 4f8bd39789
75 changed files with 1023 additions and 407 deletions
@@ -1713,7 +1713,7 @@ namespace Barotrauma
if (holdable.ControlPose)
{
head.body.SmoothRotate(itemAngle);
head?.body.SmoothRotate(itemAngle);
if (TargetMovement == Vector2.Zero && inWater)
{
@@ -1735,13 +1735,13 @@ namespace Barotrauma
{
if (character.SelectedItems[0] == item)
{
if (rightHand.IsSevered) return;
if (rightHand == null || rightHand.IsSevered) { return; }
transformedHoldPos = rightHand.PullJointWorldAnchorA - transformedHandlePos[0];
itemAngle = (rightHand.Rotation + (holdAngle - MathHelper.PiOver2) * Dir);
}
else if (character.SelectedItems[1] == item)
{
if (leftHand.IsSevered) return;
if (leftHand == null || leftHand.IsSevered) { return; }
transformedHoldPos = leftHand.PullJointWorldAnchorA - transformedHandlePos[1];
itemAngle = (leftHand.Rotation + (holdAngle - MathHelper.PiOver2) * Dir);
}
@@ -1750,12 +1750,12 @@ namespace Barotrauma
{
if (character.SelectedItems[0] == item)
{
if (rightHand.IsSevered) return;
if (rightHand == null || rightHand.IsSevered) { return; }
rightHand.Disabled = true;
}
if (character.SelectedItems[1] == item)
{
if (leftHand.IsSevered) return;
if (leftHand == null || leftHand.IsSevered) { return; }
leftHand.Disabled = true;
}
@@ -441,7 +441,7 @@ namespace Barotrauma
{
foreach (LimbJoint joint in LimbJoints)
{
if (GameMain.World.JointList.Contains(joint)) { GameMain.World.Remove(joint); }
if (GameMain.World.JointList.Contains(joint.Joint)) { GameMain.World.Remove(joint.Joint); }
}
}
DebugConsole.Log($"Creating joints from {RagdollParams.Name}.");
@@ -526,7 +526,7 @@ namespace Barotrauma
public void AddJoint(JointParams jointParams)
{
LimbJoint joint = new LimbJoint(Limbs[jointParams.Limb1], Limbs[jointParams.Limb2], jointParams, this);
GameMain.World.Add(joint);
GameMain.World.Add(joint.Joint);
for (int i = 0; i < LimbJoints.Length; i++)
{
if (LimbJoints[i] != null) continue;
@@ -609,7 +609,7 @@ namespace Barotrauma
limb.Remove();
foreach (LimbJoint limbJoint in attachedJoints)
{
GameMain.World.Remove(limbJoint);
GameMain.World.Remove(limbJoint.Joint);
}
}
@@ -726,7 +726,7 @@ namespace Barotrauma
private readonly List<Limb> connectedLimbs = new List<Limb>();
private readonly List<LimbJoint> checkedJoints = new List<LimbJoint>();
public bool SeverLimbJoint(LimbJoint limbJoint, bool playSound = true)
public bool SeverLimbJoint(LimbJoint limbJoint)
{
if (!limbJoint.CanBeSevered || limbJoint.IsSevered)
{
@@ -750,6 +750,14 @@ namespace Barotrauma
{
if (connectedLimbs.Contains(limb)) { continue; }
limb.IsSevered = true;
if (limb.type == LimbType.RightHand)
{
character.SelectedItems[0]?.Drop(character);
}
else if (limb.type == LimbType.LeftHand)
{
character.SelectedItems[1]?.Drop(character);
}
}
SeverLimbJointProjSpecific(limbJoint, playSound: true);
@@ -1776,11 +1784,12 @@ namespace Barotrauma
if (LimbJoints != null)
{
foreach (RevoluteJoint joint in LimbJoints)
foreach (var joint in LimbJoints)
{
if (GameMain.World.JointList.Contains(joint))
var j = joint.Joint;
if (GameMain.World.JointList.Contains(j))
{
GameMain.World.Remove(joint);
GameMain.World.Remove(j);
}
}
LimbJoints = null;