Helfima / helmod

Factorio Mod
149 stars 64 forks source link

Issue with values of sub block in parent block. Last block determine what parent block requests #536

Open Paraplegix opened 2 weeks ago

Paraplegix commented 2 weeks ago

Reproduced in Factorio 1.1.107 and helmod 1.0.11 (pulled from this repo)

I'm sure it's a weird edge case, but might point to another issue with the compute of blocks. I found this while trying to debug for the loop bug (#534) but with pyanodon recipes and managed to reproduce it with base factorio.

When having several blocks providing the same resource (for example several blocks doing solid fuel), there is a weird behavior on when blocks will (or not) show their output.

So based on this configuration : image

Line string The line used for the demo ```text eNrtmltvqzgQgP/KEc8k4n4SVbzsw76ttOrr0Qo54LRsDUZcehpF/Pe1sQ22uZw0Sbs9EnkpHszYHs/M56Ek+BvCMUDfovAcI1BVofEXTiAyzDQJjYxeRnvDxD9zWIbG36AEBYJP6ZthHshzLxHpteOXJcZ1r+QPKmJK2F2bNPIEvoWWmYMMhkaFUZpsjg1Em2OJs00B6xIj2GSbJ1BNjhjjJq9D2yzwT3Ir8G2L/ojapxImKczrKjz/MFQ9/4RnNpymvj4VRHhETZoYJsg6zQFRVtWghqHTmj+MZwheTxucokHJIJpU4KgKUPr0XKsKBtGkAtuWNLRmUeKkidmyBnMN2iQZV5fWMBu0+UKZTZTFzylKSpiHZ7Yh7vxeue/cKzZ2CeO0gBfsnO1azsft3M1mc+nEiqa7mDLfo9Nb7pEvmZru0bnJarEYm88+xTkx2BHENS5P/YB/srbBR4ifYZaS6N0UCOS1UEnsmdanwStNSDbk6RQ69ndq9aqAMCG6UZqlNZksCfIGQWKt1oTHI+wMx/oMk3klCkkzxnnVZEU3OXITI9Swa2IfUFzzWPdEVOMaoM4/+ltbK9B+Nl8H7+25Hl1N/wgXW1vb1X7ctoHFLiK28L6ZQFiQVmseIKAzDc99YHQCYewDb00a2RJG9nada8c4O+DQMwtYRmITra0vtyM6WA3ork/uhbxYPtdQXYKyAos46QFUMKpTMlvb7P44kn3ETCcMNGVYeSBXGYk6qRrIXZP31YTdE5JMbLAnzYw9KEu6p4gAkIirIyUzFekr5YwcuKOwbmkWkIZqcpTmL8Q167KBY62ETdxoz6CKWPB3PfHhX0jdGE7kkhd4UlPJK0ANJMahyUKynX2FdeYtQuIoAzQhHBqSj0gCpX4srgfP7iXcuXkiSdlCtLTRJ8bldPKuKBIqp4PmMmcW4dhKYdHKvUhGeCsAyblJeB5wEx4BqmCrJtLLvIafZLx5NHoiydszSX50RLgYiyzuRlS87Rhy+yFC0NCeoaE7TcNfniFmDRWLcVcSfhAJHTXyHCX0nJWECyS0lZFsS4tdOdWrMpa/e5HYXXs7moJOgcUubBoTPS7Jd2MSeoZCzgnFn4hS22q1LD7P1UuMfYs9x9x1Rtx1dO46d+TuhTH7Fbj7HtT686j1BUGcGYKMiulbUXtFwW4NeJT5eDt0B4BLrPWmWev9irWzllpZu7J2Ze2trNUh6GtVKs8ZekZpP4e1SlbrUCulA0Ha5ap1peuXoevhFPE8xyQ3lLnBPHsDQRTv7ux191ZwH/ju71nn7gXI9zN1rj/NXv9G9u5X9n4Ye+2dBpSdSpTdit8F/O6VkfaWHr8yIDQhe008yHrGOWNeOCM+OGPUBde89yWKPrFa3S8j9DILLRllDEnqzxolFZHw8vtx8vKI+l0KUSX7CjLu5sm4E/ne/dpV6ee9AA6mwRisRelalK5F6ZcpSndXIfT/fwG8VqW/wzvf9xehspuRlUmO1H91pmJh5Fas/r3/Ua3/skxyLEmmepZj6Z5EJGPPca2R6ygi/mHFHZ3HHX3DoX3E8cn+w89W1fD9mdX/u93q/xtg9e8mrP4sRiaqHIlas4QVbsqY0YH7xSssK+Z/7NjhU5ci66qJPDxfj3M6GnVA6prf+VGIrO2BfzYZkcZDtGVr24qlcUH3TeRWnJXEXb27t9jd07v7i919vXuw2D3Qu+8Wu+8eSlg3Zf4teoB58h/B486U ``` EDIT: it seems broken. The product are not set on each individual sub block and all sub block are linked...

Each block is just one recipe inside, one of the block is in "ingredient mode", but this doesn't affect things.

Now onto the weird part :

What ammount on each line will be shown on the lines seem to depend on what ammount of item the last block provides.

For example if the last row i reduce it from 90 to 60, the last block will show 60 even if showing the block is indeed 60 ![image](https://github.com/Helfima/helmod/assets/12891208/fded5423-c90a-47c7-ba41-3675f3ef774c) ![image](https://github.com/Helfima/helmod/assets/12891208/c950e474-e17c-4e32-b567-2dd4b5a33532)
If I put back 61 in the last block it will show again 61. ![image](https://github.com/Helfima/helmod/assets/12891208/1370a113-1409-4b2a-b5b0-a8028d2be86a)
If I put 30 in the last block, only the first row will show something ![image](https://github.com/Helfima/helmod/assets/12891208/09a22429-3271-4d6c-8ece-ad8a7de84f68)
The order seem to be important, if I move the first block (with 30) down two rows so the first two rows have 10 SF as product, still with 30 in the last block, then the first 3 rows will show products with a total of 50 ![image](https://github.com/Helfima/helmod/assets/12891208/1d295221-54b2-4556-af8f-708fa560c0ce)
If I toggle a sub block as "linked", The parent block will act like last block "amount" is the request for the parent block The 2nd block is configured for 10 output but show as 20 in 2 blocks. ![image](https://github.com/Helfima/helmod/assets/12891208/438cdc68-43f0-437d-a668-9e66b77fd2e0)

Adding a different recipe or block in the middle of the Solid Fuel block doesn't seem to affect the behavior.

Seems like 2 issue are at play :

  1. Parent block act like the last block providing an item is the amount the parent block "need".
  2. Unlinked block should show their "product/ingredient" as is, with no effect whatsoever from parent block "request" and/or other blocks requests.
Helfima commented 1 week ago

hello if you can try dev branch from this repository on your pyanodon game https://github.com/Helfima/helmod/tree/dev

Paraplegix commented 1 week ago

It seems much better now! And also seem to fix some issue with other stuff

I tested in my test vanilla game (the one where i took the screenshot and managed to show all block products).

I tested it by replicating (from scratch) the recipes from my current factorio pyanodon save and now the block seem to behave as expected.

I loaded the worlds on both factorio 1.0.9 with helmod available on the mod portal and on the "test" factorio 1.0.7 (a manualy downloaded version) with the helmod coming from the dev branch. And things really seem much much better : Left is dev branch after clicking "reset to 100%", and right is "master" branch after click "reset to 100%. Some where partialy fine before. image image

However, some production line seem broken by missing value: (I do not know since when) image I don't know why the failing block is empty. I do not exclude the possibility that the recipe used was removed/changed in the pyanodon mod. but considering all block below the sooth (the one with the green bar) are empty. And they all produce an error of "count_limit" or "matrix" (a nil value) Also for more context, most of the items in those productions line are inherited from helmod versions 0.XX, so maybe they were always broke. I doubt those errors are pertinent to investigate.

Here are the different message I got while navigating the different panels. from the dev branch image

Minus the "bugs" wich might not be helmod fault, I do belive that this version is already much closer to being exploitable for me !

Paraplegix commented 1 week ago

The dev branch also fixes #511 and #534 I guess

Helfima commented 1 week ago

you have missing recipe but normaly It must display row with error I fixed the error with nil value you can retry the last commit

Paraplegix commented 1 week ago

Stuff is different now, I guess the recipe I was using was removed. The rows do display now. image

Clicking reset to 100% in the line provoque an error : __helmod__/data/ModelCompute.lua:264: attempt to perform arithmetic on field 'amount' (a nil value)

The name of the recipe point to a recipe that isn't available anymore niobium plate with hot air.

The block itself show this : image

The log message clearly say ERROR: Recipe hotair-niobium-plate" not exist in game when opening the sub block.

Trying to delete the row by clicking the cross/delete button doesn't visualy change anything, with the same error ModelCompute.lua:264. However just clicking on the block again will show the block correctly with the row deleted. I guess the error prevent the interface from refreshing althoug the row/element is deleted.

I had two other sub blocks with missing recipes (so 3 in total). Deleting missing recipe on 2nd did the same thing (no visual change, but ok when click on block). On the third one the recipe updated correctly, the interface changed and removed the row correctly. What was deleted didn't matter as only the last one of the block didn't throw an error.

Other weird behavior is that block above the one with missing recipe where correctly displayed: image

But after the first block where all with missing icon and infos: image

Deleting the missing recipe between the two block shown allowed the block to be displayed correctly image

Helfima commented 1 week ago

if you can share your save with the error I can try work on the missing recipe, is not easy to reproduce

Paraplegix commented 1 week ago

Sure, but as I said, I don't think that's a must solve problem, it would only happen when recipe are deleted, and at least like this it's quite visible.

If you just hide the stuff missing it make just make it more confusing

Here is the file, works with factorio 1.1.7 and up i guess. https://drive.google.com/file/d/1CuWqZRsjbMHpPvyZuw5ZEg-Kfpr2pISD/view?usp=sharing

(just pull all pyanodon mods and helmod, the other mods are mostly qol and not necessary to reproduce the bug)

Helfima commented 1 week ago

je ne vais pas supprimer les recettes, juste améliorer la fiabilité et éventuellement l'affichage dans ce cas

Helfima commented 1 day ago

it's better :) image