diff --git a/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs b/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs index d1db7ac..1b318e7 100644 --- a/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs +++ b/Glamourer/Gui/Tabs/ActorTab/ActorPanel.cs @@ -1,5 +1,7 @@ using System; +using System.Linq; using System.Numerics; +using Dalamud.Game.ClientState.Conditions; using Dalamud.Interface; using Dalamud.Interface.Internal.Notifications; using FFXIVClientStructs.FFXIV.Client.Game; @@ -35,6 +37,7 @@ public class ActorPanel private readonly ObjectManager _objects; private readonly DesignManager _designManager; private readonly DatFileService _datFileService; + private readonly Condition _conditions; private ActorIdentifier _identifier; private string _actorName = string.Empty; @@ -45,7 +48,8 @@ public class ActorPanel public ActorPanel(ActorSelector selector, StateManager stateManager, CustomizationDrawer customizationDrawer, EquipmentDrawer equipmentDrawer, IdentifierService identification, AutoDesignApplier autoDesignApplier, - Configuration config, DesignConverter converter, ObjectManager objects, DesignManager designManager, DatFileService datFileService) + Configuration config, DesignConverter converter, ObjectManager objects, DesignManager designManager, DatFileService datFileService, + Condition conditions) { _selector = selector; _stateManager = stateManager; @@ -58,6 +62,7 @@ public class ActorPanel _objects = objects; _designManager = designManager; _datFileService = datFileService; + _conditions = conditions; } private CustomizeFlag CustomizeApplicationFlags @@ -67,7 +72,8 @@ public class ActorPanel { using var group = ImRaii.Group(); (_identifier, _data) = _selector.Selection; - _lockedRedraw = _identifier.Type is IdentifierType.Special; + _lockedRedraw = _identifier.Type is IdentifierType.Special + || _conditions[ConditionFlag.OccupiedInCutSceneEvent]; (_actorName, _actor) = GetHeaderName(); DrawHeader(); DrawPanel(); @@ -134,7 +140,7 @@ public class ActorPanel if (!ImGui.CollapsingHeader(header)) return; - if (_customizationDrawer.Draw(_state!.ModelData.Customize, _state.IsLocked, _identifier.Type is IdentifierType.Special)) + if (_customizationDrawer.Draw(_state!.ModelData.Customize, _state.IsLocked, _lockedRedraw)) _stateManager.ChangeCustomize(_state, _customizationDrawer.Customize, _customizationDrawer.Changed, StateChanged.Source.Manual); if (_customizationDrawer.DrawWetnessState(_state!.ModelData.IsWet(), out var newWetness, _state.IsLocked)) diff --git a/Glamourer/Services/CommandService.cs b/Glamourer/Services/CommandService.cs index c6ae8e2..b78f734 100644 --- a/Glamourer/Services/CommandService.cs +++ b/Glamourer/Services/CommandService.cs @@ -130,8 +130,9 @@ public class CommandService : IDisposable _chat.Print(" 》 If multiple design sets have the same name, the first one will be changed."); _chat.Print(" 》 The name is case-insensitive."); _chat.Print(new SeStringBuilder().AddText(" 》 If the command is ").AddBlue("application") - .AddText(" the design index and flags are required.").BuiltString); - _chat.Print(" 》 The design index is the number in front of the relevant design in the automated design set."); + .AddText(" the ").AddYellow("design index").AddText(" and ").AddPurple("flags").AddText(" are required.").BuiltString); + _chat.Print(new SeStringBuilder().AddText(" 》 The ").AddYellow("design index") + .AddText(" is the number in front of the relevant design in the automated design set.").BuiltString); _chat.Print(new SeStringBuilder().AddText(" 》 The ").AddPurple("Application Flags").AddText(" are a combination of the letters ") .AddPurple("C", true).AddText("ustomizations, ") .AddPurple("E", true).AddText("quipment, ") diff --git a/Glamourer/State/ActorState.cs b/Glamourer/State/ActorState.cs index e9ee35b..26ef505 100644 --- a/Glamourer/State/ActorState.cs +++ b/Glamourer/State/ActorState.cs @@ -5,6 +5,7 @@ using Glamourer.Structs; using Penumbra.GameData.Actors; using Penumbra.GameData.Enums; using System.Linq; +using Dalamud.Game.ClientState.Conditions; using CustomizeIndex = Glamourer.Customization.CustomizeIndex; namespace Glamourer.State; @@ -22,8 +23,8 @@ public class ActorState public readonly ActorIdentifier Identifier; - public bool AllowsRedraw - => Identifier.Type is not IdentifierType.Special; + public bool AllowsRedraw(Condition condition) + => Identifier.Type is not IdentifierType.Special && !condition[ConditionFlag.OccupiedInCutSceneEvent]; /// This should always represent the unmodified state of the draw object. public DesignData BaseData; diff --git a/Glamourer/State/StateEditor.cs b/Glamourer/State/StateEditor.cs index 12bcc2a..f9bede5 100644 --- a/Glamourer/State/StateEditor.cs +++ b/Glamourer/State/StateEditor.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using Dalamud.Game.ClientState.Conditions; using Glamourer.Customization; using Glamourer.Events; using Glamourer.Services; @@ -15,13 +16,15 @@ public class StateEditor private readonly CustomizationService _customizations; private readonly HumanModelList _humans; private readonly GPoseService _gPose; + private readonly Condition _condition; - public StateEditor(CustomizationService customizations, HumanModelList humans, ItemManager items, GPoseService gPose) + public StateEditor(CustomizationService customizations, HumanModelList humans, ItemManager items, GPoseService gPose, Condition condition) { _customizations = customizations; _humans = humans; _items = items; _gPose = gPose; + _condition = condition; } /// Change the model id. If the actor is changed from a human to another human, customize and equipData are unused. @@ -49,6 +52,9 @@ public class StateEditor if (oldIsHuman) return true; + if (!state.AllowsRedraw(_condition)) + return false; + // Fix up everything else to make sure the result is a valid human. state.ModelData.Customize = Customize.Default; state.ModelData.SetDefaultEquipment(_items); @@ -73,6 +79,9 @@ public class StateEditor } else { + if (!state.AllowsRedraw(_condition)) + return false; + state.ModelData.LoadNonHuman(modelId, customize, equipData); state[ActorState.MetaIndex.ModelId] = source; } diff --git a/Glamourer/State/StateManager.cs b/Glamourer/State/StateManager.cs index 994bfa2..084f014 100644 --- a/Glamourer/State/StateManager.cs +++ b/Glamourer/State/StateManager.cs @@ -3,6 +3,7 @@ using System.Collections; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; +using Dalamud.Game.ClientState.Conditions; using Glamourer.Customization; using Glamourer.Designs; using Glamourer.Events; @@ -24,18 +25,20 @@ public class StateManager : IReadOnlyDictionary private readonly StateChanged _event; private readonly StateApplier _applier; private readonly StateEditor _editor; + private readonly Condition _condition; private readonly Dictionary _states = new(); public StateManager(ActorService actors, ItemManager items, StateChanged @event, StateApplier applier, StateEditor editor, - HumanModelList humans) + HumanModelList humans, Condition condition) { - _actors = actors; - _items = items; - _event = @event; - _applier = applier; - _editor = editor; - _humans = humans; + _actors = actors; + _items = items; + _event = @event; + _applier = applier; + _editor = editor; + _humans = humans; + _condition = condition; } public IEnumerator> GetEnumerator() @@ -378,7 +381,7 @@ public class StateManager : IReadOnlyDictionary if (design.DoApplyVisorToggle()) _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(_condition) ? design.ApplyCustomize : design.ApplyCustomize & ~CustomizeFlagExtensions.RedrawRequired; _editor.ChangeHumanCustomize(state, design.DesignData.Customize, flags, source, out _, out var applied, key); redraw |= applied.RequiresRedraw(); diff --git a/Penumbra.GameData b/Penumbra.GameData index 7c48376..1c53c1d 160000 --- a/Penumbra.GameData +++ b/Penumbra.GameData @@ -1 +1 @@ -Subproject commit 7c483764678c6edb5efd55f056aeaecae144d5fe +Subproject commit 1c53c1da5a5c15cb3d37cb99db64c5651b46a551