Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/gameid.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ local game_alias = {
}

local game_modnames = {
minetest = "default",
mineclonia = "mcl_core",
farlands_reloaded = "fl_core",
minetest = "default",
hades = "hades_core",
exile = "exile_env_sounds",
ksurvive2 = "ks_metals",
Expand All @@ -16,6 +16,8 @@ local gameid = "xcompat_unknown_gameid"

if type(minetest.get_game_info) == "function" then
gameid = minetest.get_game_info().id
--while minetest game derviates are not supported, we can still try to detect them
if minetest.get_modpath("default") then gameid = "minetest" end

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moving this here breaks support for versions without this function

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there is no function, won't it just run the other stuff?

else
for game, modname in pairs(game_modnames) do
if minetest.get_modpath(modname) then
Expand All @@ -28,7 +30,5 @@ end
--for games that are similar/derviatives of other games
if game_alias[gameid] then gameid = game_alias[gameid] end

--while minetest game derviates are not supported, we can still try to detect them
if minetest.get_modpath("default") then gameid = "minetest" end

return gameid
4 changes: 2 additions & 2 deletions src/player.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
local filename = xcompat.gameid

--if we dont have a player file for the game, use minetest
--if we dont have a player file for the game, use xcompat_agnostic
if not xcompat.utilities.file_exists(xcompat.modpath .. "/src/player/" .. filename .. ".lua") then
filename = "xcompat_agnostic"
end

return dofile(xcompat.modpath .. "/src/player/" .. filename .. ".lua")
return dofile(xcompat.modpath .. "/src/player/" .. filename .. ".lua")
4 changes: 2 additions & 2 deletions src/sounds.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
local filename = xcompat.gameid

--if we dont have a materials file for the game, use minetest
--if we dont have a sounds file for the game, use xcompat_agnostic
if not xcompat.utilities.file_exists(xcompat.modpath .. "/src/sounds/" .. filename .. ".lua") then
filename = "xcompat_agnostic"
end

return dofile(xcompat.modpath .. "/src/sounds/" .. filename .. ".lua")
return dofile(xcompat.modpath .. "/src/sounds/" .. filename .. ".lua")
4 changes: 2 additions & 2 deletions src/textures.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
local filename = xcompat.gameid

--if we dont have a materials file for the game, use minetest
--if we dont have a materials file for the game, use xcompat_agnostic
if not xcompat.utilities.file_exists(xcompat.modpath .. "/src/textures/" .. filename .. ".lua") then
filename = "xcompat_agnostic"
end

return dofile(xcompat.modpath .. "/src/textures/" .. filename .. ".lua")
return dofile(xcompat.modpath .. "/src/textures/" .. filename .. ".lua")