fixed railgun, fixed repairtools radar ping & improved rendering, waypoint bugfixes, inventory bugfixes, syncing wires between clients
This commit is contained in:
@@ -74,7 +74,7 @@ namespace Subsurface
|
||||
|
||||
public Vector2 Position
|
||||
{
|
||||
get { return ConvertUnits.ToDisplayUnits(cells[1].body.Position); }
|
||||
get { return ConvertUnits.ToDisplayUnits(cells[0].body.Position); }
|
||||
}
|
||||
|
||||
public string Seed
|
||||
@@ -546,11 +546,10 @@ int currentTargetIndex = 1;
|
||||
List<Vector2> tempVertices = new List<Vector2>();
|
||||
List<Vector2> bodyPoints = new List<Vector2>();
|
||||
|
||||
int n = 0;
|
||||
foreach (VoronoiCell cell in cells)
|
||||
for (int n = cells.Count - 1; n >= 0; n-- )
|
||||
{
|
||||
n = (n + 30) % 255;
|
||||
|
||||
VoronoiCell cell = cells[n];
|
||||
|
||||
bodyPoints.Clear();
|
||||
tempVertices.Clear();
|
||||
foreach (GraphEdge ge in cell.edges)
|
||||
@@ -568,14 +567,18 @@ int currentTargetIndex = 1;
|
||||
if (!bodyPoints.Contains(ge.point2)) bodyPoints.Add(ge.point2);
|
||||
}
|
||||
|
||||
if (tempVertices.Count < 3) continue;
|
||||
if (tempVertices.Count < 3 || bodyPoints.Count < 2)
|
||||
{
|
||||
cells.RemoveAt(n);
|
||||
continue;
|
||||
}
|
||||
|
||||
var triangles = MathUtils.TriangulateConvexHull(tempVertices, cell.Center);
|
||||
for (int i = 0; i < triangles.Count; i++ )
|
||||
for (int i = 0; i < triangles.Count; i++)
|
||||
{
|
||||
foreach (Vector2 vertex in triangles[i])
|
||||
{
|
||||
verticeList.Add(new VertexPositionColor(new Vector3(vertex, 0.0f), new Color(n,(n*2)%255,(n*3)%255)*0.5f));
|
||||
verticeList.Add(new VertexPositionColor(new Vector3(vertex, 0.0f), new Color(n*30, (n * 60) % 255, (n * 90) % 255) * 0.5f));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,7 +587,7 @@ int currentTargetIndex = 1;
|
||||
|
||||
if (bodyPoints.Count < 3)
|
||||
{
|
||||
foreach(Vector2 vertex in tempVertices)
|
||||
foreach (Vector2 vertex in tempVertices)
|
||||
{
|
||||
if (bodyPoints.Contains(vertex)) continue;
|
||||
bodyPoints.Add(vertex);
|
||||
@@ -608,7 +611,7 @@ int currentTargetIndex = 1;
|
||||
if (triangles[i][0].X == triangles[i][1].X && triangles[i][0].X == triangles[i][2].X) continue;
|
||||
|
||||
Vertices bodyVertices = new Vertices(triangles[i]);
|
||||
FixtureFactory.AttachPolygon(bodyVertices, 5.0f, edgeBody);
|
||||
FixtureFactory.AttachPolygon(bodyVertices, 5.0f, edgeBody);
|
||||
}
|
||||
|
||||
edgeBody.UserData = cell;
|
||||
@@ -655,8 +658,8 @@ int currentTargetIndex = 1;
|
||||
Item item = mapEntity as Item;
|
||||
if (item == null)
|
||||
{
|
||||
if (!mapEntity.MoveWithLevel) continue;
|
||||
mapEntity.Move(amount);
|
||||
//if (!mapEntity.MoveWithLevel) continue;
|
||||
//mapEntity.Move(amount);
|
||||
}
|
||||
else if (item.body != null)
|
||||
{
|
||||
@@ -692,8 +695,8 @@ int currentTargetIndex = 1;
|
||||
Item item = mapEntity as Item;
|
||||
if (item == null)
|
||||
{
|
||||
if (!mapEntity.MoveWithLevel) continue;
|
||||
mapEntity.Move(velocity);
|
||||
//if (!mapEntity.MoveWithLevel) continue;
|
||||
//mapEntity.Move(velocity);
|
||||
}
|
||||
else if (item.body!=null)
|
||||
{
|
||||
|
||||
@@ -61,13 +61,16 @@ namespace Subsurface
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public Vector2 Position
|
||||
public virtual Vector2 Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Vector2(
|
||||
Vector2 rectPos = new Vector2(
|
||||
rect.X + rect.Width / 2.0f,
|
||||
rect.Y - rect.Height / 2.0f);
|
||||
|
||||
if (MoveWithLevel) rectPos += Level.Loaded.Position;
|
||||
return rectPos;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+11
-15
@@ -40,7 +40,6 @@ namespace Subsurface
|
||||
Vector2 speed;
|
||||
|
||||
Vector2 targetPosition;
|
||||
Vector2 targetSpeed;
|
||||
|
||||
private Rectangle borders;
|
||||
|
||||
@@ -417,7 +416,7 @@ namespace Subsurface
|
||||
|
||||
if (targetPosition != Vector2.Zero && Vector2.Distance(targetPosition, Position) > 5.0f)
|
||||
{
|
||||
translateAmount += (targetPosition - Position) * 0.05f;
|
||||
translateAmount += (targetPosition - Position) * 0.01f;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -583,6 +582,7 @@ namespace Subsurface
|
||||
return;
|
||||
}
|
||||
|
||||
newTargetPosition = newTargetPosition + newSpeed * (float)(NetTime.Now - sendingTime);
|
||||
|
||||
targetPosition = newTargetPosition;
|
||||
speed = newSpeed;
|
||||
@@ -818,20 +818,16 @@ namespace Subsurface
|
||||
hullBody.GravityScale = 0.0f;
|
||||
hullBody.OnCollision += OnCollision;
|
||||
hullBody.OnSeparation += OnSeparation;
|
||||
//body.IsSensor = true;
|
||||
|
||||
//body.SetTransform();
|
||||
|
||||
//HullBody hullBody = new HullBody();
|
||||
//hullBody.body = body;
|
||||
////hullBody.shapeTexture = GUI.CreateRectangle(borders.Width, borders.Height);
|
||||
|
||||
//hullBodies = new List<HullBody>();
|
||||
//hullBodies.Add(hullBody);
|
||||
|
||||
|
||||
MapEntity.LinkAll();
|
||||
|
||||
|
||||
|
||||
foreach (Item item in Item.itemList)
|
||||
{
|
||||
foreach (ItemComponent ic in item.components)
|
||||
{
|
||||
ic.OnMapLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
ID = int.MaxValue-10;
|
||||
|
||||
|
||||
@@ -42,11 +42,6 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
|
||||
public override Vector2 SimPosition
|
||||
{
|
||||
get { return ConvertUnits.ToSimUnits(new Vector2(rect.X, rect.Y)); }
|
||||
}
|
||||
|
||||
public WayPoint(Rectangle newRect)
|
||||
{
|
||||
rect = newRect;
|
||||
@@ -61,14 +56,16 @@ namespace Subsurface
|
||||
{
|
||||
//if (!editing) return;
|
||||
|
||||
Point pos = new Point((int)Position.X, (int)Position.Y);
|
||||
|
||||
Color clr = (isSelected) ? Color.Red : Color.LightGreen;
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(rect.X, -rect.Y, rect.Width, rect.Height), clr, true);
|
||||
GUI.DrawRectangle(spriteBatch, new Rectangle(pos.X, -pos.Y, rect.Width, rect.Height), clr, true);
|
||||
|
||||
foreach (MapEntity e in linkedTo)
|
||||
{
|
||||
GUI.DrawLine(spriteBatch,
|
||||
new Vector2(rect.X + rect.Width / 2, -rect.Y + rect.Height / 2),
|
||||
new Vector2(e.Rect.X + e.Rect.Width / 2, -e.Rect.Y + e.Rect.Height / 2),
|
||||
new Vector2(pos.X, -pos.Y),
|
||||
new Vector2(e.Position.X + e.Rect.Width / 2, -e.Position.Y + e.Rect.Height / 2),
|
||||
Color.Green);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user