defines.event.on_entity_crafting_complete

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
Mylon
Filter Inserter
Filter Inserter
Posts: 525
Joined: Sun Oct 23, 2016 11:42 pm
Contact:

defines.event.on_entity_crafting_complete

Post by Mylon »

event = {entity = "assembler", recipe = "recipe" }

I want this for assemblers, but I might be able to see some use for players too.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16360
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: defines.event.on_entity_crafting_complete

Post by Rseding91 »

We specifically don't have such an event because it would be a massive drain on game performance.
If you want to get ahold of me I'm almost always on Discord.
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: defines.event.on_entity_crafting_complete

Post by Supercheese »

Mylon wrote:event = {entity = "assembler", recipe = "recipe" }

I want this for assemblers, but I might be able to see some use for players too.
Don't we already have this for players?
Rseding91
Factorio Staff
Factorio Staff
Posts: 16360
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: defines.event.on_entity_crafting_complete

Post by Rseding91 »

Supercheese wrote:
Mylon wrote:event = {entity = "assembler", recipe = "recipe" }

I want this for assemblers, but I might be able to see some use for players too.
Don't we already have this for players?
Yes, because the player count is not in the 10s of thousands and has a fixed crafting speed.
If you want to get ahold of me I'm almost always on Discord.
Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: defines.event.on_entity_crafting_complete

Post by Supercheese »

Rseding91 wrote:Yes, because the player count is not in the 10s of thousands and has a fixed crafting speed.
Indeed, I was just pointing that event out because it seemed the OP wasn't aware of it.
User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 843
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

Re: defines.event.on_entity_crafting_complete

Post by IsaacOscar »

Sorry for necroing an old thread, but would it be possible to have the recipe and/or crafting machine's prototype opt in to an event? So any performance problems can be minimised?
SWeini
Long Handed Inserter
Long Handed Inserter
Posts: 75
Joined: Mon Apr 04, 2022 6:43 am
Contact:

Re: defines.event.on_entity_crafting_complete

Post by SWeini »

+1

Mods that want to do that will find a way and it will cost more performance that such an event (and might have restrictions with mod compatibility). For example using rocket silos or on-tick events with products_finished and/or crafting_progress.

This can be very restrictive, such that is has to be enabled per-prototype or even per-entity (similar to register_on_object_destroyed)

Having this built-in is also the only way to make this work with ultra-fast recipes that do complete more than once per tick (performance-wise this should still be fine if there aren't many of those entities).
User avatar
protocol_1903
Filter Inserter
Filter Inserter
Posts: 413
Joined: Fri Sep 09, 2022 4:33 pm
Contact:

Re: defines.event.on_entity_crafting_complete

Post by protocol_1903 »

I'm working on a script handler for such an event but it's not cheap to run. I'll be adding it to the following mod when it's done.

https://mods.factorio.com/mod/perel
Py and PyBlock developer, wielder of LUA in arbitrary ways. I make mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
Post Reply

Return to “Modding interface requests”