From 04f9123e98b7062fc45224827498b602f43be6b9 Mon Sep 17 00:00:00 2001 From: Zweihorn <4863737+Zweihorn@users.noreply.github.com> Date: Wed, 21 Dec 2022 19:20:04 +0100 Subject: [PATCH] improved load print patch From the start my prior PR was aiming at compatibility 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. However, the best solution may be this example of a new piece of improved code, if I understand the MT Lua code correctly. ``` -- print to log after mod was loaded successfully local load_message = "[MOD] XXX loaded" if minetest.log then minetest.log("info", load_message) -- aims at state of the art MT software else print (load_message) -- aims at legacy MT software used in the field end ``` Hope this helps. --- 3d_armor/init.lua | 8 ++++++++ 3d_armor_ip/init.lua | 8 ++++++++ 3d_armor_sfinv/init.lua | 8 ++++++++ 3d_armor_stand/init.lua | 8 ++++++++ 3d_armor_ui/init.lua | 8 ++++++++ armor_admin/init.lua | 10 +++++++++- armor_bronze/init.lua | 10 +++++++++- armor_cactus/init.lua | 10 +++++++++- armor_crystal/init.lua | 10 +++++++++- armor_diamond/init.lua | 10 +++++++++- armor_gold/init.lua | 10 +++++++++- armor_mithril/init.lua | 10 +++++++++- armor_nether/init.lua | 10 +++++++++- armor_steel/init.lua | 10 +++++++++- armor_wood/init.lua | 10 +++++++++- shields/init.lua | 8 ++++++++ wieldview/init.lua | 8 ++++++++ 17 files changed, 146 insertions(+), 10 deletions(-) diff --git a/3d_armor/init.lua b/3d_armor/init.lua index eba28cd..63d7091 100644 --- a/3d_armor/init.lua +++ b/3d_armor/init.lua @@ -509,3 +509,11 @@ if armor.config.fire_protect == true then return hp_change end, true) end + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/3d_armor_ip/init.lua b/3d_armor_ip/init.lua index f061200..900fc57 100644 --- a/3d_armor_ip/init.lua +++ b/3d_armor_ip/init.lua @@ -36,3 +36,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) inventory_plus.set_inventory_formspec(player, formspec) end end) + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor IP loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/3d_armor_sfinv/init.lua b/3d_armor_sfinv/init.lua index 830ebbc..7b9cb5b 100644 --- a/3d_armor_sfinv/init.lua +++ b/3d_armor_sfinv/init.lua @@ -19,3 +19,11 @@ armor:register_on_update(function(player) sfinv.set_player_inventory_formspec(player) end end) + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor SF Inv loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/3d_armor_stand/init.lua b/3d_armor_stand/init.lua index 612345b..0e89d55 100644 --- a/3d_armor_stand/init.lua +++ b/3d_armor_stand/init.lua @@ -353,3 +353,11 @@ minetest.register_craft({ {"3d_armor_stand:armor_stand", "default:steel_ingot"}, } }) + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor Stand loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/3d_armor_ui/init.lua b/3d_armor_ui/init.lua index 28193e7..efde3c6 100644 --- a/3d_armor_ui/init.lua +++ b/3d_armor_ui/init.lua @@ -59,3 +59,11 @@ unified_inventory.register_page("armor", { return {formspec=formspec} end, }) + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor UI loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/armor_admin/init.lua b/armor_admin/init.lua index 9b94fcc..50593cd 100644 --- a/armor_admin/init.lua +++ b/armor_admin/init.lua @@ -91,4 +91,12 @@ armor:register_armor(":3d_armor:boots_admin", { minetest.register_alias("adminboots", "3d_armor:boots_admin") minetest.register_alias("adminhelmet", "3d_armor:helmet_admin") minetest.register_alias("adminchestplate", "3d_armor:chestplate_admin") -minetest.register_alias("adminleggings", "3d_armor:leggings_admin") \ No newline at end of file +minetest.register_alias("adminleggings", "3d_armor:leggings_admin") + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Armor Admin loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/armor_bronze/init.lua b/armor_bronze/init.lua index d23dffb..d7f38ec 100644 --- a/armor_bronze/init.lua +++ b/armor_bronze/init.lua @@ -178,4 +178,12 @@ if armor.materials.bronze then {m, "", m}, }, }) -end \ No newline at end of file +end + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Armor Bronze loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/armor_cactus/init.lua b/armor_cactus/init.lua index 9944139..ec9eac5 100644 --- a/armor_cactus/init.lua +++ b/armor_cactus/init.lua @@ -180,4 +180,12 @@ if armor.materials.cactus then {m, "", m}, }, }) -end \ No newline at end of file +end + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Armor Cactus loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/armor_crystal/init.lua b/armor_crystal/init.lua index d845fc2..a3d65d6 100644 --- a/armor_crystal/init.lua +++ b/armor_crystal/init.lua @@ -167,4 +167,12 @@ if armor.materials.crystal then {m, "", m}, }, }) -end \ No newline at end of file +end + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Armor Crystal loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/armor_diamond/init.lua b/armor_diamond/init.lua index 8fc2d0c..7e8d4a3 100644 --- a/armor_diamond/init.lua +++ b/armor_diamond/init.lua @@ -163,4 +163,12 @@ if armor.materials.diamond then {m, "", m}, }, }) -end \ No newline at end of file +end + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Armor Diamond loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/armor_gold/init.lua b/armor_gold/init.lua index 287f307..1de3e17 100644 --- a/armor_gold/init.lua +++ b/armor_gold/init.lua @@ -180,4 +180,12 @@ if armor.materials.gold then {m, "", m}, }, }) -end \ No newline at end of file +end + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Armor Gold loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/armor_mithril/init.lua b/armor_mithril/init.lua index 8e134f1..0d1c374 100644 --- a/armor_mithril/init.lua +++ b/armor_mithril/init.lua @@ -159,4 +159,12 @@ if armor.materials.mithril then {m, "", m}, }, }) -end \ No newline at end of file +end + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Armor Mithril loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/armor_nether/init.lua b/armor_nether/init.lua index f761a21..5ab75e7 100644 --- a/armor_nether/init.lua +++ b/armor_nether/init.lua @@ -165,4 +165,12 @@ if armor.materials.nether then }, }) -end \ No newline at end of file +end + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Armor Nether loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/armor_steel/init.lua b/armor_steel/init.lua index a104e71..891acea 100644 --- a/armor_steel/init.lua +++ b/armor_steel/init.lua @@ -178,4 +178,12 @@ if armor.materials.steel then {m, "", m}, }, }) -end \ No newline at end of file +end + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Armor Steel loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/armor_wood/init.lua b/armor_wood/init.lua index 0496e77..3492eb6 100644 --- a/armor_wood/init.lua +++ b/armor_wood/init.lua @@ -183,4 +183,12 @@ if armor.materials.wood then {m, "", m}, }, }) -end \ No newline at end of file +end + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Armor Wood loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/shields/init.lua b/shields/init.lua index 3b2b43c..e8dedff 100644 --- a/shields/init.lua +++ b/shields/init.lua @@ -409,3 +409,11 @@ for k, v in pairs(armor.materials) do }, }) end + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Shields loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end diff --git a/wieldview/init.lua b/wieldview/init.lua index ecdece9..d4f7a07 100644 --- a/wieldview/init.lua +++ b/wieldview/init.lua @@ -75,3 +75,11 @@ minetest.register_globalstep(function(dtime) time = 0 end end) + +-- print to log after mod was loaded successfully +local load_message = "[MOD] 3D Armor - Wieldview loaded" +if minetest.log then + minetest.log("info", load_message) -- aims at state of the art MT software +else + print (load_message) -- aims at legacy MT software used in the field +end