~fgaz/minetest-falling_nodes

fbd9d915564279208be29f5c464186d055f854eb — Francesco Gazzetta a month ago a6cb5cb
Add heat tools
1 files changed, 26 insertions(+), 0 deletions(-)

M mods/falling_nodes/tools.lua
M mods/falling_nodes/tools.lua => mods/falling_nodes/tools.lua +26 -0
@@ 10,3 10,29 @@ minetest.register_tool("falling_nodes:spark", {
    end
  end,
})

minetest.register_tool("falling_nodes:heat", {
  description = "Heat\nHeats the clicked node",
  short_description = "Heat",
  inventory_image = "[fill:1x1:#FFDD00",
  on_place = function(itemstack, placer, pointed_thing)
    local pos = pointed_thing.under
    local name = minetest.get_node(pos).name
    if not falling_nodes.registered_materials[name] then return end
    if not falling_nodes.registered_materials[name].temperature_high then return end
    falling_nodes.registered_materials[name].temperature_high.action(pos)
  end,
})

minetest.register_tool("falling_nodes:cool", {
  description = "Cool\nCools the clicked node",
  short_description = "Cool",
  inventory_image = "[fill:1x1:#00DDFF",
  on_place = function(itemstack, placer, pointed_thing)
    local pos = pointed_thing.under
    local name = minetest.get_node(pos).name
    if not falling_nodes.registered_materials[name] then return end
    if not falling_nodes.registered_materials[name].temperature_low then return end
    falling_nodes.registered_materials[name].temperature_low.action(pos)
  end,
})