Exemple #1
0
        private void GrowVertically(int i, int j, Tile tile)
        {
            Tile above = Main.tile[i, j - 1];

            if (tile.frameX < 3 * frameSize) // If we're on the body of the stalk...
            {
                if (above.type == Type)
                {
                    TileLoader.RandomUpdate(i, j - 1, Type);
                }
                else if (Main.rand.NextBool(10) || TileExtensions.AnyTilesIn(i, i, j - 7, j - 1)) // Top the stalk if there's a roof or after a random age
                {
                    above.frameX = (short)(Main.rand.Next(3, 6) * frameSize);
                    above.frameY = 4 * frameSize;
                }
                else // Otherwise, continue stalk.
                {
                    above.frameX = (short)(Main.rand.Next(0, 3) * frameSize);
                    above.frameY = (short)(Main.rand.Next(0, 4) * frameSize);
                }
                above.type = Type;
            }
            else if (tile.frameY > 0) // Otherwise, we're at the top. Decrease frameY til we're
            {
                above.type   = Type;
                above.frameX = tile.frameX;
                above.frameY = (short)(tile.frameY - frameSize);
            }
            above.active(true);

            if (Main.netMode != NetmodeID.SinglePlayer)
            {
                NetMessage.SendTileSquare(-1, i, j - 1, 1);
            }
        }
Exemple #2
0
 private static bool GrowthConditions(int i, int j)
 {
     return(WorldGen.InWorld(i, j, 1) && !TileExtensions.AnyTilesIn(i, i, j - 7, j - 1));
 }