commit 6dcc74ae0e50d674bd0a5cdc9d2cebf962429059 Author: DonBatman Date: Tue Sep 8 11:10:04 2015 -0700 First Upload diff --git a/depends.txt b/depends.txt new file mode 100644 index 0000000..3296b1e --- /dev/null +++ b/depends.txt @@ -0,0 +1,2 @@ +default +stairs diff --git a/hammer.lua b/hammer.lua new file mode 100644 index 0000000..993876b --- /dev/null +++ b/hammer.lua @@ -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"}, + }, +}) diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..ba6672c --- /dev/null +++ b/init.lua @@ -0,0 +1,11 @@ +mycorners = {} +dofile(minetest.get_modpath("mymasonhammer").."/hammer.lua") +dofile(minetest.get_modpath("mymasonhammer").."/nodes.lua") + + + + + + + + diff --git a/nodes.lua b/nodes.lua new file mode 100644 index 0000000..9a3aad5 --- /dev/null +++ b/nodes.lua @@ -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 diff --git a/textures/mymasonhammer_hammer.png b/textures/mymasonhammer_hammer.png new file mode 100644 index 0000000..dfbb746 Binary files /dev/null and b/textures/mymasonhammer_hammer.png differ diff --git a/textures/mymasonhammer_parti.png b/textures/mymasonhammer_parti.png new file mode 100644 index 0000000..9e8df39 Binary files /dev/null and b/textures/mymasonhammer_parti.png differ diff --git a/textures/mymasonhammer_tint.png b/textures/mymasonhammer_tint.png new file mode 100644 index 0000000..5b250e1 Binary files /dev/null and b/textures/mymasonhammer_tint.png differ diff --git a/textures/mymasonhammer_tint2.png b/textures/mymasonhammer_tint2.png new file mode 100644 index 0000000..3870417 Binary files /dev/null and b/textures/mymasonhammer_tint2.png differ