From 323924fba27e6e77cbad0f9fef98e43ba80c4f07 Mon Sep 17 00:00:00 2001 From: Ottermandias Date: Thu, 20 Jul 2023 14:59:14 +0200 Subject: [PATCH] Fix locked design when reverting to game without redrawing. --- Glamourer/State/StateManager.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Glamourer/State/StateManager.cs b/Glamourer/State/StateManager.cs index 23ecebc..dff7868 100644 --- a/Glamourer/State/StateManager.cs +++ b/Glamourer/State/StateManager.cs @@ -366,17 +366,19 @@ public class StateManager : IReadOnlyDictionary HandleEquip(slot, design.DoApplyEquip(slot), design.DoApplyStain(slot)); } - var actors = ApplyAll(state, redraw); + var actors = ApplyAll(state, redraw, false); Glamourer.Log.Verbose( $"Applied design to {state.Identifier.Incognito(null)}. [Affecting {actors.ToLazyString("nothing")}.]"); _event.Invoke(StateChanged.Type.Design, state[ActorState.MetaIndex.Wetness], state, actors, design); } - private ActorData ApplyAll(ActorState state, bool redraw) + private ActorData ApplyAll(ActorState state, bool redraw, bool withLock) { var actors = _applier.ChangeWetness(state, true); if (redraw) { + if (withLock) + state.TempLock(); _applier.ForceRedraw(actors); } else @@ -420,10 +422,7 @@ public class StateManager : IReadOnlyDictionary var actors = ActorData.Invalid; if (source is StateChanged.Source.Manual or StateChanged.Source.Ipc) - { - state.TempLock(); - actors = ApplyAll(state, redraw); - } + actors = ApplyAll(state, redraw, true); Glamourer.Log.Verbose( $"Reset entire state of {state.Identifier.Incognito(null)} to game base. [Affecting {actors.ToLazyString("nothing")}.]"); _event.Invoke(StateChanged.Type.Design, StateChanged.Source.Manual, state, actors, null); @@ -434,7 +433,7 @@ public class StateManager : IReadOnlyDictionary if (!GetOrCreate(actor, out var state)) return; - ApplyAll(state, !actor.Model.IsHuman || Customize.Compare(actor.Model.GetCustomize(), state.ModelData.Customize).RequiresRedraw()); + ApplyAll(state, !actor.Model.IsHuman || Customize.Compare(actor.Model.GetCustomize(), state.ModelData.Customize).RequiresRedraw(), false); } public void DeleteState(ActorIdentifier identifier)