Alpha-v0.0.2a #1
|
@ -0,0 +1,18 @@
|
||||||
|
[mod] 3d Armor integration to unified inventory [3d_armor_ui]
|
||||||
|
=============================================================
|
||||||
|
|
||||||
|
Copyright (C) 2012-2019 stujones11, Stuart Jones <stujones111@gmail.com>
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2.1 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
@ -0,0 +1 @@
|
||||||
|
Adds 3d_armor page to the unified inventory
|
|
@ -0,0 +1,53 @@
|
||||||
|
-- support for i18n
|
||||||
|
local S = armor_i18n.gettext
|
||||||
|
local F = minetest.formspec_escape
|
||||||
|
local has_technic = minetest.get_modpath("technic") ~= nil
|
||||||
|
|
||||||
|
if not minetest.global_exists("unified_inventory") then
|
||||||
|
minetest.log("warning", S("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",
|
||||||
|
tooltip = S("3d Armor")
|
||||||
|
})
|
||||||
|
|
||||||
|
unified_inventory.register_page("armor", {
|
||||||
|
get_formspec = function(player, perplayer_formspec)
|
||||||
|
local fy = perplayer_formspec.formspec_y
|
||||||
|
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.."]"..
|
||||||
|
"listring[current_player;main]"..
|
||||||
|
"listring[detached:"..name.."_armor;armor]"
|
||||||
|
if armor.config.fire_protect then
|
||||||
|
formspec = formspec.."label[5.0,"..(fy + 1.0)..";"..
|
||||||
|
F(S("Fire"))..": "..armor.def[name].fire.."]"
|
||||||
|
end
|
||||||
|
if has_technic then
|
||||||
|
formspec = formspec.."label[5.0,"..(fy + 1.5)..";"..
|
||||||
|
F(S("Radiation"))..": "..armor.def[name].groups["radiation"].."]"
|
||||||
|
end
|
||||||
|
return {formspec=formspec}
|
||||||
|
end,
|
||||||
|
})
|
Loading…
Reference in New Issue