From cb8e3fcf82af500bcea04f1e0f7be1c6f9b7adee Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 8 Feb 2019 05:36:43 +0100 Subject: [PATCH] Fix bone meal failing to grow crops when it's dark --- mods/ITEMS/mcl_dye/init.lua | 12 ++++++------ mods/ITEMS/mcl_farming/shared_functions.lua | 7 ++++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/mcl_dye/init.lua b/mods/ITEMS/mcl_dye/init.lua index f95aa8748..c347a9000 100644 --- a/mods/ITEMS/mcl_dye/init.lua +++ b/mods/ITEMS/mcl_dye/init.lua @@ -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 diff --git a/mods/ITEMS/mcl_farming/shared_functions.lua b/mods/ITEMS/mcl_farming/shared_functions.lua index 0b201ca62..9844dd437 100644 --- a/mods/ITEMS/mcl_farming/shared_functions.lua +++ b/mods/ITEMS/mcl_farming/shared_functions.lua @@ -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