Merge branch 'master' of https://gitlab.com/poe.regalis/barotrauma
This commit is contained in:
@@ -61,6 +61,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
var nodeList = nodes.Values.ToList();
|
var nodeList = nodes.Values.ToList();
|
||||||
|
nodeList.RemoveAll(n => n.connections.Count == 0);
|
||||||
foreach (PathNode node in nodeList)
|
foreach (PathNode node in nodeList)
|
||||||
{
|
{
|
||||||
node.distances = new List<float>();
|
node.distances = new List<float>();
|
||||||
@@ -69,6 +70,7 @@ namespace Barotrauma
|
|||||||
node.distances.Add(Vector2.Distance(node.position, node.connections[i].position));
|
node.distances.Add(Vector2.Distance(node.position, node.connections[i].position));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodeList;
|
return nodeList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,12 +200,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Vector2 nodePos = 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);
|
float dist = Vector2.Distance(end, nodePos);
|
||||||
if (dist < closestDist || endNode == null)
|
if (dist < closestDist || endNode == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -432,10 +432,10 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
maintainPosTickBox.Selected = false;
|
maintainPosTickBox.Selected = false;
|
||||||
posToMaintain = null;
|
posToMaintain = null;
|
||||||
|
tickBox.Selected = true;
|
||||||
|
|
||||||
UpdatePath();
|
UpdatePath();
|
||||||
|
|
||||||
tickBox.Selected = true;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -770,6 +770,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (body == null || !body.Enabled) return;
|
if (body == null || !body.Enabled) return;
|
||||||
|
|
||||||
|
System.Diagnostics.Debug.Assert(body.FarseerBody.FixtureList != null);
|
||||||
|
|
||||||
if (Math.Abs(body.LinearVelocity.X) > 0.01f || Math.Abs(body.LinearVelocity.Y) > 0.01f)
|
if (Math.Abs(body.LinearVelocity.X) > 0.01f || Math.Abs(body.LinearVelocity.Y) > 0.01f)
|
||||||
{
|
{
|
||||||
Submarine prevSub = Submarine;
|
Submarine prevSub = Submarine;
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Barotrauma
|
|||||||
public const int GridCellSize = 2000;
|
public const int GridCellSize = 2000;
|
||||||
private List<VoronoiCell>[,] cellGrid;
|
private List<VoronoiCell>[,] cellGrid;
|
||||||
|
|
||||||
private WrappingWall[,] wrappingWalls;
|
//private WrappingWall[,] wrappingWalls;
|
||||||
|
|
||||||
//private float shaftHeight;
|
//private float shaftHeight;
|
||||||
|
|
||||||
@@ -97,10 +97,10 @@ namespace Barotrauma
|
|||||||
get { return ruins; }
|
get { return ruins; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public WrappingWall[,] WrappingWalls
|
//public WrappingWall[,] WrappingWalls
|
||||||
{
|
//{
|
||||||
get { return wrappingWalls; }
|
// get { return wrappingWalls; }
|
||||||
}
|
//}
|
||||||
|
|
||||||
public string Seed
|
public string Seed
|
||||||
{
|
{
|
||||||
@@ -440,6 +440,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
renderer.PlaceSprites(generationParams.BackgroundSpriteAmount);
|
renderer.PlaceSprites(generationParams.BackgroundSpriteAmount);
|
||||||
|
|
||||||
|
/*
|
||||||
wrappingWalls = new WrappingWall[2, 2];
|
wrappingWalls = new WrappingWall[2, 2];
|
||||||
|
|
||||||
Rectangle ignoredArea = new Rectangle((int)startPosition.X, 0, (int)(endPosition.X - startPosition.X), borders.Height);
|
Rectangle ignoredArea = new Rectangle((int)startPosition.X, 0, (int)(endPosition.X - startPosition.X), borders.Height);
|
||||||
@@ -465,7 +466,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
cells.AddRange(wrappingWalls[side, i].Cells);
|
cells.AddRange(wrappingWalls[side, i].Cells);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
ShaftBody = BodyFactory.CreateEdge(GameMain.World,
|
ShaftBody = BodyFactory.CreateEdge(GameMain.World,
|
||||||
ConvertUnits.ToSimUnits(new Vector2(borders.X, 0)),
|
ConvertUnits.ToSimUnits(new Vector2(borders.X, 0)),
|
||||||
@@ -809,10 +810,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Update(float deltaTime)
|
public void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
if (Submarine.MainSub != null)
|
if (Submarine.MainSub != null)
|
||||||
{
|
{
|
||||||
WrappingWall.UpdateWallShift(Submarine.MainSub.WorldPosition, wrappingWalls);
|
WrappingWall.UpdateWallShift(Submarine.MainSub.WorldPosition, wrappingWalls);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (Hull.renderer != null)
|
if (Hull.renderer != null)
|
||||||
{
|
{
|
||||||
@@ -884,6 +886,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (wrappingWalls == null) return cells;
|
if (wrappingWalls == null) return cells;
|
||||||
|
|
||||||
for (int side = 0; side < 2; side++)
|
for (int side = 0; side < 2; side++)
|
||||||
@@ -899,7 +902,7 @@ namespace Barotrauma
|
|||||||
cells.Add(cell);
|
cells.Add(cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
return cells;
|
return cells;
|
||||||
}
|
}
|
||||||
@@ -918,6 +921,7 @@ namespace Barotrauma
|
|||||||
ruins = null;
|
ruins = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if (wrappingWalls!=null)
|
if (wrappingWalls!=null)
|
||||||
{
|
{
|
||||||
for (int side = 0; side < 2; side++)
|
for (int side = 0; side < 2; side++)
|
||||||
@@ -929,7 +933,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
wrappingWalls = null;
|
wrappingWalls = null;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
cells = null;
|
cells = null;
|
||||||
|
|||||||
@@ -219,6 +219,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(bodyVertices.VertexCount / 3.0f));
|
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(bodyVertices.VertexCount / 3.0f));
|
||||||
|
|
||||||
|
/*
|
||||||
for (int side = 0; side < 2; side++)
|
for (int side = 0; side < 2; side++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
@@ -234,7 +235,7 @@ namespace Barotrauma
|
|||||||
PrimitiveType.TriangleList, 0,
|
PrimitiveType.TriangleList, 0,
|
||||||
(int)Math.Floor(level.WrappingWalls[side, i].BodyVertices.VertexCount / 3.0f));
|
(int)Math.Floor(level.WrappingWalls[side, i].BodyVertices.VertexCount / 3.0f));
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
graphicsDevice.SetVertexBuffer(wallVertices);
|
graphicsDevice.SetVertexBuffer(wallVertices);
|
||||||
@@ -243,7 +244,7 @@ namespace Barotrauma
|
|||||||
basicEffect.CurrentTechnique = basicEffect.Techniques["BasicEffect_Texture"];
|
basicEffect.CurrentTechnique = basicEffect.Techniques["BasicEffect_Texture"];
|
||||||
basicEffect.CurrentTechnique.Passes[0].Apply();
|
basicEffect.CurrentTechnique.Passes[0].Apply();
|
||||||
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(wallVertices.VertexCount / 3.0f));
|
graphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, (int)Math.Floor(wallVertices.VertexCount / 3.0f));
|
||||||
|
/*
|
||||||
for (int side = 0; side < 2; side++)
|
for (int side = 0; side < 2; side++)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
@@ -260,7 +261,7 @@ namespace Barotrauma
|
|||||||
(int)Math.Floor(level.WrappingWalls[side, i].WallVertices.VertexCount / 3.0f));
|
(int)Math.Floor(level.WrappingWalls[side, i].WallVertices.VertexCount / 3.0f));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,13 +44,24 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
class ConvexHullList
|
class ConvexHullList
|
||||||
{
|
{
|
||||||
|
private List<ConvexHull> list;
|
||||||
|
|
||||||
public readonly Submarine Submarine;
|
public readonly Submarine Submarine;
|
||||||
public List<ConvexHull> List;
|
public List<ConvexHull> List
|
||||||
|
{
|
||||||
|
get { return list; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Debug.Assert(value != null);
|
||||||
|
Debug.Assert(!list.Contains(null));
|
||||||
|
list = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ConvexHullList(Submarine submarine)
|
public ConvexHullList(Submarine submarine)
|
||||||
{
|
{
|
||||||
Submarine = submarine;
|
Submarine = submarine;
|
||||||
List = new List<ConvexHull>();
|
list = new List<ConvexHull>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -164,15 +164,15 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
private List<ConvexHull> GetHullsInRange(Submarine sub)
|
private List<ConvexHull> GetHullsInRange(Submarine sub)
|
||||||
{
|
{
|
||||||
|
//find the current list of hulls in range
|
||||||
var chList = hullsInRange.Find(x => x.Submarine == sub);
|
var chList = hullsInRange.Find(x => x.Submarine == sub);
|
||||||
|
|
||||||
|
//not found -> create one
|
||||||
if (chList == null)
|
if (chList == null)
|
||||||
{
|
{
|
||||||
chList = new ConvexHullList(sub);
|
chList = new ConvexHullList(sub);
|
||||||
hullsInRange.Add(chList);
|
hullsInRange.Add(chList);
|
||||||
}
|
}
|
||||||
List<ConvexHull> list = chList.List;
|
|
||||||
|
|
||||||
|
|
||||||
Vector2 lightPos = position;
|
Vector2 lightPos = position;
|
||||||
if (ParentSub == null)
|
if (ParentSub == null)
|
||||||
@@ -183,15 +183,12 @@ namespace Barotrauma.Lights
|
|||||||
if (NeedsHullUpdate)
|
if (NeedsHullUpdate)
|
||||||
{
|
{
|
||||||
var fullChList = ConvexHull.HullLists.Find(x => x.Submarine == sub);
|
var fullChList = ConvexHull.HullLists.Find(x => x.Submarine == sub);
|
||||||
|
chList.List = fullChList.List.FindAll(ch => MathUtils.CircleIntersectsRectangle(lightPos, range, ch.BoundingBox));
|
||||||
list = fullChList.List.FindAll(ch => MathUtils.CircleIntersectsRectangle(lightPos, range, ch.BoundingBox));
|
|
||||||
chList.List = list;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//light is outside, convexhull inside a sub
|
//light is outside, convexhull inside a sub
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//todo: check
|
|
||||||
lightPos -= sub.Position;
|
lightPos -= sub.Position;
|
||||||
|
|
||||||
Rectangle subBorders = sub.Borders;
|
Rectangle subBorders = sub.Borders;
|
||||||
@@ -201,7 +198,7 @@ namespace Barotrauma.Lights
|
|||||||
if (!MathUtils.CircleIntersectsRectangle(lightPos, range, subBorders)) return null;
|
if (!MathUtils.CircleIntersectsRectangle(lightPos, range, subBorders)) return null;
|
||||||
|
|
||||||
var fullChList = ConvexHull.HullLists.Find(x => x.Submarine == sub);
|
var fullChList = ConvexHull.HullLists.Find(x => x.Submarine == sub);
|
||||||
list = fullChList.List.FindAll(ch => MathUtils.CircleIntersectsRectangle(lightPos, range, ch.BoundingBox));
|
chList.List = fullChList.List.FindAll(ch => MathUtils.CircleIntersectsRectangle(lightPos, range, ch.BoundingBox));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -215,15 +212,13 @@ namespace Barotrauma.Lights
|
|||||||
if (NeedsHullUpdate)
|
if (NeedsHullUpdate)
|
||||||
{
|
{
|
||||||
var fullChList = ConvexHull.HullLists.Find(x => x.Submarine == sub);
|
var fullChList = ConvexHull.HullLists.Find(x => x.Submarine == sub);
|
||||||
|
chList.List = fullChList.List.FindAll(ch => MathUtils.CircleIntersectsRectangle(lightPos, range, ch.BoundingBox));
|
||||||
list = fullChList.List.FindAll(ch => MathUtils.CircleIntersectsRectangle(lightPos, range, ch.BoundingBox));
|
|
||||||
chList.List = list;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//light and convexhull are inside different subs
|
//light and convexhull are inside different subs
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (sub.DockedTo.Contains(ParentSub) && !NeedsHullUpdate) return list;
|
if (sub.DockedTo.Contains(ParentSub) && !NeedsHullUpdate) return chList.List;
|
||||||
|
|
||||||
lightPos -= (sub.Position - ParentSub.Position);
|
lightPos -= (sub.Position - ParentSub.Position);
|
||||||
|
|
||||||
@@ -234,12 +229,11 @@ namespace Barotrauma.Lights
|
|||||||
if (!MathUtils.CircleIntersectsRectangle(lightPos, range, subBorders)) return null;
|
if (!MathUtils.CircleIntersectsRectangle(lightPos, range, subBorders)) return null;
|
||||||
|
|
||||||
var fullChList = ConvexHull.HullLists.Find(x => x.Submarine == sub);
|
var fullChList = ConvexHull.HullLists.Find(x => x.Submarine == sub);
|
||||||
list = fullChList.List.FindAll(ch => MathUtils.CircleIntersectsRectangle(lightPos, range, ch.BoundingBox));
|
chList.List = fullChList.List.FindAll(ch => MathUtils.CircleIntersectsRectangle(lightPos, range, ch.BoundingBox));
|
||||||
chList.List = list;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return chList.List;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<ConvexHull> GetHullsInRange(Vector2 position, float range, Submarine ParentSub)
|
public static List<ConvexHull> GetHullsInRange(Vector2 position, float range, Submarine ParentSub)
|
||||||
|
|||||||
@@ -243,6 +243,21 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if outside left or right edge of the level
|
||||||
|
if (Position.X < 0 || Position.X > Level.Loaded.Size.X)
|
||||||
|
{
|
||||||
|
Rectangle worldBorders = Borders;
|
||||||
|
worldBorders.Location += Position.ToPoint();
|
||||||
|
|
||||||
|
//push the sub back below the upper "barrier" of the level
|
||||||
|
if (worldBorders.Y > Level.Loaded.Size.Y)
|
||||||
|
{
|
||||||
|
Body.LinearVelocity = new Vector2(
|
||||||
|
Body.LinearVelocity.X,
|
||||||
|
Math.Min(Body.LinearVelocity.Y, ConvertUnits.ToSimUnits(Level.Loaded.Size.Y - worldBorders.Y)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------
|
//-------------------------
|
||||||
|
|
||||||
Vector2 totalForce = CalculateBuoyancy();
|
Vector2 totalForce = CalculateBuoyancy();
|
||||||
|
|||||||
@@ -416,6 +416,7 @@ namespace Barotrauma.Networking
|
|||||||
bool myCharacter = i >= clients.Count;
|
bool myCharacter = i >= clients.Count;
|
||||||
|
|
||||||
var character = Character.Create(characterInfos[i], shuttleSpawnPoints[i].WorldPosition, !myCharacter, false);
|
var character = Character.Create(characterInfos[i], shuttleSpawnPoints[i].WorldPosition, !myCharacter, false);
|
||||||
|
character.TeamID = 1;
|
||||||
|
|
||||||
if (myCharacter)
|
if (myCharacter)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user