mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2025-07-16 23:01:09 +02:00
compatability and legacy mostly done. schema recipes are all messed up for some reason.
This commit is contained in:
6
stairsplus/craft_schemas/init.lua
Normal file
6
stairsplus/craft_schemas/init.lua
Normal file
@ -0,0 +1,6 @@
|
||||
|
||||
stairsplus.dofile("craft_schemas", "micro_8_all")
|
||||
stairsplus.dofile("craft_schemas", "other")
|
||||
stairsplus.dofile("craft_schemas", "slopes")
|
||||
stairsplus.dofile("craft_schemas", "stairs")
|
||||
stairsplus.dofile("craft_schemas", "standard_composition")
|
12
stairsplus/craft_schemas/micro_8_all.lua
Normal file
12
stairsplus/craft_schemas/micro_8_all.lua
Normal file
@ -0,0 +1,12 @@
|
||||
local api = stairsplus.api
|
||||
local register_craft_schema = api.register_craft_schema
|
||||
|
||||
for shape, shape_def in pairs(api.registered_shapes) do
|
||||
if shape ~= "micro_8" then
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = ("micro_8 %i"):format(shape_def.eighths),
|
||||
recipe = {shape},
|
||||
})
|
||||
end
|
||||
end
|
86
stairsplus/craft_schemas/other.lua
Normal file
86
stairsplus/craft_schemas/other.lua
Normal file
@ -0,0 +1,86 @@
|
||||
local api = stairsplus.api
|
||||
local register_craft_schema = api.register_craft_schema
|
||||
|
||||
|
||||
---- panel_8
|
||||
|
||||
register_craft_schema({
|
||||
output = "panel_8 12",
|
||||
recipe = {
|
||||
{"node", ""},
|
||||
{"node", "node"},
|
||||
},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
output = "panel_8 12",
|
||||
recipe = {
|
||||
{"", "node"},
|
||||
{"node", "node"},
|
||||
},
|
||||
})
|
||||
|
||||
-- slabs
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slab_8",
|
||||
recipe = {"micro_8", "micro_8", "micro_8", "micro_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slab_8",
|
||||
recipe = {"slab_2", "slab_2", "slab_2", "slab_2"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slab_8 2",
|
||||
recipe = {"slab_1", "slab_1", "slab_1", "slab_1", "slab_1", "slab_1", "slab_1", "slab_1"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slab_4 2",
|
||||
recipe = {"slab_1", "slab_1", "slab_1", "slab_1"},
|
||||
})
|
||||
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slab_12",
|
||||
recipe = {"slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slab_14",
|
||||
recipe = {"slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2"},
|
||||
})
|
||||
|
||||
-- node
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"panel_8", "panel_8", "panel_8", "panel_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"slab_4", "slab_4", "slab_4", "slab_4"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2"},
|
||||
})
|
106
stairsplus/craft_schemas/slopes.lua
Normal file
106
stairsplus/craft_schemas/slopes.lua
Normal file
@ -0,0 +1,106 @@
|
||||
local api = stairsplus.api
|
||||
local register_craft_schema = api.register_craft_schema
|
||||
|
||||
-- slopes
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slab_8",
|
||||
recipe = {"slope_half", "slope_half"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slab_8",
|
||||
recipe = {"slope_outer_half", "slope_inner_half"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slab_8",
|
||||
recipe = {"slope_outer_cut_half", "slope_inner_cut_half"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slope_half_raised",
|
||||
recipe = {"slope_half", "slope_half", "slope_half"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slope_half_raised",
|
||||
recipe = {"slab_8", "slope_half"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slope_inner_half_raised",
|
||||
recipe = {"slab_8", "slope_inner_half"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slope_outer_half_raised",
|
||||
recipe = {"slab_8", "slope_outer_half"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slope_inner_cut_half_raised",
|
||||
recipe = {"slab_8", "slope_inner_cut_half"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"slope", "slope"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"slope_half", "slope_half_raised"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"slope_half", "slope_half", "slope_half", "slope_half"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"slope_outer", "slope_inner"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"slope_outer_half", "slope_inner_half_raised"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"slope_outer_half_raised", "slope_inner_half"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"slope_outer_cut", "slope_inner_cut"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"slope_outer_cut_half", "slope_inner_cut_half_raised"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "node",
|
||||
recipe = {"slope_cut", "slope_cut"},
|
||||
})
|
96
stairsplus/craft_schemas/stairs.lua
Normal file
96
stairsplus/craft_schemas/stairs.lua
Normal file
@ -0,0 +1,96 @@
|
||||
local api = stairsplus.api
|
||||
local register_craft_schema = api.register_craft_schema
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "slab_8 3",
|
||||
recipe = {"stair", "stair"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
output = "stair 8",
|
||||
recipe = {
|
||||
{"node", "", ""},
|
||||
{"node", "node", ""},
|
||||
{"node", "node", "node"},
|
||||
},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
output = "stair 8",
|
||||
recipe = {
|
||||
{"", "", "node"},
|
||||
{"", "node", "node"},
|
||||
{"node", "node", "node"},
|
||||
},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "stair",
|
||||
recipe = {"panel_8", "slab_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "stair",
|
||||
recipe = {"panel_8", "panel_8", "panel_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "stair",
|
||||
recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "stair",
|
||||
recipe = {"panel_8", "panel_8", "panel_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "stair_inner",
|
||||
recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "stair_outer",
|
||||
recipe = {"micro_8", "slab_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "stair_outer",
|
||||
recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "stair_half",
|
||||
recipe = {"micro_8", "micro_8", "micro_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({
|
||||
type = "shapeless",
|
||||
output = "stair_half",
|
||||
recipe = {"panel_8", "micro_8"},
|
||||
})
|
||||
|
||||
register_craft_schema({ -- See mirrored variation of the recipe below.
|
||||
output = "stair_alt_8",
|
||||
recipe = {
|
||||
{"panel_8", ""},
|
||||
{"", "panel_8"},
|
||||
},
|
||||
})
|
||||
|
||||
register_craft_schema({ -- Mirrored variation of the recipe above.
|
||||
output = "stair_alt_8",
|
||||
recipe = {
|
||||
{"", "panel_8"},
|
||||
{"panel_8", ""},
|
||||
},
|
||||
})
|
109
stairsplus/craft_schemas/standard_composition.lua
Normal file
109
stairsplus/craft_schemas/standard_composition.lua
Normal file
@ -0,0 +1,109 @@
|
||||
local api = stairsplus.api
|
||||
local register_craft_schema = api.register_craft_schema
|
||||
|
||||
local slices = {1, 2, 4, 8, 12, 14, 15}
|
||||
|
||||
local valid_slice = {
|
||||
[1] = true,
|
||||
[2] = true,
|
||||
[4] = true,
|
||||
[8] = true,
|
||||
[12] = true,
|
||||
[14] = true,
|
||||
[15] = true,
|
||||
}
|
||||
|
||||
local promotion = {
|
||||
micro = "panel_8",
|
||||
panel = "slab_8",
|
||||
slab = "node",
|
||||
}
|
||||
|
||||
local demotion = {
|
||||
node = "slab",
|
||||
slab = "panel",
|
||||
panel = "micro",
|
||||
}
|
||||
|
||||
for _, shape in ipairs({"micro", "panel", "slab"}) do
|
||||
for _, slice1 in ipairs(slices) do
|
||||
local shape1 = ("%s_%s"):format(shape, slice1)
|
||||
local def1 = api.registered_shapes[shape1]
|
||||
|
||||
for _, slice2 in ipairs(slices) do
|
||||
local shape2 = ("%s_%s"):format(shape, slice2)
|
||||
local def2 = api.registered_shapes[shape2]
|
||||
|
||||
local slice3 = slice1 + slice2
|
||||
|
||||
if valid_slice[slice3] then
|
||||
local shape3 = ("%s_%s"):format(shape, slice3)
|
||||
local def3 = api.registered_shapes[shape3]
|
||||
local n = math.floor((def1.eighths + def2.eighths) / def3.eighths)
|
||||
|
||||
register_craft_schema({
|
||||
output = ("%s %s"):format(shape3, n),
|
||||
recipe = {
|
||||
{shape1},
|
||||
{shape2},
|
||||
},
|
||||
})
|
||||
|
||||
elseif slice3 == 16 then
|
||||
register_craft_schema({
|
||||
output = ("%s"):format(promotion[shape]),
|
||||
recipe = {
|
||||
{shape1},
|
||||
{shape2},
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- split in half horizontally
|
||||
|
||||
register_craft_schema({
|
||||
output = "slab_8 6",
|
||||
recipe = {{"node", "node", "node"}},
|
||||
})
|
||||
|
||||
for _, shape in ipairs({"micro", "panel", "slab"}) do
|
||||
for _, slice1 in ipairs({2, 4, 8}) do
|
||||
local slice2 = slice1 / 2
|
||||
local shape1 = ("%s_%s"):format(shape, slice1)
|
||||
local shape2 = ("%s_%s"):format(shape, slice2)
|
||||
local def1 = api.registered_shapes[shape1]
|
||||
local def2 = api.registered_shapes[shape2]
|
||||
local n = math.floor(def1.eighths / def2.eighths)
|
||||
|
||||
register_craft_schema({
|
||||
output = ("%s %s"):format(shape2, n),
|
||||
recipe = {
|
||||
{shape1, shape1, shape1},
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- split in half vertically
|
||||
|
||||
for _, shape in ipairs({"panel", "slab"}) do
|
||||
for _, slice in ipairs(slices) do
|
||||
local shape1 = ("%s_%s"):format(shape, slice)
|
||||
local shape2 = ("%s_%s"):format(demotion[shape], slice)
|
||||
local def1 = api.registered_shapes[shape1]
|
||||
local def2 = api.registered_shapes[shape2]
|
||||
local n = math.floor(def1.eighths / def2.eighths)
|
||||
|
||||
register_craft_schema({
|
||||
output = ("%s %s"):format(shape2, n),
|
||||
recipe = {
|
||||
{shape1},
|
||||
{shape1},
|
||||
{shape1},
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user