mirror of
https://github.com/minetest-mods/3d_armor.git
synced 2024-11-22 20:43:43 +01:00
f0edb9a710
fix inventory_plus after cleanup. Create own register_on_player_receive_fields for this inventory removed smart_inventory (moved to the inventoy mod), adjusted sfinv moved sfinv to own mod 3d_armor_sfinv moved unified_inventory to 3d_armor_ui moved inventory_plus support to own mod 3d_armor_ip
35 lines
1.0 KiB
Lua
35 lines
1.0 KiB
Lua
if not minetest.global_exists("inventory_plus") then
|
|
minetest.log("warning", "3d_armor_ip: Mod loaded but unused.")
|
|
return
|
|
end
|
|
|
|
armor.formspec = "size[8,8.5]button[6,0;2,0.5;main;Back]"..armor.formspec
|
|
armor:register_on_update(function(player)
|
|
local name = player:get_player_name()
|
|
local formspec = armor:get_armor_formspec(name, true)
|
|
local page = player:get_inventory_formspec()
|
|
if page:find("detached:"..name.."_armor") then
|
|
inventory_plus.set_inventory_formspec(player, formspec)
|
|
end
|
|
end)
|
|
|
|
if minetest.get_modpath("crafting") then
|
|
inventory_plus.get_formspec = function(player, page)
|
|
end
|
|
end
|
|
|
|
minetest.register_on_joinplayer(function(player)
|
|
inventory_plus.register_button(player,"armor", "Armor")
|
|
end)
|
|
|
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|
if fields.armor then
|
|
local name = armor:get_valid_player(player, "[on_player_receive_fields]")
|
|
if not name then
|
|
return
|
|
end
|
|
local formspec = armor:get_armor_formspec(name, true)
|
|
inventory_plus.set_inventory_formspec(player, formspec)
|
|
end
|
|
end)
|