Page 1 of 1

Error in speaker get_circuit_network? [solved]

Posted: Thu Jan 01, 2026 7:38 pm
by Thebri
I am currently rewriting Alertlist2 for 2.0

I found a problem that I can not fix at the moment, so I ask anyone of you if this is on my part or on the part of the api.

Setup:
I have a speaker. Connected to it are a green wire and a red wire. Both are on the other side connected to the same belt with "Read belt contents -> Hold(all belts). In the speaker UI I have the item on the belt in the left part of the "Circuit connections settings".
The number there is double the number of the items on the belt (as it should be).

In my mod I get the curcuit network via
speaker.get_control_behavior().get_circuit_network(defines.wire_type.red)

There I get only one of the signals (so the number is exactly that of the items on the belt) as is should be.

BUT
speaker.get_control_behavior().get_circuit_network(defines.wire_type.green)

returns no entries.

Also if I disconnect the red wire I still get an entry via
speaker.get_control_behavior().get_circuit_network(defines.wire_type.red)

TL;DR:
Its seems to me that
speaker.get_control_behavior().get_circuit_network(defines.wire_type.green)
is not working and
speaker.get_control_behavior().get_circuit_network(defines.wire_type.red)
is not returning the expected items.

Any thoughts on this?

Re: Error in speaker get_circuit_network?

Posted: Thu Jan 01, 2026 7:44 pm
by boskid
Please note that get_circuit_network does not accept defines.wire_type. It takes defines.wire_connector_id.

defines.wire_type.red == 2, defines.wire_type.green == 3.
defines.wire_connector_id.circuit_red == 1, defines.wire_connector_id.circuit_green == 2.

By providing wire_type.red, you get network for green wire, and by providing wire_type.green, you get no network because that is invalid connector id.

Re: Error in speaker get_circuit_network?

Posted: Thu Jan 01, 2026 8:29 pm
by Thebri
You are absolutely right. I did not see that, even if I stared my eyes out in the documentation.

Thank you so much!

Also a happy new year!