Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ PlaceSunflower()

static void Terraria.WorldGen.PlaceSunflower ( int x,
int y,
ushort type = 27 )
inlinestatic

Definition at line 45321 of file WorldGen.cs.

45322 {
45323 if ((double)y > Main.worldSurface - 1.0 && !Main.remixWorld)
45324 {
45325 return;
45326 }
45327 bool flag = true;
45328 for (int i = x; i < x + 2; i++)
45329 {
45330 for (int j = y - 3; j < y + 1; j++)
45331 {
45332 if (Main.tile[i, j] == null)
45333 {
45334 Main.tile[i, j] = new Tile();
45335 }
45336 if (Main.tile[i, j].active() || Main.tile[i, j].wall > 0)
45337 {
45338 flag = false;
45339 }
45340 }
45341 if (Main.tile[i, y + 1] == null)
45342 {
45343 Main.tile[i, y + 1] = new Tile();
45344 }
45345 if (!Main.tile[i, y + 1].nactive() || Main.tile[i, y + 1].halfBrick() || Main.tile[i, y + 1].slope() != 0 || (Main.tile[i, y + 1].type != 2 && Main.tile[i, y + 1].type != 109))
45346 {
45347 flag = false;
45348 }
45349 }
45350 if (!flag)
45351 {
45352 return;
45353 }
45354 int num = genRand.Next(3);
45355 for (int k = 0; k < 2; k++)
45356 {
45357 for (int l = -3; l < 1; l++)
45358 {
45359 int num2 = k * 18 + genRand.Next(3) * 36;
45360 if (l <= -2)
45361 {
45362 num2 = k * 18 + num * 36;
45363 }
45364 int num3 = (l + 3) * 18;
45365 Main.tile[x + k, y + l].active(active: true);
45366 Main.tile[x + k, y + l].frameX = (short)num2;
45367 Main.tile[x + k, y + l].frameY = (short)num3;
45368 Main.tile[x + k, y + l].type = type;
45369 }
45370 }
45371 }
static UnifiedRandom genRand
Definition WorldGen.cs:1215

References Terraria.Main.remixWorld, Terraria.DataStructures.Tile, Terraria.Main.tile, System.type, and Terraria.Main.worldSurface.