mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
Merge pull request 'Add sounds when using composter' (#3549) from composter-add-sounds into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3549 Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
This commit is contained in:
commit
a4b4e4de69
1 changed files with 3 additions and 2 deletions
|
@ -76,6 +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=pos, 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
|
||||
|
@ -92,6 +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=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
|
||||
|
@ -114,7 +115,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
|
||||
|
||||
|
|
Loading…
Reference in a new issue