JoinLeaveSingularity: use Try, and nicer logging

This commit is contained in:
JohnCorby 2022-02-17 04:55:43 -08:00
parent 2c51ec4a36
commit 7207211454

View File

@ -25,16 +25,17 @@ namespace QSB.Player
return; return;
} }
var go = new GameObject(nameof(JoinLeaveSingularity)); var go = new GameObject($"player {player.PlayerId} JoinLeaveSingularity");
var ct = go.GetCancellationTokenOnDestroy(); var ct = go.GetCancellationTokenOnDestroy();
UniTask.Create(async () => UniTask.Create(async () =>
{ {
DebugLog.DebugWrite($"WARP TASK {player.PlayerId}"); DebugLog.DebugWrite($"{go.name}: WARP TASK");
await Run(go.transform, player, joining, ct).SuppressCancellationThrow(); await go.name.Try("running warp task",
() => Run(go.transform, player, joining, ct));
Object.Destroy(go); Object.Destroy(go);
DebugLog.DebugWrite($"WARP TASK DONE {player.PlayerId}"); DebugLog.DebugWrite($"{go.name}: WARP TASK DONE");
}); });
} }
@ -116,18 +117,18 @@ namespace QSB.Player
if (joining) if (joining)
{ {
player.Body.SetActive(true); player.Body.SetActive(true);
DebugLog.DebugWrite($"WARP IN {player.PlayerId}"); DebugLog.DebugWrite($"{transform.name}: WARP IN");
effect.WarpObjectIn(0); effect.WarpObjectIn(0);
} }
else else
{ {
DebugLog.DebugWrite($"WARP OUT {player.PlayerId}"); DebugLog.DebugWrite($"{transform.name}: WARP OUT");
effect.WarpObjectOut(0); effect.WarpObjectOut(0);
} }
effect.OnWarpComplete += () => effect.OnWarpComplete += () =>
{ {
DebugLog.DebugWrite($"WARP DONE {player.PlayerId}"); DebugLog.DebugWrite($"{transform.name}: WARP DONE");
if (!joining) if (!joining)
{ {