diff --git a/block_league/src/GUI/gui_profile.lua b/block_league/src/GUI/gui_profile.lua index 8462481..1e35f51 100644 --- a/block_league/src/GUI/gui_profile.lua +++ b/block_league/src/GUI/gui_profile.lua @@ -1,6 +1,7 @@ local S = minetest.get_translator("block_league") local function get_formspec() end +local function get_weapon_details() end @@ -17,7 +18,9 @@ function get_formspec(p_name) local p_skill = block_league.get_player_skill(p_name) local skill_def = skills.get_skill_def(p_skill) local info_section = {} - local elem = minetest.get_player_by_name(p_name):get_meta():get_string("bl_profile_elem_active") + local p_meta = minetest.get_player_by_name(p_name):get_meta() + local elem = p_meta:get_string("bl_profile_elem_active") + local elem_technical = "block_league:" .. elem -- calcolo contenuto da metter sulla destra if elem == "" then @@ -28,82 +31,21 @@ function get_formspec(p_name) else local item, elem_name, body, button - local weap = minetest.registered_items["block_league:" .. elem] - local skill = skills.get_skill_def("block_league:" .. elem) + local weap = minetest.registered_items[elem_technical] + local skill = skills.get_skill_def(elem_technical) -- se è un'arma.. if weap then item = weap.mesh and "model[0,1.5;5.08,2.2;weap_model;" .. weap.mesh .. ";" .. table.concat(weap.tiles, ",") .. ";0,140;false;true]" or "image[2,1.7;1.5,1.5;" .. weap.wield_image .. "]" elem_name = weap.description - - local action_y = 0 - local action1, action1_hold, action1_air, action2, action2_hold, action2_air - - -- azioni varie - if weap.action1 then - action1 = "image[0," .. action_y .. ";0.4,0.55;bl_gui_profile_action_lmb.png]" .. - "hypertext[0.6," .. action_y - 0.12 .. ";3.8,0.8;elem_desc;" .. weap.action1.description .. "]" - action_y = action_y + 0.8 - end - - if weap.action1_hold then - action1_hold = "image[0," .. action_y .. ";0.4,0.55;bl_gui_profile_action_lmb_hold.png]" .. - "hypertext[0.6," .. action_y - 0.12 .. ";3.8,0.8;elem_desc;" .. weap.action1_hold.description .. "]" - action_y = action_y + 0.8 - end - - if weap.action1_air then - action1_air = "image[0," .. action_y .. ";0.4,0.55;bl_gui_profile_action_lmb_air.png]" .. - "hypertext[0.6," .. action_y - 0.12 .. ";3.8,0.8;elem_desc;" .. weap.action1_air.description .. "]" - action_y = action_y + 0.8 - end - - if weap.action2 then - action2 = "image[0," .. action_y .. ";0.4,0.55;bl_gui_profile_action_rmb.png]" .. - "hypertext[0.6," .. action_y - 0.12 .. ";3.8,0.8;elem_desc;" .. weap.action2.description .. "]" - action_y = action_y + 0.8 - end - - if weap.action2_hold then - action2_hold = "image[0," .. action_y .. ";0.4,0.55;bl_gui_profile_action_rmb_hold.png]" .. - "hypertext[0.6," .. action_y - 0.12 .. ";3.8,0.8;elem_desc;" .. weap.action2_hold.description .. "]" - action_y = action_y + 0.8 - end - - if weap.action2_air then - action1_air = "image[0," .. action_y .. ";0.4,0.55;bl_gui_profile_action_rmb_air.png]" .. - "hypertext[0.6," .. action_y - 0.12 .. ";3.8,0.8;elem_desc;" .. weap.action2_air.description .. "]" - action_y = action_y + 0.8 - end - - local ammo = "" - if weap.weapon_type ~= "melee" then - ammo = table.concat({ - "image[0,1.6;0.4,0.4;bl_gui_profile_weapon_magazine.png]", - "image[3,1.6;0.4,0.4;bl_gui_profile_weapon_reload.png]", - "hypertext[0.6,1.53;1,0.6;elem_desc;" .. weap.magazine .. " / --]", - "hypertext[3.6,1.53;1,0.6;elem_desc;" .. weap.reload_time .. "]" - }) - end - - local attributes = table.concat({ - "container[0.4,5.1]", - action1 or "", - action1_hold or "", - action1_air or "", - action2 or "", - action2_hold or "", - action2_air or "", - ammo, - "container_end[]", - }, "") - - body = table.concat({ - "hypertext[0.3,4.12;4.48,0.9;elem_desc;