镜像自地址
https://github.com/minetest-mods/3d_armor.git
已同步 2025-07-02 08:10:37 +02:00
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.
30 行
882 B
Lua
30 行
882 B
Lua
-- support for i18n
|
|
local S = minetest.get_translator(minetest.get_current_modname())
|
|
|
|
if not minetest.global_exists("sfinv") then
|
|
minetest.log("warning", S("3d_armor_sfinv: Mod loaded but unused."))
|
|
return
|
|
end
|
|
|
|
sfinv.register_page("3d_armor:armor", {
|
|
title = S("Armor"),
|
|
get = function(self, player, context)
|
|
local name = player:get_player_name()
|
|
local formspec = armor:get_armor_formspec(name, true)
|
|
return sfinv.make_formspec(player, context, formspec, false)
|
|
end
|
|
})
|
|
armor:register_on_update(function(player)
|
|
if sfinv.enabled then
|
|
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
|