API Event when crafting fails

Things that we aren't going to implement
User avatar
kizrak
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Thu Jul 19, 2018 1:27 am
Contact:

API Event when crafting fails

Post by kizrak »

I would like an event I can listen to that fires when crafting fails. TMK this just means when you are missing materials/tech/non-hand-craft-able. The event should include the item/recipe that failed.

I would like this, so I can make a mod that prevents all real-crafting but instead puts a ghost of any desired item onto the cursor.

Right now I have a non-robust hack that puts the player into cheat mode (allowing them to `craft` (aka ghost-select) everything), but detects the craft event and tries to delete the item after the craft happens (undo the craft) then ghost the deleted item to the cursor. It is very buggy and often allows duplication bugs and interacts with other events poorly.

Thanks!
-Kizrak
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: API Event when crafting fails

Post by Deadlock989 »

What do you mean, "when crafting fails"? Crafting can't "fail". If you don't have the ingredients to craft a recipe then crafting never even starts. How can you detect something that doesn't happen?
User avatar
kizrak
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Thu Jul 19, 2018 1:27 am
Contact:

Re: API Event when crafting fails

Post by kizrak »

There is still a button event somewhere when a user clicks the item to craft. That event is detected by Factorio in order to give the error message. I want a LUA event that is able to detect that click (and fail) so that my mod can act on it.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14332
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: API Event when crafting fails

Post by Rseding91 »

The game never sends that "failed" state into the game for a mod to be able to react to it. I would have to send additional network packets every time crafting failed just for mods to use and that's not something I want to do at the moment.
If you want to get ahold of me I'm almost always on Discord.
Post Reply

Return to “Won't implement”