コード例 #1
0
ファイル: InstaProj.cs プロジェクト: tyhnoone/Fargowiltas
        public override void Kill(int timeLeft)
        {
            Vector2 position = projectile.Center;

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

            if (Main.netMode == 1)
            {
                return;
            }

            //7 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);
                    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.ClearEverythingWithNet(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 == 2)
                     *  {
                     *      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);
                }
            }
        }