mirror of
https://github.com/minetest-mods/craftguide.git
synced 2024-11-22 19:03:43 +01:00
Define custom recipe's width inside craft declaration
This commit is contained in:
parent
74a2750a4d
commit
783a84d3c6
@ -20,9 +20,8 @@ Use the command `/craft` to show the recipe(s) of the pointed node.
|
|||||||
#### Registering a custom crafting type ####
|
#### Registering a custom crafting type ####
|
||||||
```Lua
|
```Lua
|
||||||
craftguide.register_craft_type("digging", {
|
craftguide.register_craft_type("digging", {
|
||||||
description = S("Digging"),
|
description = "Digging",
|
||||||
icon = "default_tool_steelpick.png",
|
icon = "default_tool_steelpick.png",
|
||||||
width = 1,
|
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -30,6 +29,7 @@ craftguide.register_craft_type("digging", {
|
|||||||
```Lua
|
```Lua
|
||||||
craftguide.register_craft({
|
craftguide.register_craft({
|
||||||
type = "digging",
|
type = "digging",
|
||||||
|
width = 1,
|
||||||
output = "default:cobble 2",
|
output = "default:cobble 2",
|
||||||
items = {"default:stone"},
|
items = {"default:stone"},
|
||||||
})
|
})
|
||||||
|
6
init.lua
6
init.lua
@ -55,8 +55,7 @@ end
|
|||||||
|
|
||||||
craftguide.register_craft_type("digging", {
|
craftguide.register_craft_type("digging", {
|
||||||
description = S("Digging"),
|
description = S("Digging"),
|
||||||
icon = "default_tool_steelpick.png",
|
icon = "default_tool_steelpick.png",
|
||||||
width = 1,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function craftguide.register_craft(def)
|
function craftguide.register_craft(def)
|
||||||
@ -65,6 +64,7 @@ end
|
|||||||
|
|
||||||
craftguide.register_craft({
|
craftguide.register_craft({
|
||||||
type = "digging",
|
type = "digging",
|
||||||
|
width = 1,
|
||||||
output = "default:cobble",
|
output = "default:cobble",
|
||||||
items = {"default:stone"},
|
items = {"default:stone"},
|
||||||
})
|
})
|
||||||
@ -476,8 +476,8 @@ local function add_custom_recipes(item, recipes)
|
|||||||
local craft = craftguide.custom_crafts[j]
|
local craft = craftguide.custom_crafts[j]
|
||||||
if craft.output:match("%S*") == item then
|
if craft.output:match("%S*") == item then
|
||||||
recipes[#recipes + 1] = {
|
recipes[#recipes + 1] = {
|
||||||
width = craftguide.craft_types[craft.type].width,
|
|
||||||
type = craft.type,
|
type = craft.type,
|
||||||
|
width = craft.width,
|
||||||
items = craft.items,
|
items = craft.items,
|
||||||
output = craft.output,
|
output = craft.output,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user