Hi all,
so I made a mod where science packs spoil into other science packs. It seemed like a fun idea to me to let all sciences spoil into each other until you end up with automation science pack spoiling into wood. When a science spoils into another science while in a lab, it will be moved to the special spoilage slot. If that's full already, it will stay where it is and wait for the spoilage slot to be freed. This process clogs the lab whith multiple slots holding the same/wrong science packs, stopping the whole research.
The problem here is, that neither do the spoiled science packs move to the correct new slot nor is there a way to remove items only from the spoilage slot but not from the regular slots. Any science pack can be in the spoilage slot so I cannot filter an inserter for anything so it will just remove the science packs from the regular slots, not prioritizing the spoiled sciences in the spoilage slot.
Since I have no clue how to either fix this with regular game mechanics or by coding someting in my mod, I came here to ask for help. Do you guys have any idea how to solve this? I really like this to work because it seems a lot of fun.
Thanks.
Handling spoil results in labs when the spoil result is a science pack
-
- Burner Inserter
- Posts: 14
- Joined: Tue Jul 26, 2022 1:53 pm
- Contact:
Handling spoil results in labs when the spoil result is a science pack
- Attachments
-
- 2024-12-05 10_25_07-Factorio_ Space Age 2.0.22.png (132.89 KiB) Viewed 229 times
Re: Handling spoil results in labs when the spoil result is a science pack
Hello,
These two inventory properties exist, so maybe you can move them in and out when one spoils;
Stack trace that might work;
- spoil_to_trigger_result
-> trigger (Trigger)
--> TriggerEffectItem with an effect_id (string), I think a separate table for data:extend (data.lua) but I might be wrong and could be just the table you have to supply for the trigger field.
--> script.on_script_trigger_effect to use that effect_id (control.lua)
--> do remove(ItemThatSpoiled), return value is amount of items. re-insert them in next line by addition.
https://lua-api.factorio.com/latest/typ ... esult.html
https://lua-api.factorio.com/latest/typ ... tItem.html
That said, it does look more on the bug side than actual intended behavior. It is impossible to move science packs to the wrong location when playing. Your green science is in the slot normally spoilage (from Gleba packs) gets to.
These two inventory properties exist, so maybe you can move them in and out when one spoils;
Code: Select all
Entity.get_inventory(defines.inventory.lab_input)
Entity.get_output_inventory() -- I suspect this is where your spoilage result ended up
- spoil_to_trigger_result
-> trigger (Trigger)
--> TriggerEffectItem with an effect_id (string), I think a separate table for data:extend (data.lua) but I might be wrong and could be just the table you have to supply for the trigger field.
--> script.on_script_trigger_effect to use that effect_id (control.lua)
--> do remove(ItemThatSpoiled), return value is amount of items. re-insert them in next line by addition.
https://lua-api.factorio.com/latest/typ ... esult.html
https://lua-api.factorio.com/latest/typ ... tItem.html
That said, it does look more on the bug side than actual intended behavior. It is impossible to move science packs to the wrong location when playing. Your green science is in the slot normally spoilage (from Gleba packs) gets to.