Merge pull request 'Fix a few issues with sweet berries.' (#3187) from CyberMango/MineClone2:bug/mango/sweet_berry_fixes into master
Reviewed-on: MineClone2/MineClone2#3187 Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
This commit is contained in:
commit
856a60bcc2
|
@ -149,6 +149,11 @@ mcl_death_messages = {
|
||||||
plain = "@1 went off with a bang",
|
plain = "@1 went off with a bang",
|
||||||
item = "@1 went off with a bang due to a firework fired from @3 by @2", -- order is intentional
|
item = "@1 went off with a bang due to a firework fired from @3 by @2", -- order is intentional
|
||||||
},
|
},
|
||||||
|
sweet_berry = {
|
||||||
|
_translator = S,
|
||||||
|
plain = "@1 died a sweet death",
|
||||||
|
assist = "@1 was poked to death by a sweet berry bush whilst trying to escape @2",
|
||||||
|
},
|
||||||
-- Missing snowballs: The Minecraft wiki mentions them but the MC source code does not.
|
-- Missing snowballs: The Minecraft wiki mentions them but the MC source code does not.
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ local function apply_bone_meal(pointed_thing,user)
|
||||||
if n.name == "mcl_farming:sweet_berry_bush_3" then
|
if n.name == "mcl_farming:sweet_berry_bush_3" then
|
||||||
return minetest.add_item(vector.offset(pos,math.random()-0.5,math.random()-0.5,math.random()-0.5),"mcl_farming:sweet_berry")
|
return minetest.add_item(vector.offset(pos,math.random()-0.5,math.random()-0.5,math.random()-0.5),"mcl_farming:sweet_berry")
|
||||||
else
|
else
|
||||||
return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, n, 1, true)
|
return mcl_farming:grow_plant("plant_sweet_berry_bush", pos, n, 0, true)
|
||||||
end
|
end
|
||||||
elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then
|
elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then
|
||||||
mcl_dye.add_bone_meal_particle(pos)
|
mcl_dye.add_bone_meal_particle(pos)
|
||||||
|
|
|
@ -89,14 +89,7 @@ minetest.register_craftitem("mcl_farming:carrot_item", {
|
||||||
groups = {food = 2, eatable = 3, compostability = 65},
|
groups = {food = 2, eatable = 3, compostability = 65},
|
||||||
_mcl_saturation = 3.6,
|
_mcl_saturation = 3.6,
|
||||||
on_secondary_use = minetest.item_eat(3),
|
on_secondary_use = minetest.item_eat(3),
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = mcl_farming:get_seed_or_eat_callback("mcl_farming:carrot_1", 3),
|
||||||
local new = mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:carrot_1")
|
|
||||||
if new then
|
|
||||||
return new
|
|
||||||
else
|
|
||||||
return minetest.do_item_eat(3, nil, itemstack, placer, pointed_thing)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_farming:carrot_item_gold", {
|
minetest.register_craftitem("mcl_farming:carrot_item_gold", {
|
||||||
|
|
|
@ -95,14 +95,7 @@ minetest.register_craftitem("mcl_farming:potato_item", {
|
||||||
_mcl_saturation = 0.6,
|
_mcl_saturation = 0.6,
|
||||||
stack_max = 64,
|
stack_max = 64,
|
||||||
on_secondary_use = minetest.item_eat(1),
|
on_secondary_use = minetest.item_eat(1),
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = mcl_farming:get_seed_or_eat_callback("mcl_farming:potato_1", 1),
|
||||||
local new = mcl_farming:place_seed(itemstack, placer, pointed_thing, "mcl_farming:potato_1")
|
|
||||||
if new then
|
|
||||||
return new
|
|
||||||
else
|
|
||||||
return minetest.do_item_eat(1, nil, itemstack, placer, pointed_thing)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craftitem("mcl_farming:potato_item_baked", {
|
minetest.register_craftitem("mcl_farming:potato_item_baked", {
|
||||||
|
|
|
@ -469,6 +469,21 @@ function mcl_farming:stem_color(startcolor, endcolor, step, step_count)
|
||||||
return colorstring
|
return colorstring
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--[[Get a callback that either eats the item or plants it.
|
||||||
|
|
||||||
|
Used for on_place callbacks for craft items which are seeds that can also be consumed.
|
||||||
|
]]
|
||||||
|
function mcl_farming:get_seed_or_eat_callback(plantname, hp_change)
|
||||||
|
return function(itemstack, placer, pointed_thing)
|
||||||
|
local new = mcl_farming:place_seed(itemstack, placer, pointed_thing, plantname)
|
||||||
|
if new then
|
||||||
|
return new
|
||||||
|
else
|
||||||
|
return minetest.do_item_eat(hp_change, nil, itemstack, placer, pointed_thing)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
label = "Add growth for unloaded farming plants",
|
label = "Add growth for unloaded farming plants",
|
||||||
name = "mcl_farming:growth",
|
name = "mcl_farming:growth",
|
||||||
|
|
|
@ -9,6 +9,9 @@ for i=0, 3 do
|
||||||
if i > 0 then
|
if i > 0 then
|
||||||
groups.sweet_berry_thorny = 1
|
groups.sweet_berry_thorny = 1
|
||||||
end
|
end
|
||||||
|
local drop_berries = (i >= 2)
|
||||||
|
local berries_to_drop = drop_berries and {i - 1, i} or nil
|
||||||
|
|
||||||
minetest.register_node(node_name, {
|
minetest.register_node(node_name, {
|
||||||
drawtype = "plantlike",
|
drawtype = "plantlike",
|
||||||
tiles = {texture},
|
tiles = {texture},
|
||||||
|
@ -24,7 +27,14 @@ for i=0, 3 do
|
||||||
liquid_renewable = false,
|
liquid_renewable = false,
|
||||||
liquid_range = 0,
|
liquid_range = 0,
|
||||||
walkable = false,
|
walkable = false,
|
||||||
drop = (i>=2) and ("mcl_farming:sweet_berry" .. (i==3 and " 3" or "")) or "",
|
-- Dont even create a table if no berries are dropped.
|
||||||
|
drop = not drop_berries and "" or {
|
||||||
|
max_items = 1,
|
||||||
|
items = {
|
||||||
|
{ items = {"mcl_farming:sweet_berry " .. berries_to_drop[1] }, rarity = 2 },
|
||||||
|
{ items = {"mcl_farming:sweet_berry " .. berries_to_drop[2] } }
|
||||||
|
}
|
||||||
|
},
|
||||||
selection_box = {
|
selection_box = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, (-0.30 + (i*0.25)), 6 / 16},
|
fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, (-0.30 + (i*0.25)), 6 / 16},
|
||||||
|
@ -41,22 +51,20 @@ for i=0, 3 do
|
||||||
minetest.record_protection_violation(pos, pn)
|
minetest.record_protection_violation(pos, pn)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
if mcl_dye and clicker:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then
|
if 3 ~= i and mcl_dye and
|
||||||
|
clicker:get_wielded_item():get_name() == "mcl_bone_meal:bone_meal" then
|
||||||
mcl_dye.apply_bone_meal({under=pos},clicker)
|
mcl_dye.apply_bone_meal({under=pos},clicker)
|
||||||
|
if not minetest.is_creative_enabled(pn) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local stage
|
|
||||||
if node.name:find("_2") then
|
if drop_berries then
|
||||||
stage = 2
|
for j=1, berries_to_drop[math.random(2)] do
|
||||||
elseif node.name:find("_3") then
|
minetest.add_item(pos, "mcl_farming:sweet_berry")
|
||||||
stage = 3
|
|
||||||
end
|
end
|
||||||
if stage then
|
minetest.swap_node(pos, {name = "mcl_farming:sweet_berry_bush_1"})
|
||||||
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
|
||||||
return itemstack
|
return itemstack
|
||||||
end,
|
end,
|
||||||
|
@ -76,8 +84,11 @@ minetest.register_craftitem("mcl_farming:sweet_berry", {
|
||||||
minetest.record_protection_violation(pointed_thing.above, pn)
|
minetest.record_protection_violation(pointed_thing.above, pn)
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
if pointed_thing.type == "node" and table.indexof(planton,minetest.get_node(pointed_thing.under).name) ~= -1 and minetest.get_node(pointed_thing.above).name == "air" then
|
if pointed_thing.type == "node" and
|
||||||
minetest.set_node(pointed_thing.above,{name="mcl_farming:sweet_berry_bush_0"})
|
table.indexof(planton, minetest.get_node(pointed_thing.under).name) ~= -1 and
|
||||||
|
pointed_thing.above.y > pointed_thing.under.y and
|
||||||
|
minetest.get_node(pointed_thing.above).name == "air" then
|
||||||
|
minetest.set_node(pointed_thing.above, {name="mcl_farming:sweet_berry_bush_0"})
|
||||||
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
if not minetest.is_creative_enabled(placer:get_player_name()) then
|
||||||
itemstack:take_item()
|
itemstack:take_item()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue