Error in speaker get_circuit_network? [solved]

Place to post guides, observations, things related to modding that are not mods themselves.
Thebri
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Aug 27, 2019 6:32 pm
Contact:

Error in speaker get_circuit_network? [solved]

Post 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?
Last edited by Thebri on Thu Jan 01, 2026 8:29 pm, edited 1 time in total.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4359
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Error in speaker get_circuit_network?

Post 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.
Thebri
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Aug 27, 2019 6:32 pm
Contact:

Re: Error in speaker get_circuit_network?

Post 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!
Post Reply

Return to “Modding discussion”