First Upload

master
DonBatman 2015-09-08 11:10:04 -07:00
commit 6dcc74ae0e
8 changed files with 329 additions and 0 deletions

2
depends.txt Normal file
View File

@ -0,0 +1,2 @@
default
stairs

115
hammer.lua Normal file
View File

@ -0,0 +1,115 @@
local USES = 200
local mode = {}
local function parti(pos)
minetest.add_particlespawner(25, 0.3,
pos, pos,
{x=2, y=0.2, z=2}, {x=-2, y=2, z=-2},
{x=0, y=-6, z=0}, {x=0, y=-10, z=0},
0.2, 1,
0.2, 2,
true, "mymasonhammer_parti.png")
end
mode = "1"
minetest.register_tool( "mymasonhammer:hammer",{
description = "Mason Hammer",
inventory_image = "mymasonhammer_hammer.png",
wield_image = "mymasonhammer_hammer.png",
on_use = function(itemstack, user, pointed_thing)
local pos = pointed_thing.under
local node = minetest.get_node(pos)
local default_material = {
{"default:cobble", "default_cobble", "Cobble","stairs:stair_cobble"},
{"default:desert_cobble","default_desert_cobble", "Desert Cobble","stairs:stair_desert_cobble"},
{"default:stone","default_stone", "Stone","stairs:stair_stone"},
{"default:desert_stone","default_desert_stone", "Desert Stone","stairs:stair_desert_stone"},
{"default:stonebrick","default_stone_brick", "Stone Brick","stairs:stair_stonebrick"},
{"default:desert_stonebrick","default_desert_stone_brick", "Desert Stone Brick","stairs:stair_desert_stonebrick"},
}
for i in ipairs (default_material) do
local item = default_material [i][1]
local mat = default_material [i][2]
local desc = default_material [i][3]
local stair = default_material [i][4]
if pointed_thing.type ~= "node" then
return
end
if minetest.is_protected(pos, user:get_player_name()) then
minetest.record_protection_violation(pos, user:get_player_name())
return
end
if mode == "1" then
if node.name == item then
minetest.set_node(pos,{name = stair, param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
end
if mode == "2" then
if node.name == item then
minetest.set_node(pos,{name = "mymasonhammer:"..mat.."_ladder2", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
elseif node.name == "mymasonhammer:"..mat.."_ladder2" then
minetest.set_node(pos,{name = "mymasonhammer:"..mat.."_ladder3", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
elseif node.name == "mymasonhammer:"..mat.."_ladder3" then
minetest.set_node(pos,{name = "mymasonhammer:"..mat.."_ladder", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
elseif node.name == "mymasonhammer:"..mat.."_ladder" then
minetest.set_node(pos,{name = "air", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
end
if mode == "3" then
if node.name == item then
minetest.set_node(pos,{name = "mymasonhammer:"..mat.."_foot2", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
elseif node.name == "mymasonhammer:"..mat.."_foot2" then
minetest.set_node(pos,{name = "mymasonhammer:"..mat.."_foot3", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
elseif node.name == "mymasonhammer:"..mat.."_foot3" then
minetest.set_node(pos,{name = "mymasonhammer:"..mat.."_foot", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
elseif node.name == "mymasonhammer:"..mat.."_foot" then
minetest.set_node(pos,{name = "air", param2=minetest.dir_to_facedir(user:get_look_dir())})
parti(pos)
end
end
end
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535 / (USES - 1))
end
return itemstack
end,
on_place = function(itemstack, user, pointed_thing)
local usr = user:get_player_name()
if mode == "1" then
mode = "2"
minetest.chat_send_player(usr,"Ladder Hammer")
elseif mode == "2" then
mode = "3"
minetest.chat_send_player(usr,"Foot Hold Hammer")
elseif mode == "3" then
mode = "1"
minetest.chat_send_player(usr,"Stair Hammer")
end
if not minetest.setting_getbool("creative_mode") then
itemstack:add_wear(65535 / (USES - 1))
end
return itemstack
end
})
minetest.register_craft({
output = "mymasonhammer:hammer",
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "wool:blue", "default:steel_ingot"},
{"", "wool:blue", ""},
},
})
minetest.register_craft({
output = "mymasonhammer:hammer",
recipe = {
{"mymasonhammer:hammer", "default:steel_ingot"},
},
})

11
init.lua Normal file
View File

@ -0,0 +1,11 @@
mycorners = {}
dofile(minetest.get_modpath("mymasonhammer").."/hammer.lua")
dofile(minetest.get_modpath("mymasonhammer").."/nodes.lua")

201
nodes.lua Normal file
View File

@ -0,0 +1,201 @@
local default_material = {
{"default:cobble", "default_cobble", "Cobble", {cracky = 3, not_in_creative_inventory=1}},
{"default:stone","default_stone", "Stone", {cracky = 3, not_in_creative_inventory=1}},
{"default:desert_stone","default_desert_stone", "Desert Stone", {cracky = 3, not_in_creative_inventory=1}},
{"default:desert_cobble","default_desert_cobble", "Desert Cobble", {cracky = 3, not_in_creative_inventory=1}},
}
for i in ipairs (default_material) do
local item = default_material [i][1]
local mat = default_material [i][2]
local desc = default_material [i][3]
local gro = default_material [i][4]
minetest.register_node("mymasonhammer:"..mat.."_ladder", {
description = desc.." Ladder Block",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mymasonhammer_tint.png",
},
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
climbable = true,
drop = item,
groups = gro,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.4375, 0.5, 0.5, 0.5},
{-0.5, -0.5, 0.3175, -0.3125, 0.5, 0.5},
{0.3125, -0.5, 0.3175, 0.5, 0.5, 0.5},
{-0.5, -0.4375, 0.3175, 0.5, -0.3125, 0.5},
{-0.5, 0.3125, 0.3175, 0.5, 0.4375, 0.5},
{-0.5, -0.1875, 0.3175, 0.5, -0.0625, 0.5},
{-0.5, 0.0625, 0.3175, 0.5, 0.1875, 0.5},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.3175, 0.5, 0.5, 0.5},
}
},
})
minetest.register_node("mymasonhammer:"..mat.."_ladder2", {
description = desc.." Ladder Block",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
},
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
climbable = true,
drop = item,
groups = gro,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.3175, 0.5, 0.5, 0.5},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.3175, 0.5, 0.5, 0.5},
}
},
})
minetest.register_node("mymasonhammer:"..mat.."_ladder3", {
description = desc.." Ladder Block",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
},
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
climbable = true,
drop = item,
groups = gro,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.3175, 0.5, 0.5, 0.5},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.3175, 0.5, 0.5, 0.5},
}
},
})
minetest.register_node("mymasonhammer:"..mat.."_foot", {
description = desc.." Foot Hold Block",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png^mymasonhammer_tint2.png",
},
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
climbable = true,
drop = item,
groups = gro,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.4375, 0.5, 0.5, 0.5},
{-0.375, -0.3755, 0.3175, -0.125, -0.125, 0.5},
{0.125, 0.1875, 0.3175, 0.375, 0.375, 0.5},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.4375, 0.5, 0.5, 0.5},
}
},
})
minetest.register_node("mymasonhammer:"..mat.."_foot2", {
description = desc.." Foot Hold Block",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
},
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
climbable = true,
drop = item,
groups = gro,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.3175, 0.5, 0.5, 0.5},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.3175, 0.5, 0.5, 0.5},
}
},
})
minetest.register_node("mymasonhammer:"..mat.."_foot3", {
description = desc.." Foot Hold Block",
drawtype = "nodebox",
tiles = {
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
mat..".png",
},
paramtype = "light",
paramtype2 = "facedir",
walkable = true,
climbable = true,
drop = item,
groups = gro,
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.3175, 0.5, 0.5, 0.5},
}
},
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0.3175, 0.5, 0.5, 0.5},
}
},
})
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 150 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B