Content update for ECS physics (#13291)

This commit is contained in:
metalgearsloth
2023-01-15 15:38:59 +11:00
committed by GitHub
parent 46d24bc36b
commit bf79d76666
61 changed files with 431 additions and 379 deletions

View File

@@ -28,21 +28,12 @@ public abstract class SharedFlyBySoundSystem : EntitySystem
private void OnStartup(EntityUid uid, FlyBySoundComponent component, ComponentStartup args)
{
if (!TryComp<PhysicsComponent>(uid, out var body)) return;
if (!TryComp<PhysicsComponent>(uid, out var body))
return;
var shape = new PhysShapeCircle()
{
Radius = component.Range,
};
var shape = new PhysShapeCircle(component.Range);
var fixture = new Fixture(body, shape)
{
Hard = false,
ID = FlyByFixture,
CollisionLayer = (int) CollisionGroup.MobMask,
};
_fixtures.TryCreateFixture(body, fixture);
_fixtures.TryCreateFixture(uid, shape, FlyByFixture, collisionLayer: (int) CollisionGroup.MobMask, hard: false, body: body);
}
private void OnShutdown(EntityUid uid, FlyBySoundComponent component, ComponentShutdown args)
@@ -53,7 +44,7 @@ public abstract class SharedFlyBySoundSystem : EntitySystem
return;
}
_fixtures.DestroyFixture(body, FlyByFixture);
_fixtures.DestroyFixture(uid, FlyByFixture, body: body);
}
private void OnHandleState(EntityUid uid, FlyBySoundComponent component, ref ComponentHandleState args)