compatability and legacy mostly done. schema recipes are all messed up for some reason.

This commit is contained in:
flux
2022-06-15 16:18:11 -07:00
parent 38f610a200
commit 92ce2e1f52
47 changed files with 1232 additions and 710 deletions

View File

@ -0,0 +1,31 @@
std = "lua51+luajit+minetest+moreblocks"
unused_args = false
max_line_length = 120
stds.minetest = {
read_globals = {
"DIR_DELIM",
"minetest",
"core",
"dump",
"vector",
"nodeupdate",
"VoxelManip",
"VoxelArea",
"PseudoRandom",
"ItemStack",
"default",
"table",
}
}
stds.moreblocks = {
globals = {
"stairsplus_legacy",
},
read_globals = {
"default",
"stairs",
"stairsplus",
},
}

View File

@ -0,0 +1,12 @@
-- not every fork of basic_materials has all the nodes
if minetest.registered_nodes["basic_materials:concrete_block"] then
stairsplus_legacy.register_legacy("basic_materials:concrete_block")
end
if minetest.registered_nodes["basic_materials:cement_block"] then
stairsplus_legacy.register_legacy("basic_materials:cement_block")
end
if minetest.registered_nodes["basic_materials:brass_block"] then
stairsplus_legacy.register_legacy("basic_materials:brass_block")
end

View File

@ -0,0 +1,102 @@
if stairsplus_legacy.has.stairs then
stairsplus_legacy.override_stairs("wood", "default:wood")
stairsplus_legacy.override_stairs("junglewood", "default:junglewood")
stairsplus_legacy.override_stairs("pine_wood", "default:pine_wood")
stairsplus_legacy.override_stairs("acacia_wood", "default:acacia_wood")
stairsplus_legacy.override_stairs("aspen_wood", "default:aspen_wood")
stairsplus_legacy.override_stairs("cobble", "default:cobble")
stairsplus_legacy.override_stairs("stone", "default:stone")
stairsplus_legacy.override_stairs("mossycobble", "default:mossycobble")
stairsplus_legacy.override_stairs("stonebrick", "default:stonebrick")
stairsplus_legacy.override_stairs("stone_block", "default:stone_block")
stairsplus_legacy.override_stairs("desert_stone", "default:desert_stone")
stairsplus_legacy.override_stairs("desert_cobble", "default:desert_cobble")
stairsplus_legacy.override_stairs("desert_stonebrick", "default:desert_stonebrick")
stairsplus_legacy.override_stairs("desert_stone_block", "default:desert_stone_block")
stairsplus_legacy.override_stairs("sandstone", "default:sandstone")
stairsplus_legacy.override_stairs("sandstonebrick", "default:sandstonebrick")
stairsplus_legacy.override_stairs("sandstone_block", "default:sandstone_block")
stairsplus_legacy.override_stairs("desert_sandstone", "default:desert_sandstone")
stairsplus_legacy.override_stairs("desert_sandstone_brick", "default:desert_sandstone_brick")
stairsplus_legacy.override_stairs("desert_sandstone_block", "default:desert_sandstone_block")
stairsplus_legacy.override_stairs("silver_sandstone", "default:silver_sandstone")
stairsplus_legacy.override_stairs("silver_sandstone_brick", "default:silver_sandstone_brick")
stairsplus_legacy.override_stairs("silver_sandstone_block", "default:silver_sandstone_block")
stairsplus_legacy.override_stairs("obsidian", "default:obsidian")
stairsplus_legacy.override_stairs("obsidianbrick", "default:obsidianbrick")
stairsplus_legacy.override_stairs("obsidian_block", "default:obsidian_block")
stairsplus_legacy.override_stairs("brick", "default:brick")
stairsplus_legacy.override_stairs("steelblock", "default:steelblock")
stairsplus_legacy.override_stairs("tinblock", "default:tinblock")
stairsplus_legacy.override_stairs("copperblock", "default:copperblock")
stairsplus_legacy.override_stairs("bronzeblock", "default:bronzeblock")
stairsplus_legacy.override_stairs("goldblock", "default:goldblock")
stairsplus_legacy.override_stairs("ice", "default:ice")
stairsplus_legacy.override_stairs("snowblock", "default:snowblock")
stairsplus_legacy.override_stairs("glass", "default:glass",
{tiles = {"stairs_glass_split.png"}}, {ignore_paramtype2 = true})
stairsplus_legacy.override_stairs("obsidian_glass", "default:obsidian_glass",
{tiles = {"stairs_obsidian_glass_split.png"}}, {ignore_paramtype2 = true})
end
local default_nodes = { -- Default stairs/slabs/panels/microblocks:
"stone",
"stone_block",
"cobble",
"mossycobble",
"brick",
"sandstone",
"steelblock",
"goldblock",
"copperblock",
"bronzeblock",
"diamondblock",
"tinblock",
"desert_stone",
"desert_stone_block",
"desert_cobble",
"meselamp",
"tree",
"wood",
"jungletree",
"junglewood",
"pine_tree",
"pine_wood",
"acacia_tree",
"acacia_wood",
"aspen_tree",
"aspen_wood",
"obsidian",
"obsidian_block",
"obsidianbrick",
"stonebrick",
"desert_stonebrick",
"sandstonebrick",
"silver_sandstone",
"silver_sandstone_brick",
"silver_sandstone_block",
"desert_sandstone",
"desert_sandstone_brick",
"desert_sandstone_block",
"sandstone_block",
"coral_skeleton",
"ice",
}
for _, name in ipairs(default_nodes) do
local node = ("default:%s"):format(name)
stairsplus_legacy.register_legacy(node)
stairsplus.api.register_alias_all(("moreblocks:%s"):format(name), node)
end
-- glass problems
local glass = {
"glass",
"obsidian_glass",
}
for _, name in ipairs(glass) do
local node = ("default:%s"):format(name)
stairsplus_legacy.register_legacy(node, nil, {ignore_paramtype2 = true})
stairsplus.api.register_alias_all(("moreblocks:%s"):format(name), node)
end

