2019-03-17 17:33:13 +03:00
|
|
|
--[[
|
|
|
|
|
|
|
|
TechAge
|
|
|
|
=======
|
|
|
|
|
|
|
|
Copyright (C) 2019 Joachim Stolberg
|
|
|
|
|
2019-08-22 21:49:47 +03:00
|
|
|
GPL v3
|
2019-03-17 17:33:13 +03:00
|
|
|
See LICENSE.txt for more information
|
|
|
|
|
|
|
|
Hammer to convert stone into gravel
|
|
|
|
|
|
|
|
]]--
|
|
|
|
|
2019-07-02 22:33:12 +03:00
|
|
|
local S = techage.S
|
2019-03-17 17:33:13 +03:00
|
|
|
|
|
|
|
local function handler(player_name, node, itemstack, digparams)
|
|
|
|
local pos = techage.dug_node[player_name]
|
|
|
|
if not pos then return end
|
|
|
|
|
|
|
|
if minetest.is_protected(pos, player_name) then
|
|
|
|
minetest.record_protection_violation(pos, player_name)
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
if minetest.get_item_group(node.name, "stone") > 0 then
|
2019-05-04 23:31:53 +03:00
|
|
|
-- Remove item from players inventory or from the world
|
|
|
|
local ndef = minetest.registered_nodes[node.name]
|
2019-07-02 22:33:12 +03:00
|
|
|
if ndef then
|
|
|
|
local item = ItemStack(ndef.drop or node.name)
|
2019-05-04 23:31:53 +03:00
|
|
|
local inv = minetest.get_inventory({type="player", name=player_name})
|
|
|
|
if inv:room_for_item("main", item) then
|
|
|
|
local taken = inv:remove_item("main", item)
|
|
|
|
else
|
|
|
|
for _,obj in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
|
|
|
|
obj:remove()
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2019-06-21 18:45:15 +03:00
|
|
|
if node.name == "techage:basalt_stone" or node.name == "techage:basalt_cobble" then
|
2019-06-11 23:51:37 +03:00
|
|
|
node.name = "techage:basalt_gravel"
|
|
|
|
else
|
|
|
|
node.name = "default:gravel"
|
|
|
|
end
|
2019-03-17 17:33:13 +03:00
|
|
|
minetest.swap_node(pos, node)
|
2019-05-04 23:31:53 +03:00
|
|
|
minetest.check_single_for_falling(pos)
|
2019-03-17 17:33:13 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_tool("techage:hammer_bronze", {
|
2019-07-02 22:33:12 +03:00
|
|
|
description = S("TA1 Bronze Hammer (smash stone to gravel)"),
|
2019-03-17 17:33:13 +03:00
|
|
|
inventory_image = "techage_tool_hammer_bronze.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
2019-05-04 23:31:53 +03:00
|
|
|
cracky = {times={[1]=5.00, [2]=2.0, [3]=1.0}, uses=40, maxlevel=2},
|
2019-03-17 17:33:13 +03:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy=4},
|
|
|
|
},
|
|
|
|
sound = {breaks = "default_tool_breaks"},
|
|
|
|
after_use = function(itemstack, user, node, digparams)
|
2019-05-04 23:31:53 +03:00
|
|
|
minetest.after(0.01, handler, user:get_player_name(), node)
|
2019-03-17 17:33:13 +03:00
|
|
|
itemstack:add_wear(digparams.wear)
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_tool("techage:hammer_steel", {
|
2019-07-02 22:33:12 +03:00
|
|
|
description = S("TA1 Steel Hammer (smash stone to gravel)"),
|
2019-03-17 17:33:13 +03:00
|
|
|
inventory_image = "techage_tool_hammer_steel.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
2019-05-04 23:31:53 +03:00
|
|
|
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=50, maxlevel=2},
|
2019-03-17 17:33:13 +03:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy=4},
|
|
|
|
},
|
|
|
|
sound = {breaks = "default_tool_breaks"},
|
|
|
|
after_use = function(itemstack, user, node, digparams)
|
2019-05-04 23:31:53 +03:00
|
|
|
minetest.after(0.01, handler, user:get_player_name(), node)
|
2019-03-17 17:33:13 +03:00
|
|
|
itemstack:add_wear(digparams.wear)
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_tool("techage:hammer_mese", {
|
2019-07-02 22:33:12 +03:00
|
|
|
description = S("TA1 Mese Hammer (smash stone to gravel)"),
|
2019-03-17 17:33:13 +03:00
|
|
|
inventory_image = "techage_tool_hammer_mese.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 0.9,
|
|
|
|
max_drop_level=3,
|
|
|
|
groupcaps={
|
2019-05-04 23:31:53 +03:00
|
|
|
cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=60, maxlevel=3},
|
2019-03-17 17:33:13 +03:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy=5},
|
|
|
|
},
|
|
|
|
sound = {breaks = "default_tool_breaks"},
|
|
|
|
after_use = function(itemstack, user, node, digparams)
|
2019-05-04 23:31:53 +03:00
|
|
|
minetest.after(0.01, handler, user:get_player_name(), node)
|
2019-03-17 17:33:13 +03:00
|
|
|
itemstack:add_wear(digparams.wear)
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_tool("techage:hammer_diamond", {
|
2019-07-02 22:33:12 +03:00
|
|
|
description = S("TA1 Diamond Hammer (smash stone to gravel)"),
|
2019-03-17 17:33:13 +03:00
|
|
|
inventory_image = "techage_tool_hammer_diamond.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 0.9,
|
|
|
|
max_drop_level=3,
|
|
|
|
groupcaps={
|
2019-05-04 23:31:53 +03:00
|
|
|
cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=70, maxlevel=3},
|
2019-03-17 17:33:13 +03:00
|
|
|
},
|
|
|
|
damage_groups = {fleshy=5},
|
|
|
|
},
|
|
|
|
sound = {breaks = "default_tool_breaks"},
|
|
|
|
after_use = function(itemstack, user, node, digparams)
|
2019-05-04 23:31:53 +03:00
|
|
|
minetest.after(0.01, handler, user:get_player_name(), node)
|
2019-03-17 17:33:13 +03:00
|
|
|
itemstack:add_wear(digparams.wear)
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
|
2019-07-02 22:33:12 +03:00
|
|
|
if minetest.global_exists("wielded_light") then
|
|
|
|
minetest.register_tool("techage:hammer_meridium", {
|
|
|
|
description = S("TA1 Meridium Hammer (smash stone to gravel)"),
|
|
|
|
inventory_image = "techage_tool_hammer_meridium.png",
|
|
|
|
tool_capabilities = {
|
|
|
|
full_punch_interval = 1.0,
|
|
|
|
max_drop_level=1,
|
|
|
|
groupcaps={
|
|
|
|
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=60, maxlevel=2},
|
|
|
|
},
|
|
|
|
damage_groups = {fleshy=4},
|
|
|
|
},
|
|
|
|
sound = {breaks = "default_tool_breaks"},
|
|
|
|
after_use = function(itemstack, user, node, digparams)
|
|
|
|
minetest.after(0.01, handler, user:get_player_name(), node)
|
|
|
|
itemstack:add_wear(digparams.wear)
|
|
|
|
return itemstack
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "techage:hammer_meridium 2",
|
|
|
|
recipe = {
|
|
|
|
{"techage:meridium_ingot", "group:stick", "techage:meridium_ingot"},
|
|
|
|
{"techage:meridium_ingot", "group:stick", "techage:meridium_ingot"},
|
|
|
|
{"", "group:stick", ""},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2019-03-17 17:33:13 +03:00
|
|
|
minetest.register_craft({
|
2019-04-28 22:34:21 +03:00
|
|
|
output = "techage:hammer_bronze 2",
|
2019-03-17 17:33:13 +03:00
|
|
|
recipe = {
|
|
|
|
{"default:bronze_ingot", "group:stick", "default:bronze_ingot"},
|
|
|
|
{"default:bronze_ingot", "group:stick", "default:bronze_ingot"},
|
|
|
|
{"", "group:stick", ""},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
2019-04-28 22:34:21 +03:00
|
|
|
output = "techage:hammer_steel 2",
|
2019-03-17 17:33:13 +03:00
|
|
|
recipe = {
|
|
|
|
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
|
|
|
|
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
|
|
|
|
{"", "group:stick", ""},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
2019-04-28 22:34:21 +03:00
|
|
|
output = "techage:hammer_mese 2",
|
2019-03-17 17:33:13 +03:00
|
|
|
recipe = {
|
|
|
|
{"default:mese_crystal", "group:stick", "default:mese_crystal"},
|
|
|
|
{"default:mese_crystal", "group:stick", "default:mese_crystal"},
|
|
|
|
{"", "group:stick", ""},
|
|
|
|
}
|
|
|
|
})
|
|
|
|
minetest.register_craft({
|
2019-04-28 22:34:21 +03:00
|
|
|
output = "techage:hammer_diamond 2",
|
2019-03-17 17:33:13 +03:00
|
|
|
recipe = {
|
|
|
|
{"default:diamond", "group:stick", "default:diamond"},
|
|
|
|
{"default:diamond", "group:stick", "default:diamond"},
|
|
|
|
{"", "group:stick", ""},
|
|
|
|
}
|
|
|
|
})
|
2019-05-01 00:58:42 +03:00
|
|
|
|