more stuff for compatibility w/ weird old setups

This commit is contained in:
flux 2022-06-24 09:44:22 -07:00
parent 2774e54a70
commit 604697d554
4 changed files with 35 additions and 3 deletions

View File

@ -156,7 +156,9 @@ function api.register_single(node, shape, overrides, meta)
end
if not meta.allow_override_groups and overrides.groups then
stairsplus.log("warning", "removing group overrides from %s", shaped_name)
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)
)
overrides.groups = nil
end

View File

@ -6,7 +6,15 @@ stairsplus.compat = {
def.drawtype == "plantlike" or
def.drawtype == "nodebox"
)
end
end,
is_legacy_paramtype2 = function(node)
local def = minetest.registered_nodes[node]
return (
def.paramtype2 == "color" or
def.paramtype2 == "colorwallmounted" or
def.paramtype2 == "glasslikeliquidlevel"
)
end,
}
stairsplus.dofile("compat2", "stairs")

View File

@ -4,6 +4,8 @@
local api = stairsplus.api
local is_legacy_drawtype = stairsplus.compat.is_legacy_drawtype
local is_legacy_paramtype2 = stairsplus.compat.is_legacy_paramtype2
local legacy_mode = stairsplus.settings.legacy_mode
local function clean_legacy_fields(fields)
@ -51,11 +53,17 @@ local function clean_legacy_fields(fields)
end
local function register_group(modname, subname, recipeitem, fields, group)
if not minetest.registered_nodes[recipeitem] then
error(("cannot register stairs for %s before the node is defined"):format(recipeitem))
end
fields = clean_legacy_fields(fields)
local meta = {}
if is_legacy_drawtype(recipeitem) then
meta.ignore_drawtype = true
end
if is_legacy_paramtype2(recipeitem) then
meta.ignore_paramtype2 = true
end
api.register_group(recipeitem, group, fields, meta)

View File

@ -9,8 +9,10 @@ local api = stairsplus.api
local S = stairsplus.S
local default_align_style = stairsplus.settings.default_align_style
local is_legacy_drawtype = stairsplus.compat.is_legacy_drawtype
local is_legacy_paramtype2 = stairsplus.compat.is_legacy_paramtype2
local default_align_style = stairsplus.settings.default_align_style
function stairs.register_stair(subname, node, groups, tiles, description, sounds, worldaligntex)
local meta = {
@ -19,6 +21,9 @@ function stairs.register_stair(subname, node, groups, tiles, description, sounds
if is_legacy_drawtype(node) then
meta.ignore_drawtype = true
end
if is_legacy_paramtype2(node) then
meta.ignore_paramtype2 = true
end
api.register_single(node, "stair", {
groups = groups,
@ -37,6 +42,9 @@ function stairs.register_slab(subname, node, groups, images, description, sounds
if is_legacy_drawtype(node) then
meta.ignore_drawtype = true
end
if is_legacy_paramtype2(node) then
meta.ignore_paramtype2 = true
end
api.register_single(node, "slab_8", {
groups = groups,
@ -55,6 +63,9 @@ function stairs.register_stair_inner(subname, node, groups, tiles, description,
if is_legacy_drawtype(node) then
meta.ignore_drawtype = true
end
if is_legacy_paramtype2(node) then
meta.ignore_paramtype2 = true
end
api.register_single(node, "stair_inner", {
groups = groups,
@ -73,6 +84,9 @@ function stairs.register_stair_outer(subname, node, groups, tiles, description,
if is_legacy_drawtype(node) then
meta.ignore_drawtype = true
end
if is_legacy_paramtype2(node) then
meta.ignore_paramtype2 = true
end
api.register_single(node, "stair_outer", {
groups = groups,