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

◆ AttemptToGeneratePlanteraBulbAt()

static bool Terraria.WorldGen.AttemptToGeneratePlanteraBulbAt ( int i,
int j,
bool forceBulb )
inlinestaticprivate

Definition at line 64160 of file WorldGen.cs.

64161 {
64162 if (forceBulb)
64163 {
64164 int num = 0;
64165 for (int k = -2; k < 2; k++)
64166 {
64167 for (int l = -2; l < 2; l++)
64168 {
64169 int num2 = i + k;
64170 int num3 = j + l;
64171 Tile tile = Main.tile[num2, num3];
64172 if (tile.type == 59 || tile.type == 60)
64173 {
64174 num++;
64175 }
64176 else if (tile.active())
64177 {
64178 num--;
64179 }
64180 if (IsAContainer(tile) || tile.type == 226 || tile.type == 237 || tile.type == 10 || tile.type == 11 || tile.type == 26 || tile.type == 16 || tile.type == 15 || tile.type == 14 || tile.type == 104 || TileID.Sets.Paintings[tile.type] || tile.type == 158 || tile.type == 105 || tile.type == 531 || tile.type == 349 || tile.type == 138 || tile.type == 664 || tile.type == 665 || tile.type == 137 || tile.type == 443 || tile.type == 12 || tile.type == 665 || tile.type == 314)
64181 {
64182 num = -1;
64183 break;
64184 }
64185 }
64186 if (num <= -1)
64187 {
64188 break;
64189 }
64190 }
64191 if (num < 12)
64192 {
64193 return false;
64194 }
64195 for (int m = -2; m < 2; m++)
64196 {
64197 for (int n = -2; n < 2; n++)
64198 {
64199 int num4 = i + m;
64200 int num5 = j + n;
64201 bool num6 = m == -2 || m == 1 || n == -2 || n == 1;
64202 Tile tile2 = Main.tile[num4, num5];
64203 tile2.ClearTile();
64204 if (num6)
64205 {
64206 tile2.type = 60;
64207 tile2.active(active: true);
64208 }
64210 }
64211 }
64212 PlaceJunglePlant(i, j, 238, 0, 0);
64213 if (Main.tile[i, j].type == 238)
64214 {
64215 SquareTileFrame(i, j);
64216 SquareTileFrame(i + 2, j);
64217 SquareTileFrame(i - 1, j);
64218 if (Main.netMode == 2)
64219 {
64220 NetMessage.SendTileSquare(-1, i, j, 8);
64221 }
64222 return true;
64223 }
64224 }
64225 else
64226 {
64227 PlaceJunglePlant(i, j, 238, 0, 0);
64228 if (Main.tile[i, j].type == 238)
64229 {
64230 SquareTileFrame(i, j);
64231 SquareTileFrame(i + 2, j);
64232 SquareTileFrame(i - 1, j);
64233 if (Main.netMode == 2)
64234 {
64235 NetMessage.SendTileSquare(-1, i, j, 5);
64236 }
64237 return true;
64238 }
64239 }
64240 return false;
64241 }
static bool[] Paintings
Definition TileID.cs:117
static bool IsAContainer(Tile t)
static void PlaceJunglePlant(int X2, int Y2, ushort type, int styleX, int styleY)
static void SquareTileFrame(int i, int j, bool resetFrame=true)

References Terraria.Tile.active(), Terraria.Main.netMode, Terraria.ID.TileID.Sets.Paintings, Terraria.NetMessage.SendTileSquare(), Terraria.Main.tile, and Terraria.Tile.type.