/// <summary> /// Ticks the server, include the network, /// and all worlds (and all chunks within those [and all entities within those]). /// </summary> /// <param name="delta">The time between the last tick and this one</param> public static void Tick(double delta) { Delta = delta; GlobalTickTime += delta; try { NetworkBase.Tick(); } catch (Exception ex) { SysConsole.Output(OutputType.ERROR, "Error / networktick: " + ex.ToString()); } try { secondTracker += Delta; if (secondTracker >= 1.0) { secondTracker -= 1.0; OncePerSecondTick(); } } catch (Exception ex) { SysConsole.Output(OutputType.ERROR, "Error / oncepersecondtick: " + ex.ToString()); } try { ServerCommands.Tick(); ConsoleHandler.CheckInput(); } catch (Exception ex) { SysConsole.Output(OutputType.ERROR, "Error / command tick: " + ex.ToString()); } try { for (int i = 0; i < WaitingPlayers.Count; i++) { if (GlobalTickTime - WaitingPlayers[i].JoinTime > 10) { WaitingPlayers.RemoveAt(i); i--; } } for (int i = 0; i < Players.Count; i++) { // TODO: CVar if (GlobalTickTime - Players[i].LastPing > 60 || GlobalTickTime - Players[i].LastSecondaryPing > 60) { DespawnPlayer(Players[i]); i--; } } } catch (Exception ex) { SysConsole.Output(OutputType.ERROR, "Error / general tick: " + ex.ToString()); } }