mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 18:27:24 +01:00
Fix an issue with game-base automation not respecting manual changes on pure redraws.
This commit is contained in:
parent
68e85a640c
commit
937e385cbc
2 changed files with 54 additions and 2 deletions
|
|
@ -237,7 +237,7 @@ public class AutoDesignApplier : IDisposable
|
||||||
CustomizeFlag totalCustomizeFlags = 0;
|
CustomizeFlag totalCustomizeFlags = 0;
|
||||||
byte totalMetaFlags = 0;
|
byte totalMetaFlags = 0;
|
||||||
if (set.BaseState == AutoDesignSet.Base.Game)
|
if (set.BaseState == AutoDesignSet.Base.Game)
|
||||||
_state.ResetState(state, StateChanged.Source.Fixed);
|
_state.ResetStateFixed(state);
|
||||||
else if (!respectManual)
|
else if (!respectManual)
|
||||||
state.RemoveFixedDesignSources();
|
state.RemoveFixedDesignSources();
|
||||||
foreach (var design in set.Designs)
|
foreach (var design in set.Designs)
|
||||||
|
|
|
||||||
|
|
@ -378,7 +378,7 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
|
||||||
if (design.DoApplyVisorToggle())
|
if (design.DoApplyVisorToggle())
|
||||||
_editor.ChangeMetaState(state, ActorState.MetaIndex.VisorState, design.DesignData.IsVisorToggled(), source, out _, key);
|
_editor.ChangeMetaState(state, ActorState.MetaIndex.VisorState, design.DesignData.IsVisorToggled(), source, out _, key);
|
||||||
|
|
||||||
var flags = state.AllowsRedraw ? design.ApplyCustomize : design.ApplyCustomize & ~CustomizeFlagExtensions.RedrawRequired;
|
var flags = state.AllowsRedraw ? design.ApplyCustomize : design.ApplyCustomize & ~CustomizeFlagExtensions.RedrawRequired;
|
||||||
_editor.ChangeHumanCustomize(state, design.DesignData.Customize, flags, source, out _, out var applied, key);
|
_editor.ChangeHumanCustomize(state, design.DesignData.Customize, flags, source, out _, out var applied, key);
|
||||||
redraw |= applied.RequiresRedraw();
|
redraw |= applied.RequiresRedraw();
|
||||||
|
|
||||||
|
|
@ -433,6 +433,7 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
|
||||||
state.ModelData = state.BaseData;
|
state.ModelData = state.BaseData;
|
||||||
foreach (var index in Enum.GetValues<CustomizeIndex>())
|
foreach (var index in Enum.GetValues<CustomizeIndex>())
|
||||||
state[index] = StateChanged.Source.Game;
|
state[index] = StateChanged.Source.Game;
|
||||||
|
|
||||||
foreach (var slot in EquipSlotExtensions.FullSlots)
|
foreach (var slot in EquipSlotExtensions.FullSlots)
|
||||||
{
|
{
|
||||||
state[slot, true] = StateChanged.Source.Game;
|
state[slot, true] = StateChanged.Source.Game;
|
||||||
|
|
@ -450,6 +451,57 @@ public class StateManager : IReadOnlyDictionary<ActorIdentifier, ActorState>
|
||||||
_event.Invoke(StateChanged.Type.Reset, StateChanged.Source.Manual, state, actors, null);
|
_event.Invoke(StateChanged.Type.Reset, StateChanged.Source.Manual, state, actors, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ResetStateFixed(ActorState state, uint key = 0)
|
||||||
|
{
|
||||||
|
if (!state.Unlock(key))
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (var index in Enum.GetValues<CustomizeIndex>().Where(i => state[i] is StateChanged.Source.Fixed))
|
||||||
|
{
|
||||||
|
state[index] = StateChanged.Source.Game;
|
||||||
|
state.ModelData.Customize[index] = state.BaseData.Customize[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var slot in EquipSlotExtensions.FullSlots)
|
||||||
|
{
|
||||||
|
if (state[slot, true] is StateChanged.Source.Fixed)
|
||||||
|
{
|
||||||
|
state[slot, true] = StateChanged.Source.Game;
|
||||||
|
state.ModelData.SetStain(slot, state.BaseData.Stain(slot));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state[slot, false] is StateChanged.Source.Fixed)
|
||||||
|
{
|
||||||
|
state[slot, false] = StateChanged.Source.Game;
|
||||||
|
state.ModelData.SetItem(slot, state.BaseData.Item(slot));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state[ActorState.MetaIndex.HatState] is StateChanged.Source.Fixed)
|
||||||
|
{
|
||||||
|
state[ActorState.MetaIndex.HatState] = StateChanged.Source.Game;
|
||||||
|
state.ModelData.SetHatVisible(state.BaseData.IsHatVisible());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state[ActorState.MetaIndex.VisorState] is StateChanged.Source.Fixed)
|
||||||
|
{
|
||||||
|
state[ActorState.MetaIndex.VisorState] = StateChanged.Source.Game;
|
||||||
|
state.ModelData.SetVisor(state.BaseData.IsVisorToggled());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state[ActorState.MetaIndex.WeaponState] is StateChanged.Source.Fixed)
|
||||||
|
{
|
||||||
|
state[ActorState.MetaIndex.WeaponState] = StateChanged.Source.Game;
|
||||||
|
state.ModelData.SetWeaponVisible(state.BaseData.IsWeaponVisible());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (state[ActorState.MetaIndex.Wetness] is StateChanged.Source.Fixed)
|
||||||
|
{
|
||||||
|
state[ActorState.MetaIndex.Wetness] = StateChanged.Source.Game;
|
||||||
|
state.ModelData.SetIsWet(state.BaseData.IsWet());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void ReapplyState(Actor actor)
|
public void ReapplyState(Actor actor)
|
||||||
{
|
{
|
||||||
if (!GetOrCreate(actor, out var state))
|
if (!GetOrCreate(actor, out var state))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue