mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2025-01-11 18:30:22 +01:00
functional, except saw, legacy, other compatability
This commit is contained in:
parent
687de31632
commit
b9eed16713
30
CHANGELOG.md
30
CHANGELOG.md
@ -11,18 +11,30 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
- turned into a modpack (separate out stairsplus properly
|
- turned into a modpack (i.e. properly separated moreblocks and stairsplus)
|
||||||
- refactored and rewrote a ton of stuff.)
|
- refactored and rewrote a ton of stuff
|
||||||
- a lot of cleanup.
|
- got rid of some dead code (e.g. "ownership.lua")
|
||||||
- got rid of some dead code ("ownership").
|
- more API for creating node variants, e.g. trap nodes, all_faces, shapes
|
||||||
- more API for creating node variants
|
- parameterized resources (sounds, textures, craft materials) to make it easier to integrate w/ other minetest "games"
|
||||||
- allow registering new variants w/ this mod
|
- actually implement luachecking - stop ignoring problems
|
||||||
- parameterized resources (sounds, textures, craft materials) to make it easier to integrate w/ other games
|
- fix some unreported bugs (e.g. dependencies which weren't declared, unused code)
|
||||||
- actually implemented proper luachecking
|
- i'm rewriting large parts of the mod and creating a sane API, i'm bumping the version
|
||||||
- fixed some unreported bugs (e.g. dependencies which weren't declared)
|
- create a default-on "legacy" mode to allow new servers to not commit to creating so many useless shapes by default
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- [stairsplus:register_custom_subset computes the wrong "cost" for elements](https://github.com/minetest-mods/moreblocks/issues/190)
|
||||||
|
- \* [Material disappears from Recycle output slot](https://github.com/minetest-mods/moreblocks/issues/189)
|
||||||
|
- \* [Would it be possible to port to mineclone?](https://github.com/minetest-mods/moreblocks/issues/188) - no plan to
|
||||||
|
actually make moreblocks mineclone-aware, but will lay the groundwork to make this very easy.
|
||||||
|
- [Minor issue causing warnings in MT 5.5.0 with texture alpha clipping](https://github.com/minetest-mods/moreblocks/issues/187)
|
||||||
|
- maybe: [world aligned textures](https://github.com/minetest-mods/moreblocks/issues/179)
|
||||||
|
- maybe: [Make microblocks work for nodes with layered textures](Make microblocks work for nodes with layered textures)
|
||||||
|
- \* [Make variants of nodes that can burn also burnable](https://github.com/minetest-mods/moreblocks/issues/177)
|
||||||
|
- [Add screenshot in README.md #151](https://github.com/minetest-mods/moreblocks/issues/151)
|
||||||
|
- maybe some of the other bugs/PRS, but they mostly either seem to be fixed or unfixable
|
||||||
|
|
||||||
|
\* not yet fixed, but planned
|
||||||
|
|
||||||
## [2.2.0] - 2021-06-28
|
## [2.2.0] - 2021-06-28
|
||||||
|
|
||||||
|
@ -72,6 +72,10 @@ minetest.register_alias("moreblocks:allfacestree", "moreblocks:all_faces_tree")
|
|||||||
minetest.register_alias("moreblocks:empty_bookshelf", "moreblocks:empty_shelf")
|
minetest.register_alias("moreblocks:empty_bookshelf", "moreblocks:empty_shelf")
|
||||||
minetest.register_alias("moreblocks:split_stone_tile_alt", "moreblocks:checker_stone_tile")
|
minetest.register_alias("moreblocks:split_stone_tile_alt", "moreblocks:checker_stone_tile")
|
||||||
|
|
||||||
|
if moreblocks.has.stairsplus and cm.jungle_wood then
|
||||||
|
stairsplus.api.register_alias_all("moreblocks:jungle_wood", cm.jungle_wood)
|
||||||
|
end
|
||||||
|
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
name = "moreblocks:reduce_wood_tile_redundancy",
|
name = "moreblocks:reduce_wood_tile_redundancy",
|
||||||
nodenames = {
|
nodenames = {
|
||||||
|
@ -354,7 +354,6 @@ if cm.glass then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "moreblocks:trap_clean_glass",
|
output = "moreblocks:trap_clean_glass",
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
|
@ -37,14 +37,8 @@ local function register_stairs(name, def)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if moreblocks.has.stairsplus then
|
if moreblocks.has.stairsplus then
|
||||||
stairsplus:register_all(modname, name, itemstring, {
|
stairsplus.api.register_group(itemstring, "common")
|
||||||
description = def.description,
|
|
||||||
groups = def.groups,
|
|
||||||
tiles = def.tiles,
|
|
||||||
sunlight_propagates = def.sunlight_propagates,
|
|
||||||
light_source = def.light_source,
|
|
||||||
sounds = def.sounds,
|
|
||||||
})
|
|
||||||
elseif moreblocks.has.stairs then
|
elseif moreblocks.has.stairs then
|
||||||
stairs.register_stair_and_slab(
|
stairs.register_stair_and_slab(
|
||||||
("%s_%s"):format(modname, name),
|
("%s_%s"):format(modname, name),
|
||||||
@ -59,7 +53,6 @@ local function register_stairs(name, def)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function tile_tiles(tex)
|
local function tile_tiles(tex)
|
||||||
return {tex, tex, tex, tex, tex .. "^[transformR90", tex .. "^[transformR90"}
|
return {tex, tex, tex, tex, tex .. "^[transformR90", tex .. "^[transformR90"}
|
||||||
end
|
end
|
||||||
@ -87,7 +80,6 @@ local function register_all_faces(name, base)
|
|||||||
minetest.register_alias(name, itemstring)
|
minetest.register_alias(name, itemstring)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
local function register_trap(name, base)
|
local function register_trap(name, base)
|
||||||
name = "trap_" .. name
|
name = "trap_" .. name
|
||||||
local itemstring = ("%s:%s"):format(modname, name)
|
local itemstring = ("%s:%s"):format(modname, name)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
minetest.register_alias("circular_saw", "stairsplus:circular_saw")
|
minetest.register_alias("circular_saw", "stairsplus:circular_saw")
|
||||||
minetest.register_alias("moreblocks:circular_saw", "stairsplus:circular_saw")
|
minetest.register_alias("moreblocks:circular_saw", "stairsplus:circular_saw")
|
||||||
|
|
||||||
|
@ -1,24 +1,50 @@
|
|||||||
|
|
||||||
local api = stairsplus.api
|
local api = stairsplus.api
|
||||||
|
|
||||||
|
local table_is_empty = stairsplus.util.table_is_empty
|
||||||
|
|
||||||
|
function api.register_alias_single(old_node, new_node, shape)
|
||||||
|
local old_shaped_node = api.format_name(shape, old_node)
|
||||||
|
local new_shaped_node = api.format_name(shape, new_node)
|
||||||
|
|
||||||
|
minetest.register_alias(old_shaped_node, new_shaped_node)
|
||||||
|
end
|
||||||
|
|
||||||
function api.register_alias_all(old_node, new_node)
|
function api.register_alias_all(old_node, new_node)
|
||||||
local old_mod, old_name = old_node:match("^([^:]+:(.*)$")
|
for shape in pairs(api.registered_shapes) do
|
||||||
local new_mod, new_name = new_node:match("^([^:]+:(.*)$")
|
api.register_alias_single(old_node, new_node, shape)
|
||||||
for _, shape_def in pairs(stairsplus.api.registered_shapes) do
|
end
|
||||||
minetest.register_alias(
|
end
|
||||||
("%s:%s"):format(old_mod, shape_def.name_format:format(old_name)),
|
|
||||||
("%s:%s"):format(new_mod, shape_def.name_format:format(new_name))
|
function api.register_alias_force_single(old_node, new_node, shape)
|
||||||
)
|
local old_shaped_node = api.format_name(shape, old_node)
|
||||||
|
local new_shaped_node = api.format_name(shape, new_node)
|
||||||
|
|
||||||
|
minetest.register_alias_force(old_shaped_node, new_shaped_node)
|
||||||
|
|
||||||
|
local nodes = api.nodes_by_shape[shape] or {}
|
||||||
|
if nodes[old_node] then
|
||||||
|
nodes[old_node] = nil
|
||||||
|
nodes[new_node] = true
|
||||||
|
api.nodes_by_shape[shape] = nodes
|
||||||
|
end
|
||||||
|
|
||||||
|
local old_shapes = api.shapes_by_node[old_node] or {}
|
||||||
|
if old_shapes[shape] then
|
||||||
|
old_shapes[shape] = nil
|
||||||
|
if table_is_empty(old_shapes) then
|
||||||
|
api.shapes_by_node[old_node] = nil
|
||||||
|
else
|
||||||
|
api.shapes_by_node[old_node] = old_shapes
|
||||||
|
end
|
||||||
|
|
||||||
|
local new_shapes = api.shapes_by_node[new_node] or {}
|
||||||
|
new_shapes[new_node] = true
|
||||||
|
api.shapes_by_node[new_node] = new_shapes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function api.register_alias_force_all(old_node, new_node)
|
function api.register_alias_force_all(old_node, new_node)
|
||||||
local old_mod, old_name = old_node:match("^([^:]+:(.*)$")
|
for shape in pairs(api.registered_shapes) do
|
||||||
local new_mod, new_name = new_node:match("^([^:]+:(.*)$")
|
api.register_alias_force_single(old_node, new_node, shape)
|
||||||
for _, shape_def in pairs(stairsplus.api.registered_shapes) do
|
|
||||||
minetest.register_alias_force(
|
|
||||||
("%s:%s"):format(old_mod, shape_def.name_format:format(old_name)),
|
|
||||||
("%s:%s"):format(new_mod, shape_def.name_format:format(new_name))
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -3,4 +3,5 @@ stairsplus.api = {}
|
|||||||
stairsplus.dofile("api", "shape")
|
stairsplus.dofile("api", "shape")
|
||||||
stairsplus.dofile("api", "node")
|
stairsplus.dofile("api", "node")
|
||||||
stairsplus.dofile("api", "station")
|
stairsplus.dofile("api", "station")
|
||||||
|
stairsplus.dofile("api", "alias")
|
||||||
stairsplus.dofile("api", "recipe")
|
stairsplus.dofile("api", "recipe")
|
||||||
|
@ -4,10 +4,16 @@
|
|||||||
]]
|
]]
|
||||||
local api = stairsplus.api
|
local api = stairsplus.api
|
||||||
|
|
||||||
|
local table_set_all = stairsplus.util.table_set_all
|
||||||
|
local table_sort_keys = stairsplus.util.table_sort_keys
|
||||||
|
|
||||||
|
local S = stairsplus.S
|
||||||
|
|
||||||
local legacy_mode = stairsplus.settings.legacy_mode
|
local legacy_mode = stairsplus.settings.legacy_mode
|
||||||
local in_creative_inventory = stairsplus.settings.in_creative_inventory
|
local in_creative_inventory = stairsplus.settings.in_creative_inventory
|
||||||
|
|
||||||
local S = stairsplus.S
|
api.nodes_by_shape = {}
|
||||||
|
api.shapes_by_node = {}
|
||||||
|
|
||||||
local function scale_light(light_source, shape_def)
|
local function scale_light(light_source, shape_def)
|
||||||
if not light_source or light_source == 0 then
|
if not light_source or light_source == 0 then
|
||||||
@ -19,14 +25,19 @@ local function scale_light(light_source, shape_def)
|
|||||||
return math.max(1, math.min(math.round(light_source * shape_def.eighths / 4), light_source))
|
return math.max(1, math.min(math.round(light_source * shape_def.eighths / 4), light_source))
|
||||||
end
|
end
|
||||||
|
|
||||||
function api.register_single(node, shape, overrides)
|
function api.format_name(shape, node)
|
||||||
local mod, name = node:match("^([^:]+):(.*)$")
|
local mod, name = node:match("^([^:]+):(.*)$")
|
||||||
|
local shape_def = api.registered_shapes[shape]
|
||||||
|
return ("%s:%s"):format(mod, shape_def.name_format:format(name))
|
||||||
|
end
|
||||||
|
|
||||||
|
function api.register_single(node, shape, overrides)
|
||||||
local node_def = table.copy(minetest.registered_nodes[node])
|
local node_def = table.copy(minetest.registered_nodes[node])
|
||||||
local shape_def = api.registered_shapes[shape]
|
local shape_def = api.registered_shapes[shape]
|
||||||
|
|
||||||
local groups = {
|
local groups = {
|
||||||
[shape] = 1,
|
[shape] = 1,
|
||||||
not_in_creative_inventory = in_creative_inventory,
|
not_in_creative_inventory = in_creative_inventory and 1 or 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
for group, value in pairs(node_def.groups) do
|
for group, value in pairs(node_def.groups) do
|
||||||
@ -47,6 +58,13 @@ function api.register_single(node, shape, overrides)
|
|||||||
light_source = scale_light(node_def.light_source, shape_def),
|
light_source = scale_light(node_def.light_source, shape_def),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local tiles = node_def.tiles
|
||||||
|
if #tiles > 1 and (node_def.drawtype or ""):match("glass") then
|
||||||
|
def.tiles = {tiles[1]}
|
||||||
|
else
|
||||||
|
def.tiles = tiles
|
||||||
|
end
|
||||||
|
|
||||||
if node_def.short_description then
|
if node_def.short_description then
|
||||||
def.short_description = S(shape_def.description, node_def.short_description)
|
def.short_description = S(shape_def.description, node_def.short_description)
|
||||||
end
|
end
|
||||||
@ -62,39 +80,72 @@ function api.register_single(node, shape, overrides)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
for k, v in pairs(overrides or {}) do
|
table_set_all(def, overrides or {})
|
||||||
def[k] = v
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_node((":%s:%s"):format(mod, shape_def.name_format:format(name)), def)
|
local shaped_name = api.format_name(shape, node)
|
||||||
|
minetest.register_node(":" .. shaped_name, def)
|
||||||
|
|
||||||
if shape_def.aliases then
|
if shape_def.aliases then
|
||||||
|
local mod, name = node:match("^([^:]+):(.*)$")
|
||||||
for _, alias in ipairs(shape_def.aliases) do
|
for _, alias in ipairs(shape_def.aliases) do
|
||||||
minetest.register_alias(
|
minetest.register_alias(
|
||||||
("%s:%s"):format(mod, alias:format(name)),
|
("%s:%s"):format(mod, alias:format(name)),
|
||||||
("%s:%s"):format(mod, shape_def.name_format:format(name))
|
shaped_name
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local nodes = api.nodes_by_shape[shape] or {}
|
||||||
|
nodes[node] = true
|
||||||
|
api.nodes_by_shape[shape] = nodes
|
||||||
|
|
||||||
|
local shapes = api.shapes_by_node[node] or {}
|
||||||
|
shapes[shape] = true
|
||||||
|
api.shapes_by_node[node] = shapes
|
||||||
end
|
end
|
||||||
|
|
||||||
function api.register_all(node, overrides)
|
function api.register_all(node, overrides)
|
||||||
for shape in pairs(api.registered_shapes) do
|
for shape in pairs(api.registered_shapes) do
|
||||||
api.register_single(node, shape, overrides)
|
api.register_single(node, shape, overrides)
|
||||||
end
|
end
|
||||||
api.register_schema_crafts_for_node(node)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function api.register_custom(node, list, overrides)
|
function api.register_custom(node, list, overrides)
|
||||||
for _, shape in ipairs(list) do
|
for _, shape in ipairs(list) do
|
||||||
api.register_single(node, shape, overrides)
|
api.register_single(node, shape, overrides)
|
||||||
end
|
end
|
||||||
api.register_schema_crafts_for_node(node)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function api.register_group(node, group, overrides)
|
function api.register_group(node, group, overrides)
|
||||||
for _, shape in ipairs(api.shapes_by_group[group] or {}) do
|
for _, shape in ipairs(api.shapes_by_group[group] or {}) do
|
||||||
api.register_single(node, shape, overrides)
|
api.register_single(node, shape, overrides)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function api.get_shapes(node)
|
||||||
|
return table_sort_keys(api.shapes_by_node[node])
|
||||||
|
end
|
||||||
|
|
||||||
|
function api.get_shapes_hash(node)
|
||||||
|
return api.shapes_by_node[node]
|
||||||
|
end
|
||||||
|
|
||||||
|
function api.get_shaped_name(node, shape_or_item)
|
||||||
|
local t = ItemStack(shape_or_item):to_table()
|
||||||
|
|
||||||
|
if api.registered_shapes[t.name] then
|
||||||
|
t.name = api.format_name(t.name, node)
|
||||||
|
|
||||||
|
elseif t.name == "node" then
|
||||||
|
t.name = node
|
||||||
|
end
|
||||||
|
|
||||||
|
return ItemStack(t):to_string()
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_mods_loaded(function()
|
||||||
|
stairsplus.log("info", "registering schema crafts")
|
||||||
|
for node in pairs(api.shapes_by_node) do
|
||||||
api.register_schema_crafts_for_node(node)
|
api.register_schema_crafts_for_node(node)
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
api.register_craft_schema({
|
api.register_craft_schema({
|
||||||
output = "panel_8 6",
|
output = "panel_8 6",
|
||||||
input = {{"node", "node", "node"}},
|
recipe = {{"node", "node", "node"}},
|
||||||
})
|
})
|
||||||
|
|
||||||
api.register_craft_schema({
|
api.register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "micro_8 7",
|
output = "micro_8 7",
|
||||||
input = {"stair_inner"},
|
recipe = {"stair_inner"},
|
||||||
})
|
})
|
||||||
|
|
||||||
api.register_schema_crafts_for_node("default:coalblock")
|
api.register_schema_crafts_for_node("default:coalblock")
|
||||||
@ -31,18 +31,11 @@ api.register_crafts_for_shapes({
|
|||||||
|
|
||||||
]]
|
]]
|
||||||
local api = stairsplus.api
|
local api = stairsplus.api
|
||||||
error("TODO: ugh, forgot to handle when output has > 1 item")
|
|
||||||
|
|
||||||
local function is_valid_shape(item)
|
local function is_valid_item(item, shapes)
|
||||||
return api.registered_shapes[item]
|
local item_name = ItemStack(item):get_name()
|
||||||
end
|
|
||||||
|
|
||||||
local function is_normal_item(item)
|
return shapes[item_name] or item_name == "" or item_name:match(":")
|
||||||
return item == "" or item:match(":")
|
|
||||||
end
|
|
||||||
|
|
||||||
local function is_valid_item(item)
|
|
||||||
return is_valid_shape(item) or is_normal_item(item)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function verify_schema(schema)
|
local function verify_schema(schema)
|
||||||
@ -52,14 +45,14 @@ local function verify_schema(schema)
|
|||||||
table.insert(problems, ("unimplemented schema type %q"):format(schema.type))
|
table.insert(problems, ("unimplemented schema type %q"):format(schema.type))
|
||||||
end
|
end
|
||||||
|
|
||||||
if not is_valid_item(schema.output) then
|
if not is_valid_item(schema.output, api.registered_shapes) then
|
||||||
table.insert(problems, ("don't know how to handle output %q"):format(schema.output))
|
table.insert(problems, ("don't know how to handle output %q"):format(schema.output))
|
||||||
end
|
end
|
||||||
|
|
||||||
if schema.replacements then
|
if schema.replacements then
|
||||||
for _, replacement in ipairs(schema.replacements) do
|
for _, replacement in ipairs(schema.replacements) do
|
||||||
for _, item in ipairs(replacement) do
|
for _, item in ipairs(replacement) do
|
||||||
if not is_valid_item(schema.output) then
|
if not is_valid_item(schema.output, api.registered_shapes) then
|
||||||
table.insert(problems, ("don't know how to handle replacement item %q"):format(item))
|
table.insert(problems, ("don't know how to handle replacement item %q"):format(item))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -67,16 +60,16 @@ local function verify_schema(schema)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if schema.type == "shapeless" then
|
if schema.type == "shapeless" then
|
||||||
for _, item in ipairs(schema.input) do
|
for _, item in ipairs(schema.recipe) do
|
||||||
if not is_valid_item(schema.output) then
|
if not is_valid_item(schema.output, api.registered_shapes) then
|
||||||
table.insert(problems, ("don't know how to handle craft item %q"):format(item))
|
table.insert(problems, ("don't know how to handle craft item %q"):format(item))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
for _, row in ipairs(schema.input) do
|
for _, row in ipairs(schema.recipe) do
|
||||||
for _, item in ipairs(row) do
|
for _, item in ipairs(row) do
|
||||||
if not is_valid_item(schema.output) then
|
if not is_valid_item(schema.output, api.registered_shapes) then
|
||||||
table.insert(problems, ("don't know how to handle craft item %q"):format(item))
|
table.insert(problems, ("don't know how to handle craft item %q"):format(item))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -91,6 +84,7 @@ end
|
|||||||
api.registered_recipe_schemas = {}
|
api.registered_recipe_schemas = {}
|
||||||
function api.register_craft_schema(schema)
|
function api.register_craft_schema(schema)
|
||||||
local problems = verify_schema(schema)
|
local problems = verify_schema(schema)
|
||||||
|
|
||||||
if problems then
|
if problems then
|
||||||
error(problems)
|
error(problems)
|
||||||
end
|
end
|
||||||
@ -98,19 +92,15 @@ function api.register_craft_schema(schema)
|
|||||||
table.insert(api.registered_recipe_schemas, schema)
|
table.insert(api.registered_recipe_schemas, schema)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function has_the_right_shape(item, shapes)
|
|
||||||
return shapes[item] or item == "" or item:match(":")
|
|
||||||
end
|
|
||||||
|
|
||||||
local function has_the_right_shapes(schema, shapes)
|
local function has_the_right_shapes(schema, shapes)
|
||||||
if not has_the_right_shape(schema.output, shapes) then
|
if not is_valid_item(schema.output, shapes) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
if schema.replacements then
|
if schema.replacements then
|
||||||
for _, replacement in ipairs(schema.replacements) do
|
for _, replacement in ipairs(schema.replacements) do
|
||||||
for _, item in ipairs(replacement) do
|
for _, item in ipairs(replacement) do
|
||||||
if not has_the_right_shape(item, shapes) then
|
if not is_valid_item(item, shapes) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -118,16 +108,16 @@ local function has_the_right_shapes(schema, shapes)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if schema.type == "shapeless" then
|
if schema.type == "shapeless" then
|
||||||
for _, item in ipairs(schema.input) do
|
for _, item in ipairs(schema.recipe) do
|
||||||
if not has_the_right_shape(item, shapes) then
|
if not is_valid_item(item, shapes) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif schema.type == "shaped" or schema.type == nil then
|
elseif schema.type == "shaped" or schema.type == nil then
|
||||||
for _, row in ipairs(schema.input) do
|
for _, row in ipairs(schema.recipe) do
|
||||||
for _, item in ipairs(row) do
|
for _, item in ipairs(row) do
|
||||||
if not has_the_right_shape(item, shapes) then
|
if not is_valid_item(item, shapes) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -155,14 +145,14 @@ local function register_for_schema(node, shapes, schema)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if recipe.type == "shapeless" then
|
if recipe.type == "shapeless" then
|
||||||
for i, item in ipairs(recipe.input) do
|
for i, item in ipairs(recipe.recipe) do
|
||||||
if shapes[item] then
|
if shapes[item] then
|
||||||
recipe.input[i] = api.get_shaped_name(node, item)
|
recipe.recipe[i] = api.get_shaped_name(node, item)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif recipe.type == "shaped" or recipe.type == nil then
|
elseif recipe.type == "shaped" or recipe.type == nil then
|
||||||
for _, row in ipairs(schema.input) do
|
for _, row in ipairs(schema.recipe) do
|
||||||
for i, item in ipairs(row) do
|
for i, item in ipairs(row) do
|
||||||
if shapes[item] then
|
if shapes[item] then
|
||||||
row[i] = api.get_shaped_name(node, item)
|
row[i] = api.get_shaped_name(node, item)
|
||||||
|
@ -1,14 +1,28 @@
|
|||||||
-- register shapes (e.g. 1/16 slab, 1/8 slab, 1/4 slab, etc)
|
-- register shapes (e.g. 1/16 slab, 1/8 slab, 1/4 slab, etc)
|
||||||
|
--[[
|
||||||
|
stairsplus.api.register_shape("micro_1", {
|
||||||
|
name_format = "micro_%s_1",
|
||||||
|
description = "@1 1/16 Microblock",
|
||||||
|
shape_groups = {micro = 1},
|
||||||
|
eighths = 1,
|
||||||
|
drawtype = "nodebox",
|
||||||
|
node_box = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.5, -0.5, 0, 0, -0.4375, 0.5},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
]]
|
||||||
|
local api = stairsplus.api
|
||||||
|
|
||||||
stairsplus.api.registered_shapes = {}
|
api.registered_shapes = {}
|
||||||
stairsplus.api.shapes_by_group = {}
|
api.shapes_by_group = {}
|
||||||
|
|
||||||
function stairsplus.api.register_shape(name , def)
|
function api.register_shape(name, def)
|
||||||
stairsplus.api.registered_shapes[name] = def
|
api.registered_shapes[name] = def
|
||||||
|
|
||||||
for group in pairs(def.shape_groups or {}) do
|
for group in pairs(def.shape_groups or {}) do
|
||||||
local shapes = stairsplus.api.shapes_by_group[group] or {}
|
local shapes = api.shapes_by_group[group] or {}
|
||||||
table.insert(shapes, name)
|
table.insert(shapes, name)
|
||||||
stairsplus.api.shapes_by_group[group] = shapes
|
api.shapes_by_group[group] = shapes
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
local api = stairsplus.api
|
local api = stairsplus.api
|
||||||
|
|
||||||
|
local S = stairsplus.S
|
||||||
|
|
||||||
function api.register_station(name, shape_groups, def)
|
function api.register_station(name, shape_groups, def)
|
||||||
minetest.register_node(name, def)
|
minetest.register_node(name, def)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local F = minetest.formspec_escape
|
local F = minetest.formspec_escape
|
||||||
|
|
||||||
local circular_saw = {}
|
local circular_saw = {}
|
||||||
@ -171,7 +171,7 @@ end
|
|||||||
function circular_saw.on_construct(pos)
|
function circular_saw.on_construct(pos)
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
local fancy_inv = ""
|
local fancy_inv = ""
|
||||||
if has_default_mod then
|
if stairsplus.has.default then
|
||||||
-- prepend background and slot styles from default if available
|
-- prepend background and slot styles from default if available
|
||||||
fancy_inv = default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
fancy_inv = default.gui_bg .. default.gui_bg_img .. default.gui_slots
|
||||||
end
|
end
|
||||||
|
@ -31,19 +31,19 @@ api.register_station("stairsplus:circular_saw", {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
tiles = {
|
tiles = {
|
||||||
"moreblocks_circular_saw_top.png",
|
"stairsplus_circular_saw_top.png",
|
||||||
"moreblocks_circular_saw_bottom.png",
|
"stairsplus_circular_saw_bottom.png",
|
||||||
"moreblocks_circular_saw_side.png"
|
"stairsplus_circular_saw_side.png"
|
||||||
},
|
},
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
paramtype2 = "facedir",
|
paramtype2 = "facedir",
|
||||||
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
groups = {choppy = 2, oddly_breakable_by_hand = 2},
|
||||||
sounds = moreblocks.resources.sounds.wood,
|
sounds = stairsplus.resources.sounds.wood,
|
||||||
})
|
})
|
||||||
|
|
||||||
if cm.steel_ingot then
|
if cm.steel_ingot then
|
||||||
if moreblocks.settings.circular_saw_crafting then
|
if stairsplus.settings.circular_saw_crafting then
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
output = "stairsplus:circular_saw",
|
output = "stairsplus:circular_saw",
|
||||||
recipe = {
|
recipe = {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
stairsplus.dofile("compat", "stairs")
|
stairsplus.dofile("compat", "stairs")
|
||||||
stairsplus.dofile("compat", "legacy")
|
stairsplus.dofile("compat", "legacy")
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ More Blocks: registrations
|
|||||||
Copyright © 2011-2020 Hugo Locurcio and contributors.
|
Copyright © 2011-2020 Hugo Locurcio and contributors.
|
||||||
Licensed under the zlib license. See LICENSE.md for more information.
|
Licensed under the zlib license. See LICENSE.md for more information.
|
||||||
--]]
|
--]]
|
||||||
local S = moreblocks.S
|
local S = stairsplus.S
|
||||||
-- default registrations
|
-- default registrations
|
||||||
if minetest.get_modpath("default") then
|
if minetest.get_modpath("default") then
|
||||||
local default_nodes = { -- Default stairs/slabs/panels/microblocks:
|
local default_nodes = { -- Default stairs/slabs/panels/microblocks:
|
||||||
@ -120,7 +120,7 @@ if minetest.get_modpath("basic_materials") then
|
|||||||
description = S("Concrete"),
|
description = S("Concrete"),
|
||||||
tiles = {"basic_materials_concrete_block.png", },
|
tiles = {"basic_materials_concrete_block.png", },
|
||||||
groups = {cracky = 1, level = 2, concrete = 1},
|
groups = {cracky = 1, level = 2, concrete = 1},
|
||||||
sounds = moreblocks.node_sound_stone_defaults(),
|
sounds = stairsplus.node_sound_stone_defaults(),
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_alias("prefab:concrete_stair", "technic:stair_concrete")
|
minetest.register_alias("prefab:concrete_stair", "technic:stair_concrete")
|
||||||
@ -130,7 +130,7 @@ if minetest.get_modpath("basic_materials") then
|
|||||||
description = S("Cement"),
|
description = S("Cement"),
|
||||||
tiles = {"basic_materials_cement_block.png"},
|
tiles = {"basic_materials_cement_block.png"},
|
||||||
groups = {cracky = 2, not_in_creative_inventory = 1},
|
groups = {cracky = 2, not_in_creative_inventory = 1},
|
||||||
sounds = moreblocks.node_sound_stone_defaults(),
|
sounds = stairsplus.node_sound_stone_defaults(),
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
local register_craft_schema = stairsplus.api.register_craft_schema
|
local register_craft_schema = stairsplus.api.register_craft_schema
|
||||||
|
|
||||||
|
-- micros
|
||||||
|
|
||||||
|
---- micro_8
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "micro_8 7",
|
output = "micro_8 7",
|
||||||
@ -42,11 +46,9 @@ register_craft_schema({
|
|||||||
recipe = {"panel_8"},
|
recipe = {"panel_8"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
-- panels
|
||||||
type = "shapeless",
|
|
||||||
output = "node",
|
---- panel_8
|
||||||
recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
|
|
||||||
})
|
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
output = "panel_8 12",
|
output = "panel_8 12",
|
||||||
@ -70,11 +72,7 @@ register_craft_schema({
|
|||||||
recipe = {"micro_8", "micro_8"},
|
recipe = {"micro_8", "micro_8"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
-- slabs
|
||||||
type = "shapeless",
|
|
||||||
output = "node",
|
|
||||||
recipe = {"panel_8", "panel_8", "panel_8", "panel_8"},
|
|
||||||
})
|
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
output = "slab_8 6",
|
output = "slab_8 6",
|
||||||
@ -99,13 +97,6 @@ register_craft_schema({
|
|||||||
{"panel_8"},
|
{"panel_8"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "node",
|
|
||||||
recipe = {"slab_8", "slab_8"},
|
|
||||||
})
|
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "slab_8 3",
|
output = "slab_8 3",
|
||||||
@ -148,18 +139,6 @@ register_craft_schema({
|
|||||||
recipe = {"slope_outer_cut_half", "slope_inner_cut_half"},
|
recipe = {"slope_outer_cut_half", "slope_inner_cut_half"},
|
||||||
})
|
})
|
||||||
|
|
||||||
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_12", "slab_4"},
|
|
||||||
})
|
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "slab_4",
|
output = "slab_4",
|
||||||
@ -190,18 +169,6 @@ register_craft_schema({
|
|||||||
recipe = {"slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2"},
|
recipe = {"slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "node",
|
|
||||||
recipe = {"slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2"},
|
|
||||||
})
|
|
||||||
|
|
||||||
register_craft_schema({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "node",
|
|
||||||
recipe = {"slab_14", "slab_2"},
|
|
||||||
})
|
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "slab_2 2",
|
output = "slab_2 2",
|
||||||
@ -220,63 +187,14 @@ register_craft_schema({
|
|||||||
recipe = {"slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2"},
|
recipe = {"slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2", "slab_2"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
|
||||||
type = "shapeless",
|
|
||||||
output = "node",
|
|
||||||
recipe = {"slab_15", "slab_1"},
|
|
||||||
})
|
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "slab_15",
|
output = "slab_15",
|
||||||
recipe = {"slab_14", "slab_1"},
|
recipe = {"slab_14", "slab_1"},
|
||||||
})
|
})
|
||||||
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({
|
-- slopes
|
||||||
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"},
|
|
||||||
})
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "slope_half_raised",
|
output = "slope_half_raised",
|
||||||
@ -288,21 +206,27 @@ register_craft_schema({
|
|||||||
output = "slope_half_raised",
|
output = "slope_half_raised",
|
||||||
recipe = {"slab_8", "slope_half"},
|
recipe = {"slab_8", "slope_half"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "slope_inner_half_raised",
|
output = "slope_inner_half_raised",
|
||||||
recipe = {"slab_8", "slope_inner_half"},
|
recipe = {"slab_8", "slope_inner_half"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "slope_outer_half_raised",
|
output = "slope_outer_half_raised",
|
||||||
recipe = {"slab_8", "slope_outer_half"},
|
recipe = {"slab_8", "slope_outer_half"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "slope_inner_cut_half_raised",
|
output = "slope_inner_cut_half_raised",
|
||||||
recipe = {"slab_8", "slope_inner_cut_half"},
|
recipe = {"slab_8", "slope_inner_cut_half"},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- stairs
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
output = "stair 8",
|
output = "stair 8",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -344,11 +268,13 @@ register_craft_schema({
|
|||||||
output = "stair",
|
output = "stair",
|
||||||
recipe = {"panel_8", "panel_8", "panel_8"},
|
recipe = {"panel_8", "panel_8", "panel_8"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "stair_inner",
|
output = "stair_inner",
|
||||||
recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
|
recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "stair_outer",
|
output = "stair_outer",
|
||||||
@ -360,6 +286,7 @@ register_craft_schema({
|
|||||||
output = "stair_outer",
|
output = "stair_outer",
|
||||||
recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
|
recipe = {"micro_8", "micro_8", "micro_8", "micro_8", "micro_8"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "stair_half",
|
output = "stair_half",
|
||||||
@ -371,11 +298,13 @@ register_craft_schema({
|
|||||||
output = "stair_half",
|
output = "stair_half",
|
||||||
recipe = {"panel_8", "micro_8"},
|
recipe = {"panel_8", "micro_8"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({
|
register_craft_schema({
|
||||||
type = "shapeless",
|
type = "shapeless",
|
||||||
output = "stair_right_half",
|
output = "stair_right_half",
|
||||||
recipe = {"stair_half"},
|
recipe = {"stair_half"},
|
||||||
})
|
})
|
||||||
|
|
||||||
register_craft_schema({ -- See mirrored variation of the recipe below.
|
register_craft_schema({ -- See mirrored variation of the recipe below.
|
||||||
output = "stair_alt_8",
|
output = "stair_alt_8",
|
||||||
recipe = {
|
recipe = {
|
||||||
@ -391,3 +320,106 @@ register_craft_schema({ -- Mirrored variation of the recipe above.
|
|||||||
{"panel_8", ""},
|
{"panel_8", ""},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- 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_8", "slab_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_12", "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"},
|
||||||
|
})
|
||||||
|
|
||||||
|
register_craft_schema({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "node",
|
||||||
|
recipe = {"slab_14", "slab_2"},
|
||||||
|
})
|
||||||
|
|
||||||
|
register_craft_schema({
|
||||||
|
type = "shapeless",
|
||||||
|
output = "node",
|
||||||
|
recipe = {"slab_15", "slab_1"},
|
||||||
|
})
|
||||||
|
|
||||||
|
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"},
|
||||||
|
})
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
|
local s = minetest.settings
|
||||||
|
|
||||||
stairsplus.settings = {
|
stairsplus.settings = {
|
||||||
in_creative_inventory = minetest.settings:get_bool("stairsplus.in_creative_inventory", false),
|
in_creative_inventory = s:get_bool("stairsplus.in_creative_inventory",
|
||||||
circular_saw_crafting = minetest.settings:get_bool("stairsplus.circular_saw_crafting", true),
|
s:get_bool("stairsplus_in_creative_inventory", false) -- turn to false because we will do nicer things
|
||||||
expect_infinite_stacks = minetest.settings:get_bool("stairsplus.expect_infinite_stacks",
|
),
|
||||||
minetest.settings:get_bool("creative_mode", false)
|
circular_saw_crafting = s:get_bool("stairsplus.circular_saw_crafting", true),
|
||||||
|
ex_nihilo = s:get_bool("stairsplus.ex_nihilo",
|
||||||
|
s:get_bool("creative_mode", false)
|
||||||
),
|
),
|
||||||
|
|
||||||
legacy_mode = minetest.settings:get_bool("stairsplus.legacy_mode", true),
|
legacy_mode = s:get_bool("stairsplus.legacy_mode", true),
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
stairsplus.api.register_shape("micro_1", {
|
stairsplus.api.register_shape("micro_1", {
|
||||||
name_format = "micro_%s_1",
|
name_format = "micro_%s_1",
|
||||||
description = "@1 1/16 Microblock",
|
description = "@1 1/16 Microblock",
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
stairsplus.api.register_shape("panel_1", {
|
stairsplus.api.register_shape("panel_1", {
|
||||||
name_format = "panel_%s_1",
|
name_format = "panel_%s_1",
|
||||||
description = "@1 1/16 Panel",
|
description = "@1 1/16 Panel",
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
stairsplus.api.register_shape("slab_1", {
|
stairsplus.api.register_shape("slab_1", {
|
||||||
name_format = "slab_%s_1",
|
name_format = "slab_%s_1",
|
||||||
description = "@1 1/16 Slab",
|
description = "@1 1/16 Slab",
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
local box_slope = {
|
local box_slope = {
|
||||||
type = "fixed",
|
type = "fixed",
|
||||||
fixed = {
|
fixed = {
|
||||||
@ -12,10 +11,10 @@ local box_slope = {
|
|||||||
stairsplus.api.register_shape("slope", {
|
stairsplus.api.register_shape("slope", {
|
||||||
name_format = "slope_%s",
|
name_format = "slope_%s",
|
||||||
description = "@1 Slope",
|
description = "@1 Slope",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 4,
|
eighths = 4,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope.obj",
|
mesh = "stairsplus_slope.obj",
|
||||||
collision_box = box_slope,
|
collision_box = box_slope,
|
||||||
selection_box = box_slope,
|
selection_box = box_slope,
|
||||||
})
|
})
|
||||||
@ -33,10 +32,10 @@ local box_slope_half = {
|
|||||||
stairsplus.api.register_shape("slope_half", {
|
stairsplus.api.register_shape("slope_half", {
|
||||||
name_format = "slope_%s_half",
|
name_format = "slope_%s_half",
|
||||||
description = "@1 1/2 Slope",
|
description = "@1 1/2 Slope",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 2,
|
eighths = 2,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_half.obj",
|
mesh = "stairsplus_slope_half.obj",
|
||||||
collision_box = box_slope_half,
|
collision_box = box_slope_half,
|
||||||
selection_box = box_slope_half,
|
selection_box = box_slope_half,
|
||||||
})
|
})
|
||||||
@ -54,10 +53,10 @@ local box_slope_half_raised = {
|
|||||||
stairsplus.api.register_shape("slope_half_raised", {
|
stairsplus.api.register_shape("slope_half_raised", {
|
||||||
name_format = "slope_%s_half_raised",
|
name_format = "slope_%s_half_raised",
|
||||||
description = "@1 1/2 Slope Raised",
|
description = "@1 1/2 Slope Raised",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 6,
|
eighths = 6,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_half_raised.obj",
|
mesh = "stairsplus_slope_half_raised.obj",
|
||||||
collision_box = box_slope_half_raised,
|
collision_box = box_slope_half_raised,
|
||||||
selection_box = box_slope_half_raised,
|
selection_box = box_slope_half_raised,
|
||||||
})
|
})
|
||||||
@ -78,10 +77,10 @@ local box_slope_inner = {
|
|||||||
stairsplus.api.register_shape("slope_inner", {
|
stairsplus.api.register_shape("slope_inner", {
|
||||||
name_format = "slope_%s_inner",
|
name_format = "slope_%s_inner",
|
||||||
description = "@1 Slope Inner",
|
description = "@1 Slope Inner",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 6,
|
eighths = 6,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_inner.obj",
|
mesh = "stairsplus_slope_inner.obj",
|
||||||
collision_box = box_slope_inner,
|
collision_box = box_slope_inner,
|
||||||
selection_box = box_slope_inner,
|
selection_box = box_slope_inner,
|
||||||
})
|
})
|
||||||
@ -89,10 +88,10 @@ stairsplus.api.register_shape("slope_inner", {
|
|||||||
stairsplus.api.register_shape("slope_inner_cut", {
|
stairsplus.api.register_shape("slope_inner_cut", {
|
||||||
name_format = "slope_%s_inner_cut",
|
name_format = "slope_%s_inner_cut",
|
||||||
description = "@1 Slope Inner Cut",
|
description = "@1 Slope Inner Cut",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 6,
|
eighths = 6,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_inner_cut.obj",
|
mesh = "stairsplus_slope_inner_cut.obj",
|
||||||
collision_box = box_slope_inner,
|
collision_box = box_slope_inner,
|
||||||
selection_box = box_slope_inner,
|
selection_box = box_slope_inner,
|
||||||
})
|
})
|
||||||
@ -113,10 +112,10 @@ local box_slope_inner_half = {
|
|||||||
stairsplus.api.register_shape("slope_inner_half", {
|
stairsplus.api.register_shape("slope_inner_half", {
|
||||||
name_format = "slope_%s_inner_half",
|
name_format = "slope_%s_inner_half",
|
||||||
description = "@1 Slope Inner Half",
|
description = "@1 Slope Inner Half",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 3,
|
eighths = 3,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_inner_half.obj",
|
mesh = "stairsplus_slope_inner_half.obj",
|
||||||
collision_box = box_slope_inner_half,
|
collision_box = box_slope_inner_half,
|
||||||
selection_box = box_slope_inner_half,
|
selection_box = box_slope_inner_half,
|
||||||
})
|
})
|
||||||
@ -124,10 +123,10 @@ stairsplus.api.register_shape("slope_inner_half", {
|
|||||||
stairsplus.api.register_shape("slope_inner_cut_half", {
|
stairsplus.api.register_shape("slope_inner_cut_half", {
|
||||||
name_format = "slope_%s_inner_cut_half",
|
name_format = "slope_%s_inner_cut_half",
|
||||||
description = "@1 Slope Inner Cut Half",
|
description = "@1 Slope Inner Cut Half",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 4,
|
eighths = 4,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_inner_cut_half.obj",
|
mesh = "stairsplus_slope_inner_cut_half.obj",
|
||||||
collision_box = box_slope_inner_half,
|
collision_box = box_slope_inner_half,
|
||||||
selection_box = box_slope_inner_half,
|
selection_box = box_slope_inner_half,
|
||||||
})
|
})
|
||||||
@ -148,10 +147,10 @@ local box_slope_inner_half_raised = {
|
|||||||
stairsplus.api.register_shape("slope_inner_half_raised", {
|
stairsplus.api.register_shape("slope_inner_half_raised", {
|
||||||
name_format = "slope_%s_inner_half_raised",
|
name_format = "slope_%s_inner_half_raised",
|
||||||
description = "@1 Slope Inner Half Raised",
|
description = "@1 Slope Inner Half Raised",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 6,
|
eighths = 6,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_inner_half_raised.obj",
|
mesh = "stairsplus_slope_inner_half_raised.obj",
|
||||||
collision_box = box_slope_inner_half_raised,
|
collision_box = box_slope_inner_half_raised,
|
||||||
selection_box = box_slope_inner_half_raised,
|
selection_box = box_slope_inner_half_raised,
|
||||||
})
|
})
|
||||||
@ -159,10 +158,10 @@ stairsplus.api.register_shape("slope_inner_half_raised", {
|
|||||||
stairsplus.api.register_shape("slope_inner_cut_half_raised", {
|
stairsplus.api.register_shape("slope_inner_cut_half_raised", {
|
||||||
name_format = "slope_%s_inner_cut_half_raised",
|
name_format = "slope_%s_inner_cut_half_raised",
|
||||||
description = "@1 Slope Inner Cut Half Raised",
|
description = "@1 Slope Inner Cut Half Raised",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 7,
|
eighths = 7,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_inner_cut_half_raised.obj",
|
mesh = "stairsplus_slope_inner_cut_half_raised.obj",
|
||||||
collision_box = box_slope_inner_half_raised,
|
collision_box = box_slope_inner_half_raised,
|
||||||
selection_box = box_slope_inner_half_raised,
|
selection_box = box_slope_inner_half_raised,
|
||||||
})
|
})
|
||||||
@ -182,10 +181,10 @@ local box_slope_outer = {
|
|||||||
stairsplus.api.register_shape("slope_outer", {
|
stairsplus.api.register_shape("slope_outer", {
|
||||||
name_format = "slope_%s_outer",
|
name_format = "slope_%s_outer",
|
||||||
description = "@1 Slope Outer",
|
description = "@1 Slope Outer",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 3,
|
eighths = 3,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_outer.obj",
|
mesh = "stairsplus_slope_outer.obj",
|
||||||
collision_box = box_slope_outer,
|
collision_box = box_slope_outer,
|
||||||
selection_box = box_slope_outer,
|
selection_box = box_slope_outer,
|
||||||
})
|
})
|
||||||
@ -193,10 +192,10 @@ stairsplus.api.register_shape("slope_outer", {
|
|||||||
stairsplus.api.register_shape("slope_outer_cut", {
|
stairsplus.api.register_shape("slope_outer_cut", {
|
||||||
name_format = "slope_%s_outer_cut",
|
name_format = "slope_%s_outer_cut",
|
||||||
description = "@1 Slope Outer Cut",
|
description = "@1 Slope Outer Cut",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 2,
|
eighths = 2,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_outer_cut.obj",
|
mesh = "stairsplus_slope_outer_cut.obj",
|
||||||
collision_box = box_slope_outer,
|
collision_box = box_slope_outer,
|
||||||
selection_box = box_slope_outer,
|
selection_box = box_slope_outer,
|
||||||
})
|
})
|
||||||
@ -204,10 +203,10 @@ stairsplus.api.register_shape("slope_outer_cut", {
|
|||||||
stairsplus.api.register_shape("slope_cut", {
|
stairsplus.api.register_shape("slope_cut", {
|
||||||
name_format = "slope_%s_cut",
|
name_format = "slope_%s_cut",
|
||||||
description = "@1 Slope Cut",
|
description = "@1 Slope Cut",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 4,
|
eighths = 4,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_cut.obj",
|
mesh = "stairsplus_slope_cut.obj",
|
||||||
collision_box = box_slope_outer,
|
collision_box = box_slope_outer,
|
||||||
selection_box = box_slope_outer,
|
selection_box = box_slope_outer,
|
||||||
})
|
})
|
||||||
@ -225,10 +224,10 @@ local box_slope_outer_half = {
|
|||||||
stairsplus.api.register_shape("slope_outer_half", {
|
stairsplus.api.register_shape("slope_outer_half", {
|
||||||
name_format = "slope_%s_outer_half",
|
name_format = "slope_%s_outer_half",
|
||||||
description = "@1 Slope Outer Half",
|
description = "@1 Slope Outer Half",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 2,
|
eighths = 2,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_outer_half.obj",
|
mesh = "stairsplus_slope_outer_half.obj",
|
||||||
collision_box = box_slope_outer_half,
|
collision_box = box_slope_outer_half,
|
||||||
selection_box = box_slope_outer_half,
|
selection_box = box_slope_outer_half,
|
||||||
})
|
})
|
||||||
@ -236,10 +235,10 @@ stairsplus.api.register_shape("slope_outer_half", {
|
|||||||
stairsplus.api.register_shape("slope_outer_cut_half", {
|
stairsplus.api.register_shape("slope_outer_cut_half", {
|
||||||
name_format = "slope_%s_outer_cut_half",
|
name_format = "slope_%s_outer_cut_half",
|
||||||
description = "@1 Slope Outer Cut Half",
|
description = "@1 Slope Outer Cut Half",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 1,
|
eighths = 1,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_outer_cut_half.obj",
|
mesh = "stairsplus_slope_outer_cut_half.obj",
|
||||||
collision_box = box_slope_outer_half,
|
collision_box = box_slope_outer_half,
|
||||||
selection_box = box_slope_outer_half,
|
selection_box = box_slope_outer_half,
|
||||||
})
|
})
|
||||||
@ -257,10 +256,10 @@ local box_slope_outer_half_raised = {
|
|||||||
stairsplus.api.register_shape("slope_outer_half_raised", {
|
stairsplus.api.register_shape("slope_outer_half_raised", {
|
||||||
name_format = "slope_%s_outer_half_raised",
|
name_format = "slope_%s_outer_half_raised",
|
||||||
description = "@1 Slope Outer Half Raised",
|
description = "@1 Slope Outer Half Raised",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 6,
|
eighths = 6,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_outer_half_raised.obj",
|
mesh = "stairsplus_slope_outer_half_raised.obj",
|
||||||
collision_box = box_slope_outer_half_raised,
|
collision_box = box_slope_outer_half_raised,
|
||||||
selection_box = box_slope_outer_half_raised,
|
selection_box = box_slope_outer_half_raised,
|
||||||
})
|
})
|
||||||
@ -268,10 +267,10 @@ stairsplus.api.register_shape("slope_outer_half_raised", {
|
|||||||
stairsplus.api.register_shape("slope_outer_cut_half_raised", {
|
stairsplus.api.register_shape("slope_outer_cut_half_raised", {
|
||||||
name_format = "slope_%s_outer_cut_half_raised",
|
name_format = "slope_%s_outer_cut_half_raised",
|
||||||
description = "@1 Slope Outer Cut Half Raised",
|
description = "@1 Slope Outer Cut Half Raised",
|
||||||
shape_groups = {slope = 1},
|
shape_groups = {slope = 1, common = 1},
|
||||||
eighths = 3,
|
eighths = 3,
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
mesh = "moreblocks_slope_outer_cut_half_raised.obj",
|
mesh = "stairsplus_slope_outer_cut_half_raised.obj",
|
||||||
collision_box = box_slope_outer_half_raised,
|
collision_box = box_slope_outer_half_raised,
|
||||||
selection_box = box_slope_outer_half_raised,
|
selection_box = box_slope_outer_half_raised,
|
||||||
})
|
})
|
||||||
|
@ -4,5 +4,22 @@ stairsplus.util = {
|
|||||||
t[key] = value
|
t[key] = value
|
||||||
end
|
end
|
||||||
return t
|
return t
|
||||||
|
end,
|
||||||
|
|
||||||
|
table_is_empty = function(t)
|
||||||
|
return not next(t)
|
||||||
|
end,
|
||||||
|
|
||||||
|
table_sort_keys = function(t, sort_function)
|
||||||
|
local sorted = {}
|
||||||
|
for key in pairs(t) do
|
||||||
|
table.insert(sorted, key)
|
||||||
|
end
|
||||||
|
if sort_function then
|
||||||
|
table.sort(sorted, sort_function)
|
||||||
|
else
|
||||||
|
table.sort(sorted)
|
||||||
|
end
|
||||||
|
return sorted
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user