forked from mtcontrib/3d_armor
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
3ca25f7ec4
Binary file not shown.
Before Width: | Height: | Size: 8.3 KiB |
@ -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,28 +28,35 @@ 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.4)..";"..F(S("Heal"))..": "..armor.def[name].heal.."]"..
|
||||
"label[5.0,"..(fy + 1.6)..";"..F(S("Speed"))..": "..armor.def[name].speed.."]"..
|
||||
"label[5.0,"..(fy + 2)..";"..F(S("Jump"))..": "..armor.def[name].jump.."]"..
|
||||
"label[5.0,"..(fy + 2.4)..";"..F(S("Gravity"))..": "..armor.def[name].gravity.."]"..
|
||||
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.."]"..
|
||||
"label[6.0,"..(fy + 2.0)..";"..F(S("Speed"))..": "..armor.def[name].speed.."]"..
|
||||
"label[6.0,"..(fy + 2.5)..";"..F(S("Jump"))..": "..armor.def[name].jump.."]"..
|
||||
"label[6.0,"..(fy + 3.0)..";"..F(S("Gravity"))..": "..armor.def[name].gravity.."]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[detached:"..name.."_armor;armor]"
|
||||
if armor.config.fire_protect then
|
||||
formspec = formspec.."label[5.0,"..(fy + 0.8)..";"..
|
||||
formspec = formspec.."label[6.0,"..(fy + 1.0)..";"..
|
||||
F(S("Fire"))..": "..armor.def[name].fire.."]"
|
||||
end
|
||||
if has_technic then
|
||||
formspec = formspec.."label[5.0,"..(fy + 1.2)..";"..
|
||||
formspec = formspec.."label[6.0,"..(fy + 1.5)..";"..
|
||||
F(S("Radiation"))..": "..armor.def[name].groups["radiation"].."]"
|
||||
end
|
||||
return {formspec=formspec}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user