Scaffolding mod

This commit is contained in:
Infinatum 2015-02-20 14:55:03 +00:00
commit 03a2039319
7 changed files with 169 additions and 0 deletions

1
depends.txt Normal file
View File

@ -0,0 +1 @@
default

89
functions.lua Normal file
View File

@ -0,0 +1,89 @@
scaffolding_nodenames={"scaffolding:scaffolding"}
minetest.register_on_dignode(function(pos, node)
local i=1
while scaffolding_nodenames[i]~=nil do
if node.name==scaffolding_nodenames[i] then
np={x=pos.x, y=pos.y+1, z=pos.z}
while minetest.env:get_node(np).name==scaffolding_nodenames[i] do
minetest.env:remove_node(np)
minetest.env:add_item(np, scaffolding_nodenames[i])
np={x=np.x, y=np.y+1, z=np.z}
end
end
i=i+1
end
end)
iron_scaffolding_nodenames={"scaffolding:iron_scaffolding"}
minetest.register_on_dignode(function(pos, node)
local i=1
while iron_scaffolding_nodenames[i]~=nil do
if node.name==iron_scaffolding_nodenames[i] then
np={x=pos.x, y=pos.y, z=pos.z+1}
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
minetest.env:remove_node(np)
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
np={x=np.x, y=np.y, z=np.z+1}
end
end
i=i+1
end
end)
minetest.register_on_dignode(function(pos, node)
local i=1
while iron_scaffolding_nodenames[i]~=nil do
if node.name==iron_scaffolding_nodenames[i] then
np={x=pos.x, y=pos.y, z=pos.z-1}
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
minetest.env:remove_node(np)
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
np={x=np.x, y=np.y, z=np.z-1}
end
end
i=i-1
end
end)
minetest.register_on_dignode(function(pos, node)
local i=1
while iron_scaffolding_nodenames[i]~=nil do
if node.name==iron_scaffolding_nodenames[i] then
np={x=pos.x+1, y=pos.y, z=pos.z}
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
minetest.env:remove_node(np)
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
np={x=np.x+1, y=np.y, z=np.z}
end
end
i=i+1
end
end)
minetest.register_on_dignode(function(pos, node)
local i=1
while iron_scaffolding_nodenames[i]~=nil do
if node.name==iron_scaffolding_nodenames[i] then
np={x=pos.x-1, y=pos.y, z=pos.z}
while minetest.env:get_node(np).name==iron_scaffolding_nodenames[i] do
minetest.env:remove_node(np)
minetest.env:add_item(np, iron_scaffolding_nodenames[i])
np={x=np.x-1, y=np.y, z=np.z}
end
end
i=i-1
end
end)
-- falling nodes go into pocket --
function default.dig_hor(pos, node, digger)
if digger == nil then return end
local np = {x = pos.x, y = pos.y, z = pos.z + 1,}
local nn = minetest.get_node(np)
if nn.name == node.name then
minetest.node_dig(np, nn, digger)
end
end

79
init.lua Normal file
View File

@ -0,0 +1,79 @@
print("scaffolding: Loading 'functions.lua'")
dofile(minetest.get_modpath("scaffolding").."/functions.lua")
minetest.register_node("scaffolding:scaffolding", {
description = "Wooden Scaffolding",
drawtype = "nodebox",
tiles = {"scaffolding_wooden_scaffolding_top.png", "scaffolding_wooden_scaffolding_top.png", "scaffolding_wooden_scaffolding.png",
"scaffolding_wooden_scaffolding.png", "scaffolding_wooden_scaffolding.png", "scaffolding_wooden_scaffolding.png"},
paramtype = "light",
paramtype2 = "facedir",
climbable = true,
walkable = false,
is_ground_content = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
sounds = default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
after_dig_node = function(pos, node, metadata, digger)
default.dig_up(pos, node, digger)
end,
})
minetest.register_node("scaffolding:iron_scaffolding", {
description = "Iron Scaffolding",
drawtype = "nodebox",
tiles = {"scaffolding_iron_scaffolding_top.png", "scaffolding_iron_scaffolding_top.png", "scaffolding_iron_scaffolding.png",
"scaffolding_iron_scaffolding.png", "scaffolding_iron_scaffolding.png", "scaffolding_iron_scaffolding.png"},
paramtype = "light",
paramtype2 = "facedir",
climbable = true,
walkable = true,
is_ground_content = true,
groups = {snappy=2,cracky=3},
sounds = default.node_sound_wood_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
},
},
after_dig_node = function(pos, node, metadata, digger)
default.dig_hor(pos, node, digger)
end,
})
minetest.register_craft({
output = 'scaffolding:scaffolding 6',
recipe = {
{'default:wood', 'default:wood', 'default:wood'},
{'default:stick', '', 'default:stick'},
{'default:wood', 'default:wood', 'default:wood'},
}
})
minetest.register_craft({
output = 'scaffolding:iron_scaffolding 6',
recipe = {
{'default:wood', 'default:wood', 'default:wood'},
{'default:steel_ingot', '', 'default:steel_ingot'},
{'default:wood', 'default:wood', 'default:wood'},
}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 392 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 404 B