Ejemplo n.º 1
0
        public override void DrawEffects(int i, int j, SpriteBatch spriteBatch, ref Color drawColor, ref int nextSpecialDrawIndex)
        {
            base.DrawEffects(i, j, spriteBatch, ref drawColor, ref nextSpecialDrawIndex);

            Tile tile = Main.tile[i, j];
            int  left = i - tile.frameX / 18;
            int  top  = j - tile.frameY / 18;

            int index = GetInstance <TEQuarry>().Find(left, top);

            if (index != -1)
            {
                TEQuarry qe = (TEQuarry)TileEntity.ByID[index];

                if (qe.on && Main.rand.Next(10) == 0)
                {
                    Vector2 pos = new Vector2(i * 16, j * 16);
                    int     ppi = Dust.NewDust(pos, 16, 16, DustID.Smoke);
                    Main.dust[ppi].velocity = Main.rand.NextVector2Circular(0.5f, 0.5f);
                    Main.dust[ppi].alpha    = 127;
                }

                if (qe.mined && tile.frameX == 18 && (tile.frameY % (18 * 3)) == 0)
                {
                    if (Main.rand.Next(1) == 0)
                    {
                        Vector2 pos = new Vector2(i * 16, j * 16);
                        int     ppi = Dust.NewDust(pos, 16, 4, DustID.Dirt);
                        Main.dust[ppi].velocity = Main.rand.NextVector2Circular(0.5f, 0.5f) + new Vector2(0, -2);
                        Main.dust[ppi].alpha    = 127;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override bool NewRightClick(int i, int j)
        {
            Tile tile = Main.tile[i, j];
            int  left = i - tile.frameX / 18;
            int  top  = j - tile.frameY / 18;

            int index = GetInstance <TEQuarry>().Find(left, top);

            if (index != -1)
            {
                TEQuarry ent = (TEQuarry)TileEntity.ByID[index];

                if (!MoreMechanisms.instance.QuarryUIVisible())
                {
                    MoreMechanisms.instance.quarryUIState.i = i * 16;
                    MoreMechanisms.instance.quarryUIState.j = j * 16;

                    MoreMechanisms.instance.ShowQuarryUI(ent.pickaxe, ent.filter, (Item it) => {
                        ent.pickaxe = it;
                    });
                }
            }

            return(true);
        }
Ejemplo n.º 3
0
        public override void HitWire(int i, int j)
        {
            base.HitWire(i, j);

            Tile tile = Main.tile[i, j];
            int  left = i - tile.frameX / 18;
            int  top  = j - tile.frameY / 18;

            int index = GetInstance <TEQuarry>().Find(left, top);

            if (index != -1)
            {
                TEQuarry qe = (TEQuarry)TileEntity.ByID[index];

                qe.on = !qe.on;
                if (qe.on)
                {
                    Main.PlaySound(SoundID.Item23, left * 16, top * 16);
                }
            }
        }