From 6972d6ebda517083618de1c4df91c83f81fdc555 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Thu, 13 Jul 2023 17:54:13 -0500 Subject: [PATCH] mods - default - foward compatibilty for default mod on modern engines * try to adapt due commit https://github.com/minetest/minetest/commit/66372e75d9b584fbb3b3fbce0de572585dd86dca 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 --- mods/default/functions.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mods/default/functions.lua b/mods/default/functions.lua index 4c8d2f0..e09a735 100644 --- a/mods/default/functions.lua +++ b/mods/default/functions.lua @@ -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