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:
@@ -51,7 +51,7 @@ namespace Barotrauma
|
||||
get { return Vector2.Zero; }
|
||||
}
|
||||
|
||||
public Vector2 WorldPosition
|
||||
public virtual Vector2 WorldPosition
|
||||
{
|
||||
get { return Submarine == null ? Position : Submarine.Position + Position; }
|
||||
}
|
||||
|
||||
@@ -170,15 +170,14 @@ namespace Barotrauma
|
||||
InsertToList();
|
||||
}
|
||||
|
||||
public override void OnMapLoaded()
|
||||
public static void GenerateEntityGrid()
|
||||
{
|
||||
|
||||
if (entityGrid == null)
|
||||
entityGrid = new EntityGrid(Submarine.Borders, 200.0f);
|
||||
|
||||
foreach (Hull hull in hullList)
|
||||
{
|
||||
entityGrid = new EntityGrid(Submarine.Borders, 200.0f);
|
||||
entityGrid.InsertEntity(hull);
|
||||
}
|
||||
|
||||
entityGrid.InsertEntity(this);
|
||||
}
|
||||
|
||||
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++)
|
||||
{
|
||||
MapEntity e = mapEntityList[i];
|
||||
|
||||
e.OnMapLoaded();
|
||||
|
||||
if (e.Submarine != null) e.Move(Submarine.HiddenSubPosition);
|
||||
mapEntityList[i].OnMapLoaded();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -105,6 +105,14 @@ namespace Barotrauma
|
||||
get { return subBody==null ? Vector2.Zero : subBody.Position - HiddenSubPosition; }
|
||||
}
|
||||
|
||||
public override Vector2 WorldPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
return ConvertUnits.ToDisplayUnits(subBody.Position);
|
||||
}
|
||||
}
|
||||
|
||||
public bool AtEndPosition
|
||||
{
|
||||
get
|
||||
@@ -136,7 +144,7 @@ namespace Barotrauma
|
||||
return ConvertUnits.ToSimUnits(Position);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Vector2 Velocity
|
||||
{
|
||||
get { return subBody==null ? Vector2.Zero : subBody.Velocity; }
|
||||
@@ -661,6 +669,8 @@ namespace Barotrauma
|
||||
|
||||
loaded = this;
|
||||
|
||||
Hull.GenerateEntityGrid();
|
||||
|
||||
MapEntity.MapLoaded();
|
||||
|
||||
WayPoint.GenerateSubWaypoints();
|
||||
|
||||
@@ -212,20 +212,27 @@ namespace Barotrauma
|
||||
{
|
||||
if (targetPosition != null && targetPosition != Position)
|
||||
{
|
||||
Vector2 targetSimPos = ConvertUnits.ToSimUnits((Vector2)targetPosition);
|
||||
//Vector2 targetSimPos = ConvertUnits.ToSimUnits((Vector2)targetPosition);
|
||||
|
||||
float dist = Vector2.Distance((Vector2)targetPosition, Position);
|
||||
System.Diagnostics.Debug.WriteLine(targetPosition + " -> " + Position + " - " + dist);
|
||||
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;
|
||||
}
|
||||
else if (dist > 50.0f)
|
||||
{
|
||||
Vector2 moveAmount = Vector2.Normalize(targetSimPos - body.Position);
|
||||
moveAmount *= Math.Min(dist, 100.0f);
|
||||
Vector2 moveAmount = Vector2.Normalize((Vector2)targetPosition - Position);
|
||||
moveAmount *= ConvertUnits.ToSimUnits(Math.Min(dist, 100.0f));
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("moveamount: "+moveAmount);
|
||||
|
||||
body.SetTransform(body.Position + moveAmount * deltaTime, 0.0f);
|
||||
|
||||
//GameMain.GameScreen.Cam.Position += ConvertUnits.ToDisplayUnits(moveAmount);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -15,8 +15,10 @@ namespace Barotrauma
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
private float duration;
|
||||
|
||||
public TransitionCinematic(Submarine submarine, Camera cam)
|
||||
public TransitionCinematic(Submarine submarine, Camera cam, float duration)
|
||||
{
|
||||
Vector2 targetPos = submarine.Position;
|
||||
|
||||
@@ -29,6 +31,8 @@ namespace Barotrauma
|
||||
targetPos = Level.Loaded.StartPosition + Vector2.UnitY * 500.0f;
|
||||
}
|
||||
|
||||
this.duration = duration;
|
||||
|
||||
Running = true;
|
||||
CoroutineManager.StartCoroutine(UpdateTransitionCinematic(submarine, cam, targetPos));
|
||||
}
|
||||
@@ -46,7 +50,6 @@ namespace Barotrauma
|
||||
Level.Loaded.ShaftBodies[1].Enabled = false;
|
||||
|
||||
cam.TargetPos = Vector2.Zero;
|
||||
float duration = 5.0f;
|
||||
float timer = 0.0f;
|
||||
|
||||
while (timer < duration)
|
||||
|
||||
@@ -80,6 +80,8 @@ namespace Barotrauma
|
||||
|
||||
InsertToList();
|
||||
WayPointList.Add(this);
|
||||
|
||||
currentHull = Hull.FindHull(WorldPosition);
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back=true)
|
||||
@@ -472,7 +474,7 @@ namespace Barotrauma
|
||||
|
||||
public override void OnMapLoaded()
|
||||
{
|
||||
currentHull = Hull.FindHull(WorldPosition);
|
||||
currentHull = Hull.FindHull(WorldPosition, currentHull);
|
||||
}
|
||||
|
||||
public override XElement Save(XDocument doc)
|
||||
|
||||
Reference in New Issue
Block a user