mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2025-02-22 04:50:25 +01:00
fix a bunch of bugs. still need to do more work on the station/circular saw distinction
This commit is contained in:
parent
21d4fab1f5
commit
21f36e6c1c
13
TODO.md
13
TODO.md
@ -17,9 +17,14 @@ stairsplus/API.md
|
|||||||
|
|
||||||
### other things
|
### other things
|
||||||
|
|
||||||
* finish documentation
|
* finish updating documentation, for both users and API
|
||||||
* unified_inventory / sfinv / i3 support
|
* update translations (i18n, locale)
|
||||||
* finish legacy support
|
* unified_inventory / i3 support
|
||||||
* finish compatability support
|
* finish testing (and creating) legacy support
|
||||||
* create a way to analyze and reduce node_count
|
* create a way to analyze and reduce node_count
|
||||||
* ? create a way for admins to execute a command to create a config option to register a shaped node?
|
* ? create a way for admins to execute a command to create a config option to register a shaped node?
|
||||||
|
|
||||||
|
### future goals
|
||||||
|
|
||||||
|
* port other "microblocks" mods to use this framework, e.g. pkarcs and facade
|
||||||
|
* maybe integration w/ the technic cnc and such
|
||||||
|
@ -7,6 +7,15 @@ function api.register_alias_single(old_node, new_node, shape)
|
|||||||
local new_shaped_node = api.format_name(new_node, shape)
|
local new_shaped_node = api.format_name(new_node, shape)
|
||||||
|
|
||||||
minetest.register_alias(old_shaped_node, new_shaped_node)
|
minetest.register_alias(old_shaped_node, new_shaped_node)
|
||||||
|
|
||||||
|
local shape_def = api.registered_shapes[shape]
|
||||||
|
if shape_def.aliases then
|
||||||
|
local old_mod, old_name = old_node:match("^([^:]+):(.*)$")
|
||||||
|
for _, alias in ipairs(shape_def.aliases) do
|
||||||
|
old_shaped_node = ("%s:%s"):format(old_mod, alias:format(old_name))
|
||||||
|
minetest.register_alias(old_shaped_node, new_shaped_node)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function api.register_alias_all(old_node, new_node)
|
function api.register_alias_all(old_node, new_node)
|
||||||
@ -39,6 +48,15 @@ function api.register_alias_force_single(old_node, new_node, shape)
|
|||||||
|
|
||||||
minetest.register_alias_force(old_shaped_node, new_shaped_node)
|
minetest.register_alias_force(old_shaped_node, new_shaped_node)
|
||||||
|
|
||||||
|
local shape_def = api.registered_shapes[shape]
|
||||||
|
if shape_def.aliases then
|
||||||
|
local old_mod, old_name = old_node:match("^([^:]+):(.*)$")
|
||||||
|
for _, alias in ipairs(shape_def.aliases) do
|
||||||
|
old_shaped_node = ("%s:%s"):format(old_mod, alias:format(old_name))
|
||||||
|
minetest.register_alias_force(old_shaped_node, new_shaped_node)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local nodes = api.nodes_by_shape[shape] or {}
|
local nodes = api.nodes_by_shape[shape] or {}
|
||||||
if nodes[old_node] then
|
if nodes[old_node] then
|
||||||
nodes[old_node] = nil
|
nodes[old_node] = nil
|
||||||
|
@ -41,7 +41,7 @@ function api.build_groups(node, shape)
|
|||||||
|
|
||||||
local groups = {
|
local groups = {
|
||||||
[("shape_%s"):format(shape)] = 1,
|
[("shape_%s"):format(shape)] = 1,
|
||||||
not_in_creative_inventory = in_creative_inventory and 1,
|
not_in_creative_inventory = in_creative_inventory and 1 or nil,
|
||||||
}
|
}
|
||||||
|
|
||||||
local shape_def = api.registered_shapes[shape]
|
local shape_def = api.registered_shapes[shape]
|
||||||
|
@ -179,6 +179,11 @@ function api.register_single(node, shape, overrides, meta)
|
|||||||
|
|
||||||
-- register node
|
-- register node
|
||||||
local shaped_name = api.format_name(node, shape)
|
local shaped_name = api.format_name(node, shape)
|
||||||
|
for k, v in pairs(def.groups) do
|
||||||
|
if type(v) ~= "number" then
|
||||||
|
error(("%s %s group:%s = %s"):format(node, shape, k, v))
|
||||||
|
end
|
||||||
|
end
|
||||||
minetest.register_node(":" .. shaped_name, def)
|
minetest.register_node(":" .. shaped_name, def)
|
||||||
|
|
||||||
-- alias old name formats
|
-- alias old name formats
|
||||||
@ -228,7 +233,9 @@ function api.register_groups(node, groups, overrides, meta)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function api.get_shapes(node)
|
function api.get_shapes(node)
|
||||||
return table_sort_keys(api.shapes_by_node[node])
|
if api.shapes_by_node[node] then
|
||||||
|
return table_sort_keys(api.shapes_by_node[node])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- warning: don't mutate the return value
|
-- warning: don't mutate the return value
|
||||||
|
@ -62,7 +62,7 @@ local function verify_schema(schema)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function api.register_on_register_craft_schema(func)
|
function api.register_on_register_craft_schema(func)
|
||||||
table.insert(api.registered_on_register_craft_schema, func)
|
table.insert(api.registered_on_register_craft_schemas, func)
|
||||||
end
|
end
|
||||||
|
|
||||||
function api.register_craft_schema(schema)
|
function api.register_craft_schema(schema)
|
||||||
@ -157,7 +157,7 @@ function api.register_schema_crafts_for_node(node)
|
|||||||
local shapes = api.get_shapes_hash(node)
|
local shapes = api.get_shapes_hash(node)
|
||||||
for _, schema in ipairs(api.registered_recipe_schemas) do
|
for _, schema in ipairs(api.registered_recipe_schemas) do
|
||||||
if has_the_right_shapes(schema, shapes) then
|
if has_the_right_shapes(schema, shapes) then
|
||||||
stairsplus.log("debug", "using schema %q", minetest.serialize(schema):sub(#("return ")))
|
stairsplus.log("verbose", "using schema %s", minetest.serialize(schema):sub(#("return ")))
|
||||||
register_for_schema(node, schema)
|
register_for_schema(node, schema)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -195,7 +195,7 @@ function api.register_crafts_for_shapes(def)
|
|||||||
output = api.get_schema_recipe_item(def.output, shape),
|
output = api.get_schema_recipe_item(def.output, shape),
|
||||||
recipe = api.get_schema_recipe_item(def.recipe, shape),
|
recipe = api.get_schema_recipe_item(def.recipe, shape),
|
||||||
cooktime = def.cooktime(api.registered_shapes[shape].eighths),
|
cooktime = def.cooktime(api.registered_shapes[shape].eighths),
|
||||||
groups = (not recipes_in_creative_inventory) and {not_in_creative_inventory = 1}
|
groups = (not recipes_in_creative_inventory) and {not_in_creative_inventory = 1} or nil
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ function api.register_crafts_for_shapes(def)
|
|||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = api.get_schema_recipe_item(def.recipe, shape),
|
recipe = api.get_schema_recipe_item(def.recipe, shape),
|
||||||
burntime = def.burntime(api.registered_shapes[shape].eighths),
|
burntime = def.burntime(api.registered_shapes[shape].eighths),
|
||||||
groups = (not recipes_in_creative_inventory) and {not_in_creative_inventory = 1}
|
groups = (not recipes_in_creative_inventory) and {not_in_creative_inventory = 1} or nil
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
-- compatability stuff for after the API is created, but before we start using it
|
-- compatability stuff for after the API is created, but before we start using it
|
||||||
|
|
||||||
stairsplus.dofile("compat", "i3")
|
--stairsplus.dofile("compat1", "i3")
|
||||||
stairsplus.dofile("compat", "unified_inventory")
|
--stairsplus.dofile("compat1", "unified_inventory")
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ stairsplus.compat = {
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
stairsplus.dofile("compat", "stairs")
|
stairsplus.dofile("compat2", "stairs")
|
||||||
stairsplus.dofile("compat", "old_moreblocks")
|
stairsplus.dofile("compat2", "old_moreblocks")
|
||||||
|
|
||||||
-- stairsplus.dofile("compat", "inventory_managers")
|
-- stairsplus.dofile("compat", "inventory_managers")
|
||||||
-- unified_inventory, sfinv, i3
|
-- unified_inventory, sfinv, i3
|
||||||
|
@ -21,5 +21,20 @@ stairsplus.util = {
|
|||||||
table.sort(sorted)
|
table.sort(sorted)
|
||||||
end
|
end
|
||||||
return sorted
|
return sorted
|
||||||
|
end,
|
||||||
|
|
||||||
|
check_call = function(func)
|
||||||
|
-- wrap a function w/ logic to avoid crashing the game
|
||||||
|
local f = function(...)
|
||||||
|
local status, out = pcall(func, ...)
|
||||||
|
if status then
|
||||||
|
return out
|
||||||
|
else
|
||||||
|
local message = ("Error (func): %s %s"):format(out, dump({...}))
|
||||||
|
stairsplus.log("error", message)
|
||||||
|
error(message)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return f
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ stairsplus_legacy = {
|
|||||||
stairsplus_legacy.dofile("settings")
|
stairsplus_legacy.dofile("settings")
|
||||||
|
|
||||||
function stairsplus_legacy.register_legacy(node, overrides, meta)
|
function stairsplus_legacy.register_legacy(node, overrides, meta)
|
||||||
if stairsplus_legacy.settings.stairsplus_legacy_mode then
|
if stairsplus.settings.legacy_mode then
|
||||||
stairsplus.api.register_group(node, "legacy", overrides, meta)
|
stairsplus.api.register_group(node, "legacy", overrides, meta)
|
||||||
else
|
else
|
||||||
stairsplus.api.register_group(node, "common", overrides, meta)
|
stairsplus.api.register_group(node, "common", overrides, meta)
|
||||||
|
@ -8,6 +8,4 @@ stairsplus_legacy.settings = {
|
|||||||
technic = s:get_bool("stairsplus_legacy.technic", true),
|
technic = s:get_bool("stairsplus_legacy.technic", true),
|
||||||
prefab = s:get_bool("stairsplus_legacy.prefab", true),
|
prefab = s:get_bool("stairsplus_legacy.prefab", true),
|
||||||
wool = s:get_bool("stairsplus_legacy.wool", true),
|
wool = s:get_bool("stairsplus_legacy.wool", true),
|
||||||
|
|
||||||
stairsplus_legacy_mode = s:get_bool("stairsplus.legacy_mode")
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user