Browse Source

Scaffolding mod

auto-build
Infinatum 5 years ago
commit
03a2039319
7 changed files with 169 additions and 0 deletions
  1. +1
    -0
      depends.txt
  2. +89
    -0
      functions.lua
  3. +79
    -0
      init.lua
  4. BIN
      textures/scaffolding_iron_scaffolding.png
  5. BIN
      textures/scaffolding_iron_scaffolding_top.png
  6. BIN
      textures/scaffolding_wooden_scaffolding.png
  7. BIN
      textures/scaffolding_wooden_scaffolding_top.png

+ 1
- 0
depends.txt View File

@@ -0,0 +1 @@
default

+ 89
- 0
functions.lua 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
- 0
init.lua 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'},
}
})


BIN
textures/scaffolding_iron_scaffolding.png View File

Before After
Width: 16  |  Height: 16  |  Size: 484B

BIN
textures/scaffolding_iron_scaffolding_top.png View File

Before After
Width: 16  |  Height: 16  |  Size: 392B

BIN
textures/scaffolding_wooden_scaffolding.png View File

Before After
Width: 16  |  Height: 16  |  Size: 492B

BIN
textures/scaffolding_wooden_scaffolding_top.png View File

Before After
Width: 16  |  Height: 16  |  Size: 404B

Loading…
Cancel
Save