/// <summary>
/// This method is called when the ClientEnter event fires for a
/// player. Its purpose is to check whether the player has a pending
/// resync request, and, if so, to execute the resync operation.
/// </summary>
/// <param name="State">Supplies the player object of the incoming
/// player.</param>
/// <param name="Script">Supplies the script object.</param>
public static void OnClientEnter(uint PCObject, ACR_ServerCommunicator Script)
{
PlayerState State = Script.TryGetPlayerState(PCObject);
if (State == null)
{
return;
}
var ResyncInfo = (from RS in PlayerResyncStates
where RS.PlayerId == State.PlayerId
select RS).FirstOrDefault();
if (ResyncInfo == null)
{
return;
}
//
// Dequeue the resync state and start attempting to apply it to the
// player object once the player has loaded.
//
PlayerResyncStates.Remove(ResyncInfo);
ResynchronizePlayerState(ResyncInfo, PCObject, Script);
}