From 20f8e18098f6ce72b8447188d5c7507b02993145 Mon Sep 17 00:00:00 2001 From: SmokeyDope Date: Thu, 16 Mar 2023 01:46:01 +0000 Subject: [PATCH 1/4] Add sounds when using composter --- mods/ITEMS/mcl_composters/init.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index e1e39aefc..71ad15255 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -75,7 +75,8 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing) local chance = get_item_group(itemname, "compostability") if chance > 0 then if not is_creative_enabled(player:get_player_name()) then - itemstack:take_item() + itemstack:take_item() + minetest.sound_play({name="default_gravel_dug", pos=above, gain=1}, true) end -- calculate leveling up chance local rand = math.random(0,100) @@ -84,7 +85,6 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing) local level = registered_nodes[node.name]["_mcl_compost_level"] -- spawn green particles above new layer mcl_dye.add_bone_meal_particle(vector_offset(pos, 0, level/8, 0)) - -- TODO: play some sounds -- update composter block if level < 7 then level = level + 1 @@ -94,6 +94,8 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing) swap_node(pos, {name = "mcl_composters:composter_" .. level}) -- a full composter becomes ready for harvest after one second -- the block will get updated by the node timer callback set in node reg def + minetest.sound_play({name="default_grass_footstep", pos=above, gain=1}, true) + if level == 7 then local timer = get_node_timer(pos) timer:start(1) @@ -114,7 +116,7 @@ end local function composter_ready(pos) swap_node(pos, {name = "mcl_composters:composter_ready"}) -- maybe spawn particles again? - -- TODO: play some sounds + minetest.sound_play({name="default_dig_snappy", pos=above, gain=1}, true) return false end From 89f2c06af256218a4b5176ad6631d53842b522b6 Mon Sep 17 00:00:00 2001 From: SmokeyDope Date: Thu, 16 Mar 2023 01:54:42 +0000 Subject: [PATCH 2/4] Fix accidental extra spaces --- mods/ITEMS/mcl_composters/init.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 71ad15255..d012e250e 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -75,7 +75,7 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing) local chance = get_item_group(itemname, "compostability") if chance > 0 then if not is_creative_enabled(player:get_player_name()) then - itemstack:take_item() + itemstack:take_item() minetest.sound_play({name="default_gravel_dug", pos=above, gain=1}, true) end -- calculate leveling up chance @@ -92,10 +92,9 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing) level = "ready" end swap_node(pos, {name = "mcl_composters:composter_" .. level}) + minetest.sound_play({name="default_grass_footstep", pos=above, gain=1}, true) -- a full composter becomes ready for harvest after one second -- the block will get updated by the node timer callback set in node reg def - minetest.sound_play({name="default_grass_footstep", pos=above, gain=1}, true) - if level == 7 then local timer = get_node_timer(pos) timer:start(1) From 811f8ac516c8c5e9b19e369996d09d1eece0c65f Mon Sep 17 00:00:00 2001 From: SmokeyDope Date: Thu, 16 Mar 2023 01:56:43 +0000 Subject: [PATCH 3/4] One more indentation fix, sorry for the extra commit --- mods/ITEMS/mcl_composters/init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index d012e250e..19a89c27b 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -115,7 +115,7 @@ end local function composter_ready(pos) swap_node(pos, {name = "mcl_composters:composter_ready"}) -- maybe spawn particles again? - minetest.sound_play({name="default_dig_snappy", pos=above, gain=1}, true) + minetest.sound_play({name="default_dig_snappy", pos=above, gain=1}, true) return false end From 002a63585f6848220a922af41f1d485b2ea6eed3 Mon Sep 17 00:00:00 2001 From: ancientmarinerdev Date: Sat, 18 Mar 2023 18:27:52 +0000 Subject: [PATCH 4/4] Tweak volume and change reference to missing global variable --- mods/ITEMS/mcl_composters/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_composters/init.lua b/mods/ITEMS/mcl_composters/init.lua index 19a89c27b..51c887531 100644 --- a/mods/ITEMS/mcl_composters/init.lua +++ b/mods/ITEMS/mcl_composters/init.lua @@ -76,7 +76,7 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing) if chance > 0 then if not is_creative_enabled(player:get_player_name()) then itemstack:take_item() - minetest.sound_play({name="default_gravel_dug", pos=above, gain=1}, true) + minetest.sound_play({name="default_gravel_dug", pos=pos, gain=1}, true) end -- calculate leveling up chance local rand = math.random(0,100) @@ -92,7 +92,7 @@ local function composter_add_item(pos, node, player, itemstack, pointed_thing) level = "ready" end swap_node(pos, {name = "mcl_composters:composter_" .. level}) - minetest.sound_play({name="default_grass_footstep", pos=above, gain=1}, true) + minetest.sound_play({name="default_grass_footstep", pos=pos, gain=0.4}, true) -- a full composter becomes ready for harvest after one second -- the block will get updated by the node timer callback set in node reg def if level == 7 then