Fixed a bunch of bugs when dragging characters up ladders (see e0504042). The dragging logic didn't take into account that the characters are not necessarily in the same sub, which caused the dragged character to launch away at a high speed when climbing from a sub to another (for example when climbing down to the shuttle in Aegir). The pull joint on the target's torso was never disabled, so the character stayed floating mid-air after getting off the ladders.

+ Made Limb.pullJoint private. Now it can only be accessed by properties of the Limb, and there's some error checks in place to prevent WorldAnchorB from being set to an invalid value.
This commit is contained in:
Joonas Rikkonen
2018-09-24 21:19:18 +03:00
parent bff2852cb6
commit fec7740378
8 changed files with 285 additions and 233 deletions
@@ -100,9 +100,9 @@ namespace Barotrauma
foreach (Limb limb in Limbs)
{
if (limb.pullJoint != null)
if (limb.PullJointEnabled)
{
Vector2 pos = ConvertUnits.ToDisplayUnits(limb.pullJoint.WorldAnchorA);
Vector2 pos = ConvertUnits.ToDisplayUnits(limb.PullJointWorldAnchorA);
if (currentHull != null) pos += currentHull.Submarine.DrawPosition;
pos.Y = -pos.Y;
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true, 0.01f);