mirror of
https://github.com/minetest-mods/moreblocks.git
synced 2024-09-27 14:50:30 +02:00
create proper stairs mod replacement; create option to allow registering stairs w/out a proper recipeitem
This commit is contained in:
parent
d844a5f8b7
commit
53ac0b80b3
|
@ -29,6 +29,12 @@ repos:
|
||||||
entry: luacheck
|
entry: luacheck
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
args: [--config,./moreblocks_legacy_recipes/.luacheckrc,-q,./moreblocks_legacy_recipes]
|
args: [--config,./moreblocks_legacy_recipes/.luacheckrc,-q,./moreblocks_legacy_recipes]
|
||||||
|
- id: luacheck_stairs
|
||||||
|
name: luacheck_stairs
|
||||||
|
language: system
|
||||||
|
entry: luacheck
|
||||||
|
pass_filenames: false
|
||||||
|
args: [--config,./stairs/.luacheckrc,-q,./stairs]
|
||||||
- id: luacheck_stairsplus
|
- id: luacheck_stairsplus
|
||||||
name: luacheck_stairsplus
|
name: luacheck_stairsplus
|
||||||
language: system
|
language: system
|
||||||
|
|
|
@ -13,6 +13,12 @@ moreblocks_legacy_recipes.enabled (Enable legacy recipes) bool false
|
||||||
# Add a yellow outline around trap nodes, to make them visibly distinct
|
# Add a yellow outline around trap nodes, to make them visibly distinct
|
||||||
moreblocks.outline_trap_nodes (Outline trap nodes) bool true
|
moreblocks.outline_trap_nodes (Outline trap nodes) bool true
|
||||||
|
|
||||||
|
# If true, registering stairs w/out a registered recipe item will still create the stair nodes.
|
||||||
|
# This is how the stairs mod in minetest game works currently.
|
||||||
|
# Unfortunately, they will not be craftable.
|
||||||
|
# By default, trying to do this will create an error.
|
||||||
|
stairs.legacy_stairs_without_recipeitem (Allow stairs without a base node) bool false
|
||||||
|
|
||||||
# I guess if you want the saw to be creative-only?
|
# I guess if you want the saw to be creative-only?
|
||||||
stairsplus.circular_saw_crafting (Allow crafting the circular saw) bool true
|
stairsplus.circular_saw_crafting (Allow crafting the circular saw) bool true
|
||||||
|
|
||||||
|
|
31
stairs/.luacheckrc
Normal file
31
stairs/.luacheckrc
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
std = "lua51+luajit+minetest+stairs"
|
||||||
|
unused_args = false
|
||||||
|
max_line_length = 120
|
||||||
|
|
||||||
|
stds.minetest = {
|
||||||
|
read_globals = {
|
||||||
|
"DIR_DELIM",
|
||||||
|
"minetest",
|
||||||
|
"core",
|
||||||
|
"dump",
|
||||||
|
"vector",
|
||||||
|
"nodeupdate",
|
||||||
|
"VoxelManip",
|
||||||
|
"VoxelArea",
|
||||||
|
"PseudoRandom",
|
||||||
|
"ItemStack",
|
||||||
|
"default",
|
||||||
|
"table",
|
||||||
|
"math",
|
||||||
|
"string",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stds.stairs = {
|
||||||
|
globals = {
|
||||||
|
"stairs",
|
||||||
|
},
|
||||||
|
read_globals = {
|
||||||
|
"stairsplus",
|
||||||
|
},
|
||||||
|
}
|
1
stairs/README.md
Normal file
1
stairs/README.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
stairs compat: override what stairs does
|
|
@ -1,29 +1,34 @@
|
||||||
-- stairs compat: override what stairs does
|
|
||||||
-- in stairsplus_legacy, "fix" any stairs which were already registered
|
|
||||||
|
|
||||||
if not stairsplus.has.stairs then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local f = string.format
|
local f = string.format
|
||||||
|
|
||||||
local api = stairsplus.api
|
local api = stairsplus.api
|
||||||
|
|
||||||
local S = stairsplus.S
|
local S = stairsplus.S
|
||||||
|
|
||||||
|
local legacy = stairs.legacy
|
||||||
|
|
||||||
local is_legacy_drawtype = stairsplus.compat.is_legacy_drawtype
|
local is_legacy_drawtype = stairsplus.compat.is_legacy_drawtype
|
||||||
local is_legacy_paramtype2 = stairsplus.compat.is_legacy_paramtype2
|
local is_legacy_paramtype2 = stairsplus.compat.is_legacy_paramtype2
|
||||||
|
|
||||||
local default_align_style = stairsplus.settings.default_align_style
|
local default_align_style = stairsplus.settings.default_align_style
|
||||||
local crafting_schemata_enabled = stairsplus.settings.crafting_schemata_enabled
|
local legacy_stairs_without_recipeitem = stairs.settings.legacy_stairs_without_recipeitem
|
||||||
|
|
||||||
function stairs.register_stair(subname, node, groups, tiles, description, sounds, worldaligntex)
|
function stairs.register_stair(subname, node, groups, tiles, description, sounds, worldaligntex)
|
||||||
|
if not minetest.registered_nodes[node] then
|
||||||
|
-- registering a stair for a node that doesn't exist
|
||||||
|
if legacy_stairs_without_recipeitem then
|
||||||
|
legacy.register_stair(subname, node, groups, tiles, description, sounds, worldaligntex)
|
||||||
|
return
|
||||||
|
|
||||||
|
else
|
||||||
|
error(f("attempt to register stairs for unknown node %q. " ..
|
||||||
|
"set `stairs.legacy_stairs_without_recipeitem = true` in minetest.conf to enable this behavior.", node))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local meta = {
|
local meta = {
|
||||||
align_style = worldaligntex and "world" or default_align_style
|
align_style = worldaligntex and "world" or default_align_style
|
||||||
}
|
}
|
||||||
if not minetest.registered_nodes[node] then
|
|
||||||
error(f("cannot register stairs for unknown node %q", node))
|
|
||||||
end
|
|
||||||
if is_legacy_drawtype(node) then
|
if is_legacy_drawtype(node) then
|
||||||
meta.ignore_drawtype = true
|
meta.ignore_drawtype = true
|
||||||
end
|
end
|
||||||
|
@ -41,7 +46,19 @@ function stairs.register_stair(subname, node, groups, tiles, description, sounds
|
||||||
minetest.register_alias(("stairs:stair_%s"):format(subname), api.format_name(node, "stair"))
|
minetest.register_alias(("stairs:stair_%s"):format(subname), api.format_name(node, "stair"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function stairs.register_slab(subname, node, groups, images, description, sounds, worldaligntex)
|
function stairs.register_slab(subname, node, groups, tiles, description, sounds, worldaligntex)
|
||||||
|
if not minetest.registered_nodes[node] then
|
||||||
|
-- registering a stair for a node that doesn't exist
|
||||||
|
if legacy_stairs_without_recipeitem then
|
||||||
|
legacy.register_slab(subname, node, groups, tiles, description, sounds, worldaligntex)
|
||||||
|
return
|
||||||
|
|
||||||
|
else
|
||||||
|
error(f("attempt to register stairs for unknown node %q. " ..
|
||||||
|
"set `stairs.legacy_stairs_without_recipeitem = true` in minetest.conf to enable this behavior.", node))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local meta = {
|
local meta = {
|
||||||
align_style = worldaligntex and "world" or default_align_style
|
align_style = worldaligntex and "world" or default_align_style
|
||||||
}
|
}
|
||||||
|
@ -54,7 +71,7 @@ function stairs.register_slab(subname, node, groups, images, description, sounds
|
||||||
|
|
||||||
api.register_single(node, "slab_8", {
|
api.register_single(node, "slab_8", {
|
||||||
groups = groups,
|
groups = groups,
|
||||||
tiles = images,
|
tiles = tiles,
|
||||||
description = description,
|
description = description,
|
||||||
sounds = sounds,
|
sounds = sounds,
|
||||||
}, meta)
|
}, meta)
|
||||||
|
@ -63,6 +80,19 @@ function stairs.register_slab(subname, node, groups, images, description, sounds
|
||||||
end
|
end
|
||||||
|
|
||||||
function stairs.register_stair_inner(subname, node, groups, tiles, description, sounds, worldaligntex, full_description)
|
function stairs.register_stair_inner(subname, node, groups, tiles, description, sounds, worldaligntex, full_description)
|
||||||
|
if not minetest.registered_nodes[node] then
|
||||||
|
-- registering a stair for a node that doesn't exist
|
||||||
|
if legacy_stairs_without_recipeitem then
|
||||||
|
legacy.register_stair_inner(subname, node, groups, tiles, description, sounds, worldaligntex,
|
||||||
|
full_description)
|
||||||
|
return
|
||||||
|
|
||||||
|
else
|
||||||
|
error(f("attempt to register stairs for unknown node %q. " ..
|
||||||
|
"set `stairs.legacy_stairs_without_recipeitem = true` in minetest.conf to enable this behavior.", node))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local meta = {
|
local meta = {
|
||||||
align_style = worldaligntex and "world" or default_align_style
|
align_style = worldaligntex and "world" or default_align_style
|
||||||
}
|
}
|
||||||
|
@ -84,6 +114,19 @@ function stairs.register_stair_inner(subname, node, groups, tiles, description,
|
||||||
end
|
end
|
||||||
|
|
||||||
function stairs.register_stair_outer(subname, node, groups, tiles, description, sounds, worldaligntex, full_description)
|
function stairs.register_stair_outer(subname, node, groups, tiles, description, sounds, worldaligntex, full_description)
|
||||||
|
if not minetest.registered_nodes[node] then
|
||||||
|
-- registering a stair for a node that doesn't exist
|
||||||
|
if legacy_stairs_without_recipeitem then
|
||||||
|
legacy.register_stair_outer(subname, node, groups, tiles, description, sounds, worldaligntex,
|
||||||
|
full_description)
|
||||||
|
return
|
||||||
|
|
||||||
|
else
|
||||||
|
error(f("attempt to register stairs for unknown node %q. " ..
|
||||||
|
"set `stairs.legacy_stairs_without_recipeitem = true` in minetest.conf to enable this behavior.", node))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local meta = {
|
local meta = {
|
||||||
align_style = worldaligntex and "world" or default_align_style
|
align_style = worldaligntex and "world" or default_align_style
|
||||||
}
|
}
|
||||||
|
@ -104,68 +147,12 @@ 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"))
|
minetest.register_alias(("stairs:stair_outer_%s"):format(subname), api.format_name(node, "stair_outer"))
|
||||||
end
|
end
|
||||||
|
|
||||||
local stair_name_formats = {
|
function stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds,
|
||||||
stair = "stairs:stair_%s",
|
worldaligntex, desc_stair_inner, desc_stair_outer)
|
||||||
slab_8 = "stairs:slab_%s",
|
stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds, worldaligntex)
|
||||||
stair_inner = "stairs:stair_inner_%s",
|
stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds, worldaligntex)
|
||||||
stair_outer = "stairs:stair_outer_%s",
|
stairs.register_stair_inner(subname, recipeitem, groups, images, desc_stair, sounds, worldaligntex,
|
||||||
}
|
desc_stair_inner)
|
||||||
|
stairs.register_stair_outer(subname, recipeitem, groups, images, desc_stair, sounds, worldaligntex,
|
||||||
function stairsplus.compat.override_stairs(name, node, overrides, meta)
|
desc_stair_outer)
|
||||||
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
|
|
||||||
|
|
||||||
if not crafting_schemata_enabled then
|
|
||||||
local stair_name = stair_name_formats.stair:format(name)
|
|
||||||
local slab_name = stair_name_formats.slab_8:format(name)
|
|
||||||
|
|
||||||
minetest.clear_craft({
|
|
||||||
recipe = {
|
|
||||||
{ stair_name, stair_name },
|
|
||||||
{ stair_name, stair_name },
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.clear_craft({
|
|
||||||
recipe = {
|
|
||||||
{ slab_name },
|
|
||||||
{ slab_name },
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.clear_craft({
|
|
||||||
recipe = {
|
|
||||||
{"", "", node},
|
|
||||||
{"", node, node},
|
|
||||||
{node, node, node},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.clear_craft({
|
|
||||||
recipe = {
|
|
||||||
{node, node, node},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.clear_craft({
|
|
||||||
recipe = {
|
|
||||||
{"", node, ""},
|
|
||||||
{node, "", node},
|
|
||||||
{node, node, node},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
minetest.clear_craft({
|
|
||||||
recipe = {
|
|
||||||
{"", node, ""},
|
|
||||||
{node, node, node},
|
|
||||||
}
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
end
|
4
stairs/compat.lua
Normal file
4
stairs/compat.lua
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
-- for very, very old worlds...
|
||||||
|
|
||||||
|
minetest.register_alias("stairs:stair_pinewood", "stairs:stair_pine_wood")
|
||||||
|
minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood")
|
33
stairs/init.lua
Normal file
33
stairs/init.lua
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
local modname = minetest.get_current_modname()
|
||||||
|
local modpath = minetest.get_modpath(modname)
|
||||||
|
local S = minetest.get_translator(modname)
|
||||||
|
|
||||||
|
stairs = {
|
||||||
|
version = {3, 0, 0},
|
||||||
|
fork = "minetest_mods",
|
||||||
|
|
||||||
|
modname = modname,
|
||||||
|
modpath = modpath,
|
||||||
|
|
||||||
|
S = S,
|
||||||
|
|
||||||
|
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, ...)
|
||||||
|
return minetest.log(level, ("[%s] %s"):format(modname, messagefmt:format(...)))
|
||||||
|
end,
|
||||||
|
|
||||||
|
dofile = function(...)
|
||||||
|
return dofile(table.concat({modpath, ...}, DIR_DELIM) .. ".lua")
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
|
stairs.dofile("util")
|
||||||
|
stairs.dofile("legacy")
|
||||||
|
stairs.dofile("api")
|
||||||
|
stairs.dofile("compat")
|
245
stairs/legacy.lua
Normal file
245
stairs/legacy.lua
Normal file
|
@ -0,0 +1,245 @@
|
||||||
|
local rotate_and_place = minetest.rotate_and_place
|
||||||
|
|
||||||
|
local get_node_vars = stairs.util.get_node_vars
|
||||||
|
local get_stair_images = stairs.util.get_stair_images
|
||||||
|
|
||||||
|
local legacy = {}
|
||||||
|
|
||||||
|
local nodeboxes = {
|
||||||
|
stair = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
|
||||||
|
{-0.5, 0.0, 0.0, 0.5, 0.5, 0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
slab = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||||
|
},
|
||||||
|
stair_inner = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
|
||||||
|
{-0.5, 0.0, 0.0, 0.5, 0.5, 0.5},
|
||||||
|
{-0.5, 0.0, -0.5, 0.0, 0.5, 0.0},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
stair_outer = {
|
||||||
|
type = "fixed",
|
||||||
|
fixed = {
|
||||||
|
{-0.5, -0.5, -0.5, 0.5, 0.0, 0.5},
|
||||||
|
{-0.5, 0.0, 0.0, 0.0, 0.5, 0.5},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
local function register_generic(name, recipeitem, groups, images, description, sounds, worldaligntex, nodebox)
|
||||||
|
if not nodebox then
|
||||||
|
error()
|
||||||
|
end
|
||||||
|
|
||||||
|
local light_source, texture_alpha, sunlight = get_node_vars(recipeitem)
|
||||||
|
|
||||||
|
local stair_images = get_stair_images(images, worldaligntex)
|
||||||
|
|
||||||
|
minetest.register_node(name, {
|
||||||
|
description = description,
|
||||||
|
drawtype = "nodebox",
|
||||||
|
tiles = stair_images,
|
||||||
|
use_texture_alpha = texture_alpha,
|
||||||
|
sunlight_propagates = sunlight,
|
||||||
|
light_source = light_source,
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "facedir",
|
||||||
|
is_ground_content = false,
|
||||||
|
groups = groups,
|
||||||
|
sounds = sounds,
|
||||||
|
node_box = nodebox,
|
||||||
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
if pointed_thing.type ~= "node" then
|
||||||
|
return itemstack
|
||||||
|
end
|
||||||
|
|
||||||
|
return rotate_and_place(itemstack, placer, pointed_thing)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
function legacy.register_stair(subname, recipeitem, groups, images, description, sounds, worldaligntex)
|
||||||
|
local new_groups = table.copy(groups)
|
||||||
|
new_groups.stair = 1
|
||||||
|
|
||||||
|
register_generic(":stairs:stair_" .. subname, recipeitem, new_groups, images, description, sounds,
|
||||||
|
worldaligntex, nodeboxes.stair)
|
||||||
|
|
||||||
|
if recipeitem and minetest.registered_nodes[recipeitem] then
|
||||||
|
-- Recipe matches appearence in inventory
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "stairs:stair_" .. subname .. " 8",
|
||||||
|
recipe = {
|
||||||
|
{"", "", recipeitem},
|
||||||
|
{"", recipeitem, recipeitem},
|
||||||
|
{recipeitem, recipeitem, recipeitem},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use stairs to craft full blocks again (1:1)
|
||||||
|
minetest.register_craft({
|
||||||
|
output = recipeitem .. " 3",
|
||||||
|
recipe = {
|
||||||
|
{"stairs:stair_" .. subname, "stairs:stair_" .. subname},
|
||||||
|
{"stairs:stair_" .. subname, "stairs:stair_" .. subname},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Fuel
|
||||||
|
local baseburntime = minetest.get_craft_result({
|
||||||
|
method = "fuel",
|
||||||
|
width = 1,
|
||||||
|
items = {recipeitem}
|
||||||
|
}).time
|
||||||
|
|
||||||
|
if baseburntime > 0 then
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "stairs:stair_" .. subname,
|
||||||
|
burntime = math.floor(baseburntime * 0.75),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Register slab
|
||||||
|
-- Node will be called stairs:slab_<subname>
|
||||||
|
|
||||||
|
function legacy.register_slab(subname, recipeitem, groups, images, description, sounds, worldaligntex)
|
||||||
|
local new_groups = table.copy(groups)
|
||||||
|
new_groups.slab = 1
|
||||||
|
|
||||||
|
register_generic(":stairs:slab_" .. subname, recipeitem, new_groups, images, description, sounds,
|
||||||
|
worldaligntex, nodeboxes.slab)
|
||||||
|
|
||||||
|
if recipeitem and minetest.registered_nodes[recipeitem] then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "stairs:slab_" .. subname .. " 6",
|
||||||
|
recipe = {
|
||||||
|
{recipeitem, recipeitem, recipeitem},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Use 2 slabs to craft a full block again (1:1)
|
||||||
|
minetest.register_craft({
|
||||||
|
output = recipeitem,
|
||||||
|
recipe = {
|
||||||
|
{"stairs:slab_" .. subname},
|
||||||
|
{"stairs:slab_" .. subname},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Fuel
|
||||||
|
local baseburntime = minetest.get_craft_result({
|
||||||
|
method = "fuel",
|
||||||
|
width = 1,
|
||||||
|
items = {recipeitem}
|
||||||
|
}).time
|
||||||
|
if baseburntime > 0 then
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "stairs:slab_" .. subname,
|
||||||
|
burntime = math.floor(baseburntime * 0.5),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Register inner stair
|
||||||
|
-- Node will be called stairs:stair_inner_<subname>
|
||||||
|
|
||||||
|
function legacy.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex,
|
||||||
|
full_description)
|
||||||
|
|
||||||
|
local new_groups = table.copy(groups)
|
||||||
|
new_groups.stair = 1
|
||||||
|
if full_description then
|
||||||
|
description = full_description
|
||||||
|
else
|
||||||
|
description = "Inner " .. description
|
||||||
|
end
|
||||||
|
|
||||||
|
register_generic(":stairs:stair_inner_" .. subname, recipeitem, new_groups, images, description, sounds,
|
||||||
|
worldaligntex, nodeboxes.stair_inner)
|
||||||
|
|
||||||
|
if recipeitem and minetest.registered_nodes[recipeitem] then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "stairs:stair_inner_" .. subname .. " 7",
|
||||||
|
recipe = {
|
||||||
|
{"", recipeitem, ""},
|
||||||
|
{recipeitem, "", recipeitem},
|
||||||
|
{recipeitem, recipeitem, recipeitem},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Fuel
|
||||||
|
local baseburntime = minetest.get_craft_result({
|
||||||
|
method = "fuel",
|
||||||
|
width = 1,
|
||||||
|
items = {recipeitem}
|
||||||
|
}).time
|
||||||
|
|
||||||
|
if baseburntime > 0 then
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "stairs:stair_inner_" .. subname,
|
||||||
|
burntime = math.floor(baseburntime * 0.875),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Register outer stair
|
||||||
|
-- Node will be called stairs:stair_outer_<subname>
|
||||||
|
|
||||||
|
function legacy.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex,
|
||||||
|
full_description)
|
||||||
|
local new_groups = table.copy(groups)
|
||||||
|
new_groups.stair = 1
|
||||||
|
|
||||||
|
if full_description then
|
||||||
|
description = full_description
|
||||||
|
else
|
||||||
|
description = "Outer " .. description
|
||||||
|
end
|
||||||
|
|
||||||
|
register_generic(":stairs:stair_outer_" .. subname, recipeitem, new_groups, images, description, sounds,
|
||||||
|
worldaligntex, nodeboxes.stair_outer)
|
||||||
|
|
||||||
|
if recipeitem and minetest.registered_nodes[recipeitem] then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "stairs:stair_outer_" .. subname .. " 6",
|
||||||
|
recipe = {
|
||||||
|
{"", recipeitem, ""},
|
||||||
|
{recipeitem, recipeitem, recipeitem},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- Fuel
|
||||||
|
local baseburntime = minetest.get_craft_result({
|
||||||
|
method = "fuel",
|
||||||
|
width = 1,
|
||||||
|
items = {recipeitem}
|
||||||
|
}).time
|
||||||
|
|
||||||
|
if baseburntime > 0 then
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "fuel",
|
||||||
|
recipe = "stairs:stair_outer_" .. subname,
|
||||||
|
burntime = math.floor(baseburntime * 0.625),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
stairs.legacy = legacy
|
5
stairs/mod.conf
Normal file
5
stairs/mod.conf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
name = stairs
|
||||||
|
version = 3.0.0
|
||||||
|
title = Stairs+'s Stairs Compat layer
|
||||||
|
description = stair API
|
||||||
|
depends = stairsplus
|
5
stairs/settings.lua
Normal file
5
stairs/settings.lua
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
local s = minetest.settings
|
||||||
|
|
||||||
|
stairs.settings = {
|
||||||
|
legacy_stairs_without_recipeitem = s:get_bool("stairs.legacy_stairs_without_recipeitem", false),
|
||||||
|
}
|
47
stairs/util.lua
Normal file
47
stairs/util.lua
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
local default_align_style = stairsplus.settings.default_align_style
|
||||||
|
|
||||||
|
local util = {}
|
||||||
|
|
||||||
|
-- get node settings to use for stairs
|
||||||
|
function util.get_node_vars(nodename)
|
||||||
|
local def = minetest.registered_nodes[nodename]
|
||||||
|
|
||||||
|
if def then
|
||||||
|
return def.light_source, def.use_texture_alpha, def.sunlight_propagates
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function util.get_stair_images(images, worldaligntex)
|
||||||
|
local stair_images = {}
|
||||||
|
|
||||||
|
for i, image in ipairs(images) do
|
||||||
|
local stair_image
|
||||||
|
|
||||||
|
if type(image) == "string" then
|
||||||
|
stair_image = {
|
||||||
|
name = image,
|
||||||
|
backface_culling = true,
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
stair_image = table.copy(image)
|
||||||
|
if stair_image.backface_culling == nil then
|
||||||
|
stair_image.backface_culling = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if stair_image.align_style == nil then
|
||||||
|
if worldaligntex then
|
||||||
|
stair_image.align_style = "world"
|
||||||
|
else
|
||||||
|
stair_image.align_style = default_align_style
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
stair_images[i] = stair_image
|
||||||
|
end
|
||||||
|
|
||||||
|
return stair_images
|
||||||
|
end
|
||||||
|
|
||||||
|
stairs.util = util
|
|
@ -24,7 +24,6 @@ stds.minetest = {
|
||||||
stds.stairsplus = {
|
stds.stairsplus = {
|
||||||
globals = {
|
globals = {
|
||||||
"stairsplus",
|
"stairsplus",
|
||||||
"stairs", -- we take over control of stairs
|
|
||||||
},
|
},
|
||||||
read_globals = {
|
read_globals = {
|
||||||
"default",
|
"default",
|
||||||
|
|
|
@ -20,5 +20,4 @@ stairsplus.compat = {
|
||||||
stairsplus.dofile("compat", "i3")
|
stairsplus.dofile("compat", "i3")
|
||||||
stairsplus.dofile("compat", "unified_inventory")
|
stairsplus.dofile("compat", "unified_inventory")
|
||||||
|
|
||||||
stairsplus.dofile("compat", "stairs")
|
|
||||||
stairsplus.dofile("compat", "old_moreblocks")
|
stairsplus.dofile("compat", "old_moreblocks")
|
||||||
|
|
|
@ -2,4 +2,4 @@ name = stairsplus
|
||||||
version = 3.0.0
|
version = 3.0.0
|
||||||
title = Stairs+
|
title = Stairs+
|
||||||
description = Microblock API
|
description = Microblock API
|
||||||
optional_depends = default, i3, stairs, unified_inventory
|
optional_depends = i3, unified_inventory
|
||||||
|
|
|
@ -1,85 +1,47 @@
|
||||||
if stairsplus_legacy.has.stairs then
|
|
||||||
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", nil, {ignore_paramtype2 = true})
|
|
||||||
stairsplus.compat.override_stairs("obsidian_glass", "default:obsidian_glass", nil, {ignore_paramtype2 = true})
|
|
||||||
end
|
|
||||||
|
|
||||||
local default_nodes = { -- Default stairs/slabs/panels/microblocks:
|
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_tree",
|
||||||
"acacia_wood",
|
"acacia_wood",
|
||||||
"aspen_tree",
|
"aspen_tree",
|
||||||
"aspen_wood",
|
"aspen_wood",
|
||||||
|
"brick",
|
||||||
|
"bronzeblock",
|
||||||
|
"cobble",
|
||||||
|
"copperblock",
|
||||||
|
"coral_skeleton",
|
||||||
|
"default:ice",
|
||||||
|
"desert_cobble",
|
||||||
|
"desert_sandstone",
|
||||||
|
"desert_sandstone_block",
|
||||||
|
"desert_sandstone_brick",
|
||||||
|
"desert_stone",
|
||||||
|
"desert_stone_block",
|
||||||
|
"desert_stonebrick",
|
||||||
|
"diamondblock",
|
||||||
|
"goldblock",
|
||||||
|
"ice",
|
||||||
|
"jungletree",
|
||||||
|
"junglewood",
|
||||||
|
"meselamp",
|
||||||
|
"mossycobble",
|
||||||
"obsidian",
|
"obsidian",
|
||||||
"obsidian_block",
|
"obsidian_block",
|
||||||
"obsidianbrick",
|
"obsidianbrick",
|
||||||
"stonebrick",
|
"pine_tree",
|
||||||
"desert_stonebrick",
|
"pine_wood",
|
||||||
|
"sandstone",
|
||||||
|
"sandstone_block",
|
||||||
"sandstonebrick",
|
"sandstonebrick",
|
||||||
"silver_sandstone",
|
"silver_sandstone",
|
||||||
"silver_sandstone_brick",
|
|
||||||
"silver_sandstone_block",
|
"silver_sandstone_block",
|
||||||
"desert_sandstone",
|
"silver_sandstone_brick",
|
||||||
"desert_sandstone_brick",
|
"snowblock",
|
||||||
"desert_sandstone_block",
|
"steelblock",
|
||||||
"sandstone_block",
|
"stone",
|
||||||
"coral_skeleton",
|
"stone_block",
|
||||||
"ice",
|
"stonebrick",
|
||||||
"sand", -- TODO tmp remove
|
"tinblock",
|
||||||
|
"tree",
|
||||||
|
"wood",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, name in ipairs(default_nodes) do
|
for _, name in ipairs(default_nodes) do
|
||||||
|
@ -87,6 +49,7 @@ for _, name in ipairs(default_nodes) do
|
||||||
if minetest.registered_nodes[node] then
|
if minetest.registered_nodes[node] then
|
||||||
stairsplus_legacy.register_legacy(node)
|
stairsplus_legacy.register_legacy(node)
|
||||||
stairsplus.api.register_alias_all(("moreblocks:%s"):format(name), node)
|
stairsplus.api.register_alias_all(("moreblocks:%s"):format(name), node)
|
||||||
|
stairsplus.api.register_alias_all(("stairs:%s"):format(name), node)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -101,6 +64,7 @@ for _, name in ipairs(glass) do
|
||||||
if minetest.registered_nodes[node] then
|
if minetest.registered_nodes[node] then
|
||||||
stairsplus_legacy.register_legacy(node, nil, {ignore_paramtype2 = true})
|
stairsplus_legacy.register_legacy(node, nil, {ignore_paramtype2 = true})
|
||||||
stairsplus.api.register_alias_all(("moreblocks:%s"):format(name), node)
|
stairsplus.api.register_alias_all(("moreblocks:%s"):format(name), node)
|
||||||
|
stairsplus.api.register_alias_all(("stairs:%s"):format(name), node)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
if stairsplus_legacy.has.stairs then
|
|
||||||
stairsplus.compat.override_stairs("straw", "farming:straw")
|
|
||||||
end
|
|
||||||
|
|
||||||
local farming_nodes = {"straw"}
|
local farming_nodes = {"straw"}
|
||||||
for _, name in pairs(farming_nodes) do
|
for _, name in pairs(farming_nodes) do
|
||||||
local node = ("farming:%s"):format(name)
|
local node = ("farming:%s"):format(name)
|
||||||
if minetest.registered_nodes[node] then
|
if minetest.registered_nodes[node] then
|
||||||
stairsplus_legacy.register_legacy(node)
|
stairsplus_legacy.register_legacy(node)
|
||||||
stairsplus.api.register_alias_all(("moreblocks:%s"):format(name), node)
|
stairsplus.api.register_alias_all(("moreblocks:%s"):format(name), node)
|
||||||
|
stairsplus.api.register_alias_all(("stairs:%s"):format(name), node)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user