Add empty_spool as fab output

This commit is contained in:
Joachim Stolberg 2023-02-11 17:15:46 +01:00
parent b85e325cd5
commit 4a09dc785f
2 changed files with 11 additions and 2 deletions

View File

@ -77,8 +77,9 @@ local function making(pos, crd, nvm, inv)
local owner = M(pos):get_string("owner") local owner = M(pos):get_string("owner")
local rtype = RecipeType[crd.stage] local rtype = RecipeType[crd.stage]
local recipe = recipes.get(nvm, rtype, owner) local recipe = recipes.get(nvm, rtype, owner)
local output = ItemStack(recipe.output.name.." "..recipe.output.num) local output = ItemStack(recipe.output.name .. " " .. recipe.output.num)
if inv:room_for_item("dst", output) then local waste = recipe.waste and ItemStack(recipe.waste.name .. " " .. recipe.waste.num)
if inv:room_for_item("dst", output) and (not waste or inv:room_for_item("dst", waste)) then
for _,item in ipairs(recipe.input) do for _,item in ipairs(recipe.input) do
local input = ItemStack(item.name.." "..item.num) local input = ItemStack(item.name.." "..item.num)
if not inv:contains_item("src", input) then if not inv:contains_item("src", input) then
@ -91,6 +92,9 @@ local function making(pos, crd, nvm, inv)
inv:remove_item("src", input) inv:remove_item("src", input)
end end
inv:add_item("dst", output) inv:add_item("dst", output)
if waste then
inv:add_item("dst", waste)
end
crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS) crd.State:keep_running(pos, nvm, COUNTDOWN_TICKS)
return return
end end

View File

@ -51,11 +51,13 @@ minetest.register_craftitem("techage:ta5_aichip2", {
techage.recipes.add("ta2_electronic_fab", { techage.recipes.add("ta2_electronic_fab", {
output = "techage:vacuum_tube 2", output = "techage:vacuum_tube 2",
waste = "basic_materials:empty_spool 1",
input = {"default:glass 1", "basic_materials:copper_wire 1", "basic_materials:plastic_sheet 1", "techage:usmium_nuggets 1"} input = {"default:glass 1", "basic_materials:copper_wire 1", "basic_materials:plastic_sheet 1", "techage:usmium_nuggets 1"}
}) })
techage.recipes.add("ta3_electronic_fab", { techage.recipes.add("ta3_electronic_fab", {
output = "techage:vacuum_tube 2", output = "techage:vacuum_tube 2",
waste = "basic_materials:empty_spool 1",
input = {"default:glass 1", "basic_materials:copper_wire 1", "basic_materials:plastic_sheet 1", "techage:usmium_nuggets 1"} input = {"default:glass 1", "basic_materials:copper_wire 1", "basic_materials:plastic_sheet 1", "techage:usmium_nuggets 1"}
}) })
@ -81,17 +83,20 @@ techage.recipes.add("ta4_electronic_fab", {
techage.recipes.add("ta4_electronic_fab", { techage.recipes.add("ta4_electronic_fab", {
output = "techage:ta4_leds 8", output = "techage:ta4_leds 8",
waste = "basic_materials:empty_spool 1",
input = {"basic_materials:plastic_sheet 4", "basic_materials:copper_wire 1", "techage:ta4_silicon_wafer 1"} input = {"basic_materials:plastic_sheet 4", "basic_materials:copper_wire 1", "techage:ta4_silicon_wafer 1"}
}) })
techage.recipes.add("ta4_electronic_fab", { techage.recipes.add("ta4_electronic_fab", {
output = "techage:ta5_aichip 2", output = "techage:ta5_aichip 2",
waste = "basic_materials:empty_spool 2",
input = {"techage:ta4_leds 8", "basic_materials:copper_wire 1", "basic_materials:gold_wire 1", "techage:ta4_silicon_wafer 1"}, input = {"techage:ta4_leds 8", "basic_materials:copper_wire 1", "basic_materials:gold_wire 1", "techage:ta4_silicon_wafer 1"},
ex_points = 10, ex_points = 10,
}) })
techage.recipes.add("ta4_electronic_fab", { techage.recipes.add("ta4_electronic_fab", {
output = "techage:ta5_aichip2 2", output = "techage:ta5_aichip2 2",
waste = "basic_materials:empty_spool 2",
input = {"techage:ta4_leds 8", "basic_materials:copper_wire 1", "basic_materials:gold_wire 1", "techage:ta4_silicon_wafer 1"}, input = {"techage:ta4_leds 8", "basic_materials:copper_wire 1", "basic_materials:gold_wire 1", "techage:ta4_silicon_wafer 1"},
ex_points = 50, ex_points = 50,
}) })