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

◆ SendSection()

static void Terraria.NetMessage.SendSection ( int whoAmi,
int sectionX,
int sectionY )
inlinestatic

Definition at line 2651 of file NetMessage.cs.

2652 {
2653 if (Main.netMode != 2)
2654 {
2655 return;
2656 }
2657 try
2658 {
2659 if (sectionX < 0 || sectionY < 0 || sectionX >= Main.maxSectionsX || sectionY >= Main.maxSectionsY || Netplay.Clients[whoAmi].TileSections[sectionX, sectionY])
2660 {
2661 return;
2662 }
2663 Netplay.Clients[whoAmi].TileSections[sectionX, sectionY] = true;
2664 int number = sectionX * 200;
2665 int num = sectionY * 150;
2666 int num2 = 150;
2667 for (int i = num; i < num + 150; i += num2)
2668 {
2669 SendData(10, whoAmi, -1, null, number, i, 200f, num2);
2670 }
2671 for (int j = 0; j < 200; j++)
2672 {
2673 if (Main.npc[j].active && Main.npc[j].townNPC)
2674 {
2675 int sectionX2 = Netplay.GetSectionX((int)(Main.npc[j].position.X / 16f));
2676 int sectionY2 = Netplay.GetSectionY((int)(Main.npc[j].position.Y / 16f));
2677 if (sectionX2 == sectionX && sectionY2 == sectionY)
2678 {
2679 SendData(23, whoAmi, -1, null, j);
2680 }
2681 }
2682 }
2683 }
2684 catch
2685 {
2686 }
2687 }
static void SendData(int msgType, int remoteClient=-1, int ignoreClient=-1, NetworkText text=null, int number=0, float number2=0f, float number3=0f, float number4=0f, int number5=0, int number6=0, int number7=0)
Definition NetMessage.cs:88

References Terraria.Netplay.Clients, Terraria.Netplay.GetSectionX(), Terraria.Netplay.GetSectionY(), Terraria.Main.maxSectionsX, Terraria.Main.maxSectionsY, Terraria.Main.netMode, Terraria.Main.npc, and Terraria.NetMessage.SendData().

Referenced by Terraria.RemoteClient.CheckSection(), and Terraria.MessageBuffer.GetData().