From 283b7c7410b72ac3b1216481985ba4b5172649ba Mon Sep 17 00:00:00 2001 From: Michieal Date: Mon, 28 Nov 2022 22:06:26 +0000 Subject: [PATCH] Add in Versioning info using /ver command. --- mods/HUD/mcl_ver_info/init.lua | 33 +++++++++++++++++++++++++++++++++ mods/HUD/mcl_ver_info/mod.conf | 3 +++ 2 files changed, 36 insertions(+) create mode 100644 mods/HUD/mcl_ver_info/init.lua create mode 100644 mods/HUD/mcl_ver_info/mod.conf diff --git a/mods/HUD/mcl_ver_info/init.lua b/mods/HUD/mcl_ver_info/init.lua new file mode 100644 index 000000000..d5bc5d7e7 --- /dev/null +++ b/mods/HUD/mcl_ver_info/init.lua @@ -0,0 +1,33 @@ +--- +--- Generated by EmmyLua +--- Created by Michieal. +--- DateTime: 11/28/22 4:38 PM +--- + +-- register normal user access to debug levels 1 and 0. +minetest.register_chatcommand("ver", { + description = S("Display Mineclone 2 game version."), + func = function(name, params) + --[[ get_game_info's table data: + { + id = string, + title = string, + author = string, + -- The root directory of the game + path = string, + } + --]] + local game_info = minetest.get_game_info() + + 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." + end + + minetest.chat_send_player(name, string.format("Version: %s - %s",game_info.title, game_info.id) ) + return true + end +}) + diff --git a/mods/HUD/mcl_ver_info/mod.conf b/mods/HUD/mcl_ver_info/mod.conf new file mode 100644 index 000000000..66c5e5c7e --- /dev/null +++ b/mods/HUD/mcl_ver_info/mod.conf @@ -0,0 +1,3 @@ +name = mcl_ver_info +description = Prints game version information; /ver command. +depends = mcl_init