From 88f02e2b6bebc9e1ac80366a1c1198be0e6c3bc7 Mon Sep 17 00:00:00 2001 From: Zweihorn <4863737+Zweihorn@users.noreply.github.com> Date: Wed, 21 Dec 2022 20:05:56 +0100 Subject: [PATCH] Print when the mod is loaded (#7) * amend load print Add a final **print to log** at the end of `init.lua` to indicate the mod was loaded successfully. This idea was derived from other mods which are specifically aimed at MT servers. This could be useful not only for player support (e.g. in the MT forum) but would certainly be useful for MT server admins using the CLI and reading their server logs. * amend load print with extra compatibilty Unfortunately I do not know how to resolve a PR conversation with changing my own commit accordingly (yet). My prior PR was aiming at compatibilty with legacy clients and servers. If you scan the MT forum you will become aware that there seem to be quite many MT 0.4 servers around which are actively used by many players. I would like to continue in using the one load print for better compatibilty with legacy MT software in the field and would use the minetest.log for all other cases where applicable. However, the best solution may be this new piece of improved code, if I understand the MT Lua code correctly. * amend load print with improved compatibility This should be the more correct code now. Unfortunately I do not know how to resolve a PR conversation with changing my own commit accordingly (yet) or how to revoke a commit be GitHub web GUI. My prior PR was aiming at compatibilty with legacy clients and servers. If you scan the MT forum you will become aware that there seem to be quite many MT 0.4 servers around which are actively used by many players. I would like to continue in using the one load print for better compatibilty with legacy MT software in the field and would use the minetest.log for all other cases where applicable. However, the best solution may be this new piece of improved code, if I understand the MT Lua code correctly. * Apply suggestions from code review Co-authored-by: David Leal --- init.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/init.lua b/init.lua index bf10c53..6358d33 100644 --- a/init.lua +++ b/init.lua @@ -521,3 +521,11 @@ function lib_mount.drive(entity, dtime, is_mob, moving_anim, stand_anim, jump_he entity.v2 = v end + +-- Print after the mod was loaded successfully +local load_message = "[MOD] Library Mount loaded!" +if minetest.log then + minetest.log("info", load_message) -- Aims at state of the MT software art +else + print(load_message) -- Aims at legacy MT software used in the field +end