mods - default - foward compatibilty for default mod on modern engines

* try to adapt due commit 66372e75d9
  so provide alternate usage when up to date engines are detected
  give then `is_area_protected` if any modern engine is availabe,
  otherwise use `intersects_protection` if availabe.. or default one
* more info https://codeberg.org/minenux/minetest-engine-minetest/issues/32
This commit is contained in:
mckaygerhard 2023-07-13 17:54:13 -05:00
parent 7f06bfc3d2
commit 6972d6ebda

View File

@ -1,5 +1,8 @@
-- mods/default/functions.lua
-- Check for a volume intersecting protection
local is_50 = minetest.has_feature("object_use_texture_alpha") or nil
--
-- Sounds
--
@ -488,6 +491,9 @@ minetest.register_abm({
function default.intersects_protection(minp, maxp, player_name, interval)
-- 'interval' is the largest allowed interval for the 3D lattice of checks
if is_50 then
return minetest.is_area_protected(minp, maxp, player_name, interval)
else
-- Compute the optimal float step 'd' for each axis so that all corners and
-- borders are checked. 'd' will be smaller or equal to 'interval'.
-- Subtracting 1e-4 ensures that the max co-ordinate will be reached by the
@ -518,6 +524,9 @@ function default.intersects_protection(minp, maxp, player_name, interval)
end
return false
end
end