Fixed server end cinematic, bugfix in submarine position syncing, CharacterIgnoreDistance bugfix, readded crew button to multiplayer, searching a path out of the sub

This commit is contained in:
Regalis
2016-01-06 20:17:41 +02:00
parent ca7febfcab
commit 48eabedb77
17 changed files with 156 additions and 57 deletions
@@ -62,10 +62,26 @@ namespace Barotrauma
if (target!=null) character.AIController.SelectTarget(target.AiTarget);
character.AIController.SteeringManager.SteeringSeek(
target != null ? target.SimPosition : targetPos);
Vector2 currTargetPos = target != null ? target.SimPosition : targetPos;
Vector2 currTargetPos = Vector2.Zero;
if (target == null)
{
currTargetPos = targetPos;
}
else
{
currTargetPos = target.SimPosition;
//if character is outside the sub and target isn't, transform the position
if (character.Submarine == null && target.Submarine != null)
{
currTargetPos += target.Submarine.SimPosition;
}
}
character.AIController.SteeringManager.SteeringSeek(currTargetPos);
if (Vector2.Distance(currTargetPos, character.SimPosition) < 1.0f)
{
character.AnimController.TargetDir = currTargetPos.X > character.SimPosition.X ? Direction.Right : Direction.Left;
+25 -6
View File
@@ -100,12 +100,22 @@ namespace Barotrauma
PathNode startNode = null;
foreach (PathNode node in nodes)
{
float dist = System.Math.Abs(start.X-node.Position.X)+
System.Math.Abs(start.Y - node.Position.Y)*10.0f +
Vector2.Distance(end,node.Position)/2.0f;
Vector2 nodePos = node.Position;
//if node waypoint is one of submarine waypoints outside the sub, transform position
if (node.Waypoint != null && node.Waypoint.Submarine != null && node.Waypoint.CurrentHull == null)
{
nodePos -= node.Waypoint.Submarine.Position;
}
float dist = System.Math.Abs(start.X-nodePos.X)+
System.Math.Abs(start.Y - nodePos.Y)*10.0f +
Vector2.Distance(end,nodePos)/2.0f;
if (dist<closestDist || startNode==null)
{
if (insideSubmarine && Submarine.CheckVisibility(start, node.Position) != null) continue;
//if searching for a path inside the sub, make sure the waypoint is visible
if (insideSubmarine && node.Waypoint.CurrentHull != null && Submarine.CheckVisibility(start, node.Waypoint.SimPosition) != null) continue;
closestDist = dist;
startNode = node;
@@ -122,10 +132,19 @@ namespace Barotrauma
PathNode endNode = null;
foreach (PathNode node in nodes)
{
float dist = Vector2.Distance(end, node.Position);
Vector2 nodePos = node.Position;
//if node waypoint is one of submarine waypoints outside the sub, transform position
if (node.Waypoint!=null && node.Waypoint.Submarine != null && node.Waypoint.CurrentHull==null)
{
nodePos -= node.Waypoint.Submarine.Position;
}
float dist = Vector2.Distance(end, nodePos);
if (dist < closestDist || endNode == null)
{
if (insideSubmarine && Submarine.CheckVisibility(end, node.Waypoint.SimPosition) != null) continue;
//if searching for a path inside the sub, make sure the waypoint is visible
if (insideSubmarine && node.Waypoint.CurrentHull!=null && Submarine.CheckVisibility(end, node.Waypoint.SimPosition) != null) continue;
closestDist = dist;
endNode = node;