2020-12-24 15:18:21 +01:00
|
|
|
minetest.register_tool("hammermod:steel_hammer", {
|
2020-12-26 09:43:25 +01:00
|
|
|
description = "Steel Hammer",
|
|
|
|
short_description = "Steel Hammer",
|
|
|
|
groups={hard=1, metal=1, tool=1, pickaxe=1, dig_speed_class=4, enchantability=14 },
|
|
|
|
inventory_image="steel_hammer.png",
|
|
|
|
range=8,
|
|
|
|
liquids_pointable = false,
|
|
|
|
light_source = 3,
|
|
|
|
tool_capabilities = {
|
2020-12-26 09:54:13 +01:00
|
|
|
full_punch_interval = 0.83333333,
|
2020-12-26 09:43:25 +01:00
|
|
|
max_drop_level = 4,
|
|
|
|
groupcaps = {
|
2020-12-26 09:54:13 +01:00
|
|
|
choppy = {times = {[1] = 1.00, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
|
|
|
|
cracky={times = {[1] = 1.00, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
|
|
|
|
crumbly = {times = {[1] = 1.00, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
|
|
|
|
snappy = {times = {[1] = 1.00, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
|
|
|
|
oddly_breakable_by_hand = {times = {[1] = 1.00, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
|
|
|
|
pickaxey = {times = {[1] = 1.00, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
|
|
|
|
axey={times = {[1] = 1.00, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
|
|
|
|
shovely={times = {[1] = 1.00, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
|
|
|
|
pickaxey_dig_iron = {times={[1] = 1.00, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel=2}
|
2020-12-26 09:43:25 +01:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy=1},
|
|
|
|
|
|
|
|
},
|
|
|
|
|
2020-12-24 14:57:53 +01:00
|
|
|
})
|
|
|
|
|
2020-12-26 11:00:08 +01:00
|
|
|
|
|
|
|
minetest.register_craft( {
|
|
|
|
output = 'hammermod:steel_hammer',
|
|
|
|
recipe = {
|
|
|
|
{'mcl_core:iron_ingot', 'mcl_core:ironblock', 'mcl_core:iron_ingot'},
|
|
|
|
{'', 'mcl_core:stick', ''},
|
|
|
|
{'', 'mcl_core:stick', ''}
|
|
|
|
},
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2020-12-26 10:22:58 +01:00
|
|
|
local steelHammerDigs = {}
|
2020-12-24 14:57:53 +01:00
|
|
|
|
|
|
|
minetest.register_on_dignode(
|
2020-12-26 09:43:25 +01:00
|
|
|
function(pos, oldnode, digger)
|
|
|
|
if digger == nil or digger:get_wielded_item():get_name() ~= "hammermod:steel_hammer" then
|
|
|
|
return
|
|
|
|
end
|
2020-12-26 10:22:58 +01:00
|
|
|
|
|
|
|
local playerName = digger:get_player_name()
|
|
|
|
if(playerName == "" or steelHammerDigs[playerName]) then
|
2020-12-26 09:43:25 +01:00
|
|
|
return
|
|
|
|
end
|
2020-12-26 10:22:58 +01:00
|
|
|
steelHammerDigs[playerName] = true
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
local posDiff = pos.y - digger:get_pos().y
|
|
|
|
if(posDiff < 2 and posDiff > 1) then
|
|
|
|
if
|
|
|
|
digger:get_look_horizontal() > math.pi / 4 and digger:get_look_horizontal() < 3 * math.pi / 4 or
|
|
|
|
digger:get_look_horizontal() > 5 * math.pi / 4 and digger:get_look_horizontal() < 7 * math.pi / 4
|
|
|
|
then
|
|
|
|
pos.y = pos.y -1
|
|
|
|
pos.z = pos.z -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.y = pos.y +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.y = pos.y +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.z = pos.z +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.z = pos.z +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.y = pos.y -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.y = pos.y -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.z = pos.z -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
else
|
|
|
|
pos.y = pos.y -1
|
|
|
|
pos.x = pos.x -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.y = pos.y +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.y = pos.y +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.x = pos.x +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.x = pos.x +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.y = pos.y -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.y = pos.y -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.x = pos.x -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
end
|
|
|
|
else
|
|
|
|
pos.x = pos.x -1
|
|
|
|
pos.z = pos.z -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.x = pos.x +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.x = pos.x +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.z = pos.z +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.z = pos.z +1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.x = pos.x -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.x = pos.x -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
pos.z = pos.z -1
|
2020-12-26 09:44:45 +01:00
|
|
|
minetest.node_dig(pos, minetest.get_node(pos), digger)
|
2020-12-26 09:43:25 +01:00
|
|
|
|
|
|
|
end
|
2020-12-26 10:22:58 +01:00
|
|
|
steelHammerDigs[playerName] = nil
|
2020-12-26 09:43:25 +01:00
|
|
|
end
|
2020-12-24 14:57:53 +01:00
|
|
|
)
|