Play sound when planting crops

This commit is contained in:
TenPlus1 2016-04-01 11:02:18 +01:00
parent a084ab464e
commit 2a62120208
3 changed files with 11 additions and 5 deletions

View File

@ -19,7 +19,9 @@ minetest.register_craftitem("farming:beans", {
local nodename = minetest.get_node(pointed_thing.under).name local nodename = minetest.get_node(pointed_thing.under).name
if nodename == "farming:beanpole" then 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 else
return return
end end

View File

@ -14,7 +14,9 @@ minetest.register_craftitem("farming:grapes", {
local nodename = minetest.get_node(pointed_thing.under).name local nodename = minetest.get_node(pointed_thing.under).name
if nodename == "farming:trellis" then 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 else
return return
end end

View File

@ -1,5 +1,5 @@
--[[ --[[
Minetest Farming Redo Mod 1.22 (10th March 2016) Minetest Farming Redo Mod 1.22 (31st March 2016)
by TenPlus1 by TenPlus1
NEW growing routine by prestidigitator NEW growing routine by prestidigitator
auto-refill by crabman77 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 -- can I replace above node, and am I pointing at soil
if not minetest.registered_nodes[above.name].buildable_to 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 -- avoid multiple seed placement bug
or minetest.get_item_group(above.name, "plant") ~= 0 then or minetest.get_item_group(above.name, "plant") ~= 0 then
return return
@ -578,6 +578,8 @@ function farming.place_seed(itemstack, placer, pointed_thing, plantname)
minetest.set_node(pt.above, {name = plantname, param2 = 1}) 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 if not minetest.setting_getbool("creative_mode") then
itemstack:take_item() itemstack:take_item()
@ -636,7 +638,7 @@ farming.register_plant = function(name, def)
on_place = function(itemstack, placer, pointed_thing) on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1") return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":"..pname.."_1")
end end,
}) })
-- Register harvest -- Register harvest