forked from VoxeLibre/VoxeLibre
survival inventory
This commit is contained in:
parent
1d39c9e9a1
commit
27d9c8449b
|
@ -1,5 +1,8 @@
|
|||
local S = minetest.get_translator(minetest.get_current_modname())
|
||||
local F = minetest.formspec_escape
|
||||
local C = minetest.colorize
|
||||
|
||||
local table = table
|
||||
|
||||
mcl_inventory = {}
|
||||
|
||||
|
@ -63,21 +66,88 @@ local function set_inventory(player, armor_change_only)
|
|||
-- Show armor and player image
|
||||
local player_preview
|
||||
if minetest.settings:get_bool("3d_player_preview", true) then
|
||||
player_preview = mcl_player.get_player_formspec_model(player, 1.0, 0.0, 2.25, 4.5, "")
|
||||
player_preview = mcl_player.get_player_formspec_model(player, 1.625, 0.375, 3.5, 4.75, "")
|
||||
else
|
||||
player_preview = "image[1.1,0.2;2,4;"..mcl_player.player_get_preview(player).."]"
|
||||
player_preview = "image[1.625,0.375;3.5,4.75;"..mcl_player.player_get_preview(player).."]"
|
||||
end
|
||||
--player_preview = "image[1.625,0.375;3.5,4.75;"..mcl_player.player_get_preview(player).."]"
|
||||
|
||||
local armor_slots = {"helmet", "chestplate", "leggings", "boots"}
|
||||
local armor_slot_imgs = ""
|
||||
for a=1,4 do
|
||||
if inv:get_stack("armor", a+1):is_empty() then
|
||||
armor_slot_imgs = armor_slot_imgs .. "image[0,"..(a-1)..";1,1;mcl_inventory_empty_armor_slot_"..armor_slots[a]..".png]"
|
||||
armor_slot_imgs = armor_slot_imgs .. "image[0.375,".. 0.375 + (a-1) + (a-1)* 0.25 ..";1,1;mcl_inventory_empty_armor_slot_"..armor_slots[a]..".png]"
|
||||
end
|
||||
end
|
||||
|
||||
local form = "size[9,8.75]"..
|
||||
"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]"..
|
||||
--"label[0.375,5.575;"..F(C(mcl_formspec.label_color, S("Inventory"))).."]",
|
||||
|
||||
|
||||
local form = table.concat({
|
||||
"formspec_version[4]",
|
||||
"size[11.75,10.9]",
|
||||
mcl_formspec.apply_label_size,
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 0.375, 1, 1),
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 1.625, 1, 1),
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 2.875, 1, 1),
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 4.125, 1, 1),
|
||||
armor_slot_imgs,
|
||||
"list[current_player;armor;0.375,0.375;1,1;1]",
|
||||
"list[current_player;armor;0.375,1.625;1,1;2]",
|
||||
"list[current_player;armor;0.375,2.875;1,1;3]",
|
||||
"list[current_player;armor;0.375,4.125;1,1;4]",
|
||||
|
||||
--TMP FAKE PLAYER PREVIEW
|
||||
"box[1.625,0.375;3.5,4.75;"..mcl_formspec.label_color.."]",
|
||||
player_preview,
|
||||
|
||||
--left hand presupport
|
||||
--mcl_formspec.get_itemslot_bg_v4(5.375, 4.125, 1, 1),
|
||||
--"list[current_player;armor;5.375,4.125;1,1;4]",
|
||||
|
||||
--buttons
|
||||
|
||||
--skins
|
||||
"image_button[5.375,4.125;1,1;mcl_skins_button.png;__mcl_skins;]",
|
||||
"tooltip[__mcl_skins;"..F(S("Select player skin")).."]",
|
||||
|
||||
--crafting guide button
|
||||
"image_button[7.25,4.125;1,1;craftguide_book.png;__mcl_craftguide;]",
|
||||
"tooltip[__mcl_craftguide;"..F(S("Recipe book")).."]",
|
||||
|
||||
--achievements button
|
||||
"image_button[9.125,4.125;1,1;mcl_achievements_button.png;__mcl_achievements;]",
|
||||
"tooltip[__mcl_achievements;"..F(S("Achievements")).."]",
|
||||
|
||||
--help button
|
||||
"image_button[10.375,4.125;1,1;doc_button_icon_lores.png;__mcl_doc;]",
|
||||
"tooltip[__mcl_doc;"..F(S("Help")).."]",
|
||||
|
||||
"label[6.625,0.375;"..F(C(mcl_formspec.label_color, S("Crafting"))).."]",
|
||||
|
||||
--crafting interface
|
||||
mcl_formspec.get_itemslot_bg_v4(6.625, 0.75, 2, 2),
|
||||
"list[current_player;craft;6.625,0.75;2,2]",
|
||||
"image[9.125,1.375;1,1;crafting_formspec_arrow.png]",
|
||||
mcl_formspec.get_itemslot_bg_v4(10.375, 1.375, 1, 1),
|
||||
"list[current_player;craftpreview;10.375,1.375;1,1;]",
|
||||
|
||||
--player inventory
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 5.575, 9, 3),
|
||||
mcl_formspec.get_itemslot_bg_v4(0.375, 9.525, 9, 1),
|
||||
"list[current_player;main;0.375,5.575;9,3;9]",
|
||||
"list[current_player;main;0.375,9.525;9,1;]",
|
||||
|
||||
--for shortcuts
|
||||
"listring[current_player;main]",
|
||||
"listring[current_player;armor]",
|
||||
"listring[current_player;main]",
|
||||
"listring[current_player;craft]",
|
||||
"listring[current_player;main]",
|
||||
})
|
||||
|
||||
local form2 = "size[9,8.75]"..
|
||||
--"background[-0.19,-0.25;9.41,9.49;crafting_formspec_bg.png]"..
|
||||
player_preview..
|
||||
--armor
|
||||
"list[current_player;armor;0,0;1,1;1]"..
|
||||
|
@ -88,12 +158,12 @@ local function set_inventory(player, armor_change_only)
|
|||
mcl_formspec.get_itemslot_bg(0,1,1,1)..
|
||||
mcl_formspec.get_itemslot_bg(0,2,1,1)..
|
||||
mcl_formspec.get_itemslot_bg(0,3,1,1)..
|
||||
armor_slot_imgs..
|
||||
--armor_slot_imgs..
|
||||
-- craft and inventory
|
||||
"label[0,4;"..F(minetest.colorize("#313131", S("Inventory"))).."]"..
|
||||
"label[0,4;"..F(C("#313131", S("Inventory"))).."]"..
|
||||
"list[current_player;main;0,4.5;9,3;9]"..
|
||||
"list[current_player;main;0,7.74;9,1;]"..
|
||||
"label[4,0.5;"..F(minetest.colorize("#313131", S("Crafting"))).."]"..
|
||||
"label[4,0.5;"..F(C("#313131", S("Crafting"))).."]"..
|
||||
"list[current_player;craft;4,1;2,2]"..
|
||||
"list[current_player;craftpreview;7,1.5;1,1;]"..
|
||||
mcl_formspec.get_itemslot_bg(0,4.5,9,3)..
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 5.2 KiB |
|
@ -117,7 +117,7 @@ function mcl_player.player_get_preview(player)
|
|||
if preview == "" then
|
||||
preview = "player.png"
|
||||
end
|
||||
local armor_preview = player:get_meta():set_string("mcl_player:armor_preview")
|
||||
local armor_preview = player:get_meta():get_string("mcl_player:armor_preview")
|
||||
if armor_preview ~= "" then
|
||||
preview = preview .. "^" .. armor_preview
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue