mirror of
https://github.com/Empostor/Empostor.git
synced 2026-10-19 15:51:39 +00:00
fix
This commit is contained in:
1 parent
3e0829e05f
commit
62509fa0e0
3 files changed
+5
-11
No files matched your search
Binary file not shown.
Binary file not shown.
@@ -398,24 +398,18 @@ namespace Empostor.Server.Net.State
|
|||||||
{
|
{
|
||||||
await _eventManager.CallAsync(new PlayerSpawnedEvent(this, player, control));
|
await _eventManager.CallAsync(new PlayerSpawnedEvent(this, player, control));
|
||||||
|
|
||||||
// arrives before the PlayerControl spawn, so this fires immediately. The deadline is only a safety net for a client that never announces its scene.
|
|
||||||
_ = Task.Run(async () =>
|
_ = Task.Run(async () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var deadline = DateTime.UtcNow.AddSeconds(10);
|
await Task.Delay(TimeSpan.FromMilliseconds(1500));
|
||||||
while (player.Scene != "OnlineGame")
|
|
||||||
{
|
|
||||||
if (DateTime.UtcNow > deadline
|
|
||||||
|| !(player.Client.Connection?.IsConnected ?? false)
|
|
||||||
|| GameState == GameStates.Destroyed)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await Task.Delay(100);
|
if (!(player.Client.Connection?.IsConnected ?? false))
|
||||||
|
{
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// From Nmpostor
|
||||||
await _eventManager.CallAsync(new PlayerReadyEvent(this, player, control));
|
await _eventManager.CallAsync(new PlayerReadyEvent(this, player, control));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
Reference in new issue
Block a user