mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2024-11-15 23:10:18 +01:00
more recipe schemata
This commit is contained in:
parent
9cc83ce5cc
commit
b2217af50e
|
@ -158,7 +158,7 @@ function api.register_single(node, shape, overrides, meta)
|
|||
|
||||
if not meta.allow_override_groups and overrides.groups then
|
||||
stairsplus.log("warning", "removing group overrides from %s (was %s, will be %s)",
|
||||
shaped_name, minetest.serialize(overrides.groups):sub(8), minetest.serialize(def.groups):sub(8)
|
||||
shaped_name, minetest.write_json(overrides.groups), minetest.write_json(def.groups)
|
||||
)
|
||||
overrides.groups = nil
|
||||
end
|
||||
|
|
|
@ -68,7 +68,7 @@ function api.register_craft_schema(schema)
|
|||
error(problems)
|
||||
end
|
||||
|
||||
stairsplus.log("info", "registering craft schema %s", minetest.serialize(schema):sub(#("return ")))
|
||||
stairsplus.log("info", "registering craft schema %s", minetest.write_json(schema))
|
||||
|
||||
table.insert(api.registered_recipe_schemas, schema)
|
||||
|
||||
|
@ -138,7 +138,7 @@ local function register_for_schema(node, schema)
|
|||
end
|
||||
end
|
||||
|
||||
stairsplus.log("info", "registering recipe %s", minetest.serialize(recipe):sub(#("return ")))
|
||||
stairsplus.log("info", "registering recipe %s", minetest.write_json(recipe))
|
||||
|
||||
minetest.register_craft(recipe)
|
||||
end
|
||||
|
@ -148,7 +148,7 @@ function api.register_schema_crafts_for_node(node)
|
|||
local shapes = api.get_shapes_hash(node)
|
||||
for _, schema in ipairs(api.registered_recipe_schemas) do
|
||||
if has_the_right_shapes(schema, shapes) then
|
||||
stairsplus.log("verbose", "using schema %s", minetest.serialize(schema):sub(#("return ")))
|
||||
stairsplus.log("verbose", "using schema %s", minetest.write_json(schema))
|
||||
register_for_schema(node, schema)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -13,18 +13,24 @@ local valid_slice = {
|
|||
[15] = true,
|
||||
}
|
||||
|
||||
local promotion = {
|
||||
local full_promotion = {
|
||||
micro = "panel_8",
|
||||
panel = "slab_8",
|
||||
slab = "node",
|
||||
}
|
||||
|
||||
local half_promotion = {
|
||||
micro = "panel",
|
||||
panel = "slab",
|
||||
}
|
||||
|
||||
local demotion = {
|
||||
node = "slab",
|
||||
slab = "panel",
|
||||
panel = "micro",
|
||||
}
|
||||
|
||||
-- stack things on top of each other
|
||||
for _, shape in ipairs({"micro", "panel", "slab"}) do
|
||||
for _, slice1 in ipairs(slices) do
|
||||
local shape1 = ("%s_%s"):format(shape, slice1)
|
||||
|
@ -51,7 +57,7 @@ for _, shape in ipairs({"micro", "panel", "slab"}) do
|
|||
|
||||
elseif slice3 == 16 then
|
||||
register_craft_schema({
|
||||
output = ("%s"):format(promotion[shape]),
|
||||
output = ("%s"):format(full_promotion[shape]),
|
||||
recipe = {
|
||||
{shape1},
|
||||
{shape2},
|
||||
|
@ -62,6 +68,24 @@ for _, shape in ipairs({"micro", "panel", "slab"}) do
|
|||
end
|
||||
end
|
||||
|
||||
-- stack things next to each other
|
||||
for _, shape in ipairs({"micro", "panel"}) do
|
||||
for _, slice in ipairs(slices) do
|
||||
local shape1 = ("%s_%s"):format(shape, slice)
|
||||
local def1 = api.registered_shapes[shape1]
|
||||
local shape2 = ("%s_%s"):format(half_promotion[shape], slice)
|
||||
local def2 = api.registered_shapes[shape2]
|
||||
local n = math.floor(2 * def1.eighths / def2.eighths)
|
||||
|
||||
register_craft_schema({
|
||||
output = ("%s %s"):format(shape2, n),
|
||||
recipe = {
|
||||
{shape1, shape1},
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-- split in half horizontally
|
||||
|
||||
register_craft_schema({
|
||||
|
|
Loading…
Reference in New Issue
Block a user