(8c99939f6) Fix bots dropping from ladders if there is a non-ladder node in the path (Especially on Typhon). The distance check was incorrect, but after correcting it, I decided that it probably causes more issues than it solves. If there is one node in the path that is not in the current ladder, but the node after that is, we can just follow the path to the node that is on the ladders. Remove an unnecessary IgnorePlatforms assignment. It's handled in the HumanAIController.
This commit is contained in:
@@ -276,6 +276,9 @@ 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>
|
||||||
|
|||||||
@@ -77,8 +77,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
var node = currentPath.Nodes[index];
|
var node = currentPath.Nodes[index];
|
||||||
if (node == null) { return false; }
|
if (node == null) { return false; }
|
||||||
// Only applied if the node is close enough to the current node.
|
|
||||||
if (Vector2.DistanceSquared(currentPath.CurrentNode.WorldPosition, node.WorldPosition) > 100) { return false; }
|
|
||||||
return node.Ladders != null;
|
return node.Ladders != null;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -108,10 +106,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
var node = currentPath.Nodes[index];
|
var node = currentPath.Nodes[index];
|
||||||
if (node == null) { return false; }
|
if (node == null) { return false; }
|
||||||
// Only applied if the node is close enough to the current node.
|
|
||||||
if (Vector2.DistanceSquared(currentPath.CurrentNode.WorldPosition, node.WorldPosition) > 100) { return false; }
|
|
||||||
nextLadder = node.Ladders;
|
nextLadder = node.Ladders;
|
||||||
return nextLadder != null && nextLadder == currentLadder;
|
bool isSame = nextLadder != null && nextLadder == currentLadder;
|
||||||
|
return isSame;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -227,7 +224,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
//only humanoids can climb ladders
|
//only humanoids can climb ladders
|
||||||
if (character.AnimController is HumanoidAnimController && InLadders && IsNextLadderSameAsCurrent)
|
if (character.AnimController is HumanoidAnimController && IsNextLadderSameAsCurrent)
|
||||||
{
|
{
|
||||||
if (character.SelectedConstruction != currentPath.CurrentNode.Ladders.Item &&
|
if (character.SelectedConstruction != currentPath.CurrentNode.Ladders.Item &&
|
||||||
currentPath.CurrentNode.Ladders.Item.IsInsideTrigger(character.WorldPosition))
|
currentPath.CurrentNode.Ladders.Item.IsInsideTrigger(character.WorldPosition))
|
||||||
@@ -240,9 +237,9 @@ namespace Barotrauma
|
|||||||
if (character.IsClimbing)
|
if (character.IsClimbing)
|
||||||
{
|
{
|
||||||
Vector2 diff = currentPath.CurrentNode.SimPosition - pos;
|
Vector2 diff = currentPath.CurrentNode.SimPosition - pos;
|
||||||
bool nextLadderSamesCurrent = IsNextLadderSameAsCurrent;
|
bool nextLadderSameAsCurrent = IsNextLadderSameAsCurrent;
|
||||||
|
|
||||||
if (nextLadderSamesCurrent)
|
if (nextLadderSameAsCurrent)
|
||||||
{
|
{
|
||||||
//climbing ladders -> don't move horizontally
|
//climbing ladders -> don't move horizontally
|
||||||
diff.X = 0.0f;
|
diff.X = 0.0f;
|
||||||
@@ -257,17 +254,17 @@ namespace Barotrauma
|
|||||||
diff.Y = Math.Max(diff.Y, 1.0f);
|
diff.Y = Math.Max(diff.Y, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool aboveFloor = heightFromFloor > 0.0f && heightFromFloor < collider.height * 1.5f;
|
bool aboveFloor = heightFromFloor > 0 && heightFromFloor < collider.height * 1.5f;
|
||||||
if (aboveFloor || IsNextNodeLadder)
|
if (aboveFloor || IsNextNodeLadder)
|
||||||
{
|
{
|
||||||
if (!nextLadderSamesCurrent)
|
if (!nextLadderSameAsCurrent)
|
||||||
{
|
{
|
||||||
character.AnimController.Anim = AnimController.Animation.None;
|
character.AnimController.Anim = AnimController.Animation.None;
|
||||||
}
|
}
|
||||||
currentPath.SkipToNextNode();
|
currentPath.SkipToNextNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (nextLadderSamesCurrent)
|
else if (nextLadderSameAsCurrent)
|
||||||
{
|
{
|
||||||
//if the current node is below the character and the next one is above (or vice versa)
|
//if the current node is below the character and the next one is above (or vice versa)
|
||||||
//and both are on ladders, we can skip directly to the next one
|
//and both are on ladders, we can skip directly to the next one
|
||||||
@@ -277,8 +274,6 @@ namespace Barotrauma
|
|||||||
currentPath.SkipToNextNode();
|
currentPath.SkipToNextNode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
character.AnimController.IgnorePlatforms = false;
|
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
else if (character.AnimController.InWater)
|
else if (character.AnimController.InWater)
|
||||||
|
|||||||
@@ -145,16 +145,6 @@ 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
|
||||||
|
|||||||
Reference in New Issue
Block a user