forked from VoxeLibre/VoxeLibre
Fix passive threshold in nether and end (#4030)
Fix light check for passive mobs in other dimensions. It is apparently the same in all dimensions. If a mob has it's own spawn_check function then that should be used regardless of it's type. Fixes #4029 Reviewed-on: MineClone2/MineClone2#4030 Reviewed-by: the-real-herowl <the-real-herowl@noreply.git.minetest.land> Co-authored-by: codiac <codiac@inbox.lv> Co-committed-by: codiac <codiac@inbox.lv>
This commit is contained in:
parent
b57f6be81d
commit
4cf865a36c
|
@ -732,6 +732,9 @@ local function spawn_check(pos, spawn_def)
|
||||||
local sky_light = minetest.get_natural_light(pos)
|
local sky_light = minetest.get_natural_light(pos)
|
||||||
local art_light = minetest.get_artificial_light(my_node.param1)
|
local art_light = minetest.get_artificial_light(my_node.param1)
|
||||||
|
|
||||||
|
if mob_def.spawn_check then
|
||||||
|
return mob_def.spawn_check(pos, gotten_light, art_light, sky_light)
|
||||||
|
elseif mob_type == "monster" then
|
||||||
if dimension == "nether" then
|
if dimension == "nether" then
|
||||||
if art_light <= nether_threshold then
|
if art_light <= nether_threshold then
|
||||||
return true
|
return true
|
||||||
|
@ -741,20 +744,16 @@ local function spawn_check(pos, spawn_def)
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
elseif dimension == "overworld" then
|
elseif dimension == "overworld" then
|
||||||
if mob_type == "monster" then
|
if art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then
|
||||||
if mob_def.spawn_check then
|
|
||||||
return mob_def.spawn_check(pos, gotten_light, art_light, sky_light)
|
|
||||||
elseif art_light <= overworld_threshold and sky_light <= overworld_sky_threshold then
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if mob_def.spawn_check then
|
-- passive threshold is apparently the same in all dimensions ...
|
||||||
return mob_def.spawn_check(pos, gotten_light, art_light, sky_light)
|
if gotten_light > overworld_passive_threshold then
|
||||||
elseif gotten_light > overworld_passive_threshold then
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
|
if gotten_light >= spawn_def.min_light and gotten_light <= spawn_def.max_light then
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in New Issue