From 0bc88b55e5586a9f545a9ce0d36bbe4e80683b55 Mon Sep 17 00:00:00 2001 From: Michieal Date: Sun, 4 Dec 2022 16:39:47 +0000 Subject: [PATCH] Added in Workaround for ID not yet implemented in 5.70-Dev Minetest. For more information, please see: https://github.com/minetest/minetest/pull/12989#issuecomment-1336407807 --- mods/HUD/mcl_ver_info/init.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mods/HUD/mcl_ver_info/init.lua b/mods/HUD/mcl_ver_info/init.lua index 796245e56..7fe83270b 100644 --- a/mods/HUD/mcl_ver_info/init.lua +++ b/mods/HUD/mcl_ver_info/init.lua @@ -42,11 +42,20 @@ minetest.register_chatcommand("ver", { return true end + local conf = Settings(game_info.path .. "/game.conf") + local version = conf:get("version") + if game_info.title == nil or game_info.title == "" then game_info.title = "Mineclone 2" end - if game_info.id == nil or game_info.id == "" then - game_info.id = " Please upgrade your version to the newest version for the /ver command to work." + -- Notes: "game.conf doesn't support id currently, this is planned in the future" - rubenwardy from the github issue. + -- TODO: Remove workaround after minetest.get_game_info().id is implemented. + if version == "" or version == nil then -- workaround for id = not being implemented yet. + if game_info.id == nil or game_info.id == "" then + game_info.id = " Please upgrade your version to the newest version for the /ver command to work." + end + else + game_info.id = version end minetest.chat_send_player(name, string.format("Version: %s - %s", game_info.title, game_info.id))