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

◆ Place3x2()

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

Definition at line 43614 of file WorldGen.cs.

43615 {
43616 if (x < 5 || x > Main.maxTilesX - 5 || y < 5 || y > Main.maxTilesY - 5)
43617 {
43618 return;
43619 }
43620 bool flag = false;
43621 bool flag2 = true;
43622 if (type == 14 && style == 25)
43623 {
43624 flag = true;
43625 }
43626 int num = y - 1;
43627 if (flag)
43628 {
43629 num = y;
43630 }
43631 for (int i = x - 1; i < x + 2; i++)
43632 {
43633 for (int j = num; j < y + 1; j++)
43634 {
43635 if (Main.tile[i, j] == null)
43636 {
43637 Main.tile[i, j] = new Tile();
43638 }
43639 if (Main.tile[i, j].active())
43640 {
43641 flag2 = false;
43642 }
43643 if (type == 215 && Main.tile[i, j].liquid > 0)
43644 {
43645 flag2 = false;
43646 }
43647 }
43648 if (Main.tile[i, y + 1] == null)
43649 {
43650 Main.tile[i, y + 1] = new Tile();
43651 }
43652 switch (type)
43653 {
43654 default:
43655 if (type != 582 && type != 619)
43656 {
43657 if (type == 26 && TileID.Sets.Boulders[Main.tile[i, y + 1].type])
43658 {
43659 flag2 = false;
43660 }
43661 if (!SolidTile2(i, y + 1))
43662 {
43663 flag2 = false;
43664 }
43665 break;
43666 }
43667 goto case 285;
43668 case 285:
43669 case 286:
43670 case 298:
43671 case 299:
43672 case 310:
43673 case 361:
43674 case 362:
43675 case 363:
43676 case 364:
43677 if (!SolidTile2(i, y + 1) && (!Main.tile[i, y + 1].nactive() || !Main.tileSolidTop[Main.tile[i, y + 1].type] || Main.tile[i, y + 1].frameY != 0))
43678 {
43679 flag2 = false;
43680 }
43681 break;
43682 }
43683 }
43684 if (type == 88)
43685 {
43686 if (Chest.CreateChest(x - 1, y - 1) == -1)
43687 {
43688 flag2 = false;
43689 }
43690 else if (Main.netMode == 1)
43691 {
43692 NetMessage.SendData(34, -1, -1, null, 2, x, y, style);
43693 }
43694 }
43695 if (flag2)
43696 {
43697 short num2 = (short)(54 * style);
43698 if (flag)
43699 {
43700 Main.tile[x - 1, y].active(active: true);
43701 Main.tile[x - 1, y].frameY = 0;
43702 Main.tile[x - 1, y].frameX = num2;
43703 Main.tile[x - 1, y].type = type;
43704 Main.tile[x, y].active(active: true);
43705 Main.tile[x, y].frameY = 0;
43706 Main.tile[x, y].frameX = (short)(num2 + 18);
43707 Main.tile[x, y].type = type;
43708 Main.tile[x + 1, y].active(active: true);
43709 Main.tile[x + 1, y].frameY = 0;
43710 Main.tile[x + 1, y].frameX = (short)(num2 + 36);
43711 Main.tile[x + 1, y].type = type;
43712 return;
43713 }
43714 Main.tile[x - 1, y - 1].active(active: true);
43715 Main.tile[x - 1, y - 1].frameY = 0;
43716 Main.tile[x - 1, y - 1].frameX = num2;
43717 Main.tile[x - 1, y - 1].type = type;
43718 Main.tile[x, y - 1].active(active: true);
43719 Main.tile[x, y - 1].frameY = 0;
43720 Main.tile[x, y - 1].frameX = (short)(num2 + 18);
43721 Main.tile[x, y - 1].type = type;
43722 Main.tile[x + 1, y - 1].active(active: true);
43723 Main.tile[x + 1, y - 1].frameY = 0;
43724 Main.tile[x + 1, y - 1].frameX = (short)(num2 + 36);
43725 Main.tile[x + 1, y - 1].type = type;
43726 Main.tile[x - 1, y].active(active: true);
43727 Main.tile[x - 1, y].frameY = 18;
43728 Main.tile[x - 1, y].frameX = num2;
43729 Main.tile[x - 1, y].type = type;
43730 Main.tile[x, y].active(active: true);
43731 Main.tile[x, y].frameY = 18;
43732 Main.tile[x, y].frameX = (short)(num2 + 18);
43733 Main.tile[x, y].type = type;
43734 Main.tile[x + 1, y].active(active: true);
43735 Main.tile[x + 1, y].frameY = 18;
43736 Main.tile[x + 1, y].frameX = (short)(num2 + 36);
43737 Main.tile[x + 1, y].type = type;
43738 }
43739 }
static bool[] Boulders
Definition TileID.cs:123
static bool SolidTile2(Tile testTile)

References Terraria.ID.TileID.Sets.Boulders, Terraria.Chest.CreateChest(), Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.netMode, Terraria.NetMessage.SendData(), Terraria.DataStructures.Tile, Terraria.Main.tile, Terraria.Main.tileSolidTop, and System.type.

Referenced by Terraria.WorldGen.GenerateWorld().