View File

@ -0,0 +1,10 @@
if stairsplus_legacy.has.stairs then
stairsplus_legacy.override_stairs("straw", "farming:straw")
end
local farming_nodes = {"straw"}
for _, name in pairs(farming_nodes) do
local node = ("farming:%s"):format(name)
stairsplus_legacy.register_legacy(node)
stairsplus.api.register_alias_all(("moreblocks:%s"):format(name), node)
end

View File

@ -0,0 +1,6 @@
if stairsplus_legacy.has.basic_materials and stairsplus_legacy.settings.basic_materials then
stairsplus.api.register_alias_force_all("gloopblocks:cement", "basic_materials:cement_block")
else
stairsplus_legacy.register_legacy("gloopblocks:cement")
end

View File

@ -0,0 +1,90 @@
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
local S = minetest.get_translator(modname)
stairsplus_legacy = {
version = {3, 0, 0},
fork = "minetest_mods",
modname = modname,
modpath = modpath,
S = S,
has = {
basic_materials = minetest.get_modpath("basic_materials"),
default = minetest.get_modpath("default"),
farming = minetest.get_modpath("farming"),
gloopblocks = minetest.get_modpath("gloopblocks"),
prefab = minetest.get_modpath("prefab"),
stairs = minetest.get_modpath("stairs"),
technic = minetest.get_modpath("technic"),
wool = minetest.get_modpath("wool"),
},
log = function(level, messagefmt, ...)
return minetest.log(level, ("[%s] %s"):format(modname, messagefmt:format(...)))
end,
dofile = function(...)
return dofile(table.concat({modpath, ...}, DIR_DELIM) .. ".lua")
end,
}
stairsplus_legacy.dofile("settings")
function stairsplus_legacy.register_legacy(node, overrides, meta)
if stairsplus_legacy.settings.stairsplus_legacy_mode then
stairsplus.api.register_group(node, "legacy", overrides, meta)
else
stairsplus.api.register_group(node, "common", overrides, meta)
end
end
if stairsplus_legacy.has.stairs then
local stair_name_formats = {
stair = "stairs:stair_%s",
slab_8 = "stairs:slab_%s",
stair_inner = "stairs:stair_inner_%s",
stair_outer = "stairs:stair_outer_%s",
}
function stairsplus_legacy.override_stairs(name, node, overrides, meta)
for shape, name_format in pairs(stair_name_formats) do
local stair_name = name_format:format(name)
if minetest.registered_nodes[stair_name] then
stairsplus.api.register_single(node, shape, overrides, meta)
local shaped_name = stairsplus.api.format_name(node, shape)
minetest.register_alias_force(stair_name, shaped_name)
end
end
end
end
if stairsplus_legacy.has.basic_materials and stairsplus_legacy.settings.basic_materials then
stairsplus_legacy.dofile("basic_materials")
end
if stairsplus_legacy.has.default and stairsplus_legacy.settings.default then
stairsplus_legacy.dofile("default")
end
if stairsplus_legacy.has.farming and stairsplus_legacy.settings.farming then
stairsplus_legacy.dofile("farming")
end
if stairsplus_legacy.has.gloopblocks and stairsplus_legacy.settings.gloopblocks then
stairsplus_legacy.dofile("gloopblocks")
end
if stairsplus_legacy.has.technic and stairsplus_legacy.settings.technic then
stairsplus_legacy.dofile("technic")
end
if stairsplus_legacy.has.prefab and stairsplus_legacy.settings.prefab then
stairsplus_legacy.dofile("prefab")
end
if stairsplus_legacy.has.wool and stairsplus_legacy.settings.wool then
stairsplus_legacy.dofile("wool")
end

