From 59e42c450e648b93165e243f3a19efdaeafc4762 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Fri, 13 Jan 2023 09:20:28 -0400 Subject: [PATCH] manage a minetest engine backguard compatibility check and expose to api * provide flags for minetest release as adventuretest. for example to check 5.0 just `if adventuiretest.is_50 then` but such mod must depends on default or adventuretest mods * thos also add a pseudo check to 4.0.17 that is 0.4.17.2 and go the 0.4.18 version from sfan is not take into consideration cos provides so many things about 5.0 that must not be in such release. --- mods/adventuretest/init.lua | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/mods/adventuretest/init.lua b/mods/adventuretest/init.lua index 85abc32..90563d4 100644 --- a/mods/adventuretest/init.lua +++ b/mods/adventuretest/init.lua @@ -17,6 +17,28 @@ end adventuretest.blood = enable_blood +-- check for minetest 5.x compatibility and mantains backguard 4.X/0.4 +local is_57 = minetest.has_feature("get_light_data_buffer") +local is_56 = minetest.has_feature("particlespawner_tweenable") +local is_55 = minetest.has_feature("dynamic_add_media_table") +local is_54 = minetest.has_feature("direct_velocity_on_players") +local is_53 = minetest.has_feature("object_step_has_moveresult") +local is_52 = minetest.has_feature("pathfinder_works") +local is_51 = minetest.has_feature("httpfetch_binary_data") +local is_50 = minetest.has_feature("object_use_texture_alpha") +local is_04 = minetest.has_feature("area_store_custom_ids") +local is_40 = minetest.has_feature("add_entity_with_staticdata") +-- expose api check of minetest version compatibility, 40 is 4.0.17+ and 0.4 is 0.4.14 to 0.4.17.1 +adventuretest.is_57 = is_57 +adventuretest.is_56 = is_56 +adventuretest.is_55 = is_55 +adventuretest.is_54 = is_54 +adventuretest.is_53 = is_53 +adventuretest.is_52 = is_52 +adventuretest.is_51 = is_51 +adventuretest.is_50 = is_50 +adventuretest.is_04 = is_04 +adventuretest.is_40 = is_40 dofile(minetest.get_modpath("adventuretest").."/functions.lua"); dofile(minetest.get_modpath("adventuretest").."/register_functions.lua");