keep in line with default stairs
This commit is contained in:
parent
cb928ea42d
commit
fefd9b6d07
214
init.lua
214
init.lua
@ -17,8 +17,10 @@ stairs.dirt = default.node_sound_dirt_defaults()
|
||||
stairs.stone = default.node_sound_stone_defaults()
|
||||
stairs.glass = default.node_sound_glass_defaults()
|
||||
stairs.leaves = default.node_sound_leaves_defaults()
|
||||
stairs.wool = default.node_sound_wool_defaults() -- Xanadu only
|
||||
--stairs.wool = stairs.leaves
|
||||
stairs.wool = stairs.leaves
|
||||
if minetest.get_modpath("xanadu") then
|
||||
stairs.wool = default.node_sound_wool_defaults() -- Xanadu only
|
||||
end
|
||||
|
||||
-- Don"t break on 0.4.14 and earlier.
|
||||
stairs.metal = (default.node_sound_metal_defaults
|
||||
@ -50,42 +52,44 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
||||
stair_images[i] = {
|
||||
name = image,
|
||||
backface_culling = true,
|
||||
align_style = "world",
|
||||
}
|
||||
elseif image.backface_culling == nil then -- override using any other value
|
||||
stair_images[i] = table.copy(image)
|
||||
stair_images[i].backface_culling = true
|
||||
if stair_images[i].backface_culling == nil then
|
||||
stair_images[i].backface_culling = true
|
||||
end
|
||||
if stair_images[i].align_style == nil then
|
||||
stair_images[i].align_style = "world"
|
||||
end
|
||||
end
|
||||
end
|
||||
groups.stair = 1
|
||||
local new_groups = table.copy(groups)
|
||||
new_groups.stair = 1
|
||||
minetest.register_node(":stairs:stair_" .. subname, {
|
||||
description = description,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairs_stair.obj",
|
||||
tiles = stair_images, -- images,
|
||||
drawtype = "nodebox",
|
||||
tiles = stair_images,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = alpha,
|
||||
groups = groups,
|
||||
groups = new_groups,
|
||||
sounds = snds,
|
||||
selection_box = {
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = {
|
||||
{-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
--on_place = minetest.rotate_node
|
||||
on_place = rotate_node
|
||||
})
|
||||
|
||||
-- if no recipe item provided then skip craft recipes
|
||||
if not recipeitem then
|
||||
return
|
||||
end
|
||||
|
||||
-- stair recipes
|
||||
minetest.register_craft({
|
||||
output = "stairs:stair_" .. subname .. " 8",
|
||||
@ -96,15 +100,6 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "stairs:stair_" .. subname .. " 8",
|
||||
recipe = {
|
||||
{"", "", recipeitem},
|
||||
{"", recipeitem, recipeitem},
|
||||
{recipeitem, recipeitem, recipeitem},
|
||||
},
|
||||
})
|
||||
|
||||
-- stair to original material recipe
|
||||
minetest.register_craft({
|
||||
output = recipeitem .. " 3",
|
||||
@ -113,30 +108,49 @@ function stairs.register_stair(subname, recipeitem, groups, images, description,
|
||||
{"stairs:stair_" .. subname, "stairs:stair_" .. subname},
|
||||
},
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
-- Node will be called stairs:slab_<subname>
|
||||
function stairs.register_slab(subname, recipeitem, groups, images, description, snds, alpha)
|
||||
groups.slab = 1
|
||||
-- Set world-aligned textures
|
||||
local slab_images = {}
|
||||
for i, image in ipairs(images) do
|
||||
if type(image) == "string" then
|
||||
slab_images[i] = {
|
||||
name = image,
|
||||
align_style = "world",
|
||||
}
|
||||
else
|
||||
slab_images[i] = table.copy(image)
|
||||
if image.align_style == nil then
|
||||
slab_images[i].align_style = "world"
|
||||
end
|
||||
end
|
||||
end
|
||||
local new_groups = table.copy(groups)
|
||||
new_groups.slab = 1
|
||||
minetest.register_node(":stairs:slab_" .. subname, {
|
||||
description = description,
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
tiles = slab_images,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = alpha,
|
||||
groups = groups,
|
||||
groups = new_groups,
|
||||
sounds = snds,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5},
|
||||
},
|
||||
--on_place = minetest.rotate_node
|
||||
on_place = rotate_node
|
||||
})
|
||||
|
||||
-- if no recipe item provided then skip craft recipes
|
||||
if not recipeitem then
|
||||
return
|
||||
end
|
||||
|
||||
-- slab recipe
|
||||
minetest.register_craft({
|
||||
output = "stairs:slab_" .. subname .. " 6",
|
||||
@ -147,23 +161,46 @@ function stairs.register_slab(subname, recipeitem, groups, images, description,
|
||||
|
||||
-- slab to original material recipe
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = recipeitem,
|
||||
recipe = {"stairs:slab_" .. subname, "stairs:slab_" .. subname}
|
||||
recipe = {
|
||||
{"stairs:slab_" .. subname},
|
||||
{"stairs:slab_" .. subname},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
-- Node will be called stairs:corner_<subname>
|
||||
-- Node will be called stairs:corner_<subname> (outer stair)
|
||||
function stairs.register_corner(subname, recipeitem, groups, images, description, snds, alpha)
|
||||
-- Set backface culling and world-aligned textures
|
||||
local stair_images = {}
|
||||
for i, image in ipairs(images) do
|
||||
if type(image) == "string" then
|
||||
stair_images[i] = {
|
||||
name = image,
|
||||
backface_culling = true,
|
||||
align_style = "world",
|
||||
}
|
||||
else
|
||||
stair_images[i] = table.copy(image)
|
||||
if stair_images[i].backface_culling == nil then
|
||||
stair_images[i].backface_culling = true
|
||||
end
|
||||
if stair_images[i].align_style == nil then
|
||||
stair_images[i].align_style = "world"
|
||||
end
|
||||
end
|
||||
end
|
||||
local new_groups = table.copy(groups)
|
||||
new_groups.stair = 1
|
||||
minetest.register_node(":stairs:corner_" .. subname, {
|
||||
description = description,
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
tiles = stair_images,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = alpha,
|
||||
groups = groups,
|
||||
groups = new_groups,
|
||||
sounds = snds,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
@ -172,10 +209,14 @@ function stairs.register_corner(subname, recipeitem, groups, images, description
|
||||
{-0.5, 0, 0, 0, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
--on_place = minetest.rotate_node
|
||||
on_place = rotate_node
|
||||
})
|
||||
|
||||
-- if no recipe item provided then skip craft recipes
|
||||
if not recipeitem then
|
||||
return
|
||||
end
|
||||
|
||||
-- corner stair recipe
|
||||
minetest.register_craft({
|
||||
output = "stairs:corner_" .. subname .. " 6",
|
||||
@ -188,23 +229,46 @@ function stairs.register_corner(subname, recipeitem, groups, images, description
|
||||
|
||||
-- corner stair to original material recipe
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = recipeitem .. " 2",
|
||||
recipe = {"stairs:corner_" .. subname, "stairs:corner_" .. subname, "stairs:corner_" .. subname}
|
||||
recipe = {
|
||||
{"stairs:corner_" .. subname, "stairs:corner_" .. subname},
|
||||
{"stairs:corner_" .. subname, "stairs:corner_" .. subname},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
-- Node will be called stairs:invcorner_<subname>
|
||||
-- Node will be called stairs:invcorner_<subname> (inner stair)
|
||||
function stairs.register_invcorner(subname, recipeitem, groups, images, description, snds, alpha)
|
||||
-- Set backface culling and world-aligned textures
|
||||
local stair_images = {}
|
||||
for i, image in ipairs(images) do
|
||||
if type(image) == "string" then
|
||||
stair_images[i] = {
|
||||
name = image,
|
||||
backface_culling = true,
|
||||
align_style = "world",
|
||||
}
|
||||
else
|
||||
stair_images[i] = table.copy(image)
|
||||
if stair_images[i].backface_culling == nil then
|
||||
stair_images[i].backface_culling = true
|
||||
end
|
||||
if stair_images[i].align_style == nil then
|
||||
stair_images[i].align_style = "world"
|
||||
end
|
||||
end
|
||||
end
|
||||
local new_groups = table.copy(groups)
|
||||
new_groups.stair = 1
|
||||
minetest.register_node(":stairs:invcorner_" .. subname, {
|
||||
description = description,
|
||||
drawtype = "nodebox",
|
||||
tiles = images,
|
||||
tiles = stair_images,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = alpha,
|
||||
groups = groups,
|
||||
groups = new_groups,
|
||||
sounds = snds,
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
@ -214,13 +278,17 @@ function stairs.register_invcorner(subname, recipeitem, groups, images, descript
|
||||
{-0.5, 0, -0.5, 0, 0.5, 0},
|
||||
},
|
||||
},
|
||||
--on_place = minetest.rotate_node
|
||||
on_place = rotate_node
|
||||
})
|
||||
|
||||
-- if no recipe item provided then skip craft recipes
|
||||
if not recipeitem then
|
||||
return
|
||||
end
|
||||
|
||||
-- inside corner stair recipe
|
||||
minetest.register_craft({
|
||||
output = "stairs:invcorner_" .. subname .. " 6", -- was 8
|
||||
output = "stairs:invcorner_" .. subname .. " 9",
|
||||
recipe = {
|
||||
{recipeitem, recipeitem, ""},
|
||||
{recipeitem, recipeitem, recipeitem},
|
||||
@ -230,37 +298,47 @@ function stairs.register_invcorner(subname, recipeitem, groups, images, descript
|
||||
|
||||
-- inside corner stair to original material recipe
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = recipeitem .. " 4",
|
||||
recipe = {"stairs:invcorner_" .. subname,
|
||||
"stairs:invcorner_" .. subname, "stairs:invcorner_" .. subname}
|
||||
output = recipeitem .. " 3",
|
||||
recipe = {
|
||||
{"stairs:invcorner_" .. subname, "stairs:invcorner_" .. subname},
|
||||
{"stairs:invcorner_" .. subname, "stairs:invcorner_" .. subname},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
-- Node will be called stairs:slope_<subname>
|
||||
function stairs.register_slope(subname, recipeitem, groups, images, description, snds, alpha)
|
||||
-- Set backface culling and world-aligned textures
|
||||
local stair_images = {}
|
||||
for i, image in ipairs(images) do
|
||||
if type(image) == "string" then
|
||||
stair_images[i] = {
|
||||
name = image,
|
||||
backface_culling = true,
|
||||
align_style = "world",
|
||||
}
|
||||
elseif image.backface_culling == nil then -- override using any other value
|
||||
else
|
||||
stair_images[i] = table.copy(image)
|
||||
stair_images[i].backface_culling = true
|
||||
if stair_images[i].backface_culling == nil then
|
||||
stair_images[i].backface_culling = true
|
||||
end
|
||||
if stair_images[i].align_style == nil then
|
||||
stair_images[i].align_style = "world"
|
||||
end
|
||||
end
|
||||
end
|
||||
local new_groups = table.copy(groups)
|
||||
new_groups.stair = 1
|
||||
minetest.register_node(":stairs:slope_" .. subname, {
|
||||
description = description,
|
||||
drawtype = "mesh",
|
||||
mesh = "stairs_slope.obj",
|
||||
tiles = stair_images, --images,
|
||||
tiles = stair_images,
|
||||
paramtype = "light",
|
||||
paramtype2 = "facedir",
|
||||
is_ground_content = false,
|
||||
use_texture_alpha = alpha,
|
||||
groups = groups,
|
||||
groups = new_groups,
|
||||
sounds = snds,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
@ -276,7 +354,6 @@ function stairs.register_slope(subname, recipeitem, groups, images, description,
|
||||
{-0.5, 0, 0, 0.5, 0.5, 0.5},
|
||||
},
|
||||
},
|
||||
--on_place = minetest.rotate_node
|
||||
on_place = rotate_node
|
||||
})
|
||||
|
||||
@ -291,9 +368,10 @@ function stairs.register_slope(subname, recipeitem, groups, images, description,
|
||||
|
||||
-- slope to original material recipe
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = recipeitem,
|
||||
recipe = {"stairs:slope_" .. subname, "stairs:slope_" .. subname}
|
||||
recipe = {
|
||||
{"stairs:slope_" .. subname, "stairs:slope_" .. subname},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
@ -306,16 +384,16 @@ end
|
||||
|
||||
-- Nodes will be called stairs:{stair,slab,corner,invcorner,slope}_<subname>
|
||||
function stairs.register_all(subname, recipeitem, groups, images, desc, snds, alpha)
|
||||
local str = " Stair"
|
||||
stairs.register_stair(subname, recipeitem, groups, images, desc .. str, snds, alpha)
|
||||
str = " Slab"
|
||||
stairs.register_slab(subname, recipeitem, groups, images, desc .. str, snds, alpha)
|
||||
str = " Corner"
|
||||
stairs.register_corner(subname, recipeitem, groups, images, desc .. str, snds, alpha)
|
||||
str = " Inverted Corner"
|
||||
stairs.register_invcorner(subname, recipeitem, groups, images, desc .. str, snds, alpha)
|
||||
str = " Slope"
|
||||
stairs.register_slope(subname, recipeitem, groups, images, desc .. str, snds, alpha)
|
||||
stairs.register_stair(subname, recipeitem, groups, images,
|
||||
desc .. " stair", snds, alpha)
|
||||
stairs.register_slab(subname, recipeitem, groups, images,
|
||||
desc .. " Slab", snds, alpha)
|
||||
stairs.register_corner(subname, recipeitem, groups, images,
|
||||
desc .. " Corner", snds, alpha)
|
||||
stairs.register_invcorner(subname, recipeitem, groups, images,
|
||||
desc .. " Inverted Corner", snds, alpha)
|
||||
stairs.register_slope(subname, recipeitem, groups, images,
|
||||
desc .. " Slope", snds, alpha)
|
||||
end
|
||||
|
||||
-- Wait for mods to load before registering stairs
|
||||
@ -536,8 +614,8 @@ stairs.register_all("bronzeblock", "default:bronzeblock",
|
||||
{"default_bronze_block.png"},
|
||||
"Bronze",
|
||||
stairs.metal)
|
||||
--========
|
||||
stairs.register_all("tinlock", "default:tinblock",
|
||||
|
||||
stairs.register_all("tinblock", "default:tinblock",
|
||||
{cracky = 1, level = 2},
|
||||
{"default_tin_block.png"},
|
||||
"Tin",
|
||||
|
@ -1,113 +0,0 @@
|
||||
# Blender v2.72 (sub 0) OBJ File: ''
|
||||
# www.blender.org
|
||||
mtllib stairs.mtl
|
||||
o stairs_top
|
||||
v -0.5 0.0 -0.5
|
||||
v -0.5 0.0 0.0
|
||||
v 0.5 0.0 0.0
|
||||
v 0.5 0.0 -0.5
|
||||
v -0.5 0.5 0.0
|
||||
v 0.5 0.5 0.0
|
||||
v -0.5 0.5 0.5
|
||||
v 0.5 0.5 0.5
|
||||
vt 0.0 0.0
|
||||
vt 1.0 0.0
|
||||
vt 1.0 0.5
|
||||
vt 0.0 0.5
|
||||
vt 1.0 1.0
|
||||
vt 0.0 1.0
|
||||
vn 0.0 1.0 0.0
|
||||
g stairs_top
|
||||
usemtl None
|
||||
s off
|
||||
f 4/1/1 1/2/1 2/3/1 3/4/1
|
||||
f 7/5/1 8/6/1 6/4/1 5/3/1
|
||||
o stairs_bottom
|
||||
v -0.5 -0.5 -0.5
|
||||
v 0.5 -0.5 -0.5
|
||||
v -0.5 -0.5 0.5
|
||||
v 0.5 -0.5 0.5
|
||||
vt 1.0 0.0
|
||||
vt 1.0 1.0
|
||||
vt 0.0 1.0
|
||||
vt 0.0 0.0
|
||||
vn 0.0 -1.0 -0.0
|
||||
g stairs_bottom
|
||||
usemtl None
|
||||
s off
|
||||
f 11/7/2 9/8/2 10/9/2 12/10/2
|
||||
o stairs_right
|
||||
v -0.5 0.0 -0.5
|
||||
v -0.5 -0.5 -0.5
|
||||
v -0.5 0.0 0.0
|
||||
v -0.5 -0.5 0.5
|
||||
v -0.5 0.5 0.0
|
||||
v -0.5 0.5 0.5
|
||||
vt 0.0 0.5
|
||||
vt 0.0 0.0
|
||||
vt 0.5 0.5
|
||||
vt 1.0 1.0
|
||||
vt 0.5 1.0
|
||||
vt 1.0 0.0
|
||||
vn -1.0 0.0 0.0
|
||||
g stairs_right
|
||||
usemtl None
|
||||
s off
|
||||
f 13/11/3 14/12/3 15/13/3
|
||||
f 15/13/3 18/14/3 17/15/3
|
||||
f 14/12/3 16/16/3 18/14/3
|
||||
o stairs_left
|
||||
v 0.5 0.0 0.0
|
||||
v 0.5 -0.5 -0.5
|
||||
v 0.5 0.0 -0.5
|
||||
v 0.5 -0.5 0.5
|
||||
v 0.5 0.5 0.0
|
||||
v 0.5 0.5 0.5
|
||||
vt 0.5 0.5
|
||||
vt 1.0 0.0
|
||||
vt 1.0 0.5
|
||||
vt 0.5 1.0
|
||||
vt 0.0 1.0
|
||||
vt 0.0 0.0
|
||||
vn 1.0 0.0 0.0
|
||||
g stairs_left
|
||||
usemtl None
|
||||
s off
|
||||
f 19/17/4 20/18/4 21/19/4
|
||||
f 19/17/4 23/20/4 24/21/4
|
||||
f 20/18/4 24/21/4 22/22/4
|
||||
o stairs_back
|
||||
v -0.5 -0.5 0.5
|
||||
v 0.5 -0.5 0.5
|
||||
v -0.5 0.5 0.5
|
||||
v 0.5 0.5 0.5
|
||||
vt 1.0 0.0
|
||||
vt 1.0 1.0
|
||||
vt 0.0 1.0
|
||||
vt 0.0 0.0
|
||||
vn 0.0 -0.0 1.0
|
||||
g stairs_back
|
||||
usemtl None
|
||||
s off
|
||||
f 26/23/5 28/24/5 27/25/5 25/26/5
|
||||
o stairs_front
|
||||
v -0.5 0.0 -0.5
|
||||
v -0.5 -0.5 -0.5
|
||||
v -0.5 0.0 0.0
|
||||
v 0.5 0.0 0.0
|
||||
v 0.5 -0.5 -0.5
|
||||
v 0.5 0.0 -0.5
|
||||
v -0.5 0.5 0.0
|
||||
v 0.5 0.5 0.0
|
||||
vt 1.0 0.0
|
||||
vt 1.0 0.5
|
||||
vt 0.0 0.5
|
||||
vt 0.0 0.0
|
||||
vt 1.0 1.0
|
||||
vt 0.0 1.0
|
||||
vn 0.0 0.0 -1.0
|
||||
g stairs_front
|
||||
usemtl None
|
||||
s off
|
||||
f 30/27/6 29/28/6 34/29/6 33/30/6
|
||||
f 31/28/6 35/31/6 36/32/6 32/29/6
|
Loading…
x
Reference in New Issue
Block a user