Gun auto state handlers (#15186)

* battery auto state

* basic entity autostate

* ballistic autostate

* flyby

* cartridge ammo

* gun

* Revert "battery auto state"

This reverts commit 35b7d62f303fddb0edd9eb7a922e3c26b7a5f7fb.

* silly
This commit is contained in:
Kara
2023-04-13 20:08:56 -05:00
committed by GitHub
parent ccf81a6be9
commit 47262a6998
10 changed files with 31 additions and 173 deletions

View File

@@ -20,8 +20,6 @@ public abstract class SharedFlyBySoundSystem : EntitySystem
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<FlyBySoundComponent, ComponentGetState>(OnGetState);
SubscribeLocalEvent<FlyBySoundComponent, ComponentHandleState>(OnHandleState);
SubscribeLocalEvent<FlyBySoundComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<FlyBySoundComponent, ComponentShutdown>(OnShutdown);
}
@@ -46,28 +44,4 @@ public abstract class SharedFlyBySoundSystem : EntitySystem
_fixtures.DestroyFixture(uid, FlyByFixture, body: body);
}
private void OnHandleState(EntityUid uid, FlyBySoundComponent component, ref ComponentHandleState args)
{
if (args.Current is not FlyBySoundComponentState state) return;
component.Sound = state.Sound;
component.Range = state.Range;
}
private void OnGetState(EntityUid uid, FlyBySoundComponent component, ref ComponentGetState args)
{
args.State = new FlyBySoundComponentState()
{
Sound = component.Sound,
Range = component.Range,
};
}
[Serializable, NetSerializable]
private sealed class FlyBySoundComponentState : ComponentState
{
public SoundSpecifier Sound = default!;
public float Range;
}
}