This commit is contained in:
FangkuaiYa committed 2026-08-15 13:16:55 +08:00
1 parent 41b63f653c
commit 9dd45f35f7
1 file changed
+6 -15
+6 -15
View File
@@ -116,22 +116,13 @@ namespace Empostor.Server.Net.State
private async ValueTask CheckLimboPlayers()
{
foreach (var (_, player) in _players.Where(x => x.Value.Limbo == LimboStates.WaitingForHost))
var limboPlayers = _players.Where(x => x.Value.Limbo == LimboStates.WaitingForHost);
foreach (var (_, player) in limboPlayers)
{
// Pull players out of limbo and start their spawn timeout so a failed
// spawn is not silently stuck. Clear any stale Character too, so the
// spawn timeout can actually fire (a leftover Character != null would
// skip the timeout and leave the player stuck).
// (The PR's HandleJoinGameNext approach would re-set WaitingForHost
// and leave the player stuck on the wait-for-host screen, so we keep
// the direct pull-out instead.)
player.Character = null;
player.InitializeSpawnTimeout();
using var message = MessageWriter.Get(MessageType.Reliable);
WriteJoinedGameMessage(message, true, player);
WriteAlterGameMessage(message, false, IsPublic);
player.Limbo = LimboStates.NotLimbo;
await SendToAsync(message, player.Client.Id);
// Pull the player out of limbo via HandleJoinGameNew (not
// HandleJoinGameNext, which re-sets WaitingForHost and would
// leave the player stuck on the wait-for-host screen).
await HandleJoinGameNew(player, false);
}
}
}