Break sounds for flint and steel and fishing rod

This commit is contained in:
Wuzzy 2017-02-19 20:23:33 +01:00
parent f18ffce540
commit 3d2d31896f
4 changed files with 12 additions and 0 deletions

View File

@ -1 +1,2 @@
mcl_core mcl_core
mcl_sounds

View File

@ -6,6 +6,7 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
stack_max = 1, stack_max = 1,
groups = { tool = 1 }, groups = { tool = 1 },
on_use = function(itemstack, user, pointed_thing) on_use = function(itemstack, user, pointed_thing)
local idef = itemstack:get_definition()
if pointed_thing.type == "node" then if pointed_thing.type == "node" then
if minetest.get_node(pointed_thing.under).name == "mcl_tnt:tnt" then if minetest.get_node(pointed_thing.under).name == "mcl_tnt:tnt" then
tnt.ignite(pointed_thing.under) tnt.ignite(pointed_thing.under)
@ -19,8 +20,12 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
end end
end end
end end
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=user:getpos(), gain=0.5})
end
return itemstack return itemstack
end, end,
sound = { breaks = "default_tool_breaks" },
}) })
minetest.register_craft({ minetest.register_craft({

View File

@ -1 +1,2 @@
mcl_core mcl_core
mcl_sounds

View File

@ -77,7 +77,11 @@ local go_fishing = function(itemstack, user, pointed_thing)
inv:add_item("main", item) inv:add_item("main", item)
end end
if not minetest.setting_getbool("creative_mode") then if not minetest.setting_getbool("creative_mode") then
local idef = itemstack:get_definition()
itemstack:add_wear(65535/65) -- 65 uses itemstack:add_wear(65535/65) -- 65 uses
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=pointed_thing.above, gain=0.5})
end
end end
return itemstack return itemstack
end end
@ -93,6 +97,7 @@ minetest.register_tool("mcl_fishing:fishing_rod", {
stack_max = 1, stack_max = 1,
liquids_pointable = true, liquids_pointable = true,
on_place = go_fishing, on_place = go_fishing,
sound = { breaks = "default_tool_breaks" },
}) })
minetest.register_craft({ minetest.register_craft({