Adding in a call to CheckIfAllUsersReady in the RelayUtpHost within the lobby rate limits, so that if a player disconnects and all remaining players are readied, the countdown will begin. (If and when Wire is integrated, that might obsolesce this.)
privateboolm_isHandlingPending=false;// Just in case a pending operation tries to enqueue itself again.
if(!m_isHandlingPending)
m_pendingOperations.Enqueue(action);
m_pendingOperations.Enqueue(action);
}
privateboolm_isInCooldown=false;
privatevoidOnUpdate(floatdt)
{
m_timeSinceLastCall+=dt;
m_isHandlingPending=false;// (Backup in case a pending operation hit an exception.)
if(m_timeSinceLastCall>=m_cooldownTime)
{
IsInCooldown=false;
m_isHandlingPending=true;
while(m_pendingOperations.Count>0)
intnumPending=m_pendingOperations.Count;// It's possible a pending operation will re-enqueue itself or new operations, which should wait until the next loop.
elseif(msgType==MsgType.PlayerDisconnect)// Clients message the host when they intend to disconnect, or else the host ends up keeping the connection open.
// The user ready status lives in the lobby data, which won't update immediately, but we need to use it to identify if all remaining players have readied.
// So, we'll wait two lobby update loops before we check remaining players to ensure the lobby has received the disconnect message.
// We rely on the PlayerDisconnect message instead of this disconnect message since this message might not arrive for a long time after the disconnect actually occurs.