All the tools

All basic tools have been added.
A bug in itemdrop has been fixed.
master
opfromthestart 2022-08-25 18:58:38 -04:00
parent 904aaac029
commit 133f181f70
12 changed files with 131 additions and 68 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
.vscode/settings.json
copy.sh

View File

@ -1,71 +1,45 @@
minetest.register_craft({
output = "pmb_tools:wooden_pickaxe",
recipe = {
{ "group:planks", "group:planks", "group:planks" },
{ "", "pmb_items:stick", "" },
{ "", "pmb_items:stick", "" },
},
})
local materials = {
wooden = "group:planks",
stone = "pmb_stone:cobble",
iron = "pmb_items:iron_bar",
diamond = "pmb_items:diamond",
}
minetest.register_craft({
output = "pmb_tools:stone_pickaxe",
recipe = {
{ "pmb_stone:cobble", "pmb_stone:cobble", "pmb_stone:cobble" },
{ "", "pmb_items:stick", "" },
{ "", "pmb_items:stick", "" },
},
})
-- Pickaxes
for mat, item in pairs(materials) do
minetest.register_craft({
output = "pmb_tools:" .. mat .. "_pickaxe",
recipe = {
{ item, item, item },
{ "", "pmb_items:stick", "" },
{ "", "pmb_items:stick", "" },
},
})
minetest.register_craft({
output = "pmb_tools:wooden_axe",
recipe = {
{ "group:planks", "group:planks" },
{ "group:planks", "pmb_items:stick" },
{ "", "pmb_items:stick" },
},
})
minetest.register_craft({
output = "pmb_tools:" .. mat .. "_axe",
recipe = {
{ item, item },
{ item, "pmb_items:stick" },
{ "", "pmb_items:stick" },
},
})
minetest.register_craft({
output = "pmb_tools:stone_axe",
recipe = {
{ "pmb_stone:cobble", "pmb_stone:cobble" },
{ "pmb_stone:cobble", "pmb_items:stick"},
{ "", "pmb_items:stick"},
},
})
minetest.register_craft({
output = "pmb_tools:" .. mat .. "_axe",
recipe = {
{ item, item },
{ "pmb_items:stick", item },
{ "pmb_items:stick", "" },
},
})
minetest.register_craft({
output = "pmb_tools:wooden_axe",
recipe = {
{ "group:planks", "group:planks" },
{ "pmb_items:stick", "group:planks" },
{ "pmb_items:stick", "" },
},
})
minetest.register_craft({
output = "pmb_tools:stone_axe",
recipe = {
{ "pmb_stone:cobble", "pmb_stone:cobble" },
{ "pmb_items:stick", "pmb_stone:cobble" },
{ "pmb_items:stick", "" },
},
})
minetest.register_craft({
output = "pmb_tools:wooden_shovel",
recipe = {
{ "group:planks"},
{ "pmb_items:stick" },
{ "pmb_items:stick"},
},
})
minetest.register_craft({
output = "pmb_tools:stone_shovel",
recipe = {
{ "pmb_stone:cobble"},
{ "pmb_items:stick"},
{ "pmb_items:stick"},
},
})
minetest.register_craft({
output = "pmb_tools:"..mat.."_shovel",
recipe = {
{ item },
{ "pmb_items:stick" },
{ "pmb_items:stick" },
},
})
end

View File

@ -33,6 +33,34 @@ minetest.register_tool("pmb_tools:stone_pickaxe", {
groups = { pickaxe = 2 },
})
minetest.register_tool("pmb_tools:iron_pickaxe", {
description = S("An iron pickaxe"),
inventory_image = "pmb_iron_pickaxe.png",
tool_capabilities = {
groupcaps = {
cracky = {
times = { .5, .7, 1 },
uses = 192,
},
},
},
groups = { pickaxe = 3 },
})
minetest.register_tool("pmb_tools:diamond_pickaxe", {
description = S("A diamond pickaxe"),
inventory_image = "pmb_diamond_pickaxe.png",
tool_capabilities = {
groupcaps = {
cracky = {
times = { .3, .5, .7 },
uses = 1024,
},
},
},
groups = { pickaxe = 4 },
})
-- Axes
minetest.register_tool("pmb_tools:wooden_axe", {
description = S("A wooden axe"),
@ -59,7 +87,35 @@ minetest.register_tool("pmb_tools:stone_axe", {
},
},
},
groups = { axe = 1 },
groups = { axe = 2 },
})
minetest.register_tool("pmb_tools:iron_axe", {
description = S("An iron axe"),
inventory_image = "pmb_iron_axe.png",
tool_capabilities = {
groupcaps = {
choppy = {
times = { 0.25 },
uses = 192,
},
},
},
groups = { axe = 3 },
})
minetest.register_tool("pmb_tools:diamond_axe", {
description = S("A diamond axe"),
inventory_image = "pmb_diamond_axe.png",
tool_capabilities = {
groupcaps = {
choppy = {
times = { 0.175 },
uses = 1024,
},
},
},
groups = { axe = 4 },
})
-- Shovels
@ -91,4 +147,32 @@ minetest.register_tool("pmb_tools:stone_shovel", {
groups = { shovel = 2 },
})
minetest.register_tool("pmb_tools:iron_shovel", {
description = S("An iron shovel"),
inventory_image = "pmb_iron_shovel.png",
tool_capabilities = {
groupcaps = {
crumbly = {
times = { 0.225 },
uses = 192,
},
},
},
groups = { shovel = 3 },
})
minetest.register_tool("pmb_tools:diamond_shovel", {
description = S("A diamond shovel"),
inventory_image = "pmb_diamond_shovel.png",
tool_capabilities = {
groupcaps = {
crumbly = {
times = { 0.125 },
uses = 1024,
},
},
},
groups = { shovel = 4 },
})
dofile(mod_path .. DIR_DELIM .. "crafting.lua")

View File

@ -1,3 +1,4 @@
-- TODO better place for this
function minetest.handle_node_drops(pos, drops, digger)
local node = minetest.get_node(pos)
local node_def = minetest.registered_nodes[node.name]
@ -14,6 +15,9 @@ function minetest.handle_node_drops(pos, drops, digger)
end
local inv = digger:get_inventory()
if not inv then
return
end
for _, item in ipairs(drops) do
inv:add_item("main", item)
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB