Show missing bottles for current research

by Quezler

Research-kun why are you stuck?

Tweaks
8 months ago
1.1 - 2.0
3.29K

b Lab capability detection missing

8 days ago

When there are multiple modded lab types, where some lab types can only accept certain science bottles but not all the ones needed for the current science then this mod is reporting that some of the science bottles are missing when they are in fact not missing on all the labs that 'are' capable of processing that science.

Should be a simple enough fix though, in control.lua in the get_missing_counts function it is currently doing this for each lab:
1. if lab is valid
2. and if the lab is of the same force
3. and if the lab is of status defines.entity_status.missing_science_packs
4. and if the lab inventory is not empty
5. and it then gets the inventory of that lab into a table
6. and it then loops over the desired_list that was passed in as the list argument
7. and for each desired it checks if that lab can use that science bottle
8. and if the item count is nil
9. then it adds it to the missing list.

This works fine for a lab that can take either all of the science for the pack or only part of them, but for cases where the lab takes 'some' of the science bottles but not all of it, and those labs will never be filled with those science bottles because they are specialty use (like the Neumann V labs from the Metal and Stars mod, which takes that mods own science and some other sciences, but not all other sciences (it doesn't accept any nauvis sciences for example, among others), then this mod will complain about some of the inputs being empty even though they are and can never be used in these labs anyway, and shipping gleba science over just to let it spoil just to keep the indicator of this mod empty is not entirely easily sustainable. :-)

An example:
I research a science that uses, say, red, green, blue, purple, orange, and gleba science. This lab cannot take the red/green/blue/purple, but does accept orange and gleba, but there is no science that takes orange or gleba that can be done in this lab, so it makes no sense to keep it stocked with a spoiling science for no reason, so this mod just constantly shows I'm out of some sciences (depending on what I'm researching) even though I'm not in the labvs that can actually do it.

The simple fix is in the above steps the step 7. and for each desired it checks if that lab can use that science bottle and change it to immediately return an empty table, I.E. in the current version change line 125 that is currently if storage.lab_inputs[struct.entity.name][item_name] then -- ignore labs that cannot use this item to instead be something like if not storage.lab_inputs[struct.entity.name][item_name] then return {} else -- ignore labs that cannot use this item. This inverts the condition with the not then just returns an empty table else continues with the normal processing. Basically if a lab can't take any of the bottles of the current science then this lab can't do the science anyway so then there is no point worrying about what it's missing as it can't be missing anything for the science anyway since it can't do the science. :-)

8 days ago

I'm wondering if this would also fix the bug that one of the other discussions had as well. The Metal and Star mod science lab is not the only one that works this way, even just in my pack alone.

8 days ago

damn that's quite the writeup, and yeah this mod only really works if you have just one lab setup, kinda marked it as deprecated once but people just kept prodding, dunno if i'll ever get to refractoring this.

6 days ago

Well if you want it just changing that one line to what I put above should fix it. :-)

And yeah, know how that goes... ^.^;

6 days ago

feel free to create a pull request

5 days ago

feel free to create a pull request

Certainly, just did, see #61.

Tested it in my pack with multiple lab types that cause the issue and it appears resolved, including testing the case when a science pack was legit missing from a supported lab and that continues to work properly as well. Can anyone else confirm?

New response