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:
@@ -62,10 +62,26 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (target!=null) character.AIController.SelectTarget(target.AiTarget);
|
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)
|
if (Vector2.Distance(currTargetPos, character.SimPosition) < 1.0f)
|
||||||
{
|
{
|
||||||
character.AnimController.TargetDir = currTargetPos.X > character.SimPosition.X ? Direction.Right : Direction.Left;
|
character.AnimController.TargetDir = currTargetPos.X > character.SimPosition.X ? Direction.Right : Direction.Left;
|
||||||
|
|||||||
@@ -100,12 +100,22 @@ namespace Barotrauma
|
|||||||
PathNode startNode = null;
|
PathNode startNode = null;
|
||||||
foreach (PathNode node in nodes)
|
foreach (PathNode node in nodes)
|
||||||
{
|
{
|
||||||
float dist = System.Math.Abs(start.X-node.Position.X)+
|
Vector2 nodePos = node.Position;
|
||||||
System.Math.Abs(start.Y - node.Position.Y)*10.0f +
|
|
||||||
Vector2.Distance(end,node.Position)/2.0f;
|
//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 (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;
|
closestDist = dist;
|
||||||
startNode = node;
|
startNode = node;
|
||||||
@@ -122,10 +132,19 @@ namespace Barotrauma
|
|||||||
PathNode endNode = null;
|
PathNode endNode = null;
|
||||||
foreach (PathNode node in nodes)
|
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 (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;
|
closestDist = dist;
|
||||||
endNode = node;
|
endNode = node;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace Barotrauma
|
|||||||
//{
|
//{
|
||||||
//if (RefLimb.ignoreCollisions) continue;
|
//if (RefLimb.ignoreCollisions) continue;
|
||||||
|
|
||||||
if ((AnimController.RefLimb.SimPosition - Submarine.Loaded.SimPosition).Length() > NetConfig.CharacterIgnoreDistance) return false;
|
//if ((AnimController.RefLimb.SimPosition - Submarine.Loaded.SimPosition).Length() > NetConfig.CharacterIgnoreDistance) return false;
|
||||||
|
|
||||||
message.Write(AnimController.RefLimb.SimPosition.X);
|
message.Write(AnimController.RefLimb.SimPosition.X);
|
||||||
message.Write(AnimController.RefLimb.SimPosition.Y);
|
message.Write(AnimController.RefLimb.SimPosition.Y);
|
||||||
@@ -94,15 +94,15 @@ namespace Barotrauma
|
|||||||
aiController.FillNetworkData(message);
|
aiController.FillNetworkData(message);
|
||||||
return true;
|
return true;
|
||||||
case NetworkEventType.EntityUpdate:
|
case NetworkEventType.EntityUpdate:
|
||||||
if (Submarine == null)
|
//if (Submarine == null)
|
||||||
{
|
//{
|
||||||
if ((AnimController.RefLimb.SimPosition - Submarine.Loaded.SimPosition).Length() > NetConfig.CharacterIgnoreDistance) return false;
|
// if ((AnimController.RefLimb.SimPosition - Submarine.Loaded.SimPosition).Length() > NetConfig.CharacterIgnoreDistance) return false;
|
||||||
|
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
if (AnimController.RefLimb.SimPosition.Length() > NetConfig.CharacterIgnoreDistance) return false;
|
// if (AnimController.RefLimb.SimPosition.Length() > NetConfig.CharacterIgnoreDistance) return false;
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
message.Write(AnimController.TargetDir == Direction.Right);
|
message.Write(AnimController.TargetDir == Direction.Right);
|
||||||
|
|||||||
@@ -11,9 +11,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private Character monster;
|
private Character monster;
|
||||||
|
|
||||||
|
private Vector2 radarPosition;
|
||||||
|
|
||||||
public override Vector2 RadarPosition
|
public override Vector2 RadarPosition
|
||||||
{
|
{
|
||||||
get { return monster.Position; }
|
get { return radarPosition; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public MonsterMission(XElement element)
|
public MonsterMission(XElement element)
|
||||||
@@ -27,6 +29,7 @@ namespace Barotrauma
|
|||||||
Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)];
|
Vector2 position = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)];
|
||||||
|
|
||||||
monster = Character.Create(monsterFile, position);
|
monster = Character.Create(monsterFile, position);
|
||||||
|
radarPosition = monster.Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
@@ -34,6 +37,8 @@ namespace Barotrauma
|
|||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
if (monster.Enabled) radarPosition = monster.Position;
|
||||||
|
|
||||||
if (!monster.IsDead) return;
|
if (!monster.IsDead) return;
|
||||||
ShowMessage(state);
|
ShowMessage(state);
|
||||||
state = 1;
|
state = 1;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
@@ -225,7 +226,7 @@ namespace Barotrauma
|
|||||||
AddCharacter(character);
|
AddCharacter(character);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (characters.Count > 0) SelectCharacter(null, characters[0]);
|
if (characters.Any()) listBox.Select(0);// SelectCharacter(null, characters[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EndShift()
|
public void EndShift()
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
isRunning = false;
|
isRunning = false;
|
||||||
|
|
||||||
var cinematic = new TransitionCinematic(Submarine.Loaded, GameMain.GameScreen.Cam);
|
var cinematic = new TransitionCinematic(Submarine.Loaded, GameMain.GameScreen.Cam, 5.0f);
|
||||||
|
|
||||||
SoundPlayer.OverrideMusicType = CrewManager.characters.Any(c => !c.IsDead) ? "endshift" : "crewdead";
|
SoundPlayer.OverrideMusicType = CrewManager.characters.Any(c => !c.IsDead) ? "endshift" : "crewdead";
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace Barotrauma
|
|||||||
get { return Vector2.Zero; }
|
get { return Vector2.Zero; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 WorldPosition
|
public virtual Vector2 WorldPosition
|
||||||
{
|
{
|
||||||
get { return Submarine == null ? Position : Submarine.Position + Position; }
|
get { return Submarine == null ? Position : Submarine.Position + Position; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,15 +170,14 @@ namespace Barotrauma
|
|||||||
InsertToList();
|
InsertToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnMapLoaded()
|
public static void GenerateEntityGrid()
|
||||||
{
|
{
|
||||||
|
entityGrid = new EntityGrid(Submarine.Borders, 200.0f);
|
||||||
if (entityGrid == null)
|
|
||||||
|
foreach (Hull hull in hullList)
|
||||||
{
|
{
|
||||||
entityGrid = new EntityGrid(Submarine.Borders, 200.0f);
|
entityGrid.InsertEntity(hull);
|
||||||
}
|
}
|
||||||
|
|
||||||
entityGrid.InsertEntity(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Contains(Vector2 position)
|
public override bool Contains(Vector2 position)
|
||||||
|
|||||||
@@ -499,13 +499,14 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < mapEntityList.Count; i++)
|
||||||
|
{
|
||||||
|
if (mapEntityList[i].Submarine != null) mapEntityList[i].Move(Submarine.HiddenSubPosition);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i<mapEntityList.Count; i++)
|
for (int i = 0; i<mapEntityList.Count; i++)
|
||||||
{
|
{
|
||||||
MapEntity e = mapEntityList[i];
|
mapEntityList[i].OnMapLoaded();
|
||||||
|
|
||||||
e.OnMapLoaded();
|
|
||||||
|
|
||||||
if (e.Submarine != null) e.Move(Submarine.HiddenSubPosition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -105,6 +105,14 @@ namespace Barotrauma
|
|||||||
get { return subBody==null ? Vector2.Zero : subBody.Position - HiddenSubPosition; }
|
get { return subBody==null ? Vector2.Zero : subBody.Position - HiddenSubPosition; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Vector2 WorldPosition
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return ConvertUnits.ToDisplayUnits(subBody.Position);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool AtEndPosition
|
public bool AtEndPosition
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -136,7 +144,7 @@ namespace Barotrauma
|
|||||||
return ConvertUnits.ToSimUnits(Position);
|
return ConvertUnits.ToSimUnits(Position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector2 Velocity
|
public Vector2 Velocity
|
||||||
{
|
{
|
||||||
get { return subBody==null ? Vector2.Zero : subBody.Velocity; }
|
get { return subBody==null ? Vector2.Zero : subBody.Velocity; }
|
||||||
@@ -661,6 +669,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
loaded = this;
|
loaded = this;
|
||||||
|
|
||||||
|
Hull.GenerateEntityGrid();
|
||||||
|
|
||||||
MapEntity.MapLoaded();
|
MapEntity.MapLoaded();
|
||||||
|
|
||||||
WayPoint.GenerateSubWaypoints();
|
WayPoint.GenerateSubWaypoints();
|
||||||
|
|||||||
@@ -212,20 +212,27 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (targetPosition != null && targetPosition != Position)
|
if (targetPosition != null && targetPosition != Position)
|
||||||
{
|
{
|
||||||
Vector2 targetSimPos = ConvertUnits.ToSimUnits((Vector2)targetPosition);
|
//Vector2 targetSimPos = ConvertUnits.ToSimUnits((Vector2)targetPosition);
|
||||||
|
|
||||||
float dist = Vector2.Distance((Vector2)targetPosition, Position);
|
float dist = Vector2.Distance((Vector2)targetPosition, Position);
|
||||||
|
System.Diagnostics.Debug.WriteLine(targetPosition + " -> " + Position + " - " + dist);
|
||||||
if (dist > 1000.0f)
|
if (dist > 1000.0f)
|
||||||
{
|
{
|
||||||
body.SetTransform(targetSimPos, 0.0f);
|
body.SetTransform(ConvertUnits.ToSimUnits((Vector2)targetPosition), 0.0f);
|
||||||
|
|
||||||
|
GameMain.GameScreen.Cam.Position = submarine.Position + Submarine.HiddenSubPosition;
|
||||||
targetPosition = null;
|
targetPosition = null;
|
||||||
}
|
}
|
||||||
else if (dist > 50.0f)
|
else if (dist > 50.0f)
|
||||||
{
|
{
|
||||||
Vector2 moveAmount = Vector2.Normalize(targetSimPos - body.Position);
|
Vector2 moveAmount = Vector2.Normalize((Vector2)targetPosition - Position);
|
||||||
moveAmount *= Math.Min(dist, 100.0f);
|
moveAmount *= ConvertUnits.ToSimUnits(Math.Min(dist, 100.0f));
|
||||||
|
|
||||||
|
System.Diagnostics.Debug.WriteLine("moveamount: "+moveAmount);
|
||||||
|
|
||||||
body.SetTransform(body.Position + moveAmount * deltaTime, 0.0f);
|
body.SetTransform(body.Position + moveAmount * deltaTime, 0.0f);
|
||||||
|
|
||||||
|
//GameMain.GameScreen.Cam.Position += ConvertUnits.ToDisplayUnits(moveAmount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,8 +15,10 @@ namespace Barotrauma
|
|||||||
get;
|
get;
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float duration;
|
||||||
|
|
||||||
public TransitionCinematic(Submarine submarine, Camera cam)
|
public TransitionCinematic(Submarine submarine, Camera cam, float duration)
|
||||||
{
|
{
|
||||||
Vector2 targetPos = submarine.Position;
|
Vector2 targetPos = submarine.Position;
|
||||||
|
|
||||||
@@ -29,6 +31,8 @@ namespace Barotrauma
|
|||||||
targetPos = Level.Loaded.StartPosition + Vector2.UnitY * 500.0f;
|
targetPos = Level.Loaded.StartPosition + Vector2.UnitY * 500.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.duration = duration;
|
||||||
|
|
||||||
Running = true;
|
Running = true;
|
||||||
CoroutineManager.StartCoroutine(UpdateTransitionCinematic(submarine, cam, targetPos));
|
CoroutineManager.StartCoroutine(UpdateTransitionCinematic(submarine, cam, targetPos));
|
||||||
}
|
}
|
||||||
@@ -46,7 +50,6 @@ namespace Barotrauma
|
|||||||
Level.Loaded.ShaftBodies[1].Enabled = false;
|
Level.Loaded.ShaftBodies[1].Enabled = false;
|
||||||
|
|
||||||
cam.TargetPos = Vector2.Zero;
|
cam.TargetPos = Vector2.Zero;
|
||||||
float duration = 5.0f;
|
|
||||||
float timer = 0.0f;
|
float timer = 0.0f;
|
||||||
|
|
||||||
while (timer < duration)
|
while (timer < duration)
|
||||||
|
|||||||
@@ -80,6 +80,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
InsertToList();
|
InsertToList();
|
||||||
WayPointList.Add(this);
|
WayPointList.Add(this);
|
||||||
|
|
||||||
|
currentHull = Hull.FindHull(WorldPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back=true)
|
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back=true)
|
||||||
@@ -472,7 +474,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override void OnMapLoaded()
|
public override void OnMapLoaded()
|
||||||
{
|
{
|
||||||
currentHull = Hull.FindHull(WorldPosition);
|
currentHull = Hull.FindHull(WorldPosition, currentHull);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override XElement Save(XDocument doc)
|
public override XElement Save(XDocument doc)
|
||||||
|
|||||||
@@ -596,27 +596,51 @@ namespace Barotrauma.Networking
|
|||||||
Character.Controlled = null;
|
Character.Controlled = null;
|
||||||
GameMain.LightManager.LosEnabled = false;
|
GameMain.LightManager.LosEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
float endPreviewLength = 10.0f;
|
float endPreviewLength = 10.0f;
|
||||||
|
|
||||||
DateTime endTime = DateTime.Now + new TimeSpan(0,0,0,0,(int)(1000.0f*endPreviewLength));
|
var cinematic = new TransitionCinematic(Submarine.Loaded, GameMain.GameScreen.Cam, endPreviewLength);
|
||||||
|
|
||||||
float secondsLeft = endPreviewLength;
|
float secondsLeft = endPreviewLength;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
secondsLeft = (float)(endTime - DateTime.Now).TotalSeconds;
|
secondsLeft -= CoroutineManager.DeltaTime;
|
||||||
|
|
||||||
float camAngle = (float)((DateTime.Now - endTime).TotalSeconds / endPreviewLength) * MathHelper.TwoPi;
|
//float camAngle = (float)((DateTime.Now - endTime).TotalSeconds / endPreviewLength) * MathHelper.TwoPi;
|
||||||
Vector2 offset = (new Vector2(
|
//Vector2 offset = (new Vector2(
|
||||||
(float)Math.Cos(camAngle) * (Submarine.Borders.Width / 2.0f),
|
// (float)Math.Cos(camAngle) * (Submarine.Borders.Width / 2.0f),
|
||||||
(float)Math.Sin(camAngle) * (Submarine.Borders.Height / 2.0f)));
|
// (float)Math.Sin(camAngle) * (Submarine.Borders.Height / 2.0f)));
|
||||||
|
|
||||||
GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.DrawPosition + offset * 0.8f;
|
//GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.Position + offset * 0.8f;
|
||||||
//Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
|
//Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
|
||||||
|
|
||||||
messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s";
|
messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s";
|
||||||
|
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
} while (secondsLeft > 0.0f);
|
} while (secondsLeft > 0.0f);
|
||||||
|
|
||||||
|
//float endPreviewLength = 10.0f;
|
||||||
|
|
||||||
|
//DateTime endTime = DateTime.Now + new TimeSpan(0,0,0,0,(int)(1000.0f*endPreviewLength));
|
||||||
|
//float secondsLeft = endPreviewLength;
|
||||||
|
|
||||||
|
//do
|
||||||
|
//{
|
||||||
|
// secondsLeft = (float)(endTime - DateTime.Now).TotalSeconds;
|
||||||
|
|
||||||
|
// float camAngle = (float)((DateTime.Now - endTime).TotalSeconds / endPreviewLength) * MathHelper.TwoPi;
|
||||||
|
// Vector2 offset = (new Vector2(
|
||||||
|
// (float)Math.Cos(camAngle) * (Submarine.Borders.Width / 2.0f),
|
||||||
|
// (float)Math.Sin(camAngle) * (Submarine.Borders.Height / 2.0f)));
|
||||||
|
|
||||||
|
// GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.DrawPosition + offset * 0.8f;
|
||||||
|
// //Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
|
||||||
|
|
||||||
|
// messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s";
|
||||||
|
// yield return CoroutineStatus.Running;
|
||||||
|
//} while (secondsLeft > 0.0f);
|
||||||
|
|
||||||
messageBox.Close(null,null);
|
messageBox.Close(null,null);
|
||||||
|
|
||||||
Submarine.Unload();
|
Submarine.Unload();
|
||||||
|
|||||||
@@ -288,7 +288,9 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
if (!(c is AICharacter) || c.IsDead) continue;
|
if (!(c is AICharacter) || c.IsDead) continue;
|
||||||
|
|
||||||
if (c.SimPosition.Length() > NetConfig.CharacterIgnoreDistance) continue;
|
Vector2 diff = Submarine.Loaded.WorldPosition - c.WorldPosition;
|
||||||
|
|
||||||
|
if (FarseerPhysics.ConvertUnits.ToSimUnits(diff.Length()) > NetConfig.CharacterIgnoreDistance) continue;
|
||||||
|
|
||||||
new NetworkEvent(NetworkEventType.EntityUpdate, c.ID, false);
|
new NetworkEvent(NetworkEventType.EntityUpdate, c.ID, false);
|
||||||
}
|
}
|
||||||
@@ -318,7 +320,12 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
if (c.IsDead) continue;
|
if (c.IsDead) continue;
|
||||||
|
|
||||||
if (c is AICharacter && c.SimPosition.Length() > NetConfig.CharacterIgnoreDistance) continue;
|
if (c is AICharacter)
|
||||||
|
{
|
||||||
|
Vector2 diff = c.WorldPosition - Submarine.Loaded.WorldPosition;
|
||||||
|
|
||||||
|
if (FarseerPhysics.ConvertUnits.ToSimUnits(diff.Length()) > NetConfig.CharacterIgnoreDistance) continue;
|
||||||
|
}
|
||||||
|
|
||||||
new NetworkEvent(NetworkEventType.ImportantEntityUpdate, c.ID, false);
|
new NetworkEvent(NetworkEventType.ImportantEntityUpdate, c.ID, false);
|
||||||
}
|
}
|
||||||
@@ -870,19 +877,20 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
float endPreviewLength = 10.0f;
|
float endPreviewLength = 10.0f;
|
||||||
|
|
||||||
DateTime endTime = DateTime.Now + new TimeSpan(0, 0, 0, 0, (int)(1000.0f * endPreviewLength));
|
var cinematic = new TransitionCinematic(Submarine.Loaded, GameMain.GameScreen.Cam, endPreviewLength);
|
||||||
|
|
||||||
float secondsLeft = endPreviewLength;
|
float secondsLeft = endPreviewLength;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
secondsLeft = (float)(endTime - DateTime.Now).TotalSeconds;
|
secondsLeft -= CoroutineManager.DeltaTime;
|
||||||
|
|
||||||
float camAngle = (float)((DateTime.Now - endTime).TotalSeconds / endPreviewLength) * MathHelper.TwoPi;
|
//float camAngle = (float)((DateTime.Now - endTime).TotalSeconds / endPreviewLength) * MathHelper.TwoPi;
|
||||||
Vector2 offset = (new Vector2(
|
//Vector2 offset = (new Vector2(
|
||||||
(float)Math.Cos(camAngle) * (Submarine.Borders.Width / 2.0f),
|
// (float)Math.Cos(camAngle) * (Submarine.Borders.Width / 2.0f),
|
||||||
(float)Math.Sin(camAngle) * (Submarine.Borders.Height / 2.0f)));
|
// (float)Math.Sin(camAngle) * (Submarine.Borders.Height / 2.0f)));
|
||||||
|
|
||||||
GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.Position + offset * 0.8f;
|
//GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.Position + offset * 0.8f;
|
||||||
//Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
|
//Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
|
||||||
|
|
||||||
messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s";
|
messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s";
|
||||||
|
|||||||
@@ -206,6 +206,8 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
inGameHUD.Update(deltaTime);
|
inGameHUD.Update(deltaTime);
|
||||||
|
|
||||||
|
GameMain.GameSession.CrewManager.Update(deltaTime);
|
||||||
|
|
||||||
//if (crewFrameOpen) crewFrame.Update(deltaTime);
|
//if (crewFrameOpen) crewFrame.Update(deltaTime);
|
||||||
|
|
||||||
if (Character.Controlled == null || Character.Controlled.IsDead)
|
if (Character.Controlled == null || Character.Controlled.IsDead)
|
||||||
@@ -233,6 +235,8 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
if (!gameStarted || Screen.Selected != GameMain.GameScreen) return;
|
if (!gameStarted || Screen.Selected != GameMain.GameScreen) return;
|
||||||
|
|
||||||
|
GameMain.GameSession.CrewManager.Draw(spriteBatch);
|
||||||
|
|
||||||
inGameHUD.Draw(spriteBatch);
|
inGameHUD.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user