- projectiles don't stick to colliders

- fixed impacts weaker than the damage threshold giving characters health
- possible to slide down ladders
- improved IndoorsSteeringManager ladder climbing logic
This commit is contained in:
Regalis
2016-10-17 17:41:41 +03:00
parent efcc466fdd
commit 0cafc674dd
6 changed files with 46 additions and 32 deletions
@@ -90,7 +90,9 @@ namespace Barotrauma
var collider = character.AnimController.Collider;
//if not in water and the waypoint is between the top and bottom of the collider, no need to move vertically
if (!character.AnimController.InWater && diff.Y < collider.height / 2 + collider.radius)
if (!character.AnimController.InWater &&
character.AnimController.Anim != AnimController.Animation.Climbing &&
diff.Y < collider.height / 2 + collider.radius)
{
diff.Y = 0.0f;
}
@@ -162,20 +164,31 @@ namespace Barotrauma
if (character.AnimController.Anim == AnimController.Animation.Climbing)
{
float x = currentPath.CurrentNode.SimPosition.X - pos.X;
float y = (currentPath.CurrentNode.SimPosition.Y) - pos.Y;
Vector2 diff = currentPath.CurrentNode.SimPosition - pos;
if (Math.Abs(x) < Math.Abs(y) * 10.0f)
if (currentPath.CurrentNode.Ladders != null)
{
x = 0.0f;
}
else if (hull != null)
{
if (character.AnimController.GetColliderBottom().Y < hull.Rect.Y - hull.Rect.Height + 10.0f) x = 0.0f;
//climbing ladders -> don't move horizontally
diff.X = 0.0f;
//at the same height as the waypoint
if (currentPath.CurrentNode.SimPosition.Y > colliderBottom.Y &&
currentPath.CurrentNode.SimPosition.Y < colliderBottom.Y + collider.height + collider.radius * 2)
{
float heightFromFloor = character.AnimController.GetColliderBottom().Y - character.AnimController.FloorY;
//we can safely skip to the next waypoint if the character is at a safe height above the floor,
//or if the next waypoint in the path is also on ladders
if ((heightFromFloor > 0.0f && heightFromFloor < collider.height) ||
(currentPath.NextNode != null && currentPath.NextNode.Ladders != null))
{
currentPath.SkipToNextNode();
}
}
}
character.AnimController.IgnorePlatforms = false;
return new Vector2(x,y);
return diff;
}
return currentPath.CurrentNode.SimPosition - pos;
@@ -172,7 +172,7 @@ namespace Barotrauma
start, node.Waypoint.SimPosition, null,
Physics.CollisionWall | Physics.CollisionLevel | Physics.CollisionStairs | Physics.CollisionPlatform);
if (body != null && body.UserData is Structure) continue;
if (body != null && body.UserData is Structure && !((Structure)body.UserData).IsPlatform) continue;
}
closestDist = dist;