TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ UpdateServer()

static void Terraria.Main.UpdateServer ( )
inlinestaticprivate

Definition at line 81674 of file Main.cs.

81675 {
81676 //IL_01ff: Unknown result type (might be due to invalid IL or missing references)
81678 if (netPlayCounter % 3600 == 0)
81679 {
81680 NetMessage.SendData(7);
81681 netPlayCounter = 0;
81682 }
81683 for (int i = 0; i < maxNetPlayers; i++)
81684 {
81685 if (player[i].active && Netplay.Clients[i].IsActive)
81686 {
81687 Netplay.Clients[i].SpamUpdate();
81688 }
81689 }
81690 if (Math.IEEERemainder(netPlayCounter, 900.0) == 0.0)
81691 {
81692 bool flag = true;
81693 int num = lastItemUpdate;
81694 int num2 = 0;
81695 while (flag)
81696 {
81697 num++;
81698 if (num >= 400)
81699 {
81700 num = 0;
81701 }
81702 num2++;
81703 if (!Main.item[num].active || Main.item[num].playerIndexTheItemIsReservedFor == 255)
81704 {
81705 NetMessage.SendData(21, -1, -1, null, num);
81706 }
81708 {
81709 flag = false;
81710 }
81711 }
81713 }
81714 for (int j = 0; j < 400; j++)
81715 {
81716 Item item = Main.item[j];
81717 if (item.active && (item.playerIndexTheItemIsReservedFor == 255 || !player[item.playerIndexTheItemIsReservedFor].active))
81718 {
81719 item.FindOwner(j);
81720 }
81721 }
81722 for (int k = 0; k < 255; k++)
81723 {
81724 if (Netplay.Clients[k].IsActive)
81725 {
81726 Netplay.Clients[k].TimeOutTimer++;
81727 if (Netplay.Clients[k].State == 0)
81728 {
81729 Netplay.Clients[k].TimeOutTimer += 3;
81730 }
81731 if (!stopTimeOuts && Netplay.Clients[k].TimeOutTimer > 7200)
81732 {
81733 Netplay.Clients[k].SetPendingTermination("Timeout");
81734 Netplay.Clients[k].PendingTerminationApproved = true;
81735 }
81736 }
81737 if (player[k].active)
81738 {
81739 RemoteClient.CheckSection(k, player[k].position);
81740 }
81741 }
81742 }
static int maxItemUpdates
Definition Main.cs:2198
static Item[] item
Definition Main.cs:1826
static bool stopTimeOuts
Definition Main.cs:592
static int lastItemUpdate
Definition Main.cs:2194
static int maxNetPlayers
Definition Main.cs:1211
static int netPlayCounter
Definition Main.cs:2190
static Player[] player
Definition Main.cs:1960

References Terraria.RemoteClient.CheckSection(), Terraria.Netplay.Clients, Terraria.Main.item, Terraria.Main.lastItemUpdate, Terraria.Main.maxItemUpdates, Terraria.Main.maxNetPlayers, Terraria.Main.netPlayCounter, Terraria.Main.player, Terraria.NetMessage.SendData(), and Terraria.Main.stopTimeOuts.

Referenced by Terraria.Main.DoUpdateInWorld().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: