(f832e24f5) Prevent bots jumping from too high.

This commit is contained in:
Joonas Rikkonen
2019-04-08 19:17:20 +03:00
parent 9a829206af
commit eb6e919c66
3 changed files with 15 additions and 5 deletions
@@ -276,9 +276,6 @@ namespace Barotrauma
characterInfos.Add(characterInfo); characterInfos.Add(characterInfo);
} }
characterInfos.Add(characterInfo);
}
/// <summary> /// <summary>
/// Remove the character from the crew (and crew menus). /// Remove the character from the crew (and crew menus).
/// </summary> /// </summary>
@@ -128,11 +128,14 @@ namespace Barotrauma
{ {
if (currPath.CurrentNode.SimPosition.Y < Character.AnimController.GetColliderBottom().Y) if (currPath.CurrentNode.SimPosition.Y < Character.AnimController.GetColliderBottom().Y)
{ {
ignorePlatforms = true; // Don't allow to jump from too high. The formula might require tweaking.
float allowedJumpHeight = Character.AnimController.ImpactTolerance / 2;
float height = Math.Abs(currPath.CurrentNode.SimPosition.Y - Character.SimPosition.Y);
ignorePlatforms = height < allowedJumpHeight;
} }
} }
if (Character.IsClimbing && PathSteering.InLadders && PathSteering.IsNextLadderSameAsCurrent) if (Character.IsClimbing && PathSteering.IsNextLadderSameAsCurrent)
{ {
Character.AnimController.TargetMovement = new Vector2(0.0f, Math.Sign(Character.AnimController.TargetMovement.Y)); Character.AnimController.TargetMovement = new Vector2(0.0f, Math.Sign(Character.AnimController.TargetMovement.Y));
} }
@@ -145,6 +145,16 @@ namespace Barotrauma
} }
#endif #endif
public void SetState()
{
hit = binding.IsHit();
if (hit) hitQueue = true;
held = binding.IsDown();
if (held) heldQueue = true;
}
#endif
public bool Hit public bool Hit
{ {
get get