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

◆ Place2x2Style()

static void Terraria.WorldGen.Place2x2Style ( int x,
int y,
ushort type,
int style = 0 )
inlinestatic

Definition at line 43741 of file WorldGen.cs.

43742 {
43743 if (x < 5 || x > Main.maxTilesX - 5 || y < 5 || y > Main.maxTilesY - 5)
43744 {
43745 return;
43746 }
43747 short num = 0;
43748 if (type == 254)
43749 {
43750 num = (short)(x % 12 / 2);
43751 num *= 36;
43752 }
43753 bool flag = true;
43754 for (int i = x - 1; i < x + 1; i++)
43755 {
43756 for (int j = y - 1; j < y + 1; j++)
43757 {
43758 if (Main.tile[i, j] == null)
43759 {
43760 Main.tile[i, j] = new Tile();
43761 }
43762 if (Main.tile[i, j].active())
43763 {
43764 flag = false;
43765 }
43766 }
43767 if (Main.tile[i, y + 1] == null)
43768 {
43769 Main.tile[i, y + 1] = new Tile();
43770 }
43771 if (!SolidTile(i, y + 1))
43772 {
43773 flag = false;
43774 }
43775 if (type == 254 && Main.tile[i, y + 1].type != 2 && Main.tile[i, y + 1].type != 477 && Main.tile[i, y + 1].type != 492 && Main.tile[i, y + 1].type != 109)
43776 {
43777 flag = false;
43778 }
43779 }
43780 if (flag)
43781 {
43782 short num2 = (short)(36 * style);
43783 Main.tile[x - 1, y - 1].active(active: true);
43784 Main.tile[x - 1, y - 1].frameY = num;
43785 Main.tile[x - 1, y - 1].frameX = num2;
43786 Main.tile[x - 1, y - 1].type = type;
43787 Main.tile[x, y - 1].active(active: true);
43788 Main.tile[x, y - 1].frameY = num;
43789 Main.tile[x, y - 1].frameX = (short)(num2 + 18);
43790 Main.tile[x, y - 1].type = type;
43791 Main.tile[x - 1, y].active(active: true);
43792 Main.tile[x - 1, y].frameY = (short)(num + 18);
43793 Main.tile[x - 1, y].frameX = num2;
43794 Main.tile[x - 1, y].type = type;
43795 Main.tile[x, y].active(active: true);
43796 Main.tile[x, y].frameY = (short)(num + 18);
43797 Main.tile[x, y].frameX = (short)(num2 + 18);
43798 Main.tile[x, y].type = type;
43799 }
43800 }

References Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Enums.SolidTile, Terraria.DataStructures.Tile, Terraria.Main.tile, and System.type.