예제 #1
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = projectile.Center;

            Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            // All the way across
            for (int x = 1; x < Main.maxTilesX; x++)
            {
                // Six down, last is platforms
                for (int y = -40; y <= 0; y++)
                {
                    int xPosition = x;
                    int yPosition = (int)(y + position.Y / 16.0f);

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || yPosition < 0 || yPosition >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, yPosition];

                    if (tile == null)
                    {
                        continue;
                    }

                    // Testing for blocks that should not be destroyed
                    bool noFossil   = tile.type == TileID.DesertFossil && !NPC.downedBoss2;
                    bool noDungeon  = (tile.type == TileID.BlueDungeonBrick || tile.type == TileID.GreenDungeonBrick || tile.type == TileID.PinkDungeonBrick) && !NPC.downedBoss3;
                    bool noHMOre    = (tile.type == TileID.Cobalt || tile.type == TileID.Palladium || tile.type == TileID.Mythril || tile.type == TileID.Orichalcum || tile.type == TileID.Adamantite || tile.type == TileID.Titanium) && !NPC.downedMechBossAny;
                    bool noChloro   = tile.type == TileID.Chlorophyte && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3);
                    bool noLihzahrd = tile.type == TileID.LihzahrdBrick && !NPC.downedGolemBoss;

                    if (noFossil || noDungeon || noHMOre || noChloro || noLihzahrd)
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, yPosition);

                    if (y == -20 || y == 0)
                    {
                        // Spawn platforms
                        WorldGen.PlaceTile(xPosition, yPosition, TileID.Platforms, false, false, -1, 13);
                    }

                    if (Main.netMode == NetmodeID.Server)
                    {
                        NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                    }
                }
            }
        }
예제 #2
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = Projectile.Center;

            SoundEngine.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            // All the way across
            for (int x = 1; x <= Main.maxTilesX; x++)
            {
                // Six down, last is platforms
                for (int y = -5; y <= 0; y++)
                {
                    int xPosition = x;
                    int yPosition = (int)(y + position.Y / 16.0f);

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || yPosition < 0 || yPosition >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, yPosition];

                    if (tile == null)
                    {
                        continue;
                    }

                    if (!FargoGlobalProjectile.OkayToDestroyTile(tile))
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, yPosition);

                    if (y == 0)
                    {
                        FargoGlobalTile.ClearEverything(xPosition, yPosition, false);
                        // Spawn platforms
                        WorldGen.PlaceTile(xPosition, yPosition, TileID.Platforms, false, false, -1, 13);
                        if (Main.netMode == NetmodeID.Server)
                        {
                            NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                        }
                    }
                    else
                    {
                        if (!FargoGlobalProjectile.TileIsLiterallyAir(tile))
                        {
                            FargoGlobalTile.ClearEverything(xPosition, yPosition);
                        }
                    }
                }
            }
        }
예제 #3
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = Projectile.Center;

            SoundEngine.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            // Seven across
            for (int x = -3; x <= 3; x++)
            {
                for (int y = (int)(1 + position.Y / 16.0f); y <= (Main.maxTilesY - 40); y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, y];

                    if (tile == null)
                    {
                        continue;
                    }

                    if (!FargoGlobalProjectile.OkayToDestroyTile(tile))
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, y, false);

                    // Spawn structure
                    WorldGen.PlaceWall(xPosition, y, WallID.Stone);

                    if ((x == -3) || (x == 3))
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.GrayBrick);
                    }
                    else if ((x == -2 || x == 2) && (y % 10 == 0))
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Torches);
                    }
                    else if (x == 0)
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Rope);
                    }

                    NetMessage.SendTileSquare(-1, xPosition, y, 1);
                }
            }
        }
