Craft guide : some additional corrections
This commit is contained in:
parent
3be6cc586c
commit
519b5b299c
11
nodes.lua
11
nodes.lua
@ -215,11 +215,12 @@ xdecor.register("enderchest", {
|
|||||||
on_rotate = screwdriver.rotate_simple,
|
on_rotate = screwdriver.rotate_simple,
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
meta:set_string("formspec", "size[8,9]"..xbg..default.get_hotbar_bg(0,5)..
|
meta:set_string("formspec", [[ size[8,9]
|
||||||
"list[current_player;enderchest;0,0;8,4;]"..
|
list[current_player;enderchest;0,0;8,4;]
|
||||||
"list[current_player;main;0,5;8,4;]"..
|
list[current_player;main;0,5;8,4;]
|
||||||
"listring[current_player;enderchest]"..
|
listring[current_player;enderchest]
|
||||||
"listring[current_player;main]")
|
listring[current_player;main] ]]
|
||||||
|
..xbg..default.get_hotbar_bg(0,5))
|
||||||
meta:set_string("infotext", "Ender Chest")
|
meta:set_string("infotext", "Ender Chest")
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
@ -97,18 +97,10 @@ function worktable.craft_output_recipe(pos, start_i, pagenum, stackname, recipe_
|
|||||||
else
|
else
|
||||||
formspec = formspec.."list[context;craft_output_recipe;5,5.3;1,"..#stack_items..";]"
|
formspec = formspec.."list[context;craft_output_recipe;5,5.3;1,"..#stack_items..";]"
|
||||||
end
|
end
|
||||||
inv:set_size("craft_output_recipe", 1 * #stack_items)
|
inv:set_size("craft_output_recipe", #stack_items)
|
||||||
elseif stack_width == 2 then
|
elseif stack_width == 2 then
|
||||||
if #stack_items <= 2 then
|
formspec = formspec.."list[context;craft_output_recipe;5,5.3;2,3;]"
|
||||||
formspec = formspec.."list[context;craft_output_recipe;5,6.3;2,1;]"
|
inv:set_size("craft_output_recipe", 2*3)
|
||||||
inv:set_size("craft_output_recipe", 2)
|
|
||||||
elseif #stack_items > 2 and #stack_items <= 4 then
|
|
||||||
formspec = formspec.."list[context;craft_output_recipe;5,5.3;2,2;]"
|
|
||||||
inv:set_size("craft_output_recipe", 2*2)
|
|
||||||
else
|
|
||||||
formspec = formspec.."list[context;craft_output_recipe;5,5.3;2,3;]"
|
|
||||||
inv:set_size("craft_output_recipe", 2*3)
|
|
||||||
end
|
|
||||||
elseif stack_width == 3 then
|
elseif stack_width == 3 then
|
||||||
if stack_type == "cooking" then
|
if stack_type == "cooking" then
|
||||||
formspec = formspec..[[ list[context;craft_output_recipe;5,6.3;1,1;]
|
formspec = formspec..[[ list[context;craft_output_recipe;5,6.3;1,1;]
|
||||||
@ -125,13 +117,11 @@ function worktable.craft_output_recipe(pos, start_i, pagenum, stackname, recipe_
|
|||||||
inv:set_size("craft_output_recipe", 1)
|
inv:set_size("craft_output_recipe", 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
local craft = {}
|
local craft, group_nodes = {}, {}
|
||||||
for k, def in pairs(stack_items) do
|
for k, def in pairs(stack_items) do
|
||||||
craft[#craft+1] = def
|
craft[#craft+1] = def
|
||||||
if def and def:find("^group:") then
|
if def and def:find("^group:") then
|
||||||
if def:find("liquid") then
|
if def:find("wool") then
|
||||||
def = "default:water_source"
|
|
||||||
elseif def:find("wool") then
|
|
||||||
def = "wool:white"
|
def = "wool:white"
|
||||||
elseif def:find("dye") then
|
elseif def:find("dye") then
|
||||||
local dye_color = def:match(".*_([%w_]+)")
|
local dye_color = def:match(".*_([%w_]+)")
|
||||||
@ -154,13 +144,25 @@ function worktable.craft_output_recipe(pos, start_i, pagenum, stackname, recipe_
|
|||||||
def = "flowers:rose"
|
def = "flowers:rose"
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if minetest.registered_items["default:"..def:match("^group:([%w_]+)$")] then
|
if minetest.registered_items["default:"..def:match("^group:([%w_,]+)$")] then
|
||||||
def = def:gsub("group", "default")
|
def = def:gsub("group", "default")
|
||||||
else
|
else
|
||||||
for node, definition in pairs(minetest.registered_items) do
|
for node, definition in pairs(minetest.registered_items) do
|
||||||
for group in pairs(definition.groups) do
|
for group in pairs(definition.groups) do
|
||||||
if def:match("^group:"..group.."$") then
|
if def:match("^group:"..group) then
|
||||||
inv:set_stack("craft_output_recipe", k, node)
|
if node:find("^default:") then
|
||||||
|
if not minetest.serialize(group_nodes):match(node) then
|
||||||
|
group_nodes[#group_nodes+1] = node
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, n in pairs(group_nodes) do
|
||||||
|
inv:set_stack("craft_output_recipe", k, n)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if inv:get_stack("craft_output_recipe", k):is_empty() then
|
||||||
|
inv:set_stack("craft_output_recipe", k, node)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user