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

◆ MechSpawn()

static bool Terraria.Item.MechSpawn ( float x,
float y,
int type )
inlinestatic

Use to check if a mechanism is allowed to spawn an Item of the provided type at the provided world coordinates. Checks nearby area to see if the Spawn Limitshave been reached.

Definition at line 49504 of file Item.cs.

49505 {
49506 //IL_0048: Unknown result type (might be due to invalid IL or missing references)
49507 //IL_0061: Unknown result type (might be due to invalid IL or missing references)
49508 int num = 0;
49509 int num2 = 0;
49510 int num3 = 0;
49511 Vector2 vector = default(Vector2);
49512 for (int i = 0; i < 200; i++)
49513 {
49514 if (Main.item[i].active && Main.item[i].type == type)
49515 {
49516 num++;
49517 ((Vector2)(ref vector))._002Ector(x, y);
49518 float num5 = Main.item[i].position.X - vector.X;
49519 float num4 = Main.item[i].position.Y - vector.Y;
49520 float num6 = (float)Math.Sqrt(num5 * num5 + num4 * num4);
49521 if (num6 < 300f)
49522 {
49523 num2++;
49524 }
49525 if (num6 < 800f)
49526 {
49527 num3++;
49528 }
49529 }
49530 }
49531 if (num2 >= 3 || num3 >= 6 || num >= 10)
49532 {
49533 return false;
49534 }
49535 return true;
49536 }
int type
The Item ID of this item. The Item ID is a unique number assigned to each Item loaded into the game....
Definition Item.cs:345

References Terraria.Main.item, and Terraria.Item.type.