Remove instruments compref (#19560)

This commit is contained in:
metalgearsloth
2023-09-12 14:43:06 +10:00
committed by GitHub
parent f05f94fdc0
commit fd60d39bc7
7 changed files with 94 additions and 27 deletions

View File

@@ -2,10 +2,7 @@ namespace Content.Shared.Instruments;
public abstract class SharedInstrumentSystem : EntitySystem
{
public override void Initialize()
{
SubscribeLocalEvent<SharedInstrumentComponent, AfterAutoHandleStateEvent>(AfterHandleInstrumentState);
}
public abstract bool ResolveInstrument(EntityUid uid, ref SharedInstrumentComponent? component);
public virtual void SetupRenderer(EntityUid uid, bool fromStateChange, SharedInstrumentComponent? instrument = null)
{
@@ -21,12 +18,4 @@ public abstract class SharedInstrumentSystem : EntitySystem
component.InstrumentProgram = program;
Dirty(component);
}
private void AfterHandleInstrumentState(EntityUid uid, SharedInstrumentComponent instrument, ref AfterAutoHandleStateEvent args)
{
if(instrument.Playing)
SetupRenderer(uid, true, instrument);
else
EndRenderer(uid, true, instrument);
}
}