Redo crafting with sfinv
|
@ -24,27 +24,6 @@ end
|
||||||
|
|
||||||
local time = 0
|
local time = 0
|
||||||
|
|
||||||
sfinv.override_page("sfinv:crafting", {
|
|
||||||
title = "Crafting",
|
|
||||||
get = function(self, player, context)
|
|
||||||
local player_name = player:get_player_name();
|
|
||||||
local form = [[
|
|
||||||
listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]
|
|
||||||
list[current_player;craft;4,1;2,1;1]
|
|
||||||
list[current_player;craft;4,2;2,1;4]
|
|
||||||
list[current_player;craftpreview;7.05,1.54;1,1;]
|
|
||||||
list[detached:split;main;7.99,3.15;1,1;]
|
|
||||||
image[1.5,0;2,4;default_player2d.png]
|
|
||||||
]] ..
|
|
||||||
"list[detached:"..player_name.."_armor;armor;0,0;1,1;]"..
|
|
||||||
"list[detached:"..player_name.."_armor;armor;0,1;1,1;1]"..
|
|
||||||
"list[detached:"..player_name.."_armor;armor;0,2;1,1;2]"..
|
|
||||||
"list[detached:"..player_name.."_armor;armor;0,3;1,1;3]"..
|
|
||||||
"image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true;]"
|
|
||||||
return sfinv.make_formspec(player, context, form , true)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
armor = {
|
armor = {
|
||||||
player_hp = {},
|
player_hp = {},
|
||||||
elements = {"head", "torso", "legs", "feet"},
|
elements = {"head", "torso", "legs", "feet"},
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
default
|
default
|
||||||
sfinv
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
default
|
||||||
|
sfinv
|
||||||
|
3d_armor?
|
|
@ -0,0 +1,72 @@
|
||||||
|
local show_armor = minetest.get_modpath("3d_armor")
|
||||||
|
|
||||||
|
local function item_drop(itemstack, dropper, pos)
|
||||||
|
if dropper:is_player() then
|
||||||
|
local v = dropper:get_look_dir()
|
||||||
|
local p = {x=pos.x, y=pos.y+1.2, z=pos.z}
|
||||||
|
p.x = p.x+(math.random(1,3)*0.2)
|
||||||
|
p.z = p.z+(math.random(1,3)*0.2)
|
||||||
|
local obj = minetest.env:add_item(p, itemstack)
|
||||||
|
if obj then
|
||||||
|
v.x = v.x*4
|
||||||
|
v.y = v.y*4 + 2
|
||||||
|
v.z = v.z*4
|
||||||
|
obj:setvelocity(v)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
minetest.add_item(pos, itemstack)
|
||||||
|
end
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
local function drop_fields(player, name)
|
||||||
|
local inv = player:get_inventory()
|
||||||
|
for i,stack in ipairs(inv:get_list(name)) do
|
||||||
|
item_drop(stack, player, player:get_pos())
|
||||||
|
stack:clear()
|
||||||
|
inv:set_stack(name, i, stack)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
sfinv.override_page("sfinv:crafting", {
|
||||||
|
title = "Crafting",
|
||||||
|
get = function(self, player, context)
|
||||||
|
local form = [[
|
||||||
|
background[-0.19,-0.25;9.41,9.49;crafting_gui_formbg.png]
|
||||||
|
listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]
|
||||||
|
list[current_player;craft;4,1;2,1;1]
|
||||||
|
list[current_player;craft;4,2;2,1;4]
|
||||||
|
list[current_player;craftpreview;7.05,1.54;1,1;]
|
||||||
|
list[detached:split;main;7.99,3.15;1,1;]
|
||||||
|
image[1.5,0;2,4;default_player2d.png]
|
||||||
|
image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true]
|
||||||
|
]]
|
||||||
|
if show_armor then
|
||||||
|
local player_name = player:get_player_name()
|
||||||
|
form = form ..
|
||||||
|
"list[detached:"..player_name.."_armor;armor;0,0;1,1;]"..
|
||||||
|
"list[detached:"..player_name.."_armor;armor;0,1;1,1;1]"..
|
||||||
|
"list[detached:"..player_name.."_armor;armor;0,2;1,1;2]"..
|
||||||
|
"list[detached:"..player_name.."_armor;armor;0,3;1,1;3]"
|
||||||
|
end
|
||||||
|
return sfinv.make_formspec(player, context, form, true)
|
||||||
|
end,
|
||||||
|
on_player_receive_fields = function(self, player, context, fields)
|
||||||
|
if fields.quit then
|
||||||
|
drop_fields(player, "craft")
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
local split_inv = minetest.create_detached_inventory("split", {
|
||||||
|
allow_move = function(_, _, _, _, _, count, _)
|
||||||
|
return count
|
||||||
|
end,
|
||||||
|
allow_put = function(_, _, _, stack, _)
|
||||||
|
return stack:get_count() / 2
|
||||||
|
end,
|
||||||
|
allow_take = function(_, _, _, stack, _)
|
||||||
|
return stack:get_count()
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
split_inv:set_size("main", 1)
|
After Width: | Height: | Size: 3.4 KiB |
|
@ -1,6 +1,67 @@
|
||||||
local player_inventory = {}
|
local player_inventory = {}
|
||||||
local inventory_cache = {}
|
local inventory_cache = {}
|
||||||
|
|
||||||
|
local offset = {}
|
||||||
|
local hoch = {}
|
||||||
|
local bg = {}
|
||||||
|
|
||||||
|
offset["blocks"] = "-0.29,-0.25"
|
||||||
|
offset["deco"] = "0.98,-0.25"
|
||||||
|
offset["mese"] = "2.23,-0.25"
|
||||||
|
offset["rail"] = "3.495,-0.25"
|
||||||
|
offset["misc"] = "4.75,-0.25"
|
||||||
|
offset["all"] = "8.99,-0.25"
|
||||||
|
offset["food"] = "-0.29,8.12"
|
||||||
|
offset["tools"] = "0.98,8.12"
|
||||||
|
offset["combat"] = "2.23,8.12"
|
||||||
|
offset["brew"] = "4.78,8.12"
|
||||||
|
offset["matr"] = "3.495,8.12"
|
||||||
|
offset["inv"] = "8.99,8.12"
|
||||||
|
|
||||||
|
hoch["blocks"] = ""
|
||||||
|
hoch["deco"] = ""
|
||||||
|
hoch["mese"] = ""
|
||||||
|
hoch["rail"] = ""
|
||||||
|
hoch["misc"] = ""
|
||||||
|
hoch["all"] = ""
|
||||||
|
hoch["food"] = "^[transformfy"
|
||||||
|
hoch["tools"] = "^[transformfy"
|
||||||
|
hoch["combat"] = "^[transformfy"
|
||||||
|
hoch["brew"] = "^[transformfy"
|
||||||
|
hoch["matr"] = "^[transformfy"
|
||||||
|
hoch["inv"] = "^[transformfy"
|
||||||
|
|
||||||
|
local dark_bg = "crafting_creative_bg_dark.png"
|
||||||
|
|
||||||
|
local function reset_menu_item_bg()
|
||||||
|
bg["blocks"] = dark_bg
|
||||||
|
bg["deco"] = dark_bg
|
||||||
|
bg["mese"] = dark_bg
|
||||||
|
bg["rail"] = dark_bg
|
||||||
|
bg["misc"] = dark_bg
|
||||||
|
bg["all"] = dark_bg
|
||||||
|
bg["food"] = dark_bg
|
||||||
|
bg["tools"] = dark_bg
|
||||||
|
bg["combat"] = dark_bg
|
||||||
|
bg["brew"] = dark_bg
|
||||||
|
bg["matr"] = dark_bg
|
||||||
|
bg["inv"] = dark_bg
|
||||||
|
end
|
||||||
|
|
||||||
|
local function get_item_list(group)
|
||||||
|
local item_list = {}
|
||||||
|
for name, def in pairs(minetest.registered_items) do
|
||||||
|
if (not def.groups.not_in_creative_inventory or
|
||||||
|
def.groups.not_in_creative_inventory == 0) and
|
||||||
|
def.description and def.description ~= "" then
|
||||||
|
if minetest.get_item_group(name, group) > 0 then
|
||||||
|
item_list[name] = def
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return item_list
|
||||||
|
end
|
||||||
|
|
||||||
local function init_creative_cache(items)
|
local function init_creative_cache(items)
|
||||||
inventory_cache[items] = {}
|
inventory_cache[items] = {}
|
||||||
local i_cache = inventory_cache[items]
|
local i_cache = inventory_cache[items]
|
||||||
|
@ -90,6 +151,63 @@ trash:set_size("main", 1)
|
||||||
|
|
||||||
creative.formspec_add = ""
|
creative.formspec_add = ""
|
||||||
|
|
||||||
|
local function get_creative_formspec(player_name, start_i, pagenum, page, pagemax)
|
||||||
|
reset_menu_item_bg()
|
||||||
|
pagenum = math.floor(pagenum) or 1
|
||||||
|
local slider_height = 4 / pagemax
|
||||||
|
local slider_pos = slider_height * (pagenum - 1) + 2.2
|
||||||
|
local formspec = ""
|
||||||
|
local main_list = "list[detached:creative_" .. player_name ..
|
||||||
|
";main;0,1.75;9,5;"..tostring(start_i).."]"
|
||||||
|
local name = "all"
|
||||||
|
if page ~= nil then name = page end
|
||||||
|
bg[name] = "crafting_creative_bg.png"
|
||||||
|
if name == "inv" then
|
||||||
|
main_list = "image[-0.2,1.7;11.35,2.33;crafting_creative_bg.png]"..
|
||||||
|
"image[-0.3,0.15;3,4.3;crafting_inventory_armor2.png]"..
|
||||||
|
"list[current_player;main;0,3.75;9,3;9]"..
|
||||||
|
"list[detached:"..player_name.."_armor;armor;0.02,1.7;1,1;]"..
|
||||||
|
"list[detached:"..player_name.."_armor;armor;0.02,2.7;1,1;1]"..
|
||||||
|
"list[detached:"..player_name.."_armor;armor;0.98,1.7;1,1;2]"..
|
||||||
|
"list[detached:"..player_name.."_armor;armor;0.98,2.7;1,1;3]"
|
||||||
|
end
|
||||||
|
local formspec = "image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true;]"..
|
||||||
|
"background[-0.19,-0.25;10.5,9.87;crafting_inventory_creative.png]"..
|
||||||
|
"bgcolor[#080808BB;true]"..
|
||||||
|
"listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]"..
|
||||||
|
"label[-5,-5;"..name.."]"..
|
||||||
|
"image[" .. offset[name] .. ";1.5,1.44;crafting_creative_active.png"..hoch[name].."]"..
|
||||||
|
"image_button[-0.1,0;1,1;"..bg["blocks"].."^crafting_creative_build.png;build;]".. --build blocks
|
||||||
|
"image_button[1.15,0;1,1;"..bg["deco"].."^crafting_creative_deko.png;deco;]".. --decoration blocks
|
||||||
|
"image_button[2.415,0;1,1;"..bg["mese"].."^crafting_creative_mese.png;mese;]".. --bluestone
|
||||||
|
"image_button[3.693,0;1,1;"..bg["rail"].."^crafting_creative_rail.png;rail;]".. --transportation
|
||||||
|
"image_button[4.93,0;1,1;"..bg["misc"].."^crafting_creative_misc.png;misc;]".. --miscellaneous
|
||||||
|
"image_button[9.19,0;1,1;"..bg["all"].."^crafting_creative_all.png;default;]".. --search
|
||||||
|
"image[0,1;5,0.75;fnt_"..name..".png]"..
|
||||||
|
"list[current_player;main;0,7;9,1;]"..
|
||||||
|
main_list..
|
||||||
|
"image_button[9.03,1.74;0.85,0.6;crafting_creative_up.png;creative_prev;]"..
|
||||||
|
"image_button[9.03,6.15;0.85,0.6;crafting_creative_down.png;creative_next;]"..
|
||||||
|
"image_button[-0.1,8.28;1,1;"..bg["food"].."^crafting_food.png;food;]".. --foodstuff
|
||||||
|
"image_button[1.15,8.28;1,1;"..bg["tools"].."^crafting_creative_tool.png;tools;]".. --tools
|
||||||
|
"image_button[2.415,8.28;1,1;"..bg["combat"].."^crafting_creative_sword.png;combat;]".. --combat
|
||||||
|
"image_button[3.693,8.28;1,1;"..bg["matr"].."^crafting_creative_matr.png;matr;]".. --brewing
|
||||||
|
"image_button[4.93,8.28;1,1;"..bg["brew"].."^crafting_inventory_brew.png;brew;]".. --materials^
|
||||||
|
"image_button[9.19,8.28;1,1;"..bg["inv"].."^crafting_creative_inv.png;inv;]".. --inventory
|
||||||
|
"list[detached:creative_trash;main;9,7;1,1;]"..
|
||||||
|
"image[9,7;1,1;crafting_creative_trash.png]"..
|
||||||
|
"image[9.04," .. tostring(slider_pos) .. ";0.78,"..tostring(slider_height) .. ";crafting_slider.png]"
|
||||||
|
|
||||||
|
if name == "all" then
|
||||||
|
formspec = formspec .. "field_close_on_enter[suche;false]" ..
|
||||||
|
"field[5.3,1.3;4,0.75;suche;;]"
|
||||||
|
end
|
||||||
|
if pagenum ~= nil then
|
||||||
|
formspec = formspec .. "p"..tostring(pagenum)
|
||||||
|
end
|
||||||
|
return formspec
|
||||||
|
end
|
||||||
|
|
||||||
function creative.register_tab(name, title, items)
|
function creative.register_tab(name, title, items)
|
||||||
sfinv.register_page("creative:" .. name, {
|
sfinv.register_page("creative:" .. name, {
|
||||||
title = title,
|
title = title,
|
||||||
|
@ -101,34 +219,11 @@ function creative.register_tab(name, title, items)
|
||||||
creative.update_creative_inventory(player_name, items)
|
creative.update_creative_inventory(player_name, items)
|
||||||
local inv = player_inventory[player_name]
|
local inv = player_inventory[player_name]
|
||||||
local start_i = inv.start_i or 0
|
local start_i = inv.start_i or 0
|
||||||
local pagenum = math.floor(start_i / (3*9) + 1)
|
local pagenum = math.floor(start_i / (5*9) + 1)
|
||||||
local pagemax = math.ceil(inv.size / (3*9))
|
local pagemax = math.ceil(inv.size / (5*9))
|
||||||
return sfinv.make_formspec(player, context,
|
local formspec = get_creative_formspec(player_name, start_i,
|
||||||
"label[6.75,3.85;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" ..
|
pagenum, name, pagemax)
|
||||||
[[
|
return sfinv.make_formspec(player, context, formspec, false, "size[10,9.3]")
|
||||||
background[-0.19,-0.25;9.41,10.48;creative_gui_formbg.png]
|
|
||||||
image[4,3.7;1,1;creative_trash_icon.png]
|
|
||||||
listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]
|
|
||||||
list[current_player;main;0,5.5;9,3;9]
|
|
||||||
list[current_player;main;0,8.74;9,1;]
|
|
||||||
list[detached:creative_trash;main;4,3.7;1,1;]
|
|
||||||
listring[]
|
|
||||||
button[5.5.0,3.7;0.8,0.9;creative_prev;<]
|
|
||||||
button[8.25,3.7;0.8,0.9;creative_next;>]
|
|
||||||
button[2.1,3.9;0.8,0.5;creative_search;?]
|
|
||||||
button[2.75,3.9;0.8,0.5;creative_clear;X]
|
|
||||||
tooltip[creative_search;Search]
|
|
||||||
tooltip[creative_clear;Reset]
|
|
||||||
tooltip[creative_prev;Previous page]
|
|
||||||
tooltip[creative_next;Next page]
|
|
||||||
listring[current_player;main]
|
|
||||||
field_close_on_enter[creative_filter;false]
|
|
||||||
]] ..
|
|
||||||
"field[0.3,4.0;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" ..
|
|
||||||
"listring[detached:creative_" .. player_name .. ";main]" ..
|
|
||||||
"list[detached:creative_" .. player_name .. ";main;0,0.5;9,3;" .. tostring(start_i) .. "]" ..
|
|
||||||
"image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true;]"..
|
|
||||||
creative.formspec_add, false, "size[9,9.75]")
|
|
||||||
end,
|
end,
|
||||||
on_enter = function(self, player, context)
|
on_enter = function(self, player, context)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
|
@ -142,30 +237,48 @@ function creative.register_tab(name, title, items)
|
||||||
local inv = player_inventory[player_name]
|
local inv = player_inventory[player_name]
|
||||||
assert(inv)
|
assert(inv)
|
||||||
|
|
||||||
if fields.creative_clear then
|
if fields.build then
|
||||||
|
sfinv.set_page(player, "creative:blocks")
|
||||||
|
elseif fields.deco then
|
||||||
|
sfinv.set_page(player, "creative:deco")
|
||||||
|
elseif fields.mese then
|
||||||
|
sfinv.set_page(player, "creative:mese")
|
||||||
|
elseif fields.rail then
|
||||||
|
sfinv.set_page(player, "creative:rail")
|
||||||
|
elseif fields.misc then
|
||||||
|
sfinv.set_page(player, "creative:misc")
|
||||||
|
elseif fields.default then
|
||||||
|
sfinv.set_page(player, "creative:all")
|
||||||
|
elseif fields.food then
|
||||||
|
sfinv.set_page(player, "creative:food")
|
||||||
|
elseif fields.tools then
|
||||||
|
sfinv.set_page(player, "creative:tools")
|
||||||
|
elseif fields.combat then
|
||||||
|
sfinv.set_page(player, "creative:combat")
|
||||||
|
elseif fields.matr then
|
||||||
|
sfinv.set_page(player, "creative:matr")
|
||||||
|
elseif fields.inv then
|
||||||
|
sfinv.set_page(player, "creative:inv")
|
||||||
|
elseif fields.brew then
|
||||||
|
sfinv.set_page(player, "creative:brew")
|
||||||
|
elseif fields.suche and
|
||||||
|
fields.key_enter_field == "suche" then
|
||||||
inv.start_i = 0
|
inv.start_i = 0
|
||||||
inv.filter = ""
|
inv.filter = fields.suche:lower()
|
||||||
creative.update_creative_inventory(player_name, items)
|
|
||||||
sfinv.set_player_inventory_formspec(player, context)
|
|
||||||
elseif fields.creative_search or
|
|
||||||
fields.key_enter_field == "creative_filter" then
|
|
||||||
inv.start_i = 0
|
|
||||||
inv.filter = fields.creative_filter:lower()
|
|
||||||
creative.update_creative_inventory(player_name, items)
|
creative.update_creative_inventory(player_name, items)
|
||||||
sfinv.set_player_inventory_formspec(player, context)
|
sfinv.set_player_inventory_formspec(player, context)
|
||||||
elseif not fields.quit then
|
elseif not fields.quit then
|
||||||
local start_i = inv.start_i or 0
|
local start_i = inv.start_i or 0
|
||||||
|
|
||||||
if fields.creative_prev then
|
if fields.creative_prev then
|
||||||
start_i = start_i - 3*9
|
start_i = start_i - 5*9
|
||||||
if start_i < 0 then
|
if start_i < 0 then
|
||||||
start_i = inv.size - (inv.size % (3*9))
|
start_i = inv.size - (inv.size % (5*9))
|
||||||
if inv.size == start_i then
|
if inv.size == start_i then
|
||||||
start_i = math.max(0, inv.size - (3*9))
|
start_i = math.max(0, inv.size - (5*9))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif fields.creative_next then
|
elseif fields.creative_next then
|
||||||
start_i = start_i + 3*9
|
start_i = start_i + 5*9
|
||||||
if start_i >= inv.size then
|
if start_i >= inv.size then
|
||||||
start_i = 0
|
start_i = 0
|
||||||
end
|
end
|
||||||
|
@ -179,9 +292,19 @@ function creative.register_tab(name, title, items)
|
||||||
end
|
end
|
||||||
|
|
||||||
creative.register_tab("all", "All", minetest.registered_items)
|
creative.register_tab("all", "All", minetest.registered_items)
|
||||||
creative.register_tab("nodes", "Nodes", minetest.registered_nodes)
|
creative.register_tab("inv", "Inv", {})
|
||||||
creative.register_tab("tools", "Tools", minetest.registered_tools)
|
minetest.after(0, function()
|
||||||
creative.register_tab("craftitems", "Items", minetest.registered_craftitems)
|
creative.register_tab("blocks", "1", get_item_list("building"))
|
||||||
|
creative.register_tab("deco", "2", get_item_list("decorative"))
|
||||||
|
creative.register_tab("mese", "3", get_item_list("mese"))
|
||||||
|
creative.register_tab("rail", "4", get_item_list("rail"))
|
||||||
|
creative.register_tab("misc", "5", get_item_list("misc"))
|
||||||
|
creative.register_tab("food", "6", get_item_list("foodstuffs"))
|
||||||
|
creative.register_tab("tools", "7", get_item_list("tools"))
|
||||||
|
creative.register_tab("combat", "8", get_item_list("combat"))
|
||||||
|
creative.register_tab("matr", "9", get_item_list("materials"))
|
||||||
|
creative.register_tab("brew", "10", get_item_list("brewing"))
|
||||||
|
end)
|
||||||
|
|
||||||
local old_homepage_name = sfinv.get_homepage_name
|
local old_homepage_name = sfinv.get_homepage_name
|
||||||
function sfinv.get_homepage_name(player)
|
function sfinv.get_homepage_name(player)
|
||||||
|
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 346 B |
After Width: | Height: | Size: 282 B |
After Width: | Height: | Size: 83 B |
After Width: | Height: | Size: 83 B |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 952 B |
After Width: | Height: | Size: 184 B |
After Width: | Height: | Size: 648 B |
After Width: | Height: | Size: 519 B |
After Width: | Height: | Size: 424 B |
After Width: | Height: | Size: 544 B |
After Width: | Height: | Size: 634 B |
After Width: | Height: | Size: 324 B |
After Width: | Height: | Size: 281 B |
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
After Width: | Height: | Size: 181 B |
After Width: | Height: | Size: 428 B |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 422 B |
After Width: | Height: | Size: 239 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 550 B |
After Width: | Height: | Size: 82 B |
Before Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 186 B |
After Width: | Height: | Size: 198 B |
After Width: | Height: | Size: 171 B |
After Width: | Height: | Size: 160 B |
After Width: | Height: | Size: 203 B |
After Width: | Height: | Size: 195 B |
After Width: | Height: | Size: 210 B |
After Width: | Height: | Size: 174 B |
After Width: | Height: | Size: 153 B |
After Width: | Height: | Size: 189 B |
After Width: | Height: | Size: 192 B |
After Width: | Height: | Size: 150 B |
|
@ -4,7 +4,7 @@ sfinv = {
|
||||||
contexts = {},
|
contexts = {},
|
||||||
enabled = true,
|
enabled = true,
|
||||||
gui_bg = "bgcolor[#080808BB;true]",
|
gui_bg = "bgcolor[#080808BB;true]",
|
||||||
gui_bg_img = "background[-0.19,-0.25;9.41,9.49;gui_formbg.png]",
|
gui_bg_img = "",
|
||||||
gui_slots = "listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]",
|
gui_slots = "listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,13 +30,15 @@ function sfinv.override_page(name, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
function sfinv.get_nav_fs(player, context, nav, current_idx)
|
function sfinv.get_nav_fs(player, context, nav, current_idx)
|
||||||
-- Only show tabs if there is more than one page
|
--[[ Only show tabs if there is more than one page
|
||||||
if #nav > 1 then
|
if #nav > 1 then
|
||||||
return "tabheader[0,0;sfinv_nav_tabs;" .. table.concat(nav, ",") ..
|
return "tabheader[0,0;sfinv_nav_tabs;" .. table.concat(nav, ",") ..
|
||||||
";" .. current_idx .. ";true;false]"
|
";" .. current_idx .. ";true;false]"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
]]--
|
||||||
|
return ""
|
||||||
end
|
end
|
||||||
|
|
||||||
local theme_main = "bgcolor[#080808BB;true]" .. sfinv.gui_bg ..
|
local theme_main = "bgcolor[#080808BB;true]" .. sfinv.gui_bg ..
|
||||||
|
|
|
@ -4,26 +4,8 @@ sfinv.register_page("sfinv:crafting", {
|
||||||
title = "Crafting",
|
title = "Crafting",
|
||||||
get = function(self, player, context)
|
get = function(self, player, context)
|
||||||
return sfinv.make_formspec(player, context, [[
|
return sfinv.make_formspec(player, context, [[
|
||||||
listcolors[#9990;#FFF7;#FFF0;#160816;#D4D2FF]
|
list[current_player;craft;1.75,0.5;3,3;]
|
||||||
list[current_player;craft;4,1;2,1;1]
|
list[current_player;craftpreview;5.75,1.5;1,1;]
|
||||||
list[current_player;craft;4,2;2,1;4]
|
|
||||||
list[current_player;craftpreview;7.05,1.54;1,1;]
|
|
||||||
list[detached:split;main;7.99,3.15;1,1;]
|
|
||||||
image[1.5,0;2,4;default_player2d.png;]
|
|
||||||
image_button_exit[8.4,-0.1;0.75,0.75;close.png;exit;;true;true]
|
|
||||||
]], true)
|
]], true)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local split_inv = minetest.create_detached_inventory("split", {
|
|
||||||
allow_move = function(_, _, _, _, _, count, _)
|
|
||||||
return count
|
|
||||||
end,
|
|
||||||
allow_put = function(_, _, _, stack, _)
|
|
||||||
return stack:get_count() / 2
|
|
||||||
end,
|
|
||||||
allow_take = function(_, _, _, stack, _)
|
|
||||||
return stack:get_count()
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
split_inv:set_size("main", 1)
|
|
||||||
|
|