--if not minetest.settings:get_bool("creative_mode") then
localwdef=itemstack:get_definition()
itemstack:add_wear(65535/(wdef._airtanks_uses-1))
ifitemstack:get_count()==0then
ifwdef.soundandwdef.sound.breaksthen
minetest.sound_play(wdef.sound.breaks,
{pos=user:get_pos(),gain=0.5})
end
end
--end
returnitemstack
end
minetest.register_tool("bubblesponge:tank",{
description=S("Bubblesponge Frond"),
_doc_items_longdesc=S("A frond harvested from a bubblesponge."),
_doc_items_usagehelp=S("If you're underwater and you're running out of breath, wield this item and use it to replenish 5 bubbles on your breath bar. When fully charged this frond has @1 uses before it becomes empty.",config.uses),
_airtanks_uses=config.uses,
inventory_image="bubblesponge_frond.png",
wield_image="bubblesponge_frond.png",
stack_max=1,
groups={bubblesponge_tank=1},
on_place=function(itemstack,user,pointed_thing)
returnuse_airtank(itemstack,user)
end,
on_use=function(itemstack,user,pointed_thing)
returnuse_airtank(itemstack,user)
end,
})
minetest.register_tool("bubblesponge:bundle",{
description=S("Bubblesponge Bundle"),
_doc_items_longdesc=S("A bundle of fronds harvested from a bubblesponge."),
_doc_items_usagehelp=S("If you're underwater and you're running out of breath, wield this item and use it to replenish 5 bubbles on your breath bar. When fully charged this frond has @1 uses before it becomes empty.",config.uses*9),
_doc_items_longdesc=S("The trunk of a massive sponge. Bubblesponges grow deep underwater in caverns and their fronds have uniquely helpful properties for divers."),
_doc_items_usagehelp=S("If you're underwater and you're running out of breath you can squeeze a lungful of air from a wielded Bubblesponge frond"),