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

◆ PlacePumpkin()

static void Terraria.WorldGen.PlacePumpkin ( int x,
int superY )
inlinestatic

Definition at line 44158 of file WorldGen.cs.

44159 {
44160 ushort type = 254;
44161 int num = genRand.Next(6) * 36;
44162 if (x < 5 || x > Main.maxTilesX - 5 || superY < 5 || superY > Main.maxTilesY - 5)
44163 {
44164 return;
44165 }
44166 bool flag = true;
44167 for (int i = x - 1; i < x + 1; i++)
44168 {
44169 for (int j = superY - 1; j < superY + 1; j++)
44170 {
44171 if (Main.tile[i, j] == null)
44172 {
44173 Main.tile[i, j] = new Tile();
44174 }
44175 if (Main.tile[i, j].active() && Main.tile[i, j].type != 3 && Main.tile[i, j].type != 73 && Main.tile[i, j].type != 113 && Main.tile[i, j].type != 110 && (Main.tile[i, j].type != 185 || Main.tile[i, j].frameY != 0))
44176 {
44177 flag = false;
44178 }
44179 if (Main.tile[i, j].liquid > 0)
44180 {
44181 flag = false;
44182 }
44183 }
44184 if (!SolidTile(i, superY + 1) || (Main.tile[i, superY + 1].type != 2 && Main.tile[i, superY + 1].type != 109))
44185 {
44186 flag = false;
44187 }
44188 }
44189 if (flag)
44190 {
44191 Main.tile[x - 1, superY - 1].active(active: true);
44192 Main.tile[x - 1, superY - 1].frameY = (short)num;
44193 Main.tile[x - 1, superY - 1].frameX = 0;
44194 Main.tile[x - 1, superY - 1].type = type;
44195 Main.tile[x, superY - 1].active(active: true);
44196 Main.tile[x, superY - 1].frameY = (short)num;
44197 Main.tile[x, superY - 1].frameX = 18;
44198 Main.tile[x, superY - 1].type = type;
44199 Main.tile[x - 1, superY].active(active: true);
44200 Main.tile[x - 1, superY].frameY = (short)(num + 18);
44201 Main.tile[x - 1, superY].frameX = 0;
44202 Main.tile[x - 1, superY].type = type;
44203 Main.tile[x, superY].active(active: true);
44204 Main.tile[x, superY].frameY = (short)(num + 18);
44205 Main.tile[x, superY].frameX = 18;
44206 Main.tile[x, superY].type = type;
44207 }
44208 }
static UnifiedRandom genRand
Definition WorldGen.cs:1215

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