Fix issue with Revert to Game not removing automated changes when it needs to redraw.

This commit is contained in:
Ottermandias 2023-07-17 00:26:11 +02:00
parent 58b867bd1e
commit f4c47520cd
3 changed files with 11 additions and 0 deletions

View file

@ -62,6 +62,14 @@ public class ActorState
return !IsLocked; return !IsLocked;
} }
/// <summary> Lock for temporary changes until after redrawing. </summary>
public bool TempLock()
=> Lock(1337);
/// <summary> Unlock temp locks. </summary>
public bool TempUnlock()
=> Unlock(1337);
/// <summary> This contains whether a change to the base data was made by the game, the user via manual input or through automatic application. </summary> /// <summary> This contains whether a change to the base data was made by the game, the user via manual input or through automatic application. </summary>
private readonly StateChanged.Source[] _sources = Enumerable private readonly StateChanged.Source[] _sources = Enumerable
.Repeat(StateChanged.Source.Game, EquipFlagExtensions.NumEquipFlags + CustomizationExtensions.NumIndices + 5).ToArray(); .Repeat(StateChanged.Source.Game, EquipFlagExtensions.NumEquipFlags + CustomizationExtensions.NumIndices + 5).ToArray();

View file

@ -131,6 +131,8 @@ public class StateListener : IDisposable
break; break;
} }
state.TempUnlock();
} }
_funModule.ApplyFun(actor, new Span<CharacterArmor>((void*)equipDataPtr, 10), ref customize); _funModule.ApplyFun(actor, new Span<CharacterArmor>((void*)equipDataPtr, 10), ref customize);

View file

@ -377,6 +377,7 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
var actors = _applier.ChangeWetness(state, true); var actors = _applier.ChangeWetness(state, true);
if (redraw) if (redraw)
{ {
state.TempLock();
_applier.ForceRedraw(actors); _applier.ForceRedraw(actors);
} }
else else