Пример #1
0
 public override bool AutoSelect(int i, int j, int type, Item item)
 {
     if (Main.SmartCursorEnabled && Main.SmartCursorShowing)
     {
         type = Main.tile[Player.tileTargetX, Player.tileTargetY].type;
     }
     return(item.modItem is BaseShovel myShovel && ShovelMethods.DigPower((ushort)type, myShovel.Shovel) >= 100);
 }
Пример #2
0
        // Adapted from the vanilla Player class method
        public void PickTile(Player player, int x, int y)
        {
            int  tileId      = player.hitTile.HitObject(x, y, 1);
            Tile tile        = Main.tile[x, y];
            int  actualPower = ShovelMethods.DigPower(tile.type, Shovel);

            if (actualPower < 100 && Pick >= Shovel)
            {
                player.PickTile(x, y, Pick);
                return;
            }
            else if (actualPower == 0)
            {
                player.PickTile(x, y, Math.Max(Shovel / 8, 1));
                return;
            }
            if (!WorldGen.CanKillTile(x, y))
            {
                actualPower = 0;
            }

            if (player.hitTile.AddDamage(tileId, actualPower, true) >= 100)
            {
                AchievementsHelper.CurrentlyMining = true;
                player.hitTile.Clear(tileId);
                bool wasActive = tile.active();
                WorldGen.KillTile(x, y, false, false, false);
                if (wasActive && !tile.active())
                {
                    AchievementsHelper.HandleMining();
                }

                AchievementsHelper.CurrentlyMining = false;
            }
            else
            {
                WorldGen.KillTile(x, y, true, false, false);
            }

            if (Main.netMode == NetmodeID.MultiplayerClient)
            {
                NetMessage.SendData(MessageID.TileChange, -1, -1, null, 0, x, y);
            }

            if (actualPower != 0)
            {
                player.hitTile.Prune();
            }
        }
Пример #3
0
 // Reset effects happens almost right after the vanilla SmarCursorLookup
 public override void ResetEffects() => ShovelMethods.SmartCursorLookup(player);