1
0
Fork 0

Fix bone meal failing to grow crops when it's dark

This commit is contained in:
Wuzzy 2019-02-08 05:36:43 +01:00
parent 7d0c647e8b
commit cb8e3fcf82
2 changed files with 10 additions and 9 deletions

View File

@ -203,24 +203,24 @@ mcl_dye.apply_bone_meal = function(pointed_thing)
-- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages -- Wheat, Potato, Carrot, Pumpkin Stem, Melon Stem: Advance by 2-5 stages
elseif string.find(n.name, "mcl_farming:wheat_") ~= nil then elseif string.find(n.name, "mcl_farming:wheat_") ~= nil then
local stages = math.random(2, 5) 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 elseif string.find(n.name, "mcl_farming:potato_") ~= nil then
local stages = math.random(2, 5) 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 elseif string.find(n.name, "mcl_farming:carrot_") ~= nil then
local stages = math.random(2, 5) 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 elseif string.find(n.name, "mcl_farming:pumpkin_") ~= nil then
local stages = math.random(2, 5) 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 elseif string.find(n.name, "mcl_farming:melontige_") ~= nil then
local stages = math.random(2, 5) 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 elseif string.find(n.name, "mcl_farming:beetroot_") ~= nil then
-- Beetroot: 75% chance to advance to next stage -- Beetroot: 75% chance to advance to next stage
if math.random(1,100) <= 75 then 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 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
-- Cocoa: Advance by 1 stage -- Cocoa: Advance by 1 stage

View File

@ -24,14 +24,15 @@ end
-- pos: Position -- pos: Position
-- node: Node table -- node: Node table
-- stages: Number of stages to advance (optional, defaults to 1) -- 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 true if plant has been grown by 1 or more stages.
-- Returns false if nothing changed. -- Returns false if nothing changed.
function mcl_farming:grow_plant(identifier, pos, node, stages) function mcl_farming:grow_plant(identifier, pos, node, stages, ignore_light)
if not minetest.get_node_light(pos) then if not minetest.get_node_light(pos) and not ignore_light then
return false return false
end end
if minetest.get_node_light(pos) < 10 then if minetest.get_node_light(pos) < 10 and not ignore_light then
return false return false
end end