def.after_place_node and not def.on_rightclick and not
def.on_blast and not def.allow_metadata_inventory_take and not
(def.groups.not_in_creative_inventory == 1) and not
- def.groups.wool and not def.drop and def.light_source == 0 and
- def.description and def.description ~= ""
+ def.groups.wool and not def.description:find("Ore") and
+ def.description and def.description ~= "" and def.light_source == 0
end
-- Nodeboxes definitions.
local formspec = [[ size[8,6.6;]
tablecolumns[color;text;color;text]
tableoptions[background=#00000000;highlight=#00000000;border=false]
- button[5.5,0;0.7,1;prev;<]
- button[7.3,0;0.7,1;next;>]
+ button[5.5,0;0.7,0.95;prev;<]
+ button[7.3,0;0.7,0.95;next;>]
button[4,0.2;0.7,0.5;search;?]
button[4.6,0.2;0.7,0.5;clearfilter;X]
button[0,0;1.5,1;backcraft;< Back]
tooltip[search;Search]
tooltip[clearfilter;Reset] ]] ..
- "table[6.1,0.2;1.1,0.5;pagenum;#FFFF00,"..tostring(pagenum)..
+ "table[6.1,0.18;1.1,0.5;pagenum;#FFFF00,"..tostring(pagenum)..
",#FFFFFF,/ "..tostring(pagemax).."]"..
"field[1.8,0.32;2.6,1;filter;;"..filter.."]"..xbg
local items = minetest.get_all_craft_recipes(item)[recipe_num].items
local width = minetest.get_all_craft_recipes(item)[recipe_num].width
if width == 0 then width = math.min(3, #items) end
- local rows = math.ceil(table.maxn(items) / width)
+ local rows = math.ceil(table.maxn(items) / width) -- Lua 5.3 removed `table.maxn`, use `xdecor.maxn` in case of failure.
local function is_group(item)
- if item:find("^group:") then return "G" end
+ if item:find("^group:") then return "\nG" end
return ""
end
(math.floor((i-1) / width + (6 - math.min(2, rows))))..";1,1;"..
self:get_recipe(v)..";"..self:get_recipe(v)..";"..is_group(v).."]"
end
-
- local yield = minetest.get_all_craft_recipes(item)[recipe_num].output:match("%s(%d+)") or ""
- formspec = formspec.."item_image_button[2.5,5;1,1;"..item..";"..item..";"..yield.."]"..
+
+ local output = minetest.get_all_craft_recipes(item)[recipe_num].output
+ formspec = formspec.."item_image_button[2.5,5;1,1;"..output..";"..item..";]"..
"image[3.5,5;1,1;gui_furnace_arrow_bg.png^[transformR90]"
end
worktable:craftguide_items(meta, nil)
worktable:craftguide_formspec(meta, 1, nil, 1, "")
elseif fields.alternate then
- local item = formspec:match("item_image_button%[.*;([%w_:]+);.*%]") or ""
+ local item = formspec:match("image_button%[.*;([%w_:]+);.*%]") or ""
local recipe_num = tonumber(formspec:match("Recipe%s(%d+)")) or 1
recipe_num = recipe_num + 1
worktable:craftguide_formspec(meta, pagenum, item, recipe_num, filter)
inv:is_empty("tool") and inv:is_empty("storage")
end
-function worktable.put(pos, listname, _, stack)
+function worktable.put(_, listname, _, stack)
local stackname = stack:get_name()
if (listname == "tool" and stack:get_wear() > 0 and
worktable.repairable_tools:find(stackname:match(":(%w+)"))) or
- (listname == "input" and worktable:nodes(minetest.registered_nodes[stackname])) or
+ (listname == "input" and minetest.registered_nodes[stackname.."_cube"]) or
(listname == "hammer" and stackname == "xdecor:hammer") or
listname == "storage" or listname == "trash" then
return stack:get_count()
return stack:get_count()
end
-
function worktable.move(_, _, _, to_list, _, count)
if to_list == "storage" or to_list == "trash" then return count end
return 0
for node in pairs(minetest.registered_nodes) do
local def = minetest.registered_nodes[node]
if worktable:nodes(def) and d[3] then
- local groups, tiles = {}, {def.tiles[1]}
+ local groups, tiles = {}, {}
groups.not_in_creative_inventory = 1
for k, v in pairs(def.groups) do
end
end
- if #def.tiles > 1 and not def.drawtype:find("glass") then
- tiles = def.tiles
+ if def.tiles then
+ if #def.tiles > 1 and not def.drawtype:find("glass") then
+ tiles = def.tiles
+ else tiles = {def.tiles[1]} end
+ else
+ tiles = {def.tile_images[1]}
end
- stairs.register_stair_and_slab(node:match(":(.*)"), node, groups, tiles,
- def.description.." Stair", def.description.." Slab", def.sounds)
+ if not minetest.registered_nodes["stairs:slab_"..node:match(":(.*)")] then
+ stairs.register_stair_and_slab(node:match(":(.*)"), node, groups, tiles,
+ def.description.." Stair", def.description.." Slab", def.sounds)
+ end
minetest.register_node(":"..node.."_"..d[1], {
description = def.description.." "..d[1]:gsub("^%l", string.upper),
sounds = def.sounds,
tiles = tiles,
groups = groups,
- node_box = xdecor.pixelnodebox(16, {unpack(d, 3)}),
+ node_box = xdecor.pixelbox(16, {unpack(d, 3)}), -- `unpack` has been changed to `table.unpack` in newest Lua versions.
sunlight_propagates = true,
on_place = minetest.rotate_node,
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)