Represents a system responsible for handling switches in Electrical.
See SwitchSystemEvents for events to listen to.
The current switch states.
The brightness of lights.
The switch states that are expected.
Protected
Return the room that this system belongs to.
Whether or not this system is sabotaged.
Invert the position of a switch.
The ID of the switch to invert.
// Invert the position of each switch.for (let i = 0; i < 5; i++) { electrical.flip(i);} Copy
// Invert the position of each switch.for (let i = 0; i < 5; i++) { electrical.flip(i);}
Sabotage this system.
Set the value of a switch as flipped or not flipped
The ID of the switch to flip.
Whether the switch is flipped.
// Randomise each switch.for (let i = 0; i < 5; i++) { electrical.setSwitch(i, Math.random() > 0.5);} Copy
// Randomise each switch.for (let i = 0; i < 5; i++) { electrical.setSwitch(i, Math.random() > 0.5);}
Static
Read the value of each switch from a byte.
The byte to read from.
An array of the value of each switch.
console.log(readSwitches(0x5));// [ true, false, true, false, false ] Copy
console.log(readSwitches(0x5));// [ true, false, true, false, false ]
Write the value of each switch to a byte.
The byte representation of the switches.
console.log(writeSwitches([ false, true, false, false, true ]));// 0x12 (18) Copy
console.log(writeSwitches([ false, true, false, false, true ]));// 0x12 (18)
Represents a system responsible for handling switches in Electrical.
See SwitchSystemEvents for events to listen to.