From 2a6212020815e53540e0df28946e09a81546ff2b Mon Sep 17 00:00:00 2001 From: TenPlus1 Date: Fri, 1 Apr 2016 11:02:18 +0100 Subject: [PATCH] Play sound when planting crops --- beanpole.lua | 4 +++- grapes.lua | 4 +++- init.lua | 8 +++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/beanpole.lua b/beanpole.lua index d049438..4c14b80 100644 --- a/beanpole.lua +++ b/beanpole.lua @@ -19,7 +19,9 @@ minetest.register_craftitem("farming:beans", { local nodename = minetest.get_node(pointed_thing.under).name if nodename == "farming:beanpole" then - minetest.set_node(pointed_thing.under, {name="farming:beanpole_1"}) + minetest.set_node(pointed_thing.under, {name = "farming:beanpole_1"}) + + minetest.sound_play("default_place_node", {gain = 1.0}) else return end diff --git a/grapes.lua b/grapes.lua index a23f560..ffd5698 100644 --- a/grapes.lua +++ b/grapes.lua @@ -14,7 +14,9 @@ minetest.register_craftitem("farming:grapes", { local nodename = minetest.get_node(pointed_thing.under).name if nodename == "farming:trellis" then - minetest.set_node(pointed_thing.under, {name="farming:grapes_1"}) + minetest.set_node(pointed_thing.under, {name = "farming:grapes_1"}) + + minetest.sound_play("default_place_node", {gain = 1.0}) else return end diff --git a/init.lua b/init.lua index e141ead..f8f67b6 100644 --- a/init.lua +++ b/init.lua @@ -1,5 +1,5 @@ --[[ - Minetest Farming Redo Mod 1.22 (10th March 2016) + Minetest Farming Redo Mod 1.22 (31st March 2016) by TenPlus1 NEW growing routine by prestidigitator auto-refill by crabman77 @@ -567,7 +567,7 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) -- can I replace above node, and am I pointing at soil if not minetest.registered_nodes[above.name].buildable_to - or minetest.get_item_group(under.name, "soil") < 2 + or minetest.get_item_group(under.name, "soil") < 2 -- avoid multiple seed placement bug or minetest.get_item_group(above.name, "plant") ~= 0 then return @@ -578,6 +578,8 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname) minetest.set_node(pt.above, {name = plantname, param2 = 1}) + minetest.sound_play("default_place_node", {gain = 1.0}) + if not minetest.setting_getbool("creative_mode") then itemstack:take_item() @@ -636,7 +638,7 @@ farming.register_plant = function(name, def) on_place = function(itemstack, placer, pointed_thing) return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1") - end + end, }) -- Register harvest