start to take care of loose ends

This commit is contained in:
flux 2022-06-16 17:46:09 -07:00
parent acc6e2ebea
commit 21d4fab1f5
20 changed files with 315 additions and 229 deletions

View File

@ -17,7 +17,9 @@ stairsplus/API.md
### other things
* finish documentation
* unified_inventory / sfinv / i3 support
* finish legacy support
* finish compatability support
* create a way to analyze and reduce node_count
* ? create a way for players to request nodes or groups?
* ? create a way for admins to execute a command to create a config option to register a shaped node?

View File

@ -3,6 +3,32 @@
TODO: write new API docs
api.register_craft_schema({
output = "panel_8 6",
recipe = {{"node", "node", "node"}},
})
api.register_craft_schema({
type = "shapeless",
output = "micro_8 7",
recipe = {"stair_inner"},
})
api.register_schema_crafts_for_node("default:coalblock")
api.register_crafts_for_shapes({
type = "cooking",
output = "default:stone",
recipe = "default:cobblestone",
cooktime = function(eights) return 3 * eights / 8 end,
})
api.register_crafts_for_shapes({
type = "fuel",
recipe = "default:coalblock",
burntime = function(eights) return 370 * eights / 8 end,
})
# legacy API
* `stairsplus:register_all(modname, subname, recipeitem, fields)`

View File

@ -41,7 +41,7 @@ function api.build_groups(node, shape)
local groups = {
[("shape_%s"):format(shape)] = 1,
not_in_creative_inventory = in_creative_inventory and 1 or 0,
not_in_creative_inventory = in_creative_inventory and 1,
}
local shape_def = api.registered_shapes[shape]

View File

@ -1,5 +1,6 @@
stairsplus.api = {}
stairsplus.dofile("api", "legacy")
stairsplus.dofile("api", "shape")
stairsplus.dofile("api", "group_filters")
stairsplus.dofile("api", "node")

110
stairsplus/api/legacy.lua Normal file
View File

@ -0,0 +1,110 @@
local api = stairsplus.api
local legacy_mode = stairsplus.settings.legacy_mode
local legacy_place_mechanic = stairsplus.settings.legacy_place_mechanic
if legacy_place_mechanic then
local wall_right_dirmap = {9, 18, 7, 12}
local wall_left_dirmap = {11, 16, 5, 14}
local ceil_dirmap = {20, 23, 22, 21}
function api.on_place(itemstack, placer, pointed_thing)
if not minetest.is_player(placer) then
return minetest.item_place(itemstack, placer, pointed_thing)
end
local controls = placer:get_player_control()
local sneak = controls.sneak
local aux = controls.aux1
local shaped_node_name = itemstack:get_name()
local shape = api.get_shape_of_shaped_node(shaped_node_name)
local under = pointed_thing.under
local under_node = minetest.get_node(under)
local under_shape = api.get_shape_of_shaped_node(under_node.name)
local same_cat = shape == under_shape
-- standard (floor) facedir, also used for sneak placement against the lower half of the wall
local p2 = placer and minetest.dir_to_facedir(placer:get_look_dir()) or 0
-- check which face and which quadrant we are interested in
-- this is used both to check if we're handling parallel placement in the same-category case,
-- and in general for sneak placement
local face_pos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
local face_off = vector.subtract(face_pos, under)
-- we cannot trust face_off to tell us the correct directionif the
-- under node has a non-standard shape, so use the distance between under and above
local wallmounted = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.above, under))
if same_cat and not aux then
p2 = under_node.param2
-- flip if placing above or below an upright or upside-down node
-- TODO should we also flip when placing next to a side-mounted node?
if wallmounted < 2 then
if p2 < 4 then
p2 = (p2 + 2) % 4
p2 = ceil_dirmap[p2 + 1]
elseif p2 > 19 then
p2 = ceil_dirmap[p2 - 19] - 20
p2 = (p2 + 2) % 4
end
end
else
-- for same-cat placement, aux is used to disable param2 copying
if same_cat then
aux = not aux
end
local remap = nil
-- standard placement against the wall
local use_wallmap = (wallmounted > 1 and not sneak) or (wallmounted < 2 and sneak)
-- standard placement against the ceiling, or sneak placement against the upper half of the wall
local use_ceilmap = wallmounted == 1 and not sneak
use_ceilmap = use_ceilmap or (wallmounted > 1 and sneak and face_off.y > 0)
if use_wallmap then
local left = (p2 == 0 and face_off.x < 0) or
(p2 == 1 and face_off.z > 0) or
(p2 == 2 and face_off.x > 0) or
(p2 == 3 and face_off.z < 0)
if aux then
left = not left
end
remap = left and wall_left_dirmap or wall_right_dirmap
elseif use_ceilmap then
remap = ceil_dirmap
end
if aux then
p2 = (p2 + 2) % 4
end
if remap then
p2 = remap[p2 + 1]
end
end
return minetest.item_place(itemstack, placer, pointed_thing, p2)
end
else
api.on_place = minetest.item_place
end
function api.scale_light(light_source, shape_def)
if not light_source or light_source == 0 then
return 0
elseif legacy_mode then
return light_source - 1
end
return math.max(1, math.min(math.round(light_source * shape_def.eighths / 4), light_source))
end

View File

@ -1,7 +1,4 @@
-- for registering variants of a specific node
--[[
]]
local api = stairsplus.api
local table_set_all = stairsplus.util.table_set_all
@ -9,22 +6,13 @@ local table_sort_keys = stairsplus.util.table_sort_keys
local S = stairsplus.S
local legacy_mode = stairsplus.settings.legacy_mode
local legacy_place_mechanic = stairsplus.settings.legacy_place_mechanic
local default_align_style = stairsplus.settings.default_align_style
api.nodes_by_shape = {}
api.shapes_by_node = {}
local function scale_light(light_source, shape_def)
if not light_source or light_source == 0 then
return 0
elseif legacy_mode then
return light_source - 1
end
return math.max(1, math.min(math.round(light_source * shape_def.eighths / 4), light_source))
end
api.node_by_shaped_node = {}
api.shape_by_shaped_node = {}
local function check_node_validity(node_def, meta)
local type_ = node_def.type
@ -66,95 +54,6 @@ local function check_node_validity(node_def, meta)
end
end
local wall_right_dirmap = {9, 18, 7, 12}
local wall_left_dirmap = {11, 16, 5, 14}
local ceil_dirmap = {20, 23, 22, 21}
function api.legacy_on_place(itemstack, placer, pointed_thing)
if not minetest.is_player(placer) then
return minetest.item_place(itemstack, placer, pointed_thing)
end
local controls = placer:get_player_control()
local sneak = controls.sneak
local aux = controls.aux1
local shaped_node_name = itemstack:get_name()
local shape = api.get_shape_of_shaped_node(shaped_node_name)
local under = pointed_thing.under
local under_node = minetest.get_node(under)
local under_shape = api.get_shape_of_shaped_node(under_node.name)
local same_cat = shape == under_shape
-- standard (floor) facedir, also used for sneak placement against the lower half of the wall
local p2 = placer and minetest.dir_to_facedir(placer:get_look_dir()) or 0
-- check which face and which quadrant we are interested in
-- this is used both to check if we're handling parallel placement in the same-category case,
-- and in general for sneak placement
local face_pos = minetest.pointed_thing_to_face_pos(placer, pointed_thing)
local face_off = vector.subtract(face_pos, under)
-- we cannot trust face_off to tell us the correct directionif the
-- under node has a non-standard shape, so use the distance between under and above
local wallmounted = minetest.dir_to_wallmounted(vector.subtract(pointed_thing.above, under))
if same_cat and not aux then
p2 = under_node.param2
-- flip if placing above or below an upright or upside-down node
-- TODO should we also flip when placing next to a side-mounted node?
if wallmounted < 2 then
if p2 < 4 then
p2 = (p2 + 2) % 4
p2 = ceil_dirmap[p2 + 1]
elseif p2 > 19 then
p2 = ceil_dirmap[p2 - 19] - 20
p2 = (p2 + 2) % 4
end
end
else
-- for same-cat placement, aux is used to disable param2 copying
if same_cat then
aux = not aux
end
local remap = nil
-- standard placement against the wall
local use_wallmap = (wallmounted > 1 and not sneak) or (wallmounted < 2 and sneak)
-- standard placement against the ceiling, or sneak placement against the upper half of the wall
local use_ceilmap = wallmounted == 1 and not sneak
use_ceilmap = use_ceilmap or (wallmounted > 1 and sneak and face_off.y > 0)
if use_wallmap then
local left = (p2 == 0 and face_off.x < 0) or
(p2 == 1 and face_off.z > 0) or
(p2 == 2 and face_off.x > 0) or
(p2 == 3 and face_off.z < 0)
if aux then
left = not left
end
remap = left and wall_left_dirmap or wall_right_dirmap
elseif use_ceilmap then
remap = ceil_dirmap
end
if aux then
p2 = (p2 + 2) % 4
end
if remap then
p2 = remap[p2 + 1]
end
end
return minetest.item_place(itemstack, placer, pointed_thing, p2)
end
function api.format_name(node, shape)
local mod, name = node:match("^([^:]+):(.*)$")
local shape_def = api.registered_shapes[shape]
@ -201,7 +100,7 @@ function api.register_single(node, shape, overrides, meta)
paramtype = shape_def.paramtype or "light",
paramtype2 = paramtype2,
light_source = scale_light(node_def.light_source, shape_def),
light_source = api.scale_light(node_def.light_source, shape_def),
groups = api.build_groups(node, shape),
tiles = node_def.tiles,
@ -217,6 +116,8 @@ function api.register_single(node, shape, overrides, meta)
diggable = node_def.diggable,
climbable = node_def.climbable,
move_resistance = node_def.move_resistance,
on_place = api.on_place,
}
-- see-through nodes tend to look better if we just use the first tile
@ -236,16 +137,12 @@ function api.register_single(node, shape, overrides, meta)
-- if there's a drop defined, and we can drop a shaped version, do so
if node_def.drop and type(node_def.drop) == "string" then
local item = api.get_shaped_node(node_def.drop, shape)
local item = api.get_schema_recipe_item(node_def.drop, shape)
if item then
def.drop = item
end
end
if legacy_place_mechanic then
def.on_place = api.legacy_on_place
end
overrides.groups = nil
table_set_all(def, overrides)
@ -339,7 +236,8 @@ function api.get_shapes_hash(node)
return api.shapes_by_node[node]
end
function api.get_shaped_node(node, shape_or_item)
-- turn a recipe item into a shape if possible
function api.get_schema_recipe_item(node, shape_or_item)
if shape_or_item == "" then
return ""
end
@ -367,20 +265,11 @@ function api.get_shaped_node(node, shape_or_item)
end
function api.get_micronode(node)
return api.format_name(node, "micro_8")
end
api.node_by_shaped_node = {}
api.shape_by_shaped_node = {}
function api.get_node_of_shaped_node(shaped_node)
return api.node_by_shaped_node[shaped_node]
end
function api.get_shape_of_shaped_node(shaped_node)
return api.shape_by_shaped_node[shaped_node]
return api.get_schema_recipe_item(node, "micro_8")
end
-- create some hashes for quickly looking things up at run-time (i.e. the circular saw)
-- register schema crafts once, after everything has been registered. otherwise, it's not clear when to do this
minetest.register_on_mods_loaded(function()
stairsplus.log("info", "registering schema crafts")
for node, shapes in pairs(api.shapes_by_node) do
@ -396,3 +285,11 @@ minetest.register_on_mods_loaded(function()
api.register_schema_crafts_for_node(node)
end
end)
function api.get_node_of_shaped_node(shaped_node)
return api.node_by_shaped_node[shaped_node]
end
function api.get_shape_of_shaped_node(shaped_node)
return api.shape_by_shaped_node[shaped_node]
end

View File

@ -1,37 +1,13 @@
-- for registering recipe schemas
-- should register schemas w/ unified_inventory and i3 and whatever else,
-- and hide the recipes for the individual nodes (possibly a setting for such)
--[[
api.register_craft_schema({
output = "panel_8 6",
recipe = {{"node", "node", "node"}},
})
api.register_craft_schema({
type = "shapeless",
output = "micro_8 7",
recipe = {"stair_inner"},
})
api.register_schema_crafts_for_node("default:coalblock")
api.register_crafts_for_shapes({
type = "cooking",
output = "default:stone",
recipe = "default:cobblestone",
cooktime = function(eights) return 3 * eights / 8 end,
})
api.register_crafts_for_shapes({
type = "fuel",
recipe = "default:coalblock",
burntime = function(eights) return 370 * eights / 8 end,
})
]]
-- TODO: should register schemas w/ unified_inventory and i3 and whatever else,
-- and hide the recipes for the individual nodes (possibly a setting for such)
local api = stairsplus.api
local recipes_in_creative_inventory = stairsplus.settings.recipes_in_creative_inventory
api.registered_recipe_schemas = {}
api.registered_on_register_craft_schemas = {}
local function is_valid_output(item, shapes)
local item_name = item:match("^([^ ]+)")
@ -85,7 +61,10 @@ local function verify_schema(schema)
end
end
api.registered_recipe_schemas = {}
function api.register_on_register_craft_schema(func)
table.insert(api.registered_on_register_craft_schema, func)
end
function api.register_craft_schema(schema)
local problems = verify_schema(schema)
@ -93,9 +72,13 @@ function api.register_craft_schema(schema)
error(problems)
end
stairsplus.log("info", "registering craft schema %s", minetest.write_json(schema))
stairsplus.log("info", "registering craft schema %s", minetest.serialize(schema):sub(#("return ")))
table.insert(api.registered_recipe_schemas, schema)
for _, func in ipairs(api.registered_on_register_craft_schemas) do
func(schema)
end
end
local function has_the_right_shapes(schema, shapes)
@ -136,31 +119,36 @@ end
local function register_for_schema(node, schema)
local recipe = table.copy(schema)
recipe.output = api.get_shaped_node(node, recipe.output)
recipe.output = api.get_schema_recipe_item(node, recipe.output)
if recipe.replacements then
for _, replacement in ipairs(recipe.replacements) do
for i, item in ipairs(replacement) do
replacement[i] = api.get_shaped_node(node, item)
replacement[i] = api.get_schema_recipe_item(node, item)
end
end
end
if recipe.type == "shapeless" then
for i, item in ipairs(recipe.recipe) do
recipe.recipe[i] = api.get_shaped_node(node, item)
recipe.recipe[i] = api.get_schema_recipe_item(node, item)
end
elseif recipe.type == "shaped" or recipe.type == nil then
for _, row in ipairs(recipe.recipe) do
for i, item in ipairs(row) do
row[i] = api.get_shaped_node(node, item)
row[i] = api.get_schema_recipe_item(node, item)
end
end
end
stairsplus.log("info", "registering recipe %s", minetest.serialize(recipe):sub(#("return ")))
if not recipes_in_creative_inventory then
-- i don't think anything supports this but...
recipe.groups = {not_in_creative_inventory = 1}
end
minetest.register_craft(recipe)
end
@ -204,9 +192,10 @@ function api.register_crafts_for_shapes(def)
for _, shape in ipairs(shapes) do
minetest.register_craft({
type = "cooking",
output = api.get_shaped_node(def.output, shape),
recipe = api.get_shaped_node(def.recipe, shape),
output = api.get_schema_recipe_item(def.output, shape),
recipe = api.get_schema_recipe_item(def.recipe, shape),
cooktime = def.cooktime(api.registered_shapes[shape].eighths),
groups = (not recipes_in_creative_inventory) and {not_in_creative_inventory = 1}
})
end
@ -216,8 +205,9 @@ function api.register_crafts_for_shapes(def)
for _, shape in ipairs(shapes) do
minetest.register_craft({
type = "fuel",
recipe = api.get_shaped_node(def.recipe, shape),
recipe = api.get_schema_recipe_item(def.recipe, shape),
burntime = def.burntime(api.registered_shapes[shape].eighths),
groups = (not recipes_in_creative_inventory) and {not_in_creative_inventory = 1}
})
end

View File

View File

@ -0,0 +1,5 @@
-- compatability stuff for after the API is created, but before we start using it
stairsplus.dofile("compat", "i3")
stairsplus.dofile("compat", "unified_inventory")

View File

@ -0,0 +1,44 @@
-- luacheck: read globals unified_inventory
if not stairsplus.has.unified_inventory then
return
end
unified_inventory.register_craft_type("stairsplus", {
-- ^ Unique identifier for `register_craft`
description = "Stairs+ craft schema",
-- ^ Text shown below the crafting arrow
icon = "dummy.png",
-- ^ Image shown above the crafting arrow
width = 3,
height = 3,
-- ^ Maximal input dimensions of the recipes
uses_crafting_grid = true,
})
local function convert_schema_recipe_item(item)
if item == "" then
return item
end
local name, count = item:match("^([^ ]+) (%d+)")
if not name then
name = item
end
count = tonumber(count)
error("more logic here")
if count then
return ("%s %s"):format(name, count)
else
return name
end
end
stairsplus.api.register_on_register_craft_schema(function(schema)
local recipe = table.copy(schema)
recipe.output = convert_schema_recipe_item(recipe.output)
end)

View File

@ -9,7 +9,7 @@ stairsplus.compat = {
}
stairsplus.dofile("compat", "stairs")
stairsplus.dofile("compat", "legacy")
stairsplus.dofile("compat", "old_moreblocks")
-- stairsplus.dofile("compat", "inventory_managers")
-- unified_inventory, sfinv, i3

View File

@ -1,3 +1,6 @@
-- stairs compat: override what stairs does
-- in stairsplus_legacy, "fix" any stairs which were already registered
if not stairsplus.has.stairs then
return
end
@ -9,8 +12,6 @@ local S = stairsplus.S
local default_align_style = stairsplus.settings.default_align_style
local is_legacy_drawtype = stairsplus.compat.is_legacy_drawtype
-- 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)
local meta = {
align_style = worldaligntex and "world" or default_align_style
@ -82,3 +83,21 @@ function stairs.register_stair_outer(subname, node, groups, tiles, description,
minetest.register_alias(("stairs:stair_outer_%s"):format(subname), api.format_name(node, "stair_outer"))
end
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.compat.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
api.register_single(node, shape, overrides, meta)
local shaped_name = api.format_name(node, shape)
minetest.register_alias_force(stair_name, shaped_name)
end
end
end

View File

@ -21,7 +21,9 @@ stairsplus = {
has = {
default = minetest.get_modpath("default"),
i3 = minetest.get_modpath("i3"),
stairs = minetest.get_modpath("stairs"),
unified_inventory = minetest.get_modpath("unified_inventory"),
},
log = function(level, messagefmt, ...)
@ -33,9 +35,14 @@ stairsplus = {
end,
}
-- order matters TODO document that... though i probably won't
stairsplus.dofile("settings")
stairsplus.dofile("util")
stairsplus.dofile("api", "init")
stairsplus.dofile("compat1", "init")
stairsplus.dofile("shapes", "init")
stairsplus.dofile("groups", "init")
stairsplus.dofile("craft_schemas", "init")
@ -43,4 +50,4 @@ stairsplus.dofile("craft_schemas", "init")
stairsplus.dofile("resources", "init")
stairsplus.dofile("circular_saw")
stairsplus.dofile("compat", "init")
stairsplus.dofile("compat2", "init")

View File

@ -1,4 +1,4 @@
name = stairsplus
title = Stairs+
description = Microblock API
optional_depends = default, stairs
optional_depends = default, i3, stairs, unified_inventory

View File

@ -2,8 +2,13 @@ local s = minetest.settings
stairsplus.settings = {
in_creative_inventory = s:get_bool("stairsplus.in_creative_inventory",
s:get_bool("stairsplus_in_creative_inventory", false) -- turn to false because we will do nicer things
s:get_bool("stairsplus_in_creative_inventory", false)
),
recipes_in_creative_inventory = s:get_bool("stairsplus.recipes_in_creative_inventory",
s:get_bool("stairsplus_in_creative_inventory", 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)

View File

@ -1,4 +1,4 @@
std = "lua51+luajit+minetest+moreblocks"
std = "lua51+luajit+minetest+stairsplus_legacy"
unused_args = false
max_line_length = 120
@ -19,7 +19,7 @@ stds.minetest = {
}
}
stds.moreblocks = {
stds.stairsplus_legacy = {
globals = {
"stairsplus_legacy",
},

View File

@ -1,41 +1,41 @@
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",
stairsplus.compat.override_stairs("wood", "default:wood")
stairsplus.compat.override_stairs("junglewood", "default:junglewood")
stairsplus.compat.override_stairs("pine_wood", "default:pine_wood")
stairsplus.compat.override_stairs("acacia_wood", "default:acacia_wood")
stairsplus.compat.override_stairs("aspen_wood", "default:aspen_wood")
stairsplus.compat.override_stairs("cobble", "default:cobble")
stairsplus.compat.override_stairs("stone", "default:stone")
stairsplus.compat.override_stairs("mossycobble", "default:mossycobble")
stairsplus.compat.override_stairs("stonebrick", "default:stonebrick")
stairsplus.compat.override_stairs("stone_block", "default:stone_block")
stairsplus.compat.override_stairs("desert_stone", "default:desert_stone")
stairsplus.compat.override_stairs("desert_cobble", "default:desert_cobble")
stairsplus.compat.override_stairs("desert_stonebrick", "default:desert_stonebrick")
stairsplus.compat.override_stairs("desert_stone_block", "default:desert_stone_block")
stairsplus.compat.override_stairs("sandstone", "default:sandstone")
stairsplus.compat.override_stairs("sandstonebrick", "default:sandstonebrick")
stairsplus.compat.override_stairs("sandstone_block", "default:sandstone_block")
stairsplus.compat.override_stairs("desert_sandstone", "default:desert_sandstone")
stairsplus.compat.override_stairs("desert_sandstone_brick", "default:desert_sandstone_brick")
stairsplus.compat.override_stairs("desert_sandstone_block", "default:desert_sandstone_block")
stairsplus.compat.override_stairs("silver_sandstone", "default:silver_sandstone")
stairsplus.compat.override_stairs("silver_sandstone_brick", "default:silver_sandstone_brick")
stairsplus.compat.override_stairs("silver_sandstone_block", "default:silver_sandstone_block")
stairsplus.compat.override_stairs("obsidian", "default:obsidian")
stairsplus.compat.override_stairs("obsidianbrick", "default:obsidianbrick")
stairsplus.compat.override_stairs("obsidian_block", "default:obsidian_block")
stairsplus.compat.override_stairs("brick", "default:brick")
stairsplus.compat.override_stairs("steelblock", "default:steelblock")
stairsplus.compat.override_stairs("tinblock", "default:tinblock")
stairsplus.compat.override_stairs("copperblock", "default:copperblock")
stairsplus.compat.override_stairs("bronzeblock", "default:bronzeblock")
stairsplus.compat.override_stairs("goldblock", "default:goldblock")
stairsplus.compat.override_stairs("ice", "default:ice")
stairsplus.compat.override_stairs("snowblock", "default:snowblock")
stairsplus.compat.override_stairs("glass", "default:glass",
{tiles = {"stairs_glass_split.png"}}, {ignore_paramtype2 = true})
stairsplus_legacy.override_stairs("obsidian_glass", "default:obsidian_glass",
stairsplus.compat.override_stairs("obsidian_glass", "default:obsidian_glass",
{tiles = {"stairs_obsidian_glass_split.png"}}, {ignore_paramtype2 = true})
end

View File

@ -1,5 +1,5 @@
if stairsplus_legacy.has.stairs then
stairsplus_legacy.override_stairs("straw", "farming:straw")
stairsplus.compat.override_stairs("straw", "farming:straw")
end
local farming_nodes = {"straw"}

View File

@ -41,26 +41,6 @@ function stairsplus_legacy.register_legacy(node, 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