mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2025-07-16 06:40:34 +02:00
compatability and legacy mostly done. schema recipes are all messed up for some reason.
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
stairsplus.compat = {}
|
||||
|
||||
stairsplus.dofile("compat", "stairs")
|
||||
stairsplus.dofile("compat", "legacy")
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
-- legacy: register all the expected variants for e.g. default, wool, gloopblocks, etc.
|
||||
-- legacy: export old API for mods which depend on it
|
||||
-- provide a configuration option to *disable* legacy. it must be enabled by default, to prevent breaking
|
||||
-- existing servers
|
||||
local api = stairsplus.api
|
||||
|
@ -1,163 +0,0 @@
|
||||
--[[
|
||||
More Blocks: registrations
|
||||
|
||||
Copyright © 2011-2020 Hugo Locurcio and contributors.
|
||||
Licensed under the zlib license. See LICENSE.md for more information.
|
||||
--]]
|
||||
local S = stairsplus.S
|
||||
-- default registrations
|
||||
if minetest.get_modpath("default") then
|
||||
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",
|
||||
"glass",
|
||||
"tree",
|
||||
"wood",
|
||||
"jungletree",
|
||||
"junglewood",
|
||||
"pine_tree",
|
||||
"pine_wood",
|
||||
"acacia_tree",
|
||||
"acacia_wood",
|
||||
"aspen_tree",
|
||||
"aspen_wood",
|
||||
"obsidian",
|
||||
"obsidian_block",
|
||||
"obsidianbrick",
|
||||
"obsidian_glass",
|
||||
"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 pairs(default_nodes) do
|
||||
local mod = "default"
|
||||
local nodename = mod .. ":" .. name
|
||||
local ndef = table.copy(minetest.registered_nodes[nodename])
|
||||
ndef.sunlight_propagates = true
|
||||
|
||||
-- Stone and desert_stone drop cobble and desert_cobble respectively.
|
||||
if type(ndef.drop) == "string" then
|
||||
ndef.drop = ndef.drop:gsub(".+:", "")
|
||||
end
|
||||
|
||||
-- Use the primary tile for all sides of cut glasslike nodes and disregard paramtype2.
|
||||
if #ndef.tiles > 1 and ndef.drawtype and ndef.drawtype:find("glass") then
|
||||
ndef.tiles = {ndef.tiles[1]}
|
||||
ndef.paramtype2 = nil
|
||||
end
|
||||
|
||||
mod = "moreblocks"
|
||||
stairsplus:register_all(mod, name, nodename, ndef)
|
||||
minetest.register_alias_force("stairs:stair_" .. name, mod .. ":stair_" .. name)
|
||||
minetest.register_alias_force("stairs:stair_outer_" .. name, mod .. ":stair_" .. name .. "_outer")
|
||||
minetest.register_alias_force("stairs:stair_inner_" .. name, mod .. ":stair_" .. name .. "_inner")
|
||||
minetest.register_alias_force("stairs:slab_" .. name, mod .. ":slab_" .. name)
|
||||
end
|
||||
end
|
||||
|
||||
-- farming registrations
|
||||
if minetest.get_modpath("farming") then
|
||||
local farming_nodes = {"straw"}
|
||||
for _, name in pairs(farming_nodes) do
|
||||
local mod = "farming"
|
||||
local nodename = mod .. ":" .. name
|
||||
local ndef = table.copy(minetest.registered_nodes[nodename])
|
||||
ndef.sunlight_propagates = true
|
||||
|
||||
mod = "moreblocks"
|
||||
stairsplus:register_all(mod, name, nodename, ndef)
|
||||
minetest.register_alias_force("stairs:stair_" .. name, mod .. ":stair_" .. name)
|
||||
minetest.register_alias_force("stairs:stair_outer_" .. name, mod .. ":stair_" .. name .. "_outer")
|
||||
minetest.register_alias_force("stairs:stair_inner_" .. name, mod .. ":stair_" .. name .. "_inner")
|
||||
minetest.register_alias_force("stairs:slab_" .. name, mod .. ":slab_" .. name)
|
||||
end
|
||||
end
|
||||
|
||||
-- wool registrations
|
||||
if minetest.get_modpath("wool") then
|
||||
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
|
||||
end
|
||||
|
||||
-- basic_materials, keeping the original other-mod-oriented names
|
||||
-- for backwards compatibility
|
||||
|
||||
if minetest.get_modpath("basic_materials") then
|
||||
stairsplus:register_all("technic", "concrete", "basic_materials:concrete_block", {
|
||||
description = S("Concrete"),
|
||||
tiles = {"basic_materials_concrete_block.png", },
|
||||
groups = {cracky = 1, level = 2, concrete = 1},
|
||||
sounds = stairsplus.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_alias("prefab:concrete_stair", "technic:stair_concrete")
|
||||
minetest.register_alias("prefab:concrete_slab", "technic:slab_concrete")
|
||||
|
||||
stairsplus:register_all("gloopblocks", "cement", "basic_materials:cement_block", {
|
||||
description = S("Cement"),
|
||||
tiles = {"basic_materials_cement_block.png"},
|
||||
groups = {cracky = 2, not_in_creative_inventory = 1},
|
||||
sounds = stairsplus.node_sound_stone_defaults(),
|
||||
sunlight_propagates = true,
|
||||
})
|
||||
|
||||
stairsplus:register_all("technic", "brass_block", "basic_materials:brass_block", {
|
||||
description = S("Brass Block"),
|
||||
groups = {cracky = 1, not_in_creative_inventory = 1},
|
||||
tiles = {"basic_materials_brass_block.png"},
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
-- Alias cuts of split_stone_tile_alt which was renamed checker_stone_tile.
|
||||
stairsplus:register_alias_all("moreblocks", "split_stone_tile_alt", "moreblocks", "checker_stone_tile")
|
||||
|
||||
-- The following LBM is necessary because the name stair_split_stone_tile_alt
|
||||
-- conflicts with another node and so the alias for that specific node gets
|
||||
-- ignored.
|
||||
minetest.register_lbm({
|
||||
name = "moreblocks:fix_split_stone_tile_alt_name_collision",
|
||||
nodenames = {"moreblocks:stair_split_stone_tile_alt"},
|
||||
action = function(pos, node)
|
||||
minetest.set_node(pos, {
|
||||
name = "moreblocks:stair_checker_stone_tile",
|
||||
param2 = minetest.get_node(pos).param2
|
||||
|
||||
})
|
||||
minetest.log('action', "LBM replaced " .. node.name ..
|
||||
" at " .. minetest.pos_to_string(pos))
|
||||
end,
|
||||
})
|
@ -1 +1,63 @@
|
||||
if not stairsplus.has.stairs then
|
||||
return
|
||||
end
|
||||
|
||||
local api = stairsplus.api
|
||||
|
||||
local S = stairsplus.S
|
||||
|
||||
local default_align_style = stairsplus.settings.default_align_style
|
||||
|
||||
-- stairs compat: override what stairs does, and "fix" any stairs which were already registered...
|
||||
|
||||
function stairs.register_stair(subname, node, groups, tiles, description, sounds, worldaligntex)
|
||||
api.register_single(node, "stair", {
|
||||
groups = groups,
|
||||
tiles = tiles,
|
||||
description = description,
|
||||
sounds = sounds,
|
||||
}, {
|
||||
align_style = worldaligntex and "world" or default_align_style
|
||||
})
|
||||
|
||||
minetest.register_alias(("stairs:stair_%s"):format(subname), api.format_name(node, "stair"))
|
||||
end
|
||||
|
||||
function stairs.register_slab(subname, node, groups, images, description, sounds, worldaligntex)
|
||||
api.register_single(node, "slab_8", {
|
||||
groups = groups,
|
||||
tiles = images,
|
||||
description = description,
|
||||
sounds = sounds,
|
||||
}, {
|
||||
align_style = worldaligntex and "world" or default_align_style
|
||||
})
|
||||
|
||||
minetest.register_alias(("stairs:slab_%s"):format(subname), api.format_name(node, "slab_8"))
|
||||
end
|
||||
|
||||
function stairs.register_stair_inner(subname, node, groups, tiles, description, sounds, worldaligntex, full_description)
|
||||
api.register_single(node, "stair_inner", {
|
||||
groups = groups,
|
||||
tiles = tiles,
|
||||
description = full_description or S("Inner @1", description),
|
||||
sounds = sounds,
|
||||
}, {
|
||||
align_style = worldaligntex and "world" or default_align_style
|
||||
})
|
||||
|
||||
minetest.register_alias(("stairs:stair_inner_%s"):format(subname), api.format_name(node, "stair_inner"))
|
||||
end
|
||||
|
||||
function stairs.register_stair_outer(subname, node, groups, tiles, description, sounds, worldaligntex, full_description)
|
||||
api.register_single(node, "stair_outer", {
|
||||
groups = groups,
|
||||
tiles = tiles,
|
||||
description = full_description or S("Inner @1", description),
|
||||
sounds = sounds,
|
||||
}, {
|
||||
align_style = worldaligntex and "world" or default_align_style
|
||||
})
|
||||
|
||||
minetest.register_alias(("stairs:stair_outer_%s"):format(subname), api.format_name(node, "stair_outer"))
|
||||
end
|
||||
|
Reference in New Issue
Block a user