Fix get_light crash
parent
7e37f74339
commit
409e48f068
|
@ -1029,6 +1029,14 @@ local node_ok = function(pos, fallback)
|
|||
return minetest.registered_nodes[fallback]
|
||||
end
|
||||
|
||||
local function get_light(pos)
|
||||
if math.abs(pos.x) < 31000 and math.abs(pos.y) < 31000 and math.abs(pos.z) < 31000 then
|
||||
local lightfunc = minetest.get_natural_light or minetest.get_node_light
|
||||
return lightfunc(pos)
|
||||
else
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
-- environmental damage (water, lava, fire, light etc.)
|
||||
local do_env_damage = function(self)
|
||||
|
@ -1074,7 +1082,6 @@ local do_env_damage = function(self)
|
|||
|
||||
-- Use get_node_light for Minetest version 5.3 where get_natural_light
|
||||
-- does not exist yet.
|
||||
local get_light = minetest.get_natural_light or minetest.get_node_light
|
||||
local sunlight = get_light(pos, self.time_of_day)
|
||||
|
||||
-- bright light harms mob
|
||||
|
|
Loading…
Reference in New Issue