[SOLVED] Help fixing a job with multiple ingredients.

Started by Hilvon1984, July 22, 2020, 08:51:26 AM

Previous topic - Next topic

Hilvon1984

I am currently trying to improve the Repair Workbench mod to allow items be mended usig not generic "Repair kits" but the ingredients the item was originally created with.
The process of repairing works kind of like coocking with multiple ingredients, with a pawn hauling all the required ingredients and the item to be fixed to the workbench and doing the work. Everything works fine untill an item stars requiring more than 2 ingrediens and some of them are placed not on the table, but next to it. And my process loses track of those ingredients reporting that there aren't enough to do the repairs.
Currently I am using table.IngredientSlots but I guess that only accounts for the slots on the table, so I need to keep track of Cells the ingredients were hauled to, or (if it is possible) of Things that were designated as ingredients.

What would be the best way to get those?

LWM

How does vanilla handle that case for recipes that have a lot of different ingredients?

Hilvon1984

Judging by the cooking job when you make a meal from 10 different ingredients and they end up all over the floor, this situation is handled pretty normally.
Sure the cooking job only interacts with those ingredients when the coocking finishes to despawn them all, while reparing item gradually despawns them as proportional to current fixing progress... but this bit I already have down and it works just fine if all ingredients fit on the table. So the only thing I am missing is how to reference ingredients selected for the job.

LWM

If the cooking job tells them to despawn, it must have some way to track them?

Hilvon1984

Apparently so. :)

Anyway I found what I need. Apparently jobs have two Lists for storing Targets - TargetQueueA and TargetQueueB and 3 single item targets - TargetA, TargetB and TargetC. And after some tests I figured out that even if TargetA is occupied, I can still store more targets in TargetQueueA.

LWM

Excellent! I had forgotten about those queues, and I never did know anything that would use them.