return node.name
end
+-- Fully charge RE chargeable item.
+-- Must be defined early to reference in item definitions.
+function technic.refill_RE_charge(stack)
+ local max_charge = technic.power_tools[stack:get_name()]
+ if not max_charge then return stack end
+ technic.set_RE_wear(stack, max_charge, max_charge)
+ local meta = minetest.deserialize(stack:get_metadata()) or {}
+ meta.charge = max_charge
+ stack:set_metadata(minetest.serialize(meta))
+ return stack
+end
"technic_diamond_block_blue.png",
"technic_diamond_block_blue.png"),
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
tool_capabilities = {
max_drop_level = 0,
groupcaps = {
"technic_diamond_block_green.png",
"technic_diamond_block_green.png"),
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
tool_capabilities = {
max_drop_level = 0,
groupcaps = {
"technic_diamond_block_red.png",
"technic_diamond_block_red.png"),
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
tool_capabilities = {
max_drop_level = 0,
groupcaps = {
description = S("RE Battery"),
inventory_image = "technic_battery.png",
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
tool_capabilities = {
charge = 0,
max_drop_level = 0,
return itemstack
end
end,
+ on_refill = function(stack)
+ stack:set_metadata(tostring(water_can_max_load))
+ set_can_wear(stack, water_can_max_load, water_can_max_load)
+ return stack
+ end,
})
minetest.register_tool("technic:lava_can", {
return itemstack
end
end,
+ on_refill = function(stack)
+ stack:set_metadata(tostring(lava_can_max_load))
+ set_can_wear(stack, lava_can_max_load, lava_can_max_load)
+ return stack
+ end,
})
inventory_image = "technic_chainsaw.png",
stack_max = 1,
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
inventory_image = "technic_flashlight.png",
stack_max = 1,
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
})
minetest.register_craft({
inventory_image = "technic_mining_drill.png",
stack_max = 1,
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
on_use = function(itemstack, user, pointed_thing)
if pointed_thing.type ~= "node" then
return itemstack
description = S("Mining Drill Mk%d"):format(2),
inventory_image = "technic_mining_drill_mk2.png",
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
on_use = function(itemstack, user, pointed_thing)
mining_drill_mk2_handler(itemstack, user, pointed_thing)
return itemstack
inventory_image = "technic_mining_drill_mk2.png^technic_tool_mode"..i..".png",
wield_image = "technic_mining_drill_mk2.png",
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
groups = {not_in_creative_inventory=1},
on_use = function(itemstack, user, pointed_thing)
mining_drill_mk2_handler(itemstack, user, pointed_thing)
description = S("Mining Drill Mk%d"):format(3),
inventory_image = "technic_mining_drill_mk3.png",
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
on_use = function(itemstack, user, pointed_thing)
mining_drill_mk3_handler(itemstack,user,pointed_thing)
return itemstack
inventory_image = "technic_mining_drill_mk3.png^technic_tool_mode"..i..".png",
wield_image = "technic_mining_drill_mk3.png",
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
groups = {not_in_creative_inventory=1},
on_use = function(itemstack, user, pointed_thing)
mining_drill_mk3_handler(itemstack,user,pointed_thing)
inventory_image = "technic_mining_laser_mk"..m[1]..".png",
stack_max = 1,
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
on_use = function(itemstack, user)
local meta = minetest.deserialize(itemstack:get_metadata())
if not meta or not meta.charge then
description = S("Sonic Screwdriver"),
inventory_image = "technic_sonic_screwdriver.png",
wear_represents = "technic_RE_charge",
+ on_refill = technic.refill_RE_charge,
on_use = function(itemstack, user, pointed_thing)
-- Must be pointing to facedir applicable node
if pointed_thing.type ~= "node" then