예제 #4
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = Projectile.Center;

            SoundEngine.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            // All the way across
            const int length = 400;
            bool      goLeft = Projectile.Center.X < Main.player[Projectile.owner].Center.X;
            int       min    = goLeft ? -length : 0;
            int       max    = goLeft ? 0 : length;

            int[] deletableTiles =
            {
                TileID.Cactus,
                TileID.Trees,
                TileID.CorruptThorns,
                TileID.CrimsonThorns,
                TileID.JungleThorns
            };

            for (int x = min; x < max; x++)
            {
                int xPosition = (int)(x + position.X / 16.0f);
                int yPosition = (int)(position.Y / 16.0f);

                if (xPosition < 0 || xPosition >= Main.maxTilesX || yPosition < 0 || yPosition >= Main.maxTilesY)
                {
                    continue;
                }

                Tile tile = Main.tile[xPosition, yPosition];

                if (tile == null)
                {
                    continue;
                }

                if (deletableTiles.Contains(tile.type))
                {
                    FargoGlobalTile.ClearEverything(xPosition, yPosition);
                }

                // Spawn platforms
                WorldGen.PlaceTile(xPosition, yPosition, TileID.Platforms);

                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            }
        }
예제 #5
0
        public static void PlaceHouse(int x, int y, Vector2 position, int side)
        {
            int  xPosition = (int)((side * -1) + x + position.X / 16.0f);
            int  yPosition = (int)(y + position.Y / 16.0f);
            Tile tile      = Main.tile[xPosition, yPosition];

            // Testing for blocks that should not be destroyed
            bool noFossil   = tile.type == TileID.DesertFossil && !NPC.downedBoss2;
            bool noDungeon  = (tile.type == TileID.BlueDungeonBrick || tile.type == TileID.GreenDungeonBrick || tile.type == TileID.PinkDungeonBrick) && !NPC.downedBoss3;
            bool noHMOre    = (tile.type == TileID.Cobalt || tile.type == TileID.Palladium || tile.type == TileID.Mythril || tile.type == TileID.Orichalcum || tile.type == TileID.Adamantite || tile.type == TileID.Titanium) && !NPC.downedMechBossAny;
            bool noChloro   = tile.type == TileID.Chlorophyte && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3);
            bool noLihzahrd = tile.type == TileID.LihzahrdBrick && !NPC.downedGolemBoss;

            if (noFossil || noDungeon || noHMOre || noChloro || noLihzahrd)
            {
                return;
            }

            FargoGlobalTile.ClearEverything(xPosition, yPosition);

            /*// Tile destroy
             * WorldGen.KillTile(xPosition, yPosition, false, false, false);
             * WorldGen.KillWall(xPosition, yPosition);
             * Dust.NewDust(position, 22, 22, DustID.Smoke, Alpha: 120);
             *
             * // Kill liquids
             * if (tile != null)
             * {
             *  tile.liquid = 0;
             *  tile.lava(false);
             *  tile.honey(false);
             *  if (Main.netMode == NetmodeID.Server)
             *  {
             *      NetMessage.sendWater(xPosition, yPosition);
             *  }
             * }*/

            // Spawn walls
            if (y != -6 && y != -1 && x != (10 * side) && x != (1 * side))
            {
                WorldGen.PlaceWall(xPosition, yPosition, WallID.Wood);
            }

            // Spawn border
            if ((y == -6) || (y == -1) || (x == (10 * side)) || (x == (1 * side) && y == -5))
            {
                WorldGen.PlaceTile(xPosition, yPosition, TileID.WoodBlock);
            }
        }
예제 #6
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = Projectile.Center;

            SoundEngine.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            //cavern height plus halfway to hell
            int yEndpoint = (int)(Main.rockLayer + (Main.maxTilesY - 200 - Main.rockLayer) / 2);

            // Five across
            for (int x = -2; x <= 2; x++)
            {
                for (int y = (int)(1 + position.Y / 16.0f); y <= yEndpoint; y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, y];

                    if (tile == null)
                    {
                        continue;
                    }

                    if (!FargoGlobalProjectile.OkayToDestroyTile(tile))
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, y, false);

                    if (x == 0)
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Rope);
                    }

                    NetMessage.SendTileSquare(-1, xPosition, y, 1);
                }
            }
        }
