Show player preview in creative inventory
This commit is contained in:
parent
e296b91936
commit
04daa1295b
|
@ -210,6 +210,22 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, show, p
|
|||
if name == "inv" then
|
||||
inv_bg = "crafting_inventory_creative_survival.png"
|
||||
|
||||
-- Show armor and player image
|
||||
local show_armor = minetest.get_modpath("3d_armor")
|
||||
-- TODO: Use player.png to allow for custom skins
|
||||
local img = "crafting_player2d.png"
|
||||
local armor_img = ""
|
||||
local player_preview = "image[3.9,1.4;1.2333,2.4666;"..img.."]"
|
||||
if show_armor and armor.textures[playername] and armor.textures[playername].preview then
|
||||
img = armor.textures[playername].preview
|
||||
local s1 = img:find("character_preview")
|
||||
if s1 ~= nil then
|
||||
s1 = img:sub(s1+21)
|
||||
img = "crafting_player2d.png"..s1
|
||||
end
|
||||
player_preview = "image[3.9,1.4;1.2333,2.4666;"..img.."]"
|
||||
end
|
||||
|
||||
-- Background images for armor slots (hide if occupied)
|
||||
local armor_slot_imgs = ""
|
||||
local inv = player:get_inventory()
|
||||
|
@ -234,6 +250,8 @@ mcl_inventory.set_creative_formspec = function(player, start_i, pagenum, show, p
|
|||
"list[detached:"..playername.."_armor;armor;5.5,1.3;1,1;3]"..
|
||||
"list[detached:"..playername.."_armor;armor;5.5,2.75;1,1;4]"..
|
||||
armor_slot_imgs..
|
||||
-- player preview
|
||||
player_preview..
|
||||
-- crafting guide button
|
||||
"image_button[9,1;1,1;craftguide_book.png;__mcl_craftguide;]"..
|
||||
"tooltip[__mcl_craftguide;Show crafting recipes]"..
|
||||
|
|
|
@ -31,8 +31,6 @@ local function drop_fields(player, name)
|
|||
end
|
||||
end
|
||||
|
||||
local player_armor = {}
|
||||
|
||||
local function update_armor(player)
|
||||
return
|
||||
end
|
||||
|
@ -47,16 +45,12 @@ local function set_inventory(player)
|
|||
inv:set_size("craft", 4)
|
||||
|
||||
local player_name = player:get_player_name()
|
||||
|
||||
-- Show armor and player image
|
||||
-- TODO: Use player.png to allow for custom skins
|
||||
local img = "crafting_player2d.png"
|
||||
local armor_img = ""
|
||||
if show_armor then
|
||||
armor_img = ""
|
||||
if player_armor[player_name] ~= nil then
|
||||
img = img .. player_armor[player_name]
|
||||
end
|
||||
end
|
||||
local img_element = "image[0.6,0.2;3,4;"..img.."]"
|
||||
local player_preview = "image[0.6,0.2;2,4;"..img.."]"
|
||||
if show_armor and armor.textures[player_name] and armor.textures[player_name].preview then
|
||||
img = armor.textures[player_name].preview
|
||||
local s1 = img:find("character_preview")
|
||||
|
@ -64,7 +58,7 @@ local function set_inventory(player)
|
|||
s1 = img:sub(s1+21)
|
||||
img = "crafting_player2d.png"..s1
|
||||
end
|
||||
img_element = "image[1.1,0.2;2,4;"..img.."]"
|
||||
player_preview = "image[1.1,0.2;2,4;"..img.."]"
|
||||
end
|
||||
|
||||
local armor_slots = {"head", "torso", "legs", "feet"}
|
||||
|
@ -78,7 +72,7 @@ local function set_inventory(player)
|
|||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png^crafting_inventory.png"..armor_img.."]"..
|
||||
mcl_vars.inventory_header..
|
||||
img_element..
|
||||
player_preview..
|
||||
--armor
|
||||
"list[detached:"..player_name.."_armor;armor;0,0;1,1;1]"..
|
||||
"list[detached:"..player_name.."_armor;armor;0,1;1,1;2]"..
|
||||
|
|
Loading…
Reference in New Issue