Entity On_crafting_complete event

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
antichaos
Inserter
Inserter
Posts: 20
Joined: Tue Jul 29, 2014 11:44 am
Contact:

Entity On_crafting_complete event

Post by antichaos »

Can we please have an event which is raised when an entity of type assembling-machine completes a craft?

If anyone can point me to a mod that has a good workaround for this, that would be great.

What I want to do is replace the entity, or change its recipe when crafting finishes. An example would be placing a 'construction site', loading it with materials, and when it completes it is replaced with the completed building. This can be extended to multi - stage or cyclical buildings. The core challenge would be to automatically vary the resources that are delivered to a location over time.

Nexela
Smart Inserter
Smart Inserter
Posts: 1828
Joined: Wed May 25, 2016 11:09 am
Contact:

Re: Entity On_crafting_complete event

Post by Nexela »

Given the number of times an event like this would fire per tick I doubt we will see it.

image thousands of machines surrounded by speed beacons all doing this at once

antichaos
Inserter
Inserter
Posts: 20
Joined: Tue Jul 29, 2014 11:44 am
Contact:

Re: Entity On_crafting_complete event

Post by antichaos »

Would it be possible to have the event fire only for particular entities? Maybe a flag that defaults false? I understand that we don't want some part of the api to lag the vanilla game, but mods always have to trade potential performance for complexity. I would have thought doing this in a specific event was at least better than doing it in on_tick.

justarandomgeek
Filter Inserter
Filter Inserter
Posts: 300
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Re: Entity On_crafting_complete event

Post by justarandomgeek »

Ideally, you'd flag specific recipes as having script handlers. They probably still won't do it because of how many machines would have to check if they need to fire it every tick though.

As for a workaround, have a look at the Blueprint Printer portion of Recursive Blueprints. I did it the hard way and just ran all of crafting for that machine in script, but you can also let it run normally and just check it's progress every tick.

CmdrKeen
Long Handed Inserter
Long Handed Inserter
Posts: 98
Joined: Tue Sep 29, 2015 9:03 pm
Contact:

Re: Entity On_crafting_complete event

Post by CmdrKeen »

antichaos wrote: What I want to do is replace the entity, or change its recipe when crafting finishes. An example would be placing a 'construction site', loading it with materials, and when it completes it is replaced with the completed building. This can be extended to multi - stage or cyclical buildings. The core challenge would be to automatically vary the resources that are delivered to a location over time.
you wouldn't need an on_crafting_complete event to script this.

antichaos
Inserter
Inserter
Posts: 20
Joined: Tue Jul 29, 2014 11:44 am
Contact:

Re: Entity On_crafting_complete event

Post by antichaos »

justarandomgeek wrote:As for a workaround, have a look at the Blueprint Printer portion of Recursive Blueprints. I did it the hard way and just ran all of crafting for that machine in script, but you can also let it run normally and just check it's progress every tick.
Thanks. I wasn't aware of entity.crafting_progress. It will be interesting to see what the impact is.

Post Reply

Return to “Modding interface requests”