Page 1 of 1

Entity On_crafting_complete event

Posted: Mon Apr 17, 2017 8:35 pm
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.

Re: Entity On_crafting_complete event

Posted: Mon Apr 17, 2017 9:30 pm
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

Re: Entity On_crafting_complete event

Posted: Tue Apr 18, 2017 7:25 am
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.

Re: Entity On_crafting_complete event

Posted: Fri Apr 21, 2017 8:11 pm
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.

Re: Entity On_crafting_complete event

Posted: Fri Apr 21, 2017 10:23 pm
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.

Re: Entity On_crafting_complete event

Posted: Mon Apr 24, 2017 12:27 pm
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.