Add things
This commit is contained in:
parent
4d8312b79d
commit
00e1fd985d
28 changed files with 395 additions and 31 deletions
|
|
@ -15,10 +15,45 @@ function ns.register_slab(def)
|
|||
}))
|
||||
end
|
||||
|
||||
function ns.update_stair(pos, basename, leaf)
|
||||
local node = minetest.get_node(pos)
|
||||
local neighbors = {}
|
||||
local dir
|
||||
local pipe
|
||||
|
||||
for _, offset in ipairs(rgt.adjacent_horizontal_neighbor_offests) do
|
||||
pipe = minetest.get_node(pos +offset)
|
||||
if minetest.get_item_group(pipe.name, basename.."_stair") > 0 then
|
||||
neighbors[#neighbors +1] = offset
|
||||
end
|
||||
end
|
||||
|
||||
if #neighbors == 1 then
|
||||
node.name = basename.."_stair"
|
||||
node.param2 = minetest.dir_to_facedir(-neighbors[1]:rotate(vector.new(0, math.pi /2, 0)))
|
||||
minetest.swap_node(pos, node)
|
||||
elseif #neighbors > 1 then
|
||||
-- Just ue the first two neighbors.
|
||||
if neighbors[1].x ~= 0 and neighbors[2].x ~= 0 or neighbors[1].z ~= 0 and neighbors[2].z ~= 0 then
|
||||
node.name = basename.."_stair"
|
||||
node.param2 = minetest.dir_to_facedir(neighbors[1])
|
||||
end
|
||||
minetest.swap_node(pos, node)
|
||||
end
|
||||
|
||||
if not leaf then
|
||||
for _, x in ipairs(neighbors) do
|
||||
update_pipe(pos +x, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function ns.register_stair(def)
|
||||
def = table.copy(def)
|
||||
def._variants = nil
|
||||
|
||||
def.groups[def._name.."_stair"] = 1
|
||||
|
||||
rgt.register_node(def._name.."_stair", extend(table.copy(def), {
|
||||
drawtype = "nodebox",
|
||||
node_box = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue