Jump to content

"The production line you chose doesn't exist. " error


Laserzwei

Recommended Posts

I made a video showing the "The production line you chose doesn't exist. " error and that its occurence is relatively random. Which is caused by the way lua handles iterators.

I used the Oxygen-Hydrogen-Nitrogen Gas Collector as it seems to be especially likely to cause this error (others are likely to be affected as well. Typically multi-output üroductions are affected).

The video is pretty boring though.

Headphone users tune down volume, some bad noises sneaked in.

As you can see reloading "fixes" this bug for some ships at a time. This is not consistent in when or which ship can create the gas Collector.

Now this bug is not new to 0.16, it is here since at least 0.13, but even more likely since the steam-release or earlier.

 

I tried to find the scource of the bug, I found a solution pretty fast, but I still didn't get how the bug actually occurs.

So I will start with a summery of where and what goes wrong. Then I will present an un-invasive fix.

The cause lies within

/entity/stationsfounder.lua in  StationFounder.buildFactoryGui(levels, tab)

When iterating through    productionsByGood    in the selection of the    possibleProductions    (line 340-346) it seems as if the wrong production-index combination can get chosen (Oxygen, 2, for the above shown gas collector). Which is not present in    productionsByGood    .

This wrong combination gets saved on the client-side and is send to the server in the    foundFactory(goodName, productionIndex)    function, where in line 486

    production    becomes nil, due to the wrong parameters transferred and the error gets thrown.

 

My Solution:

It is based around the fact that    productionsByGood    is already holding all the productions, sorted by their respective resultName.

line 333:

Instead of the wildcard we save the Goodname, which happens to be the key of    productionsByGood

for k, productions in pairs(productionsByGood)

line 340:

Instead of using the first result we could grab, we use the good that actually is indexed in    productionsByGood

local result = goods[k]

line 345:

since this goodName would not be available outside of the loop we save it for later use:

table.insert(possibleProductions, {production=production, index=index, goodName = k})

 

line 377:

Now we need to unpack our additional information:

local result = goods[p.goodName]

 

Edit: added boring disclaimer

 

Link to comment
Share on other sites

  • 2 months later...
  • 3 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...