manage a minetest engine backguard compatibility check and expose to api

* provide flags for minetest release as adventuretest.<flag> 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.
master
mckaygerhard 2023-01-13 09:20:28 -04:00
parent f1ff77133a
commit 59e42c450e
1 changed files with 22 additions and 0 deletions

View File

@ -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");