Request: Hatchet hit = /killtree

I would like players to be able to /killtree without having to type anything but using hatchet hits by default. So each hatchet hit is a deforestation

Not sure I understand. You want players to be able to one-hit a single tree?

OGB5YaazKAjibvZ.png Lincoln

Not sure I understand. You want players to be able to one-hit a single tree?

That's correct

Ah, well that's not really the purpose of this plugin. This would be better if it was a entirely different plugin. I can look into building a separate one that accomplishes this.

Something like this would work:

        private object OnMeleeAttack(BasePlayer player, HitInfo info)
        {
            if (player == null) return null;

            Item item = player.GetActiveItem();
            if (item?.ToString().Contains("axe") == true
                || item?.ToString().Contains("hammer.salvaged") == true
                || item?.ToString().Contains("hatchet") == true)
            {
                TreeDeforestationCMD(player, "killtree", new string[1] { config.maxRadius.ToString() });
            }
            return null;
        }​


Merged post

You could also add something like the following in TreeDeforestationCMD to transfer the one-hit trees' wood to the player, perhaps wrapped in a config.  Not sure the purpose of this other than truly deforesting the map, but...
                    foreach (ItemAmount ia in tree.resourceDispenser.containedItems)
                    {
                        Item item = ItemManager.CreateByItemID(ia.itemid, (int)Math.Round(ia.amount));
                        bool unused = item.MoveToContainer(player.inventory.containerMain);
                    }​