Skip to content

getGroupPrioritySwitches() returns empty list #522

@RenaKunisaki

Description

@RenaKunisaki

Describe the bug
The PowerCircuit:getGroupPrioritySwitches() method always returns an empty table, even if there are priority switches on the circuit.

To Reproduce
Steps to reproduce the behavior:

  1. Build a computer with EEPROM and network card
  2. Build a circuit with any power generator, a priority switch, and any power consumer (eg a Hypertube Entrance with a tube attached).
  3. Connect a power pole to one side of the switch. (It doesn't matter which side)
  4. Connect the generator to the consumer, passing through the switch and power pole. (eg: generator -> switch -> pole -> machine, but the actual order shouldn't matter)
  5. Connect a network cable from the computer to the power pole.
  6. Run this program:
local pole = assert(component.proxy(component.findComponent(classes.Build_PowerPoleMk1_C))[1], "No PowerPoleMk1 found")
local circuit = pole:getPowerConnectors()[1]:getCircuit()
print("circuit production", circuit.production) --ensure we have the right circuit
local switches = circuit:getGroupPrioritySwitches()
for k, v in pairs(switches) do print("switch:", k, v) end
print("end of switch list")

The output should display a production value matching the circuit you've connected to (eg 10.0 in the attached save, or 0 if the switch is off); this is just to ensure I wasn't looking at some phantom circuit.

Expected behavior
There should be some switches listed in the output, but there aren't.

Additional context

Example save file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions