mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-04-15 20:42:33 +00:00
JoinLeaveSingularity - cancel if PlayerTransformSync is destroyed, and also check for player.Body before running leave singularity for if they leave while still on the title screen
This commit is contained in:
parent
e28d9ea7ad
commit
b56a3376e1
@ -19,7 +19,7 @@ public static class JoinLeaveSingularity
|
|||||||
if (joining)
|
if (joining)
|
||||||
{
|
{
|
||||||
if (PlayerTransformSync.LocalInstance == null ||
|
if (PlayerTransformSync.LocalInstance == null ||
|
||||||
player.PlayerId < QSBPlayerManager.LocalPlayerId)
|
player.PlayerId < QSBPlayerManager.LocalPlayerId)
|
||||||
{
|
{
|
||||||
// player was here before we joined
|
// player was here before we joined
|
||||||
return;
|
return;
|
||||||
@ -31,10 +31,19 @@ public static class JoinLeaveSingularity
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!player.Body)
|
||||||
|
{
|
||||||
|
// player was kicked (i.e. player body doesn't exist cuz they're still in title screen)
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var go = new GameObject($"player {player} JoinLeaveSingularity");
|
var go = new GameObject($"player {player} JoinLeaveSingularity");
|
||||||
var ct = go.GetCancellationTokenOnDestroy();
|
var ct = CancellationTokenSource.CreateLinkedTokenSource(
|
||||||
|
go.GetCancellationTokenOnDestroy(),
|
||||||
|
player.TransformSync.GetCancellationTokenOnDestroy()
|
||||||
|
).Token;
|
||||||
UniTask.Create(async () =>
|
UniTask.Create(async () =>
|
||||||
{
|
{
|
||||||
DebugLog.DebugWrite($"{go.name}: WARP TASK");
|
DebugLog.DebugWrite($"{go.name}: WARP TASK");
|
||||||
@ -142,4 +151,4 @@ public static class JoinLeaveSingularity
|
|||||||
};
|
};
|
||||||
await UniTask.WaitUntil(() => !effect.enabled && !singularity._owOneShotSource.isPlaying, cancellationToken: ct);
|
await UniTask.WaitUntil(() => !effect.enabled && !singularity._owOneShotSource.isPlaying, cancellationToken: ct);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user