[Dominik] [0.15.32] Big recipes not completing

This subforum contains all the issues which we already resolved.
EmperorZelos
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Sat Mar 05, 2016 5:44 am
Contact:

[Dominik] [0.15.32] Big recipes not completing

Post by EmperorZelos »

We have seen the thing about inputs getting huge past stack sizes in them, which when uncapped is bad but it is good when recipes are fairly big and consumes a lot of resources.

However on the output side it should allow any amount that is outputted, it does it for fluids. But for items I found that if it surpasses the stack size, it won't finish the recipe ever.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5304
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [0.15.32] Big recipes not completing

Post by Klonan »

Could you provide some further clarification?

A screenshot/video of the issue, a mod with this problem, and a save game with a setup already built demonstrating it would be really helpful
User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: [0.15.32] Big recipes not completing

Post by Arch666Angel »

You have to split the result to stack sizes by hand there, for results with more than one stack, just add another line in results with the same item, it will be put into an additional output slot then.
EmperorZelos
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Sat Mar 05, 2016 5:44 am
Contact:

Re: [0.15.32] Big recipes not completing

Post by EmperorZelos »

That's a nice solution, should be fixed though :P
Dominik
Former Staff
Former Staff
Posts: 658
Joined: Sat Oct 12, 2013 9:08 am
Contact:

Re: [Dominik] [0.15.32] Big recipes not completing

Post by Dominik »

Hi,
this is not a problem we would normally encounter in the game, but yes, the possibility of creating more than a stack size should be there and will be from 0.16.
Keep modding, just don't get too crazy :D
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2920
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: [Dominik] [0.15.32] Big recipes not completing

Post by Optera »

Here's the fix I wrote for ReStack. It works on all recipes producing 1 stack per item.
As I'm not playing with any mod producing multiple stacks of the same item I have not (yet) handled that possibility. Easiest way to handle that would be to aggregate those stacks into a single stack before splitting it into new stacks.

Code: Select all

-- fix recipes with result_count or results.amounts > item.stack_size
for _, recipe in pairs(data.raw.recipe) do
  if recipe.result and recipe.result_count then -- if result_count == nil factorio will output 1 item
    local item = data.raw.item[recipe.result]
    if item and recipe.result_count > item.stack_size then
      log("[RS] Fixing recipe "..tostring(recipe.name)..", result "..tostring(item.name).." result_count: "..tostring(recipe.result_count).."/"..tostring(item.stack_size))
      -- split into multiple results
      recipe.icon = item.icon
      recipe.localised_name = {"item-name."..item.name}
      recipe.subgroup = item.subgroup
      recipe.results = {}
      local remaining_size = recipe.result_count
      for i=1, math.ceil(recipe.result_count/item.stack_size) do
        table.insert(recipe.results, { type = "item", name = item.name, amount = math.min(item.stack_size, remaining_size) })
        remaining_size = remaining_size - item.stack_size
      end
      recipe.result = nil
      recipe.result_count = nil
    end
  elseif recipe.results then
    for index=#recipe.results, 1, -1 do
      local result = recipe.results[index]
      if result.type == "item" then
        local item = data.raw.item[result.name]
        if item and result.amount and result.amount > item.stack_size then -- skip over recipes with result.amount_min and result.amount_max
          log("[RS] Fixing recipe "..tostring(recipe.name)..", result["..index.."] "..tostring(item.name).." amount: "..tostring(result.amount).."/"..tostring(item.stack_size))
          -- replace single result with multiple
          local probability = result.probability
          local total_amount = result.amount
          local remaining_size = total_amount
          table.remove(recipe.results, index)
          for i=1, math.ceil(total_amount/item.stack_size) do
            table.insert(recipe.results, { type = "item", name = item.name, amount = math.min(item.stack_size, remaining_size), probability = probability })
            remaining_size = remaining_size - item.stack_size
          end

        end
      end
    end
  end
end
mrvn
Smart Inserter
Smart Inserter
Posts: 5969
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: [Dominik] [0.15.32] Big recipes not completing

Post by mrvn »

Would it be possible to get this workaround into the 0.15 base mod till it gets fixed for real in 0.16?
Dominik
Former Staff
Former Staff
Posts: 658
Joined: Sat Oct 12, 2013 9:08 am
Contact:

Re: [Dominik] [0.15.32] Big recipes not completing

Post by Dominik »

mrvn wrote:Would it be possible to get this workaround into the 0.15 base mod till it gets fixed for real in 0.16?
Just hang tight. As far as I know we do not plan any other 0.15 releases before 0.16.
Post Reply

Return to “Resolved Problems and Bugs”