make it work with mineclone2

This commit is contained in:
Matthias Cullmann 2020-12-26 09:43:25 +01:00
parent ec7b93a00e
commit 07b9a5e68b

213
init.lua

@ -1,131 +1,136 @@
minetest.register_tool("hammermod:steel_hammer", {
description = "Steel Hammer",
short_description = "Steel Hammer",
groups={hard=1, metal=1},
inventory_image="steel_hammer.png",
range=8,
liquids_pointable = false,
light_source = 3,
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level = 999,
groupcaps = {
choppy = {times = {[1] = 2.50, [2] = 1.40, [3] = 1.00},uses = 20, maxlevel = 2},
cracky={times={[1]=4.00, [2]=1.50, [3]=1.00}, uses=70, maxlevel=1},
crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1},
snappy = {times={[3]=0.40}, uses=0, maxlevel=1},
oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0}
},
damage_groups = {fleshy=1},
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 = {
full_punch_interval = 1.0,
max_drop_level = 4,
groupcaps = {
choppy = {times = {[1] = 2.50, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
cracky={times = {[1] = 2.50, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
crumbly = {times = {[1] = 2.50, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
snappy = {times = {[1] = 2.50, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
oddly_breakable_by_hand = {times = {[1] = 2.50, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
pickaxey = {times = {[1] = 2.50, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
axey={times = {[1] = 2.50, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
shovely={times = {[1] = 2.50, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel = 2},
pickaxey_dig_iron = {times={[1] = 2.50, [2] = 1.40, [3] = 1.00},uses = 250, maxlevel=2}
},
damage_groups = {fleshy=1},
},
},
})
thomas_dig_none = "tupeuxyaller"
function thom_dig(pos, digger)
minetest.dig_node(pos)
--minetest.node_dig(pos, minetest.get_node(pos), digger)
function thom_dig(pos, digger)
--minetest.dig_node(pos)
minetest.node_dig(pos, minetest.get_node(pos), digger)
--minetest.spawn_falling_node(pos)
end
minetest.register_on_dignode(
function(pos, oldnode, digger)
function(pos, oldnode, digger)
--TODO thomas_dig_none per player
if digger == nil or digger:get_wielded_item():get_name() ~= "hammermod:steel_hammer" then
return
end
--TODO thomas_dig_none per player
if digger == nil or digger:get_wielded_item():get_name() ~= "hammermod:steel_hammer" then
return
end
if thomas_dig_none ~= "tupeuxyaller" then
return
end
thomas_dig_none = "kesketufousla"
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
thom_dig(pos, digger)
if thomas_dig_none ~= "tupeuxyaller" then
return
end
pos.y = pos.y +1
thom_dig(pos, digger)
thomas_dig_none = "kesketufousla"
pos.y = pos.y +1
thom_dig(pos, digger)
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
thom_dig(pos, digger)
pos.z = pos.z +1
thom_dig(pos, digger)
pos.z = pos.z +1
thom_dig(pos, digger)
pos.y = pos.y -1
thom_dig(pos, digger)
pos.y = pos.y +1
thom_dig(pos, digger)
pos.y = pos.y -1
thom_dig(pos, digger)
pos.y = pos.y +1
thom_dig(pos, digger)
pos.z = pos.z -1
thom_dig(pos, digger)
else
pos.y = pos.y -1
pos.x = pos.x -1
thom_dig(pos, digger)
pos.z = pos.z +1
thom_dig(pos, digger)
pos.y = pos.y +1
thom_dig(pos, digger)
pos.z = pos.z +1
thom_dig(pos, digger)
pos.y = pos.y +1
thom_dig(pos, digger)
pos.y = pos.y -1
thom_dig(pos, digger)
pos.x = pos.x +1
thom_dig(pos, digger)
pos.x = pos.x +1
thom_dig(pos, digger)
pos.y = pos.y -1
thom_dig(pos, digger)
pos.y = pos.y -1
thom_dig(pos, digger)
pos.y = pos.y -1
thom_dig(pos, digger)
pos.z = pos.z -1
thom_dig(pos, digger)
else
pos.y = pos.y -1
pos.x = pos.x -1
thom_dig(pos, digger)
pos.x = pos.x -1
thom_dig(pos, digger)
end
else
pos.x = pos.x -1
pos.z = pos.z -1
thom_dig(pos, digger)
pos.y = pos.y +1
thom_dig(pos, digger)
pos.x = pos.x +1
thom_dig(pos, digger)
pos.y = pos.y +1
thom_dig(pos, digger)
pos.x = pos.x +1
thom_dig(pos, digger)
pos.x = pos.x +1
thom_dig(pos, digger)
pos.z = pos.z +1
thom_dig(pos, digger)
pos.z = pos.z +1
thom_dig(pos, digger)
pos.x = pos.x -1
thom_dig(pos, digger)
pos.x = pos.x +1
thom_dig(pos, digger)
pos.x = pos.x -1
thom_dig(pos, digger)
pos.y = pos.y -1
thom_dig(pos, digger)
pos.z = pos.z -1
thom_dig(pos, digger)
end
thomas_dig_none = "tupeuxyaller"
end
pos.y = pos.y -1
thom_dig(pos, digger)
pos.x = pos.x -1
thom_dig(pos, digger)
end
else
pos.x = pos.x -1
pos.z = pos.z -1
thom_dig(pos, digger)
pos.x = pos.x +1
thom_dig(pos, digger)
pos.x = pos.x +1
thom_dig(pos, digger)
pos.z = pos.z +1
thom_dig(pos, digger)
pos.z = pos.z +1
thom_dig(pos, digger)
pos.x = pos.x -1
thom_dig(pos, digger)
pos.x = pos.x -1
thom_dig(pos, digger)
pos.z = pos.z -1
thom_dig(pos, digger)
end
thomas_dig_none = "tupeuxyaller"
end
)