diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 52f9caf64f..20dc5c9379 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -194,3 +194,14 @@ end function mcl_util.is_fuel(item) return minetest.get_craft_result({method="fuel", width=1, items={item}}).time ~= 0 end + +-- For a given position, returns a 2-tuple: +-- 1st return value: true if pos is in void +-- 2nd return value: true if it is in the deadly part of the void +function mcl_util.is_in_void(pos) + local void, void_deadly + void = pos.y < mcl_vars.bedrock_overworld_min + void_deadly = pos.y < mcl_vars.bedrock_overworld_min - 65 + return void, void_deadly +end + diff --git a/mods/PLAYER/playerplus/depends.txt b/mods/PLAYER/playerplus/depends.txt index 149d813a30..cfa064e27e 100644 --- a/mods/PLAYER/playerplus/depends.txt +++ b/mods/PLAYER/playerplus/depends.txt @@ -1,3 +1,4 @@ mcl_init +mcl_util mcl_core 3d_armor? diff --git a/mods/PLAYER/playerplus/init.lua b/mods/PLAYER/playerplus/init.lua index 37f47bd058..1f3f308fd9 100644 --- a/mods/PLAYER/playerplus/init.lua +++ b/mods/PLAYER/playerplus/init.lua @@ -129,7 +129,8 @@ minetest.register_globalstep(function(dtime) -- This only works beause weather_pack currently does not touch the sky for players below the height used for this check. -- There should be a real skybox API. end - if pos.y < mcl_vars.bedrock_overworld_min - 65 then + local void, void_deadly = mcl_util.is_in_void(pos) + if void_deadly then -- Player is deep into the void, deal void damage if player:get_hp() > 0 then player:set_hp(player:get_hp() - 4)