-- IndustrialTest -- Copyright (C) 2023 mrkubax10 and Migdyn -- This program is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- You should have received a copy of the GNU General Public License -- along with this program. If not, see . local S=minetest.get_translator("industrialtest") local definition={ description=S("Treetap"), inventory_image="industrialtest_treetap.png", tool_capabilities={ full_punch_interval=1, uses=50 }, on_place=function(itemstack,user,pointed) if pointed.type=="node" and user and user:is_player() then local node=minetest.get_node_or_nil(pointed.under) if not node then return nil end -- Note: if more nodes from which treetap can extract will be added then they shouldn't be added here -- Instead they should have additional entry in definition which will denote that treetap can be used on them if node.name=="industrialtest:rubber_wood_with_rubber" then local inv=user:get_inventory() inv:add_item("main",ItemStack("industrialtest:sticky_resin")) minetest.set_node(pointed.under,{name="industrialtest:rubber_wood"}) industrialtest.api.afterToolUse(itemstack) return itemstack end end return nil end, _industrialtest_tool=true } minetest.register_tool("industrialtest:drill", { description = S("Mining Drill"), inventory_image = "industrialtest_drill.png", _industrialtest_powerStorage=true, _industrialtest_powerCapacity=30000, _industrialtest_powerFlow=128, tool_capabilities = { full_punch_interval = 1.5, max_drop_level = 1, groupcaps = { crumbly = { maxlevel = 3, times = {[1]=0.3, [2]=0.3, [3]=0.3} }, cracky = { maxlevel = 3, times = {[1]=0.3, [2]=0.3, [3]=0.3} }, }, damage_groups = {cracky=3,crubmly=3,fleshy=3}, }, }) minetest.register_tool("industrialtest:drill_diamond", { description = S("Diamond Drill"), inventory_image = "industrialtest_drill_diamond.png", _industrialtest_powerStorage=true, _industrialtest_powerCapacity=30000, _industrialtest_powerFlow=128, tool_capabilities = { full_punch_interval = 1.5, max_drop_level = 1, groupcaps = { crumbly = { maxlevel = 3, times = {[1]=0.1, [2]=0.1, [3]=0.1} }, cracky = { maxlevel = 3, times = {[1]=0.1, [2]=0.1, [3]=0.1} }, }, damage_groups = {cracky=3,crubmly=3,fleshy=3}, }, }) if industrialtest.mtgAvailable then definition.groups={ flammable=2 } elseif industrialtest.mclAvailable then definition.groups={ tool=1 } definition._repair_material="group:wood" definition._mcl_toollike_wield=true end minetest.register_tool("industrialtest:treetap", definition) minetest.register_craft({ type="shaped", output="industrialtest:treetap", recipe={ {"","group:wood",""}, {"group:wood","group:wood","group:wood"}, {"group:wood","",""} } })