summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authortenplus1 <kinsellaja@yahoo.com>2015-05-21 20:26:57 +0100
committertenplus1 <kinsellaja@yahoo.com>2015-05-21 20:26:57 +0100
commit84dc9643b14891c997761f30be96147b8c064943 (patch)
tree68a8499f0d9d5d8c332f3bea07b6440630a3248d /init.lua
parent7ff3416737a5a05242114945c6ddc34393ddfd54 (diff)
Fixed nil compare bug
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/init.lua b/init.lua
index 90714f0..94e9832 100644
--- a/init.lua
+++ b/init.lua
@@ -338,12 +338,12 @@ function farming.plant_growth_timer(pos, elapsed, node_name)
local lambda = elapsed / STAGE_LENGTH_AVG
if lambda < 0.1 then return true end
if max_growth == 1 or lambda < 2.0 then
- local light = minetest.get_node_light(light_pos)
+ local light = (minetest.get_node_light(light_pos) or 0) -- CHANGED
if not in_range(light, MIN_LIGHT, MAX_LIGHT) then return true end
growth = 1
else
- local night_light = minetest.get_node_light(light_pos, 0)
- local day_light = minetest.get_node_light(light_pos, 0.5)
+ local night_light = (minetest.get_node_light(light_pos, 0) or 0) -- CHANGED
+ local day_light = (minetest.get_node_light(light_pos, 0.5) or 0) -- ChANGED
local night_growth = in_range(night_light, MIN_LIGHT, MAX_LIGHT)
local day_growth = in_range(day_light, MIN_LIGHT, MAX_LIGHT)