Recipes not part of def

Fixes #22
This commit is contained in:
Louis 2021-02-25 17:10:22 +01:00
parent f1cfa9d7f3
commit 9526aec1cd
8 changed files with 56 additions and 64 deletions

View File

@ -10,17 +10,16 @@ local cobble = gen_def({
side = "default_cobble.png",
front = "cobblechest_front.png"
},
pipeworks_enabled = true,
recipe = {
{"group:wood", "default:cobble", "group:wood"},
{"default:cobble", "default:steel_ingot", "default:cobble"},
{"group:wood", "default:cobble", "group:wood"}
},
pipeworks_enabled = true
})
minetest.register_node("more_chests:cobble", cobble)
minetest.register_craft({
output = "more_chests:cobble",
recipe = cobble.recipe,
recipe = {
{"group:wood", "default:cobble", "group:wood"},
{"default:cobble", "default:steel_ingot", "default:cobble"},
{"group:wood", "default:cobble", "group:wood"}
}
})

View File

@ -12,11 +12,6 @@ local dropbox = gen_def({
front = "dropbox_front.png"
},
pipeworks_enabled = true,
recipe = {
{"group:wood", "", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
},
allow_metadata_inventory_move = false,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
local meta = minetest.get_meta(pos)
@ -41,5 +36,9 @@ local dropbox = gen_def({
minetest.register_node("more_chests:dropbox", dropbox)
minetest.register_craft({
output = "more_chests:dropbox",
recipe = dropbox.recipe,
recipe = {
{"group:wood", "", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
}
})

View File

@ -3,6 +3,7 @@ local S = minetest.get_translator("more_chests")
-- TODO model open
-- normal fridge
local fridge = gen_def({
description = S("Fridge"),
type = "fridge",
@ -11,20 +12,19 @@ local fridge = gen_def({
side = "fridge_side.png",
front = "fridge_front.png",
},
recipe = {
{"", "default:steel_ingot", ""},
{"default:steel_ingot", "default:ice", "default:steel_ingot"},
{"", "default:steel_ingot", ""}
},
})
minetest.register_node("more_chests:fridge", fridge)
minetest.register_craft({
output = "more_chests:fridge",
recipe = fridge.recipe,
recipe = {
{"", "default:steel_ingot", ""},
{"default:steel_ingot", "default:ice", "default:steel_ingot"},
{"", "default:steel_ingot", ""}
}
})
-- big fridge
local big_fridge = gen_def({
description = S("Big Fridge"),
type = "fridge",
@ -36,15 +36,14 @@ local big_fridge = gen_def({
side = "fridge_side.png",
front = "fridge_front.png",
},
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:ice", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
},
})
minetest.register_node("more_chests:big_fridge", big_fridge)
minetest.register_craft({
output = "more_chests:big_fridge",
recipe = big_fridge.recipe,
recipe = {
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
{"default:steel_ingot", "default:ice", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}
}
})

View File

@ -28,11 +28,6 @@ local secret = gen_def({
},
formspec = open,
pipeworks_enabled = true,
recipe = {
{"group:wood", "default:cobble", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
},
})
secret.on_receive_fields = function(pos, formname, fields, sender)
@ -50,5 +45,9 @@ end
minetest.register_node("more_chests:secret", secret)
minetest.register_craft({
output = "more_chests:secret",
recipe = secret.recipe,
recipe = {
{"group:wood", "default:cobble", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
}
})

View File

@ -44,11 +44,6 @@ local shared = gen_def({
formspec = get_formspec(""),
pipeworks_enabled = true,
sounds = default.node_sound_wood_defaults(),
recipe = {
{"group:wood", "default:leaves", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
},
allow_metadata_inventory_move = actions.get_allow_metadata_inventory_move{"shared chest", check_privs=check_privs},
allow_metadata_inventory_put = actions.get_allow_metadata_inventory_put{"shared chest", check_privs=check_privs},
allow_metadata_inventory_take = actions.get_allow_metadata_inventory_take{"shared chest", check_privs=check_privs},
@ -68,5 +63,9 @@ end
minetest.register_node("more_chests:shared", shared)
minetest.register_craft({
output = "more_chests:shared",
recipe = shared.recipe,
recipe = {
{"group:wood", "default:leaves", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
}
})

View File

@ -1,7 +1,7 @@
local gen_def = dofile(minetest.get_modpath("more_chests") .. "/utils/base.lua")
local S = minetest.get_translator("more_chests")
local function register_toolbox(description, type, side_tile, recipe)
local function register_toolbox(description, material, side_tile, craft_item)
local def = gen_def({
description = description,
type = "toolbox",
@ -9,26 +9,25 @@ local function register_toolbox(description, type, side_tile, recipe)
-- node_box = {-0.5, -0.5, -0.5, 1.5, 0.5, 0.5}, -- makes it two blocks wide
tiles = {
side = side_tile,
front = "toolbox_" .. type .. "_front.png",
top = "toolbox_" .. type .. "_top.png",
front = "toolbox_" .. material .. "_front.png",
top = "toolbox_" .. material .. "_top.png",
},
recipe = recipe,
})
minetest.register_node("more_chests:toolbox_" .. type, def)
minetest.register_node("more_chests:toolbox_" .. material, def)
minetest.register_craft({
output = "morechests:toolbox_" .. material,
recipe = {
{craft_item, craft_item, craft_item},
{craft_item, "group:pickaxe", craft_item},
{craft_item, craft_item, craft_item}
}
})
end
local function gen_recipe(craft_item)
return {
{craft_item, craft_item, craft_item},
{craft_item, "group:pickaxe", craft_item},
{craft_item, craft_item, craft_item}
}
end
register_toolbox(S("Wooden Toolbox"), "wood", "default_wood.png", gen_recipe("default:wood"))
register_toolbox(S("Aspen Wood Toolbox"), "aspen", "default_aspen_wood.png", gen_recipe("default:aspen_wood"))
register_toolbox(S("Acacia Wood Toolbox"), "acacia", "default_acacia_wood.png", gen_recipe("default:acacia_wood"))
register_toolbox(S("Junglewood Toolbox"), "jungle", "default_junglewood.png", gen_recipe("default:junglewood"))
register_toolbox(S("Pine Wood Toolbox"), "pine", "default_pine_wood.png", gen_recipe("default:pine_wood"))
register_toolbox(S("Steel Toolbox"), "steel", "default_steel_block.png", gen_recipe("default:steel_ingot"))
register_toolbox(S("Wooden Toolbox"), "wood", "default_wood.png", "default:wood")
register_toolbox(S("Aspen Wood Toolbox"), "aspen", "default_aspen_wood.png", "default:aspen_wood")
register_toolbox(S("Acacia Wood Toolbox"), "acacia", "default_acacia_wood.png", "default:acacia_wood")
register_toolbox(S("Junglewood Toolbox"), "jungle", "default_junglewood.png", "default:junglewood")
register_toolbox(S("Pine Wood Toolbox"), "pine", "default_pine_wood.png", "default:pine_wood")
register_toolbox(S("Steel Toolbox"), "steel", "default_steel_block.png", "default:steel_ingot")

View File

@ -11,11 +11,6 @@ local wifi = gen_def({
front = {name="wifi_front_animated.png", animation={type="vertical_frames",
aspect_w=16, aspect_h=16, length=2.0}}
},
recipe = {
{"group:wood", "default:mese", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
},
allow_metadata_inventory_move = false,
allow_metadata_inventory_put = false,
allow_metadata_inventory_take = false,
@ -26,7 +21,11 @@ wifi.can_dig = function(pos, player) return true end
minetest.register_node("more_chests:wifi", wifi)
minetest.register_craft({
output = "more_chests:wifi",
recipe = wifi.recipe,
recipe = {
{"group:wood", "default:mese", "group:wood"},
{"group:wood", "default:steel_ingot", "group:wood"},
{"group:wood", "group:wood", "group:wood"}
},
})
minetest.register_on_joinplayer(function(player)

View File

@ -34,7 +34,6 @@ function generate_chest_def(def)
oddly_breakable_by_hand=2
},
sounds = def.sounds or default.node_sound_wood_defaults(),
recipe = def.recipe, -- TODO this is buggy, reason why all models except from toolbox have their own extra call to minetest.register_craft - TODO possibily other similar bugs?
after_place_node = function(pos, placer)
local meta = minetest.get_meta(pos)
meta:set_string("owner", placer:get_player_name() or "")