Merge pull request 'Sweet berries: Add rightclick harvesting' (#2971) from sweet_berries into master
Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2971 Reviewed-by: PrairieWind <prairie.astronomer1@gmail.com>
This commit is contained in:
commit
eaccd71558
|
@ -379,6 +379,8 @@ local function apply_bone_meal(pointed_thing,user)
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
mcl_dye.apply_bone_meal = apply_bone_meal
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_dye:white", {
|
minetest.register_craftitem("mcl_dye:white", {
|
||||||
inventory_image = "mcl_dye_white.png",
|
inventory_image = "mcl_dye_white.png",
|
||||||
description = S("Bone Meal"),
|
description = S("Bone Meal"),
|
||||||
|
|
|
@ -35,6 +35,24 @@ for i=0, 3 do
|
||||||
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
sounds = mcl_sounds.node_sound_leaves_defaults(),
|
||||||
_mcl_blast_resistance = 0,
|
_mcl_blast_resistance = 0,
|
||||||
_mcl_hardness = 0,
|
_mcl_hardness = 0,
|
||||||
|
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||||
|
if mcl_dye and clicker:get_wielded_item():get_name() == "mcl_dye:white" then
|
||||||
|
mcl_dye.apply_bone_meal({under=pos},clicker)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local stage
|
||||||
|
if node.name:find("_2") then
|
||||||
|
stage = 2
|
||||||
|
elseif node.name:find("_3") then
|
||||||
|
stage = 3
|
||||||
|
end
|
||||||
|
if stage then
|
||||||
|
for i=1,math.random(stage) do
|
||||||
|
minetest.add_item(pos,"mcl_farming:sweet_berry")
|
||||||
|
end
|
||||||
|
minetest.swap_node(pos,{name = "mcl_farming:sweet_berry_bush_" .. stage - 1 })
|
||||||
|
end
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
minetest.register_alias("mcl_sweet_berry:sweet_berry_bush_" .. i, node_name)
|
minetest.register_alias("mcl_sweet_berry:sweet_berry_bush_" .. i, node_name)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user