From 3d2d31896fe2be1545d022ad6afc6988ae6a46b9 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 19 Feb 2017 20:23:33 +0100 Subject: [PATCH] Break sounds for flint and steel and fishing rod --- mods/ITEMS/mcl_fire/depends.txt | 1 + mods/ITEMS/mcl_fire/flint_and_steel.lua | 5 +++++ mods/ITEMS/mcl_fishing/depends.txt | 1 + mods/ITEMS/mcl_fishing/init.lua | 5 +++++ 4 files changed, 12 insertions(+) diff --git a/mods/ITEMS/mcl_fire/depends.txt b/mods/ITEMS/mcl_fire/depends.txt index 315237e07b..97bf510696 100644 --- a/mods/ITEMS/mcl_fire/depends.txt +++ b/mods/ITEMS/mcl_fire/depends.txt @@ -1 +1,2 @@ mcl_core +mcl_sounds diff --git a/mods/ITEMS/mcl_fire/flint_and_steel.lua b/mods/ITEMS/mcl_fire/flint_and_steel.lua index c63c0c310b..f2e2fa55c0 100644 --- a/mods/ITEMS/mcl_fire/flint_and_steel.lua +++ b/mods/ITEMS/mcl_fire/flint_and_steel.lua @@ -6,6 +6,7 @@ minetest.register_tool("mcl_fire:flint_and_steel", { stack_max = 1, groups = { tool = 1 }, on_use = function(itemstack, user, pointed_thing) + local idef = itemstack:get_definition() if pointed_thing.type == "node" then if minetest.get_node(pointed_thing.under).name == "mcl_tnt:tnt" then tnt.ignite(pointed_thing.under) @@ -19,8 +20,12 @@ minetest.register_tool("mcl_fire:flint_and_steel", { 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 end, + sound = { breaks = "default_tool_breaks" }, }) minetest.register_craft({ diff --git a/mods/ITEMS/mcl_fishing/depends.txt b/mods/ITEMS/mcl_fishing/depends.txt index 315237e07b..97bf510696 100644 --- a/mods/ITEMS/mcl_fishing/depends.txt +++ b/mods/ITEMS/mcl_fishing/depends.txt @@ -1 +1,2 @@ mcl_core +mcl_sounds diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index 26b16b06a7..9d66ee5e9f 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -77,7 +77,11 @@ local go_fishing = function(itemstack, user, pointed_thing) inv:add_item("main", item) end if not minetest.setting_getbool("creative_mode") then + local idef = itemstack:get_definition() 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 return itemstack end @@ -93,6 +97,7 @@ minetest.register_tool("mcl_fishing:fishing_rod", { stack_max = 1, liquids_pointable = true, on_place = go_fishing, + sound = { breaks = "default_tool_breaks" }, }) minetest.register_craft({