From 053fa59739f4b772174bf0a090969b3395ab3f98 Mon Sep 17 00:00:00 2001 From: kpoppel <poulsen.kim@gmail.com> Date: Tue, 02 Jul 2013 00:19:06 +0200 Subject: [PATCH] Merge pull request #38 from kpoppel/master --- technic/chainsaw.lua | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/technic/chainsaw.lua b/technic/chainsaw.lua index c31d9a8..5c5de4c 100644 --- a/technic/chainsaw.lua +++ b/technic/chainsaw.lua @@ -3,7 +3,7 @@ local chainsaw_charge_per_node = 12 -- 12 - Gives 2500 nodes on a single charge (about 50 complete normal trees) local chainsaw_leaves = true -- true - Cut down entire trees, leaves and all -register_power_tool ("technic:chainsaw",chainsaw_max_charge) +technic.register_LV_power_tool ("technic:chainsaw",chainsaw_max_charge) minetest.register_tool("technic:chainsaw", { description = "Chainsaw", @@ -20,7 +20,7 @@ if charge < chainsaw_charge_per_node then return end -- only cut if charged charge=chainsaw_dig_it(minetest.get_pointed_thing_position(pointed_thing, above),user,charge) - set_RE_wear(item,charge,chainsaw_max_charge) + technic.set_RE_wear(item,charge,chainsaw_max_charge) meta["charge"]=charge item["metadata"]=set_item_meta(meta) itemstack:replace(item) @@ -138,12 +138,22 @@ timber_nodenames["growing_cactus:branch_xx"] = true end +-- Support farming_plus if it is there +if( minetest.get_modpath("farming_plus") ~= nil ) then + if chainsaw_leaves == true then + timber_nodenames["farming_plus:cocoa_leaves"] = true + end +end + -- Table for saving what was sawed down local produced -- Saw down trees entry point chainsaw_dig_it = function(pos, player,current_charge) local remaining_charge=current_charge + + -- Save the currently installed dropping mechanism so we can restore it. + local original_handle_node_drops = minetest.handle_node_drops -- A bit of trickery here: use a different node drop callback -- and restore the original afterwards. @@ -194,9 +204,6 @@ end end end - --- Save the currently installed dropping mechanism so we can restore it. -local original_handle_node_drops = minetest.handle_node_drops -- This function does all the hard work. Recursively we dig the node at hand -- if it is in the table and then search the surroundings for more stuff to dig. -- Gitblit v1.8.0