From d5be2aecfa939ab0731cda6477c1a6fbe0de4460 Mon Sep 17 00:00:00 2001 From: Stanley Dimant Date: Mon, 27 Mar 2023 11:06:32 +0200 Subject: [PATCH] do not apply data during cutscene/gpose --- MareSynchronos/PlayerData/Pairs/CachedPlayer.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/MareSynchronos/PlayerData/Pairs/CachedPlayer.cs b/MareSynchronos/PlayerData/Pairs/CachedPlayer.cs index 9cd319b..968abe8 100644 --- a/MareSynchronos/PlayerData/Pairs/CachedPlayer.cs +++ b/MareSynchronos/PlayerData/Pairs/CachedPlayer.cs @@ -81,6 +81,12 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase if (string.Equals(characterData.DataHash.Value, _cachedData.DataHash.Value, StringComparison.Ordinal) && !forced) return; + if (_dalamudUtil.IsInCutscene || _dalamudUtil.IsInGpose) + { + Logger.LogInformation("Received data for {player} while in cutscene/gpose, returning", this); + return; + } + var charaDataToUpdate = CheckUpdatedData(_cachedData.DeepClone(), characterData, forced); if (charaDataToUpdate.TryGetValue(ObjectKind.Player, out var playerChanges)) @@ -375,11 +381,12 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase if (!updatedData.Any()) { Logger.LogDebug("Nothing to update for {obj}", this); + return; } var updateModdedPaths = updatedData.Values.Any(v => v.Any(p => p == PlayerChanges.Mods)); - _downloadCancellationTokenSource = _downloadCancellationTokenSource?.CancelRecreate(); + _downloadCancellationTokenSource = _downloadCancellationTokenSource?.CancelRecreate() ?? new CancellationTokenSource(); var downloadToken = _downloadCancellationTokenSource.Token; Task.Run(async () => @@ -429,7 +436,7 @@ public sealed class CachedPlayer : DisposableMediatorSubscriberBase if (downloadToken.IsCancellationRequested || (appToken?.IsCancellationRequested ?? false)) return; - _applicationCancellationTokenSource = _applicationCancellationTokenSource.CancelRecreate(); + _applicationCancellationTokenSource = _applicationCancellationTokenSource.CancelRecreate() ?? new CancellationTokenSource(); var token = _applicationCancellationTokenSource.Token; _applicationTask = Task.Run(async () => {