Make Saltern driveable (#4257)

* Broadphase refactor (content)

* Shuttle jank

* Fixes

* Testing jank

* Features and things

* Balance stuffsies

* AHHHHHHHHHHHHHHHH

* Mass and stuff working

* Fix drops

* Another balance pass

* Balance AGEN

* Add in stuff for rotating shuttles for debugging

* Nothing to see here

* Testbed stuffsies

* Fix some tests

* Fixen test

* Try fixing map

* Shuttle movement balance pass

* lasaggne

* Basic Helmsman console working

* Slight docking cleanup

* Helmsman requires power

* Basic shuttle test

* Stuff

* Fix computations

* Add shuttle console to saltern

* Rename helmsman to shuttleconsole

* Final stretch

* More tweaks

* Fix piloting prediction for now.
This commit is contained in:
metalgearsloth
2021-07-21 21:15:12 +10:00
committed by GitHub
parent 55087a6f16
commit 500b9cb1ea
44 changed files with 1042 additions and 1601 deletions

View File

@@ -50,7 +50,7 @@ namespace Content.Server.Physics
public class TestbedCommand : IConsoleCommand
{
public string Command => "testbed";
public string Description => "Loads a physics testbed and teleports your player there";
public string Description => "Loads a physics testbed on the specified map.";
public string Help => $"{Command} <mapid> <test>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
@@ -127,7 +127,10 @@ namespace Content.Server.Physics
CollisionMask = (int) CollisionGroup.Impassable,
Hard = true
};
ground.AddFixture(horizontalFixture);
var broadphase = EntitySystem.Get<SharedBroadphaseSystem>();
broadphase.CreateFixture(ground, horizontalFixture);
var vertical = new EdgeShape(new Vector2(10, 0), new Vector2(10, 10));
var verticalFixture = new Fixture(ground, vertical)
@@ -136,7 +139,8 @@ namespace Content.Server.Physics
CollisionMask = (int) CollisionGroup.Impassable,
Hard = true
};
ground.AddFixture(verticalFixture);
broadphase.CreateFixture(ground, verticalFixture);
var xs = new[]
{
@@ -157,7 +161,6 @@ namespace Content.Server.Physics
new MapCoordinates(new Vector2(xs[j] + x, 0.55f + 2.1f * i), mapId)).AddComponent<PhysicsComponent>();
box.BodyType = BodyType.Dynamic;
box.SleepingAllowed = false;
shape = new PolygonShape();
shape.SetAsBox(0.5f, 0.5f);
box.FixedRotation = false;
@@ -169,7 +172,8 @@ namespace Content.Server.Physics
CollisionLayer = (int) CollisionGroup.Impassable,
Hard = true,
};
box.AddFixture(fixture);
broadphase.CreateFixture(box, fixture);
}
}
}
@@ -187,7 +191,9 @@ namespace Content.Server.Physics
CollisionMask = (int) CollisionGroup.Impassable,
Hard = true
};
ground.AddFixture(horizontalFixture);
var broadphase = EntitySystem.Get<SharedBroadphaseSystem>();
broadphase.CreateFixture(ground, horizontalFixture);
var vertical = new EdgeShape(new Vector2(10, 0), new Vector2(10, 10));
var verticalFixture = new Fixture(ground, vertical)
@@ -196,7 +202,8 @@ namespace Content.Server.Physics
CollisionMask = (int) CollisionGroup.Impassable,
Hard = true
};
ground.AddFixture(verticalFixture);
broadphase.CreateFixture(ground, verticalFixture);
var xs = new[]
{
@@ -217,7 +224,6 @@ namespace Content.Server.Physics
new MapCoordinates(new Vector2(xs[j] + x, 0.55f + 2.1f * i), mapId)).AddComponent<PhysicsComponent>();
box.BodyType = BodyType.Dynamic;
box.SleepingAllowed = false;
shape = new PhysShapeCircle {Radius = 0.5f};
box.FixedRotation = false;
// TODO: Need to detect shape and work out if we need to use fixedrotation
@@ -228,7 +234,8 @@ namespace Content.Server.Physics
CollisionLayer = (int) CollisionGroup.Impassable,
Hard = true,
};
box.AddFixture(fixture);
broadphase.CreateFixture(box, fixture);
}
}
}
@@ -249,7 +256,8 @@ namespace Content.Server.Physics
Hard = true
};
ground.AddFixture(horizontalFixture);
var broadphase = EntitySystem.Get<SharedBroadphaseSystem>();
broadphase.CreateFixture(ground, horizontalFixture);
// Setup boxes
float a = 0.5f;
@@ -270,13 +278,13 @@ namespace Content.Server.Physics
var box = entityManager.SpawnEntity(null, new MapCoordinates(0, 0, mapId)).AddComponent<PhysicsComponent>();
box.BodyType = BodyType.Dynamic;
box.Owner.Transform.WorldPosition = y;
box.AddFixture(
broadphase.CreateFixture(box,
new Fixture(box, shape) {
CollisionLayer = (int) CollisionGroup.Impassable,
CollisionMask = (int) CollisionGroup.Impassable,
Hard = true,
Mass = 5.0f,
});
CollisionLayer = (int) CollisionGroup.Impassable,
CollisionMask = (int) CollisionGroup.Impassable,
Hard = true,
Mass = 5.0f,
});
y += deltaY;
}