mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 20:11:06 +01:00
Fix bone meal failing to grow crops when it's dark
This commit is contained in:
parent
7d0c647e8b
commit
cb8e3fcf82
2 changed files with 10 additions and 9 deletions
|
@ -203,24 +203,24 @@ mcl_dye.apply_bone_meal = function(pointed_thing)
|
|||
-- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages
|
||||
elseif string.find(n.name, "mcl_farming:wheat_") ~= nil then
|
||||
local stages = math.random(2, 5)
|
||||
return mcl_farming:grow_plant("plant_wheat", pos, n, stages)
|
||||
return mcl_farming:grow_plant("plant_wheat", pos, n, stages, true)
|
||||
elseif string.find(n.name, "mcl_farming:potato_") ~= nil then
|
||||
local stages = math.random(2, 5)
|
||||
return mcl_farming:grow_plant("plant_potato", pos, n, stages)
|
||||
return mcl_farming:grow_plant("plant_potato", pos, n, stages, true)
|
||||
elseif string.find(n.name, "mcl_farming:carrot_") ~= nil then
|
||||
local stages = math.random(2, 5)
|
||||
return mcl_farming:grow_plant("plant_carrot", pos, n, stages)
|
||||
return mcl_farming:grow_plant("plant_carrot", pos, n, stages, true)
|
||||
elseif string.find(n.name, "mcl_farming:pumpkin_") ~= nil then
|
||||
local stages = math.random(2, 5)
|
||||
return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages)
|
||||
return mcl_farming:grow_plant("plant_pumpkin_stem", pos, n, stages, true)
|
||||
elseif string.find(n.name, "mcl_farming:melontige_") ~= nil then
|
||||
local stages = math.random(2, 5)
|
||||
return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages)
|
||||
return mcl_farming:grow_plant("plant_melon_stem", pos, n, stages, true)
|
||||
|
||||
elseif string.find(n.name, "mcl_farming:beetroot_") ~= nil then
|
||||
-- Beetroot: 75% chance to advance to next stage
|
||||
if math.random(1,100) <= 75 then
|
||||
return mcl_farming:grow_plant("plant_beetroot", pos, n)
|
||||
return mcl_farming:grow_plant("plant_beetroot", pos, n, 1, true)
|
||||
end
|
||||
elseif n.name == "mcl_cocoas:cocoa_1" or n.name == "mcl_cocoas:cocoa_2" then
|
||||
-- Cocoa: Advance by 1 stage
|
||||
|
|
|
@ -24,14 +24,15 @@ end
|
|||
-- pos: Position
|
||||
-- node: Node table
|
||||
-- stages: Number of stages to advance (optional, defaults to 1)
|
||||
-- ignore_light: if true, ignore light requirements for growing
|
||||
|
||||
-- Returns true if plant has been grown by 1 or more stages.
|
||||
-- Returns false if nothing changed.
|
||||
function mcl_farming:grow_plant(identifier, pos, node, stages)
|
||||
if not minetest.get_node_light(pos) then
|
||||
function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light)
|
||||
if not minetest.get_node_light(pos) and not ignore_light then
|
||||
return false
|
||||
end
|
||||
if minetest.get_node_light(pos) < 10 then
|
||||
if minetest.get_node_light(pos) < 10 and not ignore_light then
|
||||
return false
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue