changed the formspec method

switched to table.concat() for faster loading
This commit is contained in:
Pinky Snow 2015-12-21 23:13:36 -05:00
parent 8704afe5b1
commit b29993d8e7

View file

@ -70,29 +70,30 @@ trash:set_size("main", 1)
creative_inventory.set_creative_formspec = function(player, start_i, pagenum) creative_inventory.set_creative_formspec = function(player, start_i, pagenum)
pagenum = math.floor(pagenum) pagenum = math.floor(pagenum)
local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1) local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1)
player:set_inventory_formspec( local fs = {
"size[13,7.5]".. "size[13,7.5]",
--"image[6,0.6;1,2;player.png]".. --"image[6,0.6;1,2;player.png]",
default.gui_bg.. default.gui_bg,
default.gui_bg_img.. default.gui_bg_img,
default.gui_slots.. default.gui_slots,
"list[current_player;main;5,3.5;8,1;]".. "list[current_player;main;5,3.5;8,1;]",
"list[current_player;main;5,4.75;8,3;8]".. "list[current_player;main;5,4.75;8,3;8]",
"list[current_player;craft;8,0;3,3;]".. "list[current_player;craft;8,0;3,3;]",
"list[current_player;craftpreview;12,1;1,1;]".. "list[current_player;craftpreview;12,1;1,1;]",
"image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]".. "image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]",
"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]".. "list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]",
"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]".. "label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]",
"button[0.3,6.5;1.6,1;creative_prev;<<]".. "button[0.3,6.5;1.6,1;creative_prev;<<]",
"button[2.7,6.5;1.6,1;creative_next;>>]".. "button[2.7,6.5;1.6,1;creative_next;>>]",
"listring[current_player;main]".. "listring[current_player;main]",
"listring[current_player;craft]".. "listring[current_player;craft]",
"listring[current_player;main]".. "listring[current_player;main]",
"listring[detached:creative;main]".. "listring[detached:creative;main]",
"label[5,1.5;Trash:]".. "label[5,1.5;Trash:]",
"list[detached:creative_trash;main;5,2;1,1;]".. "list[detached:creative_trash;main;5,2;1,1;]",
default.get_hotbar_bg(5,3.5) default.get_hotbar_bg(5,3.5),
) }
player:set_inventory_formspec(table.concat(fs))
end end
minetest.register_on_joinplayer(function(player) minetest.register_on_joinplayer(function(player)
-- If in creative mode, modify player's inventory forms -- If in creative mode, modify player's inventory forms