Page 1 of 1

Explaination on how to interface with circuit network

Posted: Wed Dec 15, 2021 2:16 pm
by DrConsole
Hey guys,

I'm quite new to factorio modding and just writing my first mod.

At the moment I have a working entity with corresponding item which loads fine.
Now I'm at the control stage, and struggeling....

I can't find any tutorial or documentation on how to add the dialog to set the circuit network activation condition and doing calls to other functions on activation or deactivation condition.

Could someone explain it to me or give me a hint where to find more info?

About my mod: I want to implement a pipe valve which can be controlled by the circuit network for connecting / disconnecting parts of the fluid network.

As now my functions look like this:

Code: Select all

function closeValve(entity)
    fb = entity.fluidbox[1]
    fb.base_level = 500
    entity.fluidbox[1] = fb
end

function openValve(entity)
    fb = entity.fluidbox[1]
    fb.base_level = 0
    entity.fluidbox[1] = fb
end

Re: Explaination on how to interface with circuit network

Posted: Wed Dec 15, 2021 2:45 pm
by DaveMcW
It is very difficult.

There are no circuit network events, so you must update everything in on_tick.

You must build your own gui out of LuaGuiElements.

I tried to build a simple version of this in Recursive Blueprints, but it is still a mess.

Re: Explaination on how to interface with circuit network

Posted: Wed Dec 15, 2021 2:53 pm
by DrConsole
Thanks for the reply.

Is there no other way than building an custom GUI?
I only need the normal dialog like inserters have to set a X > Y condition for activation / deactivation....

I hoped that it wouldn't dive me that deep inside the code... :roll:

Re: Explaination on how to interface with circuit network

Posted: Wed Dec 15, 2021 11:39 pm
by DaveMcW
For your specific case, it sounds like you can use a modded pump.