Remove obsolete Fixture.Body references (#16259)

This commit is contained in:
Leon Friedrich
2023-05-09 19:21:26 +12:00
committed by GitHub
parent dac7025cc5
commit 2bd5fb3736
32 changed files with 67 additions and 77 deletions

View File

@@ -23,25 +23,25 @@ public sealed partial class ShuttleSystem
private void OnShuttleCollide(EntityUid uid, ShuttleComponent component, ref StartCollideEvent args)
{
var ourBody = args.OurFixture.Body;
var otherBody = args.OtherFixture.Body;
if (!HasComp<ShuttleComponent>(otherBody.Owner))
if (!HasComp<ShuttleComponent>(args.OtherEntity))
return;
var ourBody = args.OurBody;
var otherBody = args.OtherBody;
// TODO: Would also be nice to have a continuous sound for scraping.
var ourXform = Transform(ourBody.Owner);
var ourXform = Transform(uid);
if (ourXform.MapUid == null)
return;
var otherXform = Transform(otherBody.Owner);
var otherXform = Transform(args.OtherEntity);
var ourPoint = ourXform.InvWorldMatrix.Transform(args.WorldPoint);
var otherPoint = otherXform.InvWorldMatrix.Transform(args.WorldPoint);
var ourVelocity = _physics.GetLinearVelocity(ourBody.Owner, ourPoint, ourBody, ourXform);
var otherVelocity = _physics.GetLinearVelocity(otherBody.Owner, otherPoint, otherBody, otherXform);
var ourVelocity = _physics.GetLinearVelocity(uid, ourPoint, ourBody, ourXform);
var otherVelocity = _physics.GetLinearVelocity(args.OtherEntity, otherPoint, otherBody, otherXform);
var jungleDiff = (ourVelocity - otherVelocity).Length;
if (jungleDiff < MinimumImpactVelocity)

View File

@@ -58,7 +58,7 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
SubscribeLocalEvent<RoundRestartCleanupEvent>(OnRoundRestart);
SubscribeLocalEvent<GridInitializeEvent>(OnGridInit);
SubscribeLocalEvent<GridFixtureChangeEvent>(OnGridFixtureChange);
SubscribeLocalEvent<FixturesComponent, GridFixtureChangeEvent>(OnGridFixtureChange);
}
public override void Update(float frameTime)
@@ -81,22 +81,13 @@ public sealed partial class ShuttleSystem : SharedShuttleSystem
}
}
private void OnGridFixtureChange(GridFixtureChangeEvent args)
private void OnGridFixtureChange(EntityUid uid, FixturesComponent manager, GridFixtureChangeEvent args)
{
// Look this is jank but it's a placeholder until we design it.
if (args.NewFixtures.Count == 0)
return;
var uid = args.NewFixtures[0].Body.Owner;
var manager = Comp<FixturesComponent>(uid);
foreach (var fixture in args.NewFixtures)
{
_physics.SetDensity(uid, fixture, TileMassMultiplier, false, manager);
_fixtures.SetRestitution(uid, fixture, 0.1f, false, manager);
}
_fixtures.FixtureUpdate(uid, manager: manager);
}
private void OnGridInit(GridInitializeEvent ev)

View File

@@ -18,10 +18,10 @@ public sealed class SpaceGarbageSystem : EntitySystem
private void OnCollide(EntityUid uid, SpaceGarbageComponent component, ref StartCollideEvent args)
{
if (args.OtherFixture.Body.BodyType != BodyType.Static) return;
if (args.OtherBody.BodyType != BodyType.Static) return;
var ourXform = Transform(args.OurFixture.Body.Owner);
var otherXform = Transform(args.OtherFixture.Body.Owner);
var ourXform = Transform(uid);
var otherXform = Transform(args.OtherEntity);
if (ourXform.GridUid == otherXform.GridUid) return;