mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-14 20:54:17 +01:00
Make the player not update too often on changes.
This commit is contained in:
parent
e4324bc4ce
commit
3e9edf3617
1 changed files with 11 additions and 0 deletions
|
|
@ -41,6 +41,7 @@ public class PenumbraAutoRedraw : IDisposable, IRequiredService
|
||||||
|
|
||||||
private readonly ConcurrentQueue<(ActorState, Action, int)> _actions = [];
|
private readonly ConcurrentQueue<(ActorState, Action, int)> _actions = [];
|
||||||
private readonly ConcurrentSet<ActorState> _skips = [];
|
private readonly ConcurrentSet<ActorState> _skips = [];
|
||||||
|
private DateTime _frame;
|
||||||
|
|
||||||
private void OnStateChange(StateChanged.Type type, StateSource source, ActorState state, ActorData _1, object? _2)
|
private void OnStateChange(StateChanged.Type type, StateSource source, ActorState state, ActorData _1, object? _2)
|
||||||
{
|
{
|
||||||
|
|
@ -69,6 +70,7 @@ public class PenumbraAutoRedraw : IDisposable, IRequiredService
|
||||||
private void OnModSettingChange(ModSettingChange type, string name, string mod, bool inherited)
|
private void OnModSettingChange(ModSettingChange type, string name, string mod, bool inherited)
|
||||||
{
|
{
|
||||||
if (type is ModSettingChange.TemporaryMod)
|
if (type is ModSettingChange.TemporaryMod)
|
||||||
|
{
|
||||||
_framework.RunOnFrameworkThread(() =>
|
_framework.RunOnFrameworkThread(() =>
|
||||||
{
|
{
|
||||||
_objects.Update();
|
_objects.Update();
|
||||||
|
|
@ -89,7 +91,15 @@ public class PenumbraAutoRedraw : IDisposable, IRequiredService
|
||||||
}, WaitFrames));
|
}, WaitFrames));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
else if (_config.AutoRedrawEquipOnChanges)
|
else if (_config.AutoRedrawEquipOnChanges)
|
||||||
|
{
|
||||||
|
// Only update once per frame.
|
||||||
|
var currentFrame = _framework.LastUpdateUTC;
|
||||||
|
if (currentFrame == _frame)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_frame = currentFrame;
|
||||||
_framework.RunOnFrameworkThread(() =>
|
_framework.RunOnFrameworkThread(() =>
|
||||||
{
|
{
|
||||||
var playerName = _penumbra.GetCurrentPlayerCollection();
|
var playerName = _penumbra.GetCurrentPlayerCollection();
|
||||||
|
|
@ -100,3 +110,4 @@ public class PenumbraAutoRedraw : IDisposable, IRequiredService
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue