Esempio n. 1
0
        public static void PlaceTrack(int x, int y)
        {
            WorldGen.PlaceTile(x, y, TileID.MinecartTrack);
            WorldGen.SquareTileFrame(x, y);

            var pos = new Vector2(x << 4, y << 4);

            Main.PlaySound(SoundID.Item52, pos);
            ParticleFxHelpers.MakeDustCloud(pos, 1);
        }
Esempio n. 2
0
        ////////////////

        /*private void DrawInterface01_PiratesArrive() {
         *      Main.instance.LoadNPC( NPCID.PirateShip );
         *
         *      Vector2 pos = this.PirateShipPos - Main.screenPosition;
         *      pos.Y -= Main.npcTexture[ NPCID.PirateShip ].Height;
         *      pos.Y += 48;
         *
         *      Main.spriteBatch.Draw(
         *              texture: Main.npcTexture[ NPCID.PirateShip ],
         *              position: pos,
         *              sourceRectangle: null,
         *              color: Lighting.GetColor( (int)(this.PirateShipPos.X/16), (int)(this.PirateShipPos.Y/16) ),
         *              rotation: 0,
         *              origin: default( Vector2 ),
         *              scale: 1f,
         *              effects: SpriteEffects.FlipHorizontally,
         *              layerDepth: 1f
         *      );
         *
         *      this.PirateShipPos.X -= 1;
         * }*/


        ////////////////

        private void FireCannon()
        {
            NPC     ship = Main.npc[this.Set.ShipPropNPC];
            Vector2 pos  = ship.Center;

            pos.X -= 16f;
            pos.X += Main.rand.Next(4) * 48;
            pos.Y -= 64;
            pos.Y += Main.npcTexture[NPCID.PirateShip].Height / 2;

            Main.PlaySound(SoundID.Item14, pos);
            ParticleFxHelpers.MakeDustCloud(pos, 1);
        }
        public static bool HitTile(int damage, int tileX, int tileY, int totalHits, float percent = 1f)
        {
            var  mymod  = DestructibleTilesMod.Instance;
            var  config = DestructibleTilesConfig.Instance;
            Tile tile   = Framing.GetTileSafely(tileX, tileY);
            //HitTile plrTileHits = Main.LocalPlayer.hitTile;

            //int tileHitId = plrTileHits.HitObject( tileX, tileY, 1 );
            int dmg = (int)(DestructibleTilesProjectile.ComputeHitDamage(tile, damage, totalHits) * percent);

            if (config.DebugModeInfo)
            {
                Main.NewText(HamstarHelpers.Helpers.Tiles.Attributes.TileAttributeHelpers.GetVanillaTileDisplayName(tile.type) + " hit for " + dmg.ToString("N2"));
            }

            if (mymod.TileDataMngr.AddDamage(tileX, tileY, dmg) >= 100)                 //
            //if( plrTileHits.AddDamage( tileHitId, dmg, true ) >= 100 ) {
            //	plrTileHits.Clear( tileHitId );
            {
                bool isTileKilled = TileHelpers.KillTileSynced(
                    tileX: tileX,
                    tileY: tileY,
                    effectOnly: false,
                    dropsItem: config.DestroyedTilesDropItems,
                    forceSyncIfUnchanged: true,
                    suppressErrors: false
                    );

                if (isTileKilled)
                {
                    WorldGen.SquareTileFrame(tileX, tileY);                         // unnecessary?

                    ParticleFxHelpers.MakeDustCloud(
                        new Vector2((tileX * 16) + 8, (tileY * 16) + 8),
                        1,
                        0.3f,
                        1.2f
                        );
                }

                return(isTileKilled);
            }

            return(false);
        }
Esempio n. 4
0
        public static void EmitSmoke(Vector2 pos, bool fake)
        {
            ParticleFxHelpers.MakeDustCloud(
                position: fake
                                        ? pos
                                        : pos - new Vector2(16f),
                quantity: 1,
                sprayAmount: 0.3f,
                scale: fake
                                        ? 0.5f
                                        : 2f
                );

            if (!fake)
            {
                PirateNegotiatorTownNPC.EmitSmoke(pos, true);
            }
        }