mcl_vegan_utils: create compression recipe util
create function for registering recipes that compress (and optionally un-compress) items. an example of this in vanilla is wheat being compressable into hay.
This commit is contained in:
parent
5d9abe9cfe
commit
754f902359
2 changed files with 40 additions and 0 deletions
39
mcl_vegan_utils/craft.lua
Normal file
39
mcl_vegan_utils/craft.lua
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
function mcl_vegan.register_compress_recipe (input, output, def)
|
||||||
|
def = def or {}
|
||||||
|
|
||||||
|
if def.reversible == nil then def.reversible = true end
|
||||||
|
local reversible = def.reversible
|
||||||
|
|
||||||
|
if def.big == nil then def.big = true end
|
||||||
|
local big = def.big
|
||||||
|
|
||||||
|
local compress_factor = 4
|
||||||
|
if big then compress_factor = 9 end
|
||||||
|
|
||||||
|
if big then
|
||||||
|
minetest.register_craft({
|
||||||
|
output = output,
|
||||||
|
recipe = {
|
||||||
|
{ input, input, input },
|
||||||
|
{ input, input, input },
|
||||||
|
{ input, input, input },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
else
|
||||||
|
minetest.register_craft({
|
||||||
|
output = output,
|
||||||
|
recipe = {
|
||||||
|
{ input, input },
|
||||||
|
{ input, input },
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
if reversible then
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = input .. " " .. compress_factor,
|
||||||
|
recipe = { output },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
|
@ -13,3 +13,4 @@ include("farming_node")
|
||||||
include("farming_item")
|
include("farming_item")
|
||||||
include("drops")
|
include("drops")
|
||||||
include("food")
|
include("food")
|
||||||
|
include("craft")
|
||||||
|
|
Loading…
Reference in a new issue