mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 16:39:33 +01:00
Fix get_light crash
This commit is contained in:
parent
baebe3c2d2
commit
bcd058feb1
1 changed files with 8 additions and 1 deletions
|
@ -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 a new issue