Log warning if initialization fails and validate armor.def for UI

This commit is contained in:
stujones11 2017-04-11 20:42:58 +01:00
parent 9ffcc19fd7
commit b45fbd0f2a
2 changed files with 17 additions and 10 deletions

View File

@ -239,9 +239,13 @@ minetest.register_globalstep(function(dtime)
timer = timer + dtime
if timer > armor.config.init_delay then
for i, con in pairs(pending_players) do
local remove = armor:init_player_armor(con[1]) == true
con[2] = con[2] + 1
if con[2] > armor.config.init_times or
armor:init_player_armor(con[1]) == true then
if con[2] > armor.config.init_times then
minetest.log("warning", "3d_armor: Failed to initialize player")
remove = true
end
if remove == true then
table.remove(pending_players, i)
end
end

View File

@ -29,19 +29,22 @@ unified_inventory.register_page("armor", {
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;]"..
"list[detached:"..name.."_armor;armor;0,"..fy..";2,3;]"
if armor.def[name] then
formspec = formspec ..
"image[2.5,"..(fy - 0.25)..";2,4;"..armor.textures[name].preview.."]"..
"label[5.0,"..(fy + 0.0)..";"..S("Level")..": "..armor.def[name].level.."]"..
"label[5.0,"..(fy + 0.5)..";"..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)..";"..
S("Fire")..": "..armor.def[name].fire.."]"
end
if minetest.global_exists("technic") then
formspec = formspec.."label[5.0,"..(fy + 1.5)..";"..
S("Radiation")..": "..armor.def[name].groups["radiation"].."]"
if armor.config.fire_protect then
formspec = formspec.."label[5.0,"..(fy + 1.0)..";"..
S("Fire")..": "..armor.def[name].fire.."]"
end
if minetest.global_exists("technic") then
formspec = formspec.."label[5.0,"..(fy + 1.5)..";"..
S("Radiation")..": "..armor.def[name].groups["radiation"].."]"
end
end
return {formspec=formspec}
end,