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

◆ PlaceMB()

static void Terraria.WorldGen.PlaceMB ( int X,
int y,
ushort type,
int style )
inlinestatic

Definition at line 42849 of file WorldGen.cs.

42850 {
42851 int num = X + 1;
42852 if (num < 5 || num > Main.maxTilesX - 5 || y < 5 || y > Main.maxTilesY - 5)
42853 {
42854 return;
42855 }
42856 bool flag = true;
42857 for (int i = num - 1; i < num + 1; i++)
42858 {
42859 for (int j = y - 1; j < y + 1; j++)
42860 {
42861 if (Main.tile[i, j] == null)
42862 {
42863 Main.tile[i, j] = new Tile();
42864 }
42865 if (Main.tile[i, j].active())
42866 {
42867 flag = false;
42868 }
42869 }
42870 if (Main.tile[i, y + 1] == null)
42871 {
42872 Main.tile[i, y + 1] = new Tile();
42873 }
42874 if (!Main.tile[i, y + 1].active() || Main.tile[i, y + 1].halfBrick() || (!Main.tileSolid[Main.tile[i, y + 1].type] && !Main.tileTable[Main.tile[i, y + 1].type]))
42875 {
42876 flag = false;
42877 }
42878 }
42879 if (flag)
42880 {
42881 Main.tile[num - 1, y - 1].active(active: true);
42882 Main.tile[num - 1, y - 1].frameY = (short)(style * 36);
42883 Main.tile[num - 1, y - 1].frameX = 0;
42884 Main.tile[num - 1, y - 1].type = type;
42885 Main.tile[num, y - 1].active(active: true);
42886 Main.tile[num, y - 1].frameY = (short)(style * 36);
42887 Main.tile[num, y - 1].frameX = 18;
42888 Main.tile[num, y - 1].type = type;
42889 Main.tile[num - 1, y].active(active: true);
42890 Main.tile[num - 1, y].frameY = (short)(style * 36 + 18);
42891 Main.tile[num - 1, y].frameX = 0;
42892 Main.tile[num - 1, y].type = type;
42893 Main.tile[num, y].active(active: true);
42894 Main.tile[num, y].frameY = (short)(style * 36 + 18);
42895 Main.tile[num, y].frameX = 18;
42896 Main.tile[num, y].type = type;
42897 }
42898 }

References Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.DataStructures.Tile, Terraria.Main.tile, Terraria.Main.tileSolid, Terraria.Main.tileTable, System.type, and System.X.