From 68fd9679ea4839822ff56d4d405adcacf63590ae Mon Sep 17 00:00:00 2001 From: wsor4035 <24964441+wsor4035@users.noreply.github.com> Date: Sat, 25 May 2024 15:41:52 -0400 Subject: [PATCH] add rough support for getting gameid pre 5.7 --- src/gameid.lua | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/gameid.lua b/src/gameid.lua index b802e60..d2d343f 100644 --- a/src/gameid.lua +++ b/src/gameid.lua @@ -2,7 +2,27 @@ local game_alias = { mineclone2 = "mineclonia", } -local gameid = minetest.get_game_info().id +local game_modnames = { + mineclonia = "mcl_core", + farlands_reloaded = "fl_core", + minetest = "default", + hades = "hades_core", + exile = "exile_env_sounds", + ksurvive2 = "ks_metals", +} + +local gameid = "xcompat_unknown_gameid" + +if type(minetest.get_game_info) == "function" then + gameid = minetest.get_game_info().id +else + for game, modname in pairs(game_modnames) do + if minetest.get_modpath(modname) then + gameid = game + break + end + end +end --for games that are similar/derviatives of other games if game_alias[gameid] then gameid = game_alias[gameid] end