Skip to content

Commit

Permalink
Allow changing instrument style while playing them (#9946)
Browse files Browse the repository at this point in the history
* Properly dirty changes when calling "SetInstrumentProgram" method

* Allow using swappable instrument verbs even while playing the instrument.
It's funnier this way
  • Loading branch information
gradientvera authored Jul 24, 2022
1 parent 16a08a6 commit cb5f051
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 0 additions & 3 deletions Content.Server/Instruments/SwappableInstrumentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ private void AddStyleVerb(EntityUid uid, SwappableInstrumentComponent component,
if (!TryComp<SharedInstrumentComponent>(uid, out var instrument))
return;

if (instrument.Playing) //no changing while playing
return;

var priority = 0;
foreach (var entry in component.InstrumentList)
{
Expand Down
4 changes: 3 additions & 1 deletion Content.Shared/Instruments/SharedInstrumentSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ public virtual void EndRenderer(EntityUid uid, bool fromStateChange, SharedInstr

public void SetInstrumentProgram(SharedInstrumentComponent component, byte program, byte bank)
{
component.InstrumentProgram = program;
component.InstrumentBank = bank;
component.InstrumentProgram = program;
component.DirtyRenderer = true;
Dirty(component);
}

private void OnGetState(EntityUid uid, SharedInstrumentComponent instrument, ref ComponentGetState args)
Expand Down

0 comments on commit cb5f051

Please sign in to comment.