View File

@ -0,0 +1,5 @@
name = stairsplus_legacy
title = Stairs+ legacy support
description = Support for old registrations which were part of moreblocks/stairsplus
depends = stairsplus
optional_depends = basic_materials, default, farming, gloopblocks, stairs, prefab, technic, wool

View File

@ -0,0 +1,9 @@
if stairsplus_legacy.has.basic_materials and stairsplus_legacy.settings.basic_materials then
stairsplus.api.register_alias_force_all("prefab:concrete", "basic_materials:concrete_block")
elseif stairsplus_legacy.has.technic and stairsplus_legacy.settings.technic then
stairsplus.api.register_alias_force_all("prefab:concrete", "technic:concrete")
else
stairsplus_legacy.register_legacy("prefab:concrete")
end

View File

@ -0,0 +1,13 @@
local s = minetest.settings
stairsplus_legacy.settings = {
basic_materials = s:get_bool("stairsplus_legacy.basic_materials", true),
default = s:get_bool("stairsplus_legacy.default", true),
farming = s:get_bool("stairsplus_legacy.farming", true),
gloopblocks = s:get_bool("stairsplus_legacy.gloopblocks", true),
technic = s:get_bool("stairsplus_legacy.technic", true),
prefab = s:get_bool("stairsplus_legacy.prefab", true),
wool = s:get_bool("stairsplus_legacy.wool", true),
stairsplus_legacy_mode = s:get_bool("stairsplus.legacy_mode")
}

View File

@ -0,0 +1,9 @@
if stairsplus_legacy.has.basic_materials and stairsplus_legacy.settings.basic_materials then
stairsplus.api.register_alias_force_all("technic:brass_block", "basic_materials:concrete_block")
stairsplus.api.register_alias_force_all("technic:brass_block", "basic_materials:brass_block")
else
stairsplus_legacy.register_legacy("technic:brass_block")
stairsplus_legacy.register_legacy("technic:concrete")
end

View File

@ -0,0 +1,11 @@
local dyes = {"white", "grey", "black", "red", "yellow", "green", "cyan",
"blue", "magenta", "orange", "violet", "brown", "pink",
"dark_grey", "dark_green"}
for _, name in pairs(dyes) do
local mod = "wool"
local nodename = mod .. ":" .. name
local ndef = table.copy(minetest.registered_nodes[nodename])
ndef.sunlight_propagates = true
stairsplus:register_all(mod, name, nodename, ndef)
end