(99a5e8cf8) Fix bots not using the ladders when swimming on the water surface. + merge fix

This commit is contained in:
Joonas Rikkonen
2019-04-26 11:25:41 +03:00
parent 2aec2414be
commit 46f5bd5b15
3 changed files with 6 additions and 23 deletions
@@ -223,8 +223,10 @@ namespace Barotrauma
}
}
bool isDiving = character.AnimController.InWater && character.AnimController.HeadInWater;
//only humanoids can climb ladders
if (!character.AnimController.InWater && character.AnimController is HumanoidAnimController && IsNextLadderSameAsCurrent)
if (!isDiving && character.AnimController is HumanoidAnimController && IsNextLadderSameAsCurrent)
{
if (character.SelectedConstruction != currentPath.CurrentNode.Ladders.Item &&
currentPath.CurrentNode.Ladders.Item.IsInsideTrigger(character.WorldPosition))
@@ -234,7 +236,7 @@ namespace Barotrauma
}
var collider = character.AnimController.Collider;
if (character.IsClimbing && !character.AnimController.InWater)
if (character.IsClimbing && !isDiving)
{
Vector2 diff = currentPath.CurrentNode.SimPosition - pos;
bool nextLadderSameAsCurrent = IsNextLadderSameAsCurrent;
@@ -279,7 +281,7 @@ namespace Barotrauma
else if (character.AnimController.InWater)
{
// If the character is underwater, we don't need the ladders anymore
if (character.IsClimbing)
if (character.IsClimbing && isDiving)
{
character.AnimController.Anim = AnimController.Animation.None;
character.SelectedConstruction = null;