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 <halfpacho@gmail.com>
This commit is contained in:
Zweihorn 2022-12-21 20:05:56 +01:00 committed by GitHub
parent c9d0dddf18
commit 88f02e2b6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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