forked from mtcontrib/3d_armor
Inventory compat cleanup
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
This commit is contained in:
committed by
stujones11
parent
75191490c2
commit
f0edb9a710
5
3d_armor_ui/LICENSE.txt
Normal file
5
3d_armor_ui/LICENSE.txt
Normal file
@ -0,0 +1,5 @@
|
||||
[mod] 3d Armor integration to unified inventory [3d_armor_ui]
|
||||
=============================================================
|
||||
|
||||
License Source Code: (C) 2012-2017 Stuart Jones - LGPL v2.1
|
||||
|
2
3d_armor_ui/depends.txt
Normal file
2
3d_armor_ui/depends.txt
Normal file
@ -0,0 +1,2 @@
|
||||
3d_armor
|
||||
unified_inventory?
|
1
3d_armor_ui/description.txt
Normal file
1
3d_armor_ui/description.txt
Normal file
@ -0,0 +1 @@
|
||||
Adds 3d_armor page to the unified inventory
|
44
3d_armor_ui/init.lua
Normal file
44
3d_armor_ui/init.lua
Normal file
@ -0,0 +1,44 @@
|
||||
if not minetest.global_exists("unified_inventory") then
|
||||
minetest.log("warning", "3d_armor_ui: Mod loaded but unused.")
|
||||
return
|
||||
end
|
||||
|
||||
if unified_inventory.sfinv_compat_layer then
|
||||
return
|
||||
end
|
||||
|
||||
armor:register_on_update(function(player)
|
||||
local name = player:get_player_name()
|
||||
if unified_inventory.current_page[name] == "armor" then
|
||||
unified_inventory.set_inventory_formspec(player, "armor")
|
||||
end
|
||||
end)
|
||||
|
||||
unified_inventory.register_button("armor", {
|
||||
type = "image",
|
||||
image = "inventory_plus_armor.png",
|
||||
})
|
||||
|
||||
unified_inventory.register_page("armor", {
|
||||
get_formspec = function(player, perplayer_formspec)
|
||||
local fy = perplayer_formspec.formspec_y
|
||||
local name = player:get_player_name()
|
||||
local formspec = "background[0.06,"..fy..";7.92,7.52;3d_armor_ui_form.png]"..
|
||||
"label[0,0;Armor]"..
|
||||
"list[detached:"..name.."_armor;armor;0,"..fy..";2,3;]"..
|
||||
"image[2.5,"..(fy - 0.25)..";2,4;"..armor.textures[name].preview.."]"..
|
||||
"label[5.0,"..(fy + 0.0)..";Level: "..armor.def[name].level.."]"..
|
||||
"label[5.0,"..(fy + 0.5)..";Heal: "..armor.def[name].heal.."]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[detached:"..name.."_armor;armor]"
|
||||
if armor.config.fire_protect then
|
||||
formspec = formspec.."label[5.0,"..(fy + 1.0)..
|
||||
";Fire: "..armor.def[name].fire.."]"
|
||||
end
|
||||
if minetest.global_exists("technic") then
|
||||
formspec = formspec.."label[5.0,"..(fy + 1.5)..
|
||||
";Radiation: "..armor.def[name].radiation.."]"
|
||||
end
|
||||
return {formspec=formspec}
|
||||
end,
|
||||
})
|
Reference in New Issue
Block a user