From 4c8c3517385bc497c63b8be6fb91c9f92c508f03 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Sat, 5 Dec 2020 23:37:22 -0500 Subject: [PATCH] distribute evenly, and caps for standard --- src/facilities/fsDecoration.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/facilities/fsDecoration.js b/src/facilities/fsDecoration.js index 5529b78909b..dfa9241948c 100644 --- a/src/facilities/fsDecoration.js +++ b/src/facilities/fsDecoration.js @@ -82,7 +82,7 @@ App.UI.facilityRedecoration = function() { } select.append(choice); } - const choice = App.UI.DOM.makeElement("option", "standard", "indent"); + const choice = App.UI.DOM.makeElement("option", "Standard", "indent"); if (V[variable] === "standard") { choice.selected = true; } @@ -90,10 +90,12 @@ App.UI.facilityRedecoration = function() { select.onchange = () => { const O = select.options[select.selectedIndex]; - if (O.value !== "standard") { + if (O.value !== "Standard") { cashX(-5000, "capEx"); + V[variable] = O.value; + } else { + V[variable] = "standard"; } - V[variable] = O.value; App.UI.reload(); }; select.append(option); @@ -106,7 +108,7 @@ App.UI.facilityRedecoration = function() { for (const decorationName of decorationNames) { App.UI.DOM.appendNewElement("option", select, decorationName, "indent"); } - App.UI.DOM.appendNewElement("option", select, "standard", "indent"); + App.UI.DOM.appendNewElement("option", select, "Standard", "indent"); App.UI.DOM.appendNewElement("option", select, "Distribute Evenly", "indent"); @@ -115,17 +117,21 @@ App.UI.facilityRedecoration = function() { if (O.value === "Distribute Evenly") { let i = 0; for (const decoration of activeFacilities.values()) { - if (O.value !== "standard") { - cashX(-5000, "capEx"); + cashX(-5000, "capEx"); + V[decoration] = decorationNames[i]; + i++; + if (i >= decorationNames.length) { + i = 0; } - V[decoration] = O.value; } } else { for (const decoration of activeFacilities.values()) { - if (O.value !== "standard") { + if (O.value !== "Standard") { cashX(-5000, "capEx"); + V[decoration] = O.value; + } else { + V[decoration] = "standard"; } - V[decoration] = O.value; } } -- GitLab