예제 #7
0
        public override void Kill(int timeLeft)
        {
            for (int i = 0; i < Main.maxTilesX; i++)
            {
                for (int j = 0; j < Main.maxTilesY; j++)
                {
                    FargoGlobalTile.ClearEverything(i, j);

                    if (WorldGen.InWorld(i, j))
                    {
                        Main.Map.Update(i, j, 255);
                    }
                }
            }

            for (int i = 0; i < Main.maxNPCs; i++)
            {
                NPC npc = Main.npc[i];
                if (npc.active && !npc.boss && !npc.dontTakeDamage)
                {
                    npc.StrikeNPC(npc.lifeMax + npc.defense, 0, 0, true);
                }
            }

            if (Main.LocalPlayer.active && !Main.LocalPlayer.dead && !Main.LocalPlayer.ghost)
            {
                int   def = Main.LocalPlayer.statDefense;
                float dr  = Main.LocalPlayer.endurance;
                Main.LocalPlayer.statDefense = 0;
                Main.LocalPlayer.endurance   = 0f;

                int damage = Math.Max(9999, Main.LocalPlayer.statLifeMax2 * 2);
                Main.LocalPlayer.Hurt(PlayerDeathReason.ByProjectile(Main.LocalPlayer.whoAmI, projectile.whoAmI), damage, 0);

                Main.LocalPlayer.statDefense = def;
                Main.LocalPlayer.endurance   = dr;
            }

            Main.refreshMap = true;

            //custom sound when
            Main.PlaySound(SoundID.Item15, projectile.position);
        }
예제 #8
0
        public override void Kill(int timeLeft)
        {
            SoundEngine.PlaySound(SoundID.Item15, Projectile.Center);
            SoundEngine.PlaySound(SoundID.Item14, Projectile.Center);

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            Vector2 position = Projectile.Center;
            int     radius   = 60; //bigger = boomer

            for (int x = -radius; x <= radius; x++)
            {
                for (int y = -radius * 2; y <= 0; y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);
                    int yPosition = (int)(y + position.Y / 16.0f);

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || yPosition < 0 || yPosition >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, yPosition];
                    if (tile == null)
                    {
                        continue;
                    }

                    if (!FargoGlobalProjectile.OkayToDestroyTile(tile) || FargoGlobalProjectile.TileIsLiterallyAir(tile))
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, yPosition);
                }
            }

            Main.refreshMap = true;
        }
예제 #9
0
        public override void Kill(int timeLeft)
        {
            for (int i = 0; i < Main.maxTilesX; i++)
            {
                for (int j = 0; j < Main.maxTilesY; j++)
                {
                    FargoGlobalTile.ClearEverything(i, j);

                    if (WorldGen.InWorld(i, j))
                    {
                        Main.Map.Update(i, j, 255);
                    }
                }
            }

            Main.refreshMap = true;

            //custom sound when
            Main.PlaySound(SoundID.Item15, projectile.position);
        }
        public override void Kill(int timeLeft)
        {
            Vector2 position = projectile.Center;

            Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            // All the way across
            for (int x = -200; x < 200; x++)
            {
                int xPosition = (int)(x + position.X / 16.0f);
                int yPosition = (int)(position.Y / 16.0f);

                if (xPosition < 0 || xPosition >= Main.maxTilesX || yPosition < 0 || yPosition >= Main.maxTilesY)
                {
                    continue;
                }

                Tile tile = Main.tile[xPosition, yPosition];

                if (tile == null)
                {
                    continue;
                }

                if (tile.type == TileID.Trees || tile.type == TileID.Cactus)
                {
                    FargoGlobalTile.ClearEverything(xPosition, yPosition);
                }

                // Spawn platforms
                WorldGen.PlaceTile(xPosition, yPosition, TileID.Platforms);

                NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
            }
        }
예제 #11
0
        public static void PlaceHouse(int x, int y, Vector2 position, int side, Player player)
        {
            int  xPosition = (int)((side * -1) + x + position.X / 16.0f);
            int  yPosition = (int)(y + position.Y / 16.0f);
            Tile tile      = Main.tile[xPosition, yPosition];

            // Testing for blocks that should not be destroyed
            if (!FargoGlobalProjectile.OkayToDestroyTile(tile))
            {
                return;
            }

            int wallType      = WallID.Wood;
            int tileType      = TileID.WoodBlock;
            int platformStyle = 0;

            if (player.ZoneDesert && !player.ZoneBeach)
            {
                wallType      = WallID.Cactus;
                tileType      = TileID.CactusBlock;
                platformStyle = 25;
            }
            else if (player.ZoneSnow)
            {
                wallType      = WallID.BorealWood;
                tileType      = TileID.BorealWood;
                platformStyle = 19;
            }
            else if (player.ZoneJungle)
            {
                wallType      = WallID.RichMaogany;
                tileType      = TileID.RichMahogany;
                platformStyle = 2;
            }
            else if (player.ZoneCorrupt)
            {
                wallType      = WallID.Ebonwood;
                tileType      = TileID.Ebonwood;
                platformStyle = 1;
            }
            else if (player.ZoneCrimson)
            {
                wallType      = WallID.Shadewood;
                tileType      = TileID.Shadewood;
                platformStyle = 5;
            }
            else if (player.ZoneBeach)
            {
                wallType      = WallID.PalmWood;
                tileType      = TileID.PalmWood;
                platformStyle = 17;
            }
            else if (player.ZoneHallow)
            {
                wallType      = WallID.Pearlwood;
                tileType      = TileID.Pearlwood;
                platformStyle = 3;
            }
            else if (player.ZoneGlowshroom)
            {
                wallType      = WallID.Mushroom;
                tileType      = TileID.MushroomBlock;
                platformStyle = 18;
            }
            else if (player.ZoneSkyHeight)
            {
                wallType      = WallID.DiscWall;
                tileType      = TileID.Sunplate;
                platformStyle = 22;
            }
            else if (player.ZoneUnderworldHeight)
            {
                wallType      = WallID.ObsidianBrick;
                tileType      = TileID.ObsidianBrick;
                platformStyle = 13;
            }

            //dont act if the right blocks already above
            if ((y == -5) && (tile.type == TileID.Platforms || tile.type == tileType))
            {
                return;
            }

            if (x == 10 * side || x == 1 * side)
            {
                //dont act on correct block above/below door, destroying them will break it
                if ((y == -4 || y == 0) && tile.type == tileType)
                {
                    return;
                }

                if ((y == -1 || y == -2 || y == -3) && (tile.type == TileID.ClosedDoor || tile.type == TileID.OpenDoor))
                {
                    return;
                }
            }
            else //for blocks besides those on the left/right edges where doors are placed, its okay to have platform as floor
            {
                if (y == 0 && (tile.type == TileID.Platforms || tile.type == tileType))
                {
                    return;
                }
            }

            //doing it this way so the code still runs to place bg walls behind open door
            if (!((x == 9 * side || x == 2 * side) && (y == -1 || y == -2 || y == -3) && tile.type == TileID.OpenDoor))
            {
                FargoGlobalTile.ClearEverything(xPosition, yPosition);
            }

            // Spawn walls
            if (y != -5 && y != 0 && x != (10 * side) && x != (1 * side))
            {
                WorldGen.PlaceWall(xPosition, yPosition, wallType);
                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                }
            }

            //platforms on top
            if (y == -5 && Math.Abs(x) >= 3 && Math.Abs(x) <= 5)
            {
                WorldGen.PlaceTile(xPosition, yPosition, TileID.Platforms, style: platformStyle);
                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendData(MessageID.TileChange, -1, -1, null, 1, xPosition, yPosition, TileID.Platforms, platformStyle);
                }
            }
            // Spawn border
            else if ((y == -5) || (y == 0) || (x == (10 * side)) || (x == (1 * side) && y == -4))
            {
                WorldGen.PlaceTile(xPosition, yPosition, tileType);
                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                }
            }
        }
예제 #12
0
        public static void PlaceHouse(int x, int y, Vector2 position, int side, Player player)
        {
            int  xPosition = (int)((side * -1) + x + position.X / 16.0f);
            int  yPosition = (int)(y + position.Y / 16.0f);
            Tile tile      = Main.tile[xPosition, yPosition];

            // Testing for blocks that should not be destroyed
            bool noFossil   = tile.type == TileID.DesertFossil && !NPC.downedBoss2;
            bool noDungeon  = (tile.type == TileID.BlueDungeonBrick || tile.type == TileID.GreenDungeonBrick || tile.type == TileID.PinkDungeonBrick) && !NPC.downedBoss3;
            bool noHMOre    = (tile.type == TileID.Cobalt || tile.type == TileID.Palladium || tile.type == TileID.Mythril || tile.type == TileID.Orichalcum || tile.type == TileID.Adamantite || tile.type == TileID.Titanium) && !NPC.downedMechBossAny;
            bool noChloro   = tile.type == TileID.Chlorophyte && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3);
            bool noLihzahrd = tile.type == TileID.LihzahrdBrick && !NPC.downedGolemBoss;

            if (noFossil || noDungeon || noHMOre || noChloro || noLihzahrd)
            {
                return;
            }

            int wallType      = WallID.Wood;
            int tileType      = TileID.WoodBlock;
            int platformStyle = 0;

            if (player.ZoneDesert && !player.ZoneBeach)
            {
                wallType      = WallID.Cactus;
                tileType      = TileID.CactusBlock;
                platformStyle = 25;
            }
            else if (player.ZoneSnow)
            {
                wallType      = WallID.BorealWood;
                tileType      = TileID.BorealWood;
                platformStyle = 19;
            }
            else if (player.ZoneJungle)
            {
                wallType      = WallID.RichMaogany;
                tileType      = TileID.RichMahogany;
                platformStyle = 2;
            }
            else if (player.ZoneCorrupt)
            {
                wallType      = WallID.Ebonwood;
                tileType      = TileID.Ebonwood;
                platformStyle = 1;
            }
            else if (player.ZoneCrimson)
            {
                wallType      = WallID.Shadewood;
                tileType      = TileID.Shadewood;
                platformStyle = 5;
            }
            else if (player.ZoneBeach)
            {
                wallType      = WallID.PalmWood;
                tileType      = TileID.PalmWood;
                platformStyle = 17;
            }
            else if (player.ZoneHoly)
            {
                wallType      = WallID.Pearlwood;
                tileType      = TileID.Pearlwood;
                platformStyle = 3;
            }
            else if (player.ZoneGlowshroom)
            {
                wallType      = WallID.Mushroom;
                tileType      = TileID.MushroomBlock;
                platformStyle = 18;
            }
            else if (player.ZoneSkyHeight)
            {
                wallType      = WallID.DiscWall;
                tileType      = TileID.Sunplate;
                platformStyle = 22;
            }
            else if (player.ZoneUnderworldHeight)
            {
                wallType      = WallID.ObsidianBrick;
                tileType      = TileID.ObsidianBrick;
                platformStyle = 13;
            }

            //dont act if the right blocks already above
            if ((y == -5) && (tile.type == TileID.Platforms || tile.type == tileType))
            {
                return;
            }

            if ((x == 10 * side || x == 1 * side))
            {
                //dont act on correct block above/below door, destroying them will break it
                if ((y == -4 || y == 0) && tile.type == tileType)
                {
                    return;
                }

                bool isADoor = (tile.type == TileID.ClosedDoor || tile.type == TileID.OpenDoor);
                //Main.NewText($"edge: {x}, type: {tile.type}, check: {isADoor}");
                if ((y == -1 || y == -2 || y == -3) && isADoor)
                {
                    return;
                }
            }
            else //for blocks besides those on the left/right edges where doors are placed, its okay to have platform as floor
            {
                if (y == 0 && (tile.type == TileID.Platforms || tile.type == tileType))
                {
                    return;
                }
            }

            FargoGlobalTile.ClearEverything(xPosition, yPosition);

            // Spawn walls
            if (y != -5 && y != 0 && x != (10 * side) && x != (1 * side))
            {
                WorldGen.PlaceWall(xPosition, yPosition, wallType);
                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                }
            }

            //platforms on top
            if (y == -5 && Math.Abs(x) >= 4 && Math.Abs(x) <= 7)
            {
                WorldGen.PlaceTile(xPosition, yPosition, TileID.Platforms, style: platformStyle);
                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendData(MessageID.TileChange, -1, -1, null, 1, xPosition, yPosition, TileID.Platforms, platformStyle);
                }
            }
            // Spawn border
            else if ((y == -5) || (y == 0) || (x == (10 * side)) || (x == (1 * side) && y == -4))
            {
                WorldGen.PlaceTile(xPosition, yPosition, tileType);
                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                }
            }
        }
예제 #13
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = projectile.Center;

            Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            // Seven across
            for (int x = -3; x <= 3; x++)
            {
                for (int y = (int)(1 + position.Y / 16.0f); y <= (Main.maxTilesY - 40); y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, y];

                    if (tile == null)
                    {
                        continue;
                    }

                    // Testing for blocks that should not be destroyed
                    bool noFossil   = tile.type == TileID.DesertFossil && !NPC.downedBoss2;
                    bool noDungeon  = (tile.type == TileID.BlueDungeonBrick || tile.type == TileID.GreenDungeonBrick || tile.type == TileID.PinkDungeonBrick) && !NPC.downedBoss3;
                    bool noHMOre    = (tile.type == TileID.Cobalt || tile.type == TileID.Palladium || tile.type == TileID.Mythril || tile.type == TileID.Orichalcum || tile.type == TileID.Adamantite || tile.type == TileID.Titanium) && !NPC.downedMechBossAny;
                    bool noChloro   = tile.type == TileID.Chlorophyte && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3);
                    bool noLihzahrd = tile.type == TileID.LihzahrdBrick && !NPC.downedGolemBoss;

                    if (noFossil || noDungeon || noHMOre || noChloro || noLihzahrd)
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, y);

                    // Tile destroy

                    // WorldGen.KillTile(xPosition, y);
                    // WorldGen.KillWall(xPosition, y);
                    // Dust.NewDust(position, 22, 22, DustID.Smoke, 0.0f, 0.0f, 120);

                    // Kill liquids

                    /*if (tile != null)
                     * {
                     *  tile.liquid = 0;
                     *  tile.lava(false);
                     *  tile.honey(false);
                     *  if (Main.netMode == NetmodeID.Server)
                     *  {
                     *      NetMessage.sendWater(xPosition, y);
                     *  }
                     * }*/

                    // Spawn structure
                    WorldGen.PlaceWall(xPosition, y, WallID.Stone);

                    if ((x == -3) || (x == 3))
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.GrayBrick);
                    }

                    if ((x == -2 || x == 2) && (y % 10 == 0))
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Torches);
                    }

                    if (x == 0)
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Rope);
                    }

                    NetMessage.SendTileSquare(-1, xPosition, y, 1);
                }
            }
        }
예제 #14
0
        public override void Kill(int timeLeft)
        {
            Vector2 position = projectile.Center;

            Main.PlaySound(SoundID.Item14, (int)position.X, (int)position.Y);

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                return;
            }

            // Seven across
            for (int x = -3; x <= 3; x++)
            {
                for (int y = (int)(1 + position.Y / 16.0f); y <= (Main.maxTilesY - 40); y++)
                {
                    int xPosition = (int)(x + position.X / 16.0f);

                    if (xPosition < 0 || xPosition >= Main.maxTilesX || y < 0 || y >= Main.maxTilesY)
                    {
                        continue;
                    }

                    Tile tile = Main.tile[xPosition, y];

                    if (tile == null)
                    {
                        continue;
                    }

                    if (!FargoGlobalProjectile.OkayToDestroyTile(tile))
                    {
                        continue;
                    }

                    FargoGlobalTile.ClearEverything(xPosition, y);

                    // Tile destroy

                    // WorldGen.KillTile(xPosition, y);
                    // WorldGen.KillWall(xPosition, y);
                    // Dust.NewDust(position, 22, 22, DustID.Smoke, 0.0f, 0.0f, 120);

                    // Kill liquids

                    /*if (tile != null)
                     * {
                     *  tile.liquid = 0;
                     *  tile.lava(false);
                     *  tile.honey(false);
                     *  if (Main.netMode == NetmodeID.Server)
                     *  {
                     *      NetMessage.sendWater(xPosition, y);
                     *  }
                     * }*/

                    // Spawn structure
                    WorldGen.PlaceWall(xPosition, y, WallID.Stone);

                    if ((x == -3) || (x == 3))
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.GrayBrick);
                    }

                    if ((x == -2 || x == 2) && (y % 10 == 0))
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Torches);
                    }

                    if (x == 0)
                    {
                        WorldGen.PlaceTile(xPosition, y, TileID.Rope);
                    }

                    NetMessage.SendTileSquare(-1, xPosition, y, 1);
                }
            }
        }
예제 #15
0
        public static void PlaceHouse(int x, int y, Vector2 position, int side, Player player)
        {
            int  xPosition = (int)((side * -1) + x + position.X / 16.0f);
            int  yPosition = (int)(y + position.Y / 16.0f);
            Tile tile      = Main.tile[xPosition, yPosition];

            // Testing for blocks that should not be destroyed
            bool noFossil   = tile.type == TileID.DesertFossil && !NPC.downedBoss2;
            bool noDungeon  = (tile.type == TileID.BlueDungeonBrick || tile.type == TileID.GreenDungeonBrick || tile.type == TileID.PinkDungeonBrick) && !NPC.downedBoss3;
            bool noHMOre    = (tile.type == TileID.Cobalt || tile.type == TileID.Palladium || tile.type == TileID.Mythril || tile.type == TileID.Orichalcum || tile.type == TileID.Adamantite || tile.type == TileID.Titanium) && !NPC.downedMechBossAny;
            bool noChloro   = tile.type == TileID.Chlorophyte && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || NPC.downedMechBoss3);
            bool noLihzahrd = tile.type == TileID.LihzahrdBrick && !NPC.downedGolemBoss;

            if (noFossil || noDungeon || noHMOre || noChloro || noLihzahrd)
            {
                return;
            }

            FargoGlobalTile.ClearEverything(xPosition, yPosition);

            /*// Tile destroy
             * WorldGen.KillTile(xPosition, yPosition, false, false, false);
             * WorldGen.KillWall(xPosition, yPosition);
             * Dust.NewDust(position, 22, 22, DustID.Smoke, Alpha: 120);
             *
             * // Kill liquids
             * if (tile != null)
             * {
             *  tile.liquid = 0;
             *  tile.lava(false);
             *  tile.honey(false);
             *  if (Main.netMode == NetmodeID.Server)
             *  {
             *      NetMessage.sendWater(xPosition, yPosition);
             *  }
             * }*/

            int wallType = WallID.Wood;
            int tileType = TileID.WoodBlock;

            if (player.ZoneDesert && !player.ZoneBeach)
            {
                wallType = WallID.Cactus;
                tileType = TileID.CactusBlock;
            }
            else if (player.ZoneSnow)
            {
                wallType = WallID.BorealWood;
                tileType = TileID.BorealWood;
            }
            else if (player.ZoneJungle)
            {
                wallType = WallID.RichMaogany;
                tileType = TileID.RichMahogany;
            }
            else if (player.ZoneCorrupt)
            {
                wallType = WallID.Ebonwood;
                tileType = TileID.Ebonwood;
            }
            else if (player.ZoneCrimson)
            {
                wallType = WallID.Shadewood;
                tileType = TileID.Shadewood;
            }
            else if (player.ZoneBeach)
            {
                wallType = WallID.PalmWood;
                tileType = TileID.PalmWood;
            }
            else if (player.ZoneHoly)
            {
                wallType = WallID.Pearlwood;
                tileType = TileID.Pearlwood;
            }
            else if (player.ZoneGlowshroom)
            {
                wallType = WallID.Mushroom;
                tileType = TileID.MushroomBlock;
            }
            else if (player.ZoneSkyHeight)
            {
                wallType = WallID.DiscWall;
                tileType = TileID.Sunplate;
            }
            else if (player.ZoneUnderworldHeight)
            {
                wallType = WallID.ObsidianBrick;
                tileType = TileID.ObsidianBrick;
            }

            // Spawn walls
            if (y != -6 && y != -1 && x != (10 * side) && x != (1 * side))
            {
                WorldGen.PlaceWall(xPosition, yPosition, wallType);
                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                }
            }

            // Spawn border
            if ((y == -6) || (y == -1) || (x == (10 * side)) || (x == (1 * side) && y == -5))
            {
                WorldGen.PlaceTile(xPosition, yPosition, tileType);
                if (Main.netMode == NetmodeID.Server)
                {
                    NetMessage.SendTileSquare(-1, xPosition, yPosition, 1);
                }
            }
        }