Removel warm reload start
This commit is contained in:
@@ -77,21 +77,6 @@ public sealed class ActorObjectService : IHostedService, IDisposable, IMediatorS
|
|||||||
_clientState = clientState;
|
_clientState = clientState;
|
||||||
_condition = condition;
|
_condition = condition;
|
||||||
_mediator = mediator;
|
_mediator = mediator;
|
||||||
_mediator.Subscribe<PenumbraInitializedMessage>(this, _ =>
|
|
||||||
{
|
|
||||||
QueueWarmStart("PenumbraInitialized");
|
|
||||||
});
|
|
||||||
|
|
||||||
_mediator.Subscribe<ConnectedMessage>(this, _ =>
|
|
||||||
{
|
|
||||||
QueueWarmStart("Connected");
|
|
||||||
});
|
|
||||||
|
|
||||||
// Optional: helps after zoning
|
|
||||||
_mediator.Subscribe<ZoneSwitchEndMessage>(this, _ =>
|
|
||||||
{
|
|
||||||
QueueWarmStart("ZoneSwitchEnd");
|
|
||||||
});
|
|
||||||
_mediator.Subscribe<GameObjectHandlerCreatedMessage>(this, (msg) =>
|
_mediator.Subscribe<GameObjectHandlerCreatedMessage>(this, (msg) =>
|
||||||
{
|
{
|
||||||
if (!msg.OwnedObject) return;
|
if (!msg.OwnedObject) return;
|
||||||
@@ -1165,57 +1150,6 @@ public sealed class ActorObjectService : IHostedService, IDisposable, IMediatorS
|
|||||||
PublishGposeSnapshot();
|
PublishGposeSnapshot();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void QueueWarmStart(string reason)
|
|
||||||
{
|
|
||||||
if (Interlocked.Exchange(ref _warmStartQueued, 1) == 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_ = Task.Run(async () =>
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Interlocked.Exchange(ref _warmStartRan, 1) == 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
await Task.Delay(500).ConfigureAwait(false);
|
|
||||||
|
|
||||||
if (IsZoning)
|
|
||||||
return;
|
|
||||||
|
|
||||||
await _framework.RunOnFrameworkThread(() =>
|
|
||||||
{
|
|
||||||
RefreshTrackedActorsInternal();
|
|
||||||
|
|
||||||
var snapshot = Snapshot;
|
|
||||||
|
|
||||||
var published = new HashSet<nint>();
|
|
||||||
|
|
||||||
foreach (var d in snapshot.PlayerDescriptors)
|
|
||||||
{
|
|
||||||
if (d.Address != nint.Zero && published.Add(d.Address))
|
|
||||||
_mediator.Publish(new ActorTrackedMessage(d));
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var d in snapshot.OwnedDescriptors)
|
|
||||||
{
|
|
||||||
if (d.Address != nint.Zero && published.Add(d.Address))
|
|
||||||
_mediator.Publish(new ActorTrackedMessage(d));
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.LogDebug("WarmStart republished {count} actors ({reason})", published.Count, reason);
|
|
||||||
}).ConfigureAwait(false);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogDebug(ex, "WarmStart failed ({reason})", reason);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
Interlocked.Exchange(ref _warmStartQueued, 0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private unsafe void TrackGposeObject(GameObject* gameObject)
|
private unsafe void TrackGposeObject(GameObject* gameObject)
|
||||||
{
|
{
|
||||||
if (gameObject == null)
|
if (gameObject == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user