From cb5f051be5728b784c621db72695e5b8c44ef7f7 Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com> Date: Sun, 24 Jul 2022 13:40:05 +0200 Subject: [PATCH] Allow changing instrument style while playing them (#9946) * Properly dirty changes when calling "SetInstrumentProgram" method * Allow using swappable instrument verbs even while playing the instrument. It's funnier this way --- Content.Server/Instruments/SwappableInstrumentSystem.cs | 3 --- Content.Shared/Instruments/SharedInstrumentSystem.cs | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Content.Server/Instruments/SwappableInstrumentSystem.cs b/Content.Server/Instruments/SwappableInstrumentSystem.cs index 1f64a0c7c7..30cdf7de21 100644 --- a/Content.Server/Instruments/SwappableInstrumentSystem.cs +++ b/Content.Server/Instruments/SwappableInstrumentSystem.cs @@ -25,9 +25,6 @@ public sealed class SwappableInstrumentSystem : EntitySystem if (!TryComp(uid, out var instrument)) return; - if (instrument.Playing) //no changing while playing - return; - var priority = 0; foreach (var entry in component.InstrumentList) { diff --git a/Content.Shared/Instruments/SharedInstrumentSystem.cs b/Content.Shared/Instruments/SharedInstrumentSystem.cs index 767738f175..cdfc7506a0 100644 --- a/Content.Shared/Instruments/SharedInstrumentSystem.cs +++ b/Content.Shared/Instruments/SharedInstrumentSystem.cs @@ -20,8 +20,10 @@ public abstract class SharedInstrumentSystem : EntitySystem 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)