mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Maybe fix visor state issue.
This commit is contained in:
parent
3d421881f6
commit
8375abd6cb
4 changed files with 11 additions and 4 deletions
|
|
@ -12,7 +12,7 @@ namespace Glamourer.Events;
|
|||
/// </list>
|
||||
/// </summary>
|
||||
public sealed class VisorStateChanged()
|
||||
: EventWrapperRef2<Model, bool, VisorStateChanged.Priority>(nameof(VisorStateChanged))
|
||||
: EventWrapperRef3<Model, bool, bool, VisorStateChanged.Priority>(nameof(VisorStateChanged))
|
||||
{
|
||||
public enum Priority
|
||||
{
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public unsafe class MetaService : IDisposable
|
|||
private void ToggleVisorDetour(DrawDataContainer* drawData, bool value)
|
||||
{
|
||||
Actor actor = drawData->Parent;
|
||||
_visorEvent.Invoke(actor.Model, ref value);
|
||||
_visorEvent.Invoke(actor.Model, true, ref value);
|
||||
Glamourer.Log.Verbose($"[MetaService] Toggle Visor triggered with 0x{(nint)drawData:X} {value} for {actor.Utf8Name}.");
|
||||
_toggleVisorHook.Original(drawData, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class VisorService : IDisposable
|
|||
var originalOn = on;
|
||||
// Invoke an event that can change the requested value
|
||||
// and also control whether the function should be called at all.
|
||||
Event.Invoke(human, ref on);
|
||||
Event.Invoke(human, false, ref on);
|
||||
|
||||
Glamourer.Log.Excessive(
|
||||
$"[SetVisorState] Invoked from game on 0x{human:X} switching to {on} (original {originalOn}).");
|
||||
|
|
|
|||
|
|
@ -568,7 +568,7 @@ public class StateListener : IDisposable
|
|||
}
|
||||
|
||||
/// <summary> Handle visor state changes made by the game. </summary>
|
||||
private void OnVisorChange(Model model, ref bool value)
|
||||
private unsafe void OnVisorChange(Model model, bool game, ref bool value)
|
||||
{
|
||||
// Skip updates when in customize update.
|
||||
if (ChangeCustomizeService.InUpdate.InMethod)
|
||||
|
|
@ -578,6 +578,13 @@ public class StateListener : IDisposable
|
|||
// We do not need to handle fixed designs,
|
||||
// since a fixed design would already have established state-tracking.
|
||||
var actor = _penumbra.GameObjectFromDrawObject(model);
|
||||
|
||||
// Only actually change anything if the actor state changed,
|
||||
// when equipping headgear the method is called with the current draw object state,
|
||||
// which corrupts Glamourer's assumed game state otherwise.
|
||||
if (!game && actor.AsCharacter->DrawData.IsVisorToggled != value)
|
||||
return;
|
||||
|
||||
if (_condition[ConditionFlag.CreatingCharacter] && actor.Index >= ObjectIndex.CutsceneStart)
|
||||
return;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue