cancel_crafting works in unexpected ways

Place to report issues and suggest improvements to the API documentation.
galgtonold
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Dec 16, 2025 3:50 pm
Contact:

cancel_crafting works in unexpected ways

Post by galgtonold »

Let's assume an item is added to the crafting queue that causes multiple items to appear in the crafting queue because the player doesn't have all the direct ingredients for it. For example after adding a solar-panel-equipment the crafting queue might look like this:
12-16-2025, 16-55-50.png
12-16-2025, 16-55-50.png (15.83 KiB) Viewed 118 times
Given the description of the documentation if I call
12-16-2025, 16-56-29.png
12-16-2025, 16-56-29.png (2.43 KiB) Viewed 118 times
I would expect one of the copper cables to be removed from the queue. What happens instead is that the entire queue gets cancelled because the "cancel_crafting" seems to look at the queue of composite items that were added through "begin_crafting" instead.

With other words it only considers items that are not a prerequisite to be cancelled. All other items would only indirectly be affected.

Many thanks!
12-16-2025, 16-53-43.png
12-16-2025, 16-53-43.png (41.05 KiB) Viewed 118 times
Rseding91
Factorio Staff
Factorio Staff
Posts: 16380
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: cancel_crafting works in unexpected ways

Post by Rseding91 »

How it works:

When starting any given craft the game will also queue any required items to craft the original request. If one or more of those dependencies are cancelled then the original craft is updated to show the reduced total. If you ask for an iron chest and it needs 1 iron plate crafted, and you cancel the iron plate - the chest obviously can't be crafted. (just an example).

This is what "prerequisite" in the read data means: it is a prerequisite of a later crafting queue entry.

By removing one of the copper cables it's causing one of the electronic circuits to be cancelled which makes the total crafted insufficient for the solar panel which cancels that which cancels the entire queue because the solar panel is what caused all previous crafting entries to exist.
If you want to get ahold of me I'm almost always on Discord.
curiosity
Filter Inserter
Filter Inserter
Posts: 719
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: cancel_crafting works in unexpected ways

Post by curiosity »

And it works the same as the player manually cancelling. That's hardly unexpected.
galgtonold
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Dec 16, 2025 3:50 pm
Contact:

Re: cancel_crafting works in unexpected ways

Post by galgtonold »

Thanks for elaborating, that makes sense from a logical standpoint!

I guess I was thinking about it too naively, expecting it to behave like a list that you modify. :D
Post Reply

Return to “Documentation Improvement Requests”