Circuit Power Switch

by rullaf

Extends the vanilla power switch with independent left and right red/green circuit connections that follow the electrical switch state.

Tweaks
5 hours ago
2.1
5
Circuit network
Owner:
rullaf
Source:
N/A
Homepage:
N/A
License:
MIT
Created:
5 hours ago
Latest Version:
0.3.3 (5 hours ago)
Factorio version:
2.1
Downloaded by:
5 users

Circuit Power Switch

Circuit Power Switch extends the vanilla power switch with independent red and
green circuit connections on both sides.

When the switch is open, its left and right electrical and circuit networks are
isolated. When it closes, power is connected and each circuit-wire colour is
joined to the same colour on the opposite side.

Features

  • Uses the ordinary vanilla power-switch item and artwork.
  • Accepts copper, red, and green wires on either half of the switch.
  • Keeps Factorio's native power-switch GUI and Enable when condition.
  • Reads the selected circuit-network colours from either side.
  • Preserves external copper and circuit wiring in blueprints.
  • Automatically upgrades existing vanilla power switches when a save is loaded.

Performance

The hot path reads one cached switch-state boolean per switch per tick. Circuit
signals are not enumerated by Lua. Wire-presence maintenance is distributed
across 60 ticks, and internal wires are changed only when necessary.

The internal forwarding reader adds one circuit tick of signal latency. The
circuit bridge follows an observed power-switch state change on the next script
tick.

Removing the mod

Back up your save first. Vanilla power switches remain after removal, but wires
attached through the mod's internal terminal helpers will be removed and may
need to be reconnected manually.