Author Topic: "The production line you chose doesn't exist. " error  (Read 717 times)

Laserzwei

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    340
    • View Profile
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
Quote
/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
Code: [Select]
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
Code: [Select]
local result = goods[k]line 345:
since this goodName would not be available outside of the loop we save it for later use:
Code: [Select]
table.insert(possibleProductions, {production=production, index=index, goodName = k})
line 377:
Now we need to unpack our additional information:
Code: [Select]
local result = goods[p.goodName]
Edit: added boring disclaimer
« Last Edit: March 04, 2018, 08:07:06 PM by Laserzwei »



Kamo

  • Full Member
  • ***
  • Status:
    Offline
    Posts:
    232
  • Cuddles float better in space~
    • View Profile
on: March 08, 2018, 10:23:54 AM
Good bugfix :D ! Will probably be implemented next update !
Colorize messages, with the colors of materials (from wiki) !
Ir #FFB380 Ti #FFFFFF Na #4DFF4D Tr #4D9AFF Xa #FFFF4D Og #FF8133 Av #FF2626



Laserzwei

  • Sr. Member
  • ****
  • Status:
    Offline
    Posts:
    340
    • View Profile
on: May 13, 2018, 10:59:52 AM
Since this is
a) still not fixed and
b) is also mentioned in this reddit post,
I decided to publish  the complete fixed file here. (The file is for beta 0.17 , but should work with stable 0.16)



Grandirus

  • Newbie
  • *
  • Status:
    Offline
    Posts:
    16
    • View Profile
on: May 29, 2018, 07:22:22 AM
Since this is
a) still not fixed and
b) is also mentioned in this reddit post,
I decided to publish  the complete fixed file here. (The file is for beta 0.17 , but should work with stable 0.16)

 ;D Worked for me. Thanks