diff --git a/3d_armor/textures/3d_armor_ui_form.png b/3d_armor/textures/3d_armor_ui_form.png deleted file mode 100644 index 993809f..0000000 Binary files a/3d_armor/textures/3d_armor_ui_form.png and /dev/null differ diff --git a/3d_armor_ui/init.lua b/3d_armor_ui/init.lua index 2a6f654..293cd28 100644 --- a/3d_armor_ui/init.lua +++ b/3d_armor_ui/init.lua @@ -2,6 +2,7 @@ local S = minetest.get_translator(minetest.get_current_modname()) local F = minetest.formspec_escape local has_technic = minetest.get_modpath("technic") ~= nil +local ui = unified_inventory if not minetest.global_exists("unified_inventory") then minetest.log("warning", S("3d_armor_ui: Mod loaded but unused.")) @@ -27,17 +28,24 @@ unified_inventory.register_button("armor", { unified_inventory.register_page("armor", { get_formspec = function(player, perplayer_formspec) - local fy = perplayer_formspec.formspec_y + local fy = perplayer_formspec.form_header_y + 0.5 + local gridx = perplayer_formspec.std_inv_x + local gridy = 0.6 + local name = player:get_player_name() if armor.def[name].init_time == 0 then return {formspec="label[0,0;"..F(S("Armor not initialized!")).."]"} end - local formspec = "background[0.06,"..fy..";7.92,7.52;3d_armor_ui_form.png]".. - "label[0,0;"..F(S("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)..";"..F(S("Level"))..": "..armor.def[name].level.."]".. - "label[5.0,"..(fy + 0.5)..";"..F(S("Heal"))..": "..armor.def[name].heal.."]".. + local formspec = perplayer_formspec.standard_inv_bg.. + perplayer_formspec.standard_inv.. + ui.make_inv_img_grid(gridx, gridy, 2, 3).. + string.format("label[%f,%f;%s]", + perplayer_formspec.form_header_x, perplayer_formspec.form_header_y, F(S("Armor"))).. + string.format("list[detached:%s_armor;armor;%f,%f;2,3;]", + name, gridx + ui.list_img_offset, gridy + ui.list_img_offset) .. + "image[3.5,"..(fy - 0.25)..";2,4;"..armor.textures[name].preview.."]".. + "label[6.0,"..(fy + 0.0)..";"..F(S("Level"))..": "..armor.def[name].level.."]".. + "label[6.0,"..(fy + 0.5)..";"..F(S("Heal"))..": "..armor.def[name].heal.."]".. "listring[current_player;main]".. "listring[detached:"..name.."_armor;armor]" if armor.config.fire_protect then @@ -45,7 +53,7 @@ unified_inventory.register_page("armor", { F(S("Fire"))..": "..armor.def[name].fire.."]" end if has_technic then - formspec = formspec.."label[5.0,"..(fy + 1.5)..";".. + formspec = formspec.."label[6.0,"..(fy + 1.5)..";".. F(S("Radiation"))..": "..armor.def[name].groups["radiation"].."]" end return {formspec=formspec} diff --git a/3d_armor_ui/mod.conf b/3d_armor_ui/mod.conf index 68eff85..331627e 100644 --- a/3d_armor_ui/mod.conf +++ b/3d_armor_ui/mod.conf @@ -2,3 +2,4 @@ name = 3d_armor_ui depends = 3d_armor optional_depends = unified_inventory description = Adds 3d_armor page to the unified inventory. +min_minetest_version = 5.4.0