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
API Event when crafting fails
- Deadlock989
- Smart Inserter
- Posts: 2529
- Joined: Fri Nov 06, 2015 7:41 pm
Re: API Event when crafting fails
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?
Re: API Event when crafting fails
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.
Re: API Event when crafting fails
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.