Item created from assembly machine event?

Place to get help with not working mods / modding interface.
Post Reply
Lumikins
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Sep 13, 2014 4:22 am
Contact:

Item created from assembly machine event?

Post by Lumikins »

Hello,

I'm looking to make some sort of mod to add an endgame to factorio by maintaining a colony. Taking this in small steps first I want to be able to intercept the creation of an item from an assembly-machine type and use that to increment a variable. The game unfortunately doesn't have an event trigger for this - any ideas if this event can be intercepted? Thanks.

PS: My plan right now is to have assembly machines that act as colony homes which take goods and return nothing. I saw a water void mod which accomplished this but now I want to somehow intercept the creation event from the assembly machine to increment a variable which keeps track of how many times the assembly machine created a good (which is nothing in this case). This way we will have an assembly machine that takes an item - returns nothing - and changes the state of the game. From there we'd have the basis to make a colony simulation.

User avatar
ludsoe
Fast Inserter
Fast Inserter
Posts: 243
Joined: Tue Feb 11, 2014 8:16 am
Contact:

Re: Item created from assembly machine event?

Post by ludsoe »

Well when i was going to make a colony mod, I was planning on using accumulators and containers to simulate the structures. As you can directly control the items inside containers and the energy in accumulators. Course you would have to make your own process delays and such. This can be setup pretty easily using MoLogicCore, and some finger grease. If you want I can fit together a example with a pair of devices that eat resources or energy.

Lumikins
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Sep 13, 2014 4:22 am
Contact:

Re: Item created from assembly machine event?

Post by Lumikins »

That'd be great if you can post a sample. Looked thru your mod looks pretty nifty and I like the commenting. I'm just getting back into coding after being out of commercial development for about 6 years so it really helps.

User avatar
ludsoe
Fast Inserter
Fast Inserter
Posts: 243
Joined: Tue Feb 11, 2014 8:16 am
Contact:

Re: Item created from assembly machine event?

Post by ludsoe »

Well here you go, Heres some example entity's you can look at / work with. I placed comments all over the control.lua also. Hopefully they will get you on the right track with your mod. The example has a structure that consumes energy and another that consumes items.

http://www.mediafire.com/download/wueh2 ... plemod.zip

Lumikins
Burner Inserter
Burner Inserter
Posts: 17
Joined: Sat Sep 13, 2014 4:22 am
Contact:

Re: Item created from assembly machine event?

Post by Lumikins »

Thanks! Will play with this and see what I can come up with.

I'm thinking now if this is the only workaround is there a way to restrict assembly machine's to only being able to craft 1 single recipe or 1 subtype of recipe's? I might just have the house type make some dummy item called taxes or something that gets collected into the box which triggers LUA. Barring that I'll just make the houses really cheap which may obsolete the first lvl assembly machine but that's completely fine as no one uses those late game anyway

Post Reply

Return to “Modding help”