From 039290138ad70740cd9b3abc96d64225b87573d7 Mon Sep 17 00:00:00 2001 From: "Laetitia (O-01-67)" <68935009+O-01-67@users.noreply.github.com> Date: Mon, 30 Jan 2023 09:20:42 -0500 Subject: [PATCH] Switches * Controlled with the switch_off_control and switch_on_control elements * Control does not propagate * Requires noConduct.js * States exist as two separate elements --- mods/switches.js | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 mods/switches.js diff --git a/mods/switches.js b/mods/switches.js new file mode 100644 index 00000000..46bf568f --- /dev/null +++ b/mods/switches.js @@ -0,0 +1,47 @@ +var modName = "mods/switches.js"; +var noConductMod = "mods/noConduct.js"; + +if(enabledMods.includes(noConductMod)) { + elements.switch_off = { + name: "switch (off)", + color: "#7F3333", + behavior: behaviors.WALL, + noConduct: ["switch_on_control","switch_off_control"], + }; + + elements.switch_on = { + name: "switch (on)", + color: "#33CC33", + behavior: behaviors.WALL, + conduct: 1, + noConduct: ["switch_on_control","switch_off_control"], + }; + + elements.switch_off_control = { + color: "#FF3333", + behavior: behaviors.WALL, + behaviorOn: [ + "XX|CH:switch_on>switch_off|XX", + "CH:switch_on>switch_off|XX|CH:switch_on>switch_off", + "XX|CH:switch_on>switch_off|XX" + ], + conduct: 1, + noConduct: ["switch_on","switch_off"], + }; + + elements.switch_on_control = { + color: "#33FF33", + behavior: behaviors.WALL, + behaviorOn: [ + "XX|CH:switch_off>switch_on|XX", + "CH:switch_off>switch_on|XX|CH:switch_off>switch_on", + "XX|CH:switch_off>switch_on|XX" + ], + conduct: 1, + noConduct: ["switch_on","switch_off"], + }; +} else { + enabledMods.splice(enabledMods.indexOf(modName),0,noConductMod) + alert(`The ${noConductMod} mod is required and has been automatically inserted (reload for this to take effect).`) + localStorage.setItem("enabledMods", JSON.stringify(enabledMods)); +}; \ No newline at end of file