Add crafting type: digging by chance

This commit is contained in:
Wuzzy 2016-08-07 03:49:16 +02:00
parent 7d039147e7
commit 08d8d99ab3
4 changed files with 27 additions and 0 deletions

21
api.lua
View File

@ -55,6 +55,21 @@ minetest.after(0.01, function()
}) })
end end
elseif type(def.drop) == "table" then
for i=1,#def.drop.items do
local itit = def.drop.items[i]
for j=1,#itit.items do
local dstack = ItemStack(itit.items[j])
if not dstack:is_empty() and dstack:get_name() ~= name then
unified_inventory.register_craft({
type = "digging_chance",
items = {name},
output = dstack:get_name(),
width = 0,
})
end
end
end
end end
end end
for _, recipes in pairs(unified_inventory.crafts_for.recipe) do for _, recipes in pairs(unified_inventory.crafts_for.recipe) do
@ -203,6 +218,12 @@ unified_inventory.register_craft_type("digging", {
height = 1, height = 1,
}) })
unified_inventory.register_craft_type("digging_chance", {
description = "Digging (by chance)",
icon = "default_tool_steelpick.png^[transformFY.png",
width = 1,
height = 1,
})
function unified_inventory.register_page(name, def) function unified_inventory.register_page(name, def)
unified_inventory.pages[name] = def unified_inventory.pages[name] = def

View File

@ -1,5 +1,8 @@
# Translation mostly by Xanthin # Translation mostly by Xanthin
### api.lua ###
Digging (by chance) = Graben (durch Zufall)
### bags.lua ### ### bags.lua ###
Bags = Rucksaecke Bags = Rucksaecke
Bag 1 = Rucksack 1 Bag 1 = Rucksack 1

View File

@ -1,5 +1,8 @@
# Translation by # Translation by
### api.lua ###
Digging (by chance) =
# Template # Template
### bags.lua ### ### bags.lua ###
Bags = Bags =

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

After

Width:  |  Height:  |  Size: 896 B