diff --git a/src/Mods/SecExp/buildings/weaponsManufacturing.tw b/src/Mods/SecExp/buildings/weaponsManufacturing.tw index 0f06a8a51d3762b58a7cc361803d5ef364b5f37b..ec51be61070f9c6fcecae145eb716fecf5051bc8 100644 --- a/src/Mods/SecExp/buildings/weaponsManufacturing.tw +++ b/src/Mods/SecExp/buildings/weaponsManufacturing.tw @@ -149,20 +149,24 @@ You own <<print num($menials)>> free menial slaves. This manufacturing complex c <<set _time = Math.ceil(_baseUpgradeTime / $SecExp.buildings.weapManu.productivity)>> <br><br>Upgrades: With our current industrial and research capabilities upgrades will be finished in _time weeks. -<<if $SecExp.buildings.weapManu.upgrades.current.time <= 0>> +<<if App.SecExp.weapManuUpgrade.fully().bots && App.SecExp.weapManuUpgrade.fully().human>> + <<run delete $SecExp.buildings.weapManu.upgrades.queue>> +<<else>> + <<set $SecExp.buildings.weapManu.upgrades.queue = $SecExp.buildings.weapManu.upgrades.queue || []>> + <br>Security Drones: <<if $SecExp.buildings.weapManu.lab < 3>> Upgrade the research facility further to unlock more upgrades for the security drones. <</if>> - <<if $SecExp.buildings.weapManu.upgrades.completed.includesAll(-1, -2, -3)>> + <<if App.SecExp.weapManuUpgrade.fully().bots>> You have fully upgraded the security drones. <<else>> - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(-1)>> </p> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(-1)>> </div> <<if $SecExp.buildings.weapManu.lab >= 2>> - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(-2)>> </p> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(-2)>> </div> <</if>> <<if $SecExp.buildings.weapManu.lab >= 3>> - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(-3)>> </p> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(-3)>> </div> <</if>> <br> <</if>> @@ -178,42 +182,44 @@ You own <<print num($menials)>> free menial slaves. This manufacturing complex c <<elseif $SecExp.buildings.weapManu.lab < 3>> Upgrade the research facility further to unlock more upgrades for human troops. <</if>> - - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(0)>> </p> - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(1)>> </p> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(0)>> </div> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(1)>> </div> <<if $SecExp.buildings.weapManu.lab >= 2>> - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(2)>> </p> - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(3)>> </p> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(2)>> </div> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(3)>> </div> <</if>> <<if $SecExp.buildings.weapManu.lab >= 3>> - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(4)>> </p> - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(5)>> </p> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(4)>> </div> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(5)>> </div> <</if>> <<if $SF.Toggle && $SF.Active >= 1>> <<if $SecExp.buildings.weapManu.lab >= 2 && $SecExp.edicts.SFSupportLevel >= 2 && $SF.Squad.Firebase >= 7>> - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(6)>> </p> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(6)>> </div> <</if>> <<if $SecExp.buildings.weapManu.lab >= 2 && $SecExp.edicts.SFSupportLevel >= 4 && $SF.Squad.Drugs >= 8>> - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(7)>> </p> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(7)>> </div> <</if>> <<if $SecExp.buildings.weapManu.lab >= 3 && $SecExp.edicts.SFSupportLevel >= 5>> - <p> <<includeDOM App.SecExp.weapManuUpgrade.purchase(8)>> </p> + <div> <<includeDOM App.SecExp.weapManuUpgrade.purchase(8)>> </div> <</if>> <</if>> -<<else>> - <<set _current = App.SecExp.weapManuUpgrade.current()>> - <br>You are developing _current.dec. - It is for _current.unit. It will enhance their _current.purpose. - Estimated completion time is <<= numberWithPluralOne($SecExp.buildings.weapManu.upgrades.current.time, "week")>>. - <br> + + <<for _i = 0; _i < $SecExp.buildings.weapManu.upgrades.queue.length; _i++>> + <<set _current = App.SecExp.weapManuUpgrade.current($SecExp.buildings.weapManu.upgrades.queue[_i].ID)>> + <<if _i === 0>><br>Currently developing<<else>><br><<= ordinalSuffix(_i + 1)>> in queue<</if>>: + _current.dec for _current.unit. It will enhance their _current.purpose. + Estimated completion time is <<= numberWithPluralOne($SecExp.buildings.weapManu.upgrades.queue[_i].time, "week")>> + <</for>> <</if>> -<<set _completed = $SecExp.buildings.weapManu.upgrades.completed.length>> -<<if _completed > 0>> +<<set _completed = $SecExp.buildings.weapManu.upgrades.completed>> +<<if _completed.length > 0>> + <p> You have completed the following projects: - <<for _i = 0; _i < _completed; _i++>> - <<= App.SecExp.weapManuUpgrade.current($SecExp.buildings.weapManu.upgrades.completed[_i]).dec>><<if _i < _completed - 1>>,<<else>>.<</if>> + <<for _i = 0; _i < _completed.length; _i++>> + <<= App.SecExp.weapManuUpgrade.current($SecExp.buildings.weapManu.upgrades.completed[_i]).dec>><<if _i < _completed.length - 1>>,<<else>>.<</if>> <</for>> + </p> <</if>> -<br><br> <<set _cost = Math.trunc(10000*$upgradeMultiplierArcology)>> -[[Return this sector to standard manufacturing|Main][delete $SecExp.buildings.weapManu, cashX(-_cost), "capEx"), App.Arcology.cellUpgrade($building, App.Arcology.Cell.Manufacturing, "Weapon Manufacturing", "Manufacturing")]] //Costs <<print cashFormat(_cost)>>// \ No newline at end of file +<<set _cost = Math.trunc(10000*$upgradeMultiplierArcology)>> +<p>[[Return this sector to standard manufacturing|Main][delete $SecExp.buildings.weapManu, cashX(-_cost), "capEx"), App.Arcology.cellUpgrade($building, App.Arcology.Cell.Manufacturing, "Weapon Manufacturing", "Manufacturing")]] //Costs <<print cashFormat(_cost)>>//</p> \ No newline at end of file diff --git a/src/Mods/SecExp/js/buildingsJS.js b/src/Mods/SecExp/js/buildingsJS.js index 62dcca7e1e54f7e11e0c7e7d9ec97a2303ddd8f6..00ad32adf82113f7cb0013009e78cd9626b7024a 100644 --- a/src/Mods/SecExp/js/buildingsJS.js +++ b/src/Mods/SecExp/js/buildingsJS.js @@ -3,6 +3,7 @@ App.SecExp.weapManuUpgrade = (function() { baseTime, current, purchase, + fully, }; /** Weeks to completion without any modification. @@ -15,7 +16,7 @@ App.SecExp.weapManuUpgrade = (function() { * @returns {Object} */ function current(x = null) { - let o = {unit: "our human troops", ID: jsDef(x) ? x : V.SecExp.buildings.weapManu.upgrades.current.ID}; + let o = {unit: "our human troops", ID: jsDef(x) ? x : V.SecExp.buildings.weapManu.upgrades.queue[0].ID}; switch(o.ID) { case -3: Object.assign(o, { @@ -115,31 +116,50 @@ App.SecExp.weapManuUpgrade = (function() { * @returns {Node} */ function purchase(x) { - let el = document.createElement("div") , options; + let el = document.createElement("div"), found = 0; if (!V.SecExp.buildings.weapManu.upgrades.completed.includes(x)) { - options = document.createElement("div"); - const item = current(x), time = Math.ceil(baseTime() / V.SecExp.buildings.weapManu.productivity); - el.append(App.UI.DOM.link(`Develop ${item.dec}`, () => { - V.SecExp.buildings.weapManu.upgrades.current = {ID: x, time: time}; - cashX(-item.cost, "capEx"); - }, - [], passage() - )); - options.append(`Will take ${time} weeks`); - if (item.cost > 0) { - options.append(`, cost ${cashFormat(item.cost)}`); + for (let i = 0; i < V.SecExp.buildings.weapManu.upgrades.queue.length; i++) { + if (V.SecExp.buildings.weapManu.upgrades.queue[i].ID === x) { + found = [i]; break; + } } - options.append(` and will increase `); - if (item.type !== "all") { - options.append(`the base ${item.type} value${item.type.contains("and") ? 's' : ''}`); + const item = current(x), time = Math.ceil(baseTime() / V.SecExp.buildings.weapManu.productivity); + if (found === 0) { + el.append(App.UI.DOM.link(`Develop ${item.dec}.`, () => { + V.SecExp.buildings.weapManu.upgrades.queue.push({ID: x, time: time}); + cashX(-item.cost, "capEx"); + }, + [], passage() + )); + el.append(`This will take ${time} weeks`); + if (item.cost > 0) { + el.append(`, cost ${cashFormat(item.cost)}`); + } + el.append(` and will increase `); + if (item.type !== "all") { + el.append(`the base ${item.type} value${item.type.contains("and") ? 's' : ''}`); + } else { + el.append('all base stats'); + } + el.append(` of ${item.unit}.`); } else { - options.append('all base stats'); + el.append(App.UI.DOM.link(`Remove ${item.dec} from the queue.`, () => { + V.SecExp.buildings.weapManu.upgrades.queue.deleteAt(found); + }, + [], passage() + )); } - options.append(` of ${item.unit}.`); - el.append(options); } return el; } + + function fully() { + const human = [0, 1, 2, 3, 4, 5] + (V.SF.Toggle && V.SF.Active >= 1 ? [,6, 7, 8] : []); + return { + human: V.SecExp.buildings.weapManu.upgrades.completed.includesAll(human), + bots: V.SecExp.buildings.weapManu.upgrades.completed.includesAll(-1, -2, -3), + }; + } })(); App.SecExp.propHub = (function() { @@ -385,7 +405,6 @@ App.SecExp.weapManu = (function() { }, upgrades: { completed: [], - current: {time: 0} } }; } @@ -411,37 +430,48 @@ App.SecExp.weapManu = (function() { } V.SecExp.buildings.weapManu.upgrades = V.SecExp.buildings.weapManu.upgrades || {}; - V.SecExp.buildings.weapManu.upgrades.completed = V.SecExp.buildings.weapManu.upgrades.completed || V.completedUpgrades || []; - V.SecExp.buildings.weapManu.upgrades.current = V.SecExp.buildings.weapManu.upgrades.current || {time: 0}; - if (jsDef(V.currentUpgrade)) { - if (!jsDef(V.currentUpgrade.ID)) { - if (V.currentUpgrade.name === "magnetic based ballistic weaponry") { - V.currentUpgrade.ID = 0; - } else if (V.currentUpgrade.name === "ceramo-metallic alloys") { - V.currentUpgrade.ID = 1; - } else if (V.currentUpgrade.name === "rapid action stimulants") { - V.currentUpgrade.ID = 2; - } else if (V.currentUpgrade.name === "fast response neural stimulant") { - V.currentUpgrade.ID = 3; - } else if (V.currentUpgrade.name === "universal cyber enhancements") { - V.currentUpgrade.ID = 4; - } else if (V.currentUpgrade.name === "remote neural links") { - V.currentUpgrade.ID = 5; - } else if (V.currentUpgrade.name === "combined training regimens with the special force") { - V.currentUpgrade.ID = 6; - } else if (V.currentUpgrade.name === "a variant of the stimulant cocktail that the special force created") { - V.currentUpgrade.ID = 7; - } else if (V.currentUpgrade.name === "a mesh network based off the custom network of the special force") { - V.currentUpgrade.ID = 8; - } else if (V.currentUpgrade.name === "dynamic battle aware AI") { - V.currentUpgrade.ID = -1; - } else if (V.currentUpgrade.name === "adaptive armored frames") { - V.currentUpgrade.ID = -2; - } else if (V.currentUpgrade.name === "advanced synthetic alloys") { - V.currentUpgrade.ID = -3; + V.SecExp.buildings.weapManu.upgrades.completed = V.SecExp.buildings.weapManu.upgrades.completed || V.completedUpgrades || []; + if (!App.SecExp.weapManuUpgrade.fully().bots && !App.SecExp.weapManuUpgrade.fully().human) { + V.SecExp.buildings.weapManu.upgrades.queue = V.SecExp.buildings.weapManu.upgrades.queue || []; + if (jsDef(V.currentUpgrade)) { + if (!jsDef(V.currentUpgrade.ID)) { + if (V.currentUpgrade.name === "magnetic based ballistic weaponry") { + V.currentUpgrade.ID = 0; + } else if (V.currentUpgrade.name === "ceramo-metallic alloys") { + V.currentUpgrade.ID = 1; + } else if (V.currentUpgrade.name === "rapid action stimulants") { + V.currentUpgrade.ID = 2; + } else if (V.currentUpgrade.name === "fast response neural stimulant") { + V.currentUpgrade.ID = 3; + } else if (V.currentUpgrade.name === "universal cyber enhancements") { + V.currentUpgrade.ID = 4; + } else if (V.currentUpgrade.name === "remote neural links") { + V.currentUpgrade.ID = 5; + } else if (V.currentUpgrade.name === "combined training regimens with the special force") { + V.currentUpgrade.ID = 6; + } else if (V.currentUpgrade.name === "a variant of the stimulant cocktail that the special force created") { + V.currentUpgrade.ID = 7; + } else if (V.currentUpgrade.name === "a mesh network based off the custom network of the special force") { + V.currentUpgrade.ID = 8; + } else if (V.currentUpgrade.name === "dynamic battle aware AI") { + V.currentUpgrade.ID = -1; + } else if (V.currentUpgrade.name === "adaptive armored frames") { + V.currentUpgrade.ID = -2; + } else if (V.currentUpgrade.name === "advanced synthetic alloys") { + V.currentUpgrade.ID = -3; + } } + V.SecExp.buildings.weapManu.upgrades.queue.push({ID: V.currentUpgrade.ID, time: V.currentUpgrade.time}); } - V.SecExp.buildings.weapManu.upgrades.current = {ID: V.currentUpgrade.ID, time: V.currentUpgrade.time}; + + if (jsDef(V.SecExp.buildings.weapManu.upgrades.current)) { + if (V.SecExp.buildings.weapManu.upgrades.current.time > 0) { + V.SecExp.buildings.weapManu.upgrades.queue.push(V.SecExp.buildings.weapManu.upgrades.current); + } + delete V.SecExp.buildings.weapManu.upgrades.current; + } + } else { + delete V.SecExp.buildings.weapManu.upgrades.queue; } } } diff --git a/src/Mods/SecExp/securityReport.tw b/src/Mods/SecExp/securityReport.tw index aa7c125cd4644e28ba8e57dfce88a3758c7950d3..d7a809807b2d20d54cb8213eebd9095fa9c18bf6 100644 --- a/src/Mods/SecExp/securityReport.tw +++ b/src/Mods/SecExp/securityReport.tw @@ -510,8 +510,8 @@ Due to the deterioration of the old world countries, organized crime focuses mor <</if>> <</if>> -<<if $SecExp.buildings.weapManu && $SecExp.buildings.weapManu.upgrades.current.time > 0>> - <<set _current = App.SecExp.weapManuUpgrade.current(), $SecExp.buildings.weapManu.upgrades.current.time-->> +<<if $SecExp.buildings.weapManu && jsDef($SecExp.buildings.weapManu.upgrades.queue) && $SecExp.buildings.weapManu.upgrades.queue[0].time > 0>> + <<set _current = App.SecExp.weapManuUpgrade.current(), $SecExp.buildings.weapManu.upgrades.queue[0].time-->> <br>In the research lab, _current.dec <<switch _current.dec>> <<case "adaptive armored frames" "advanced synthetic alloys" "ceramo-metallic alloys" "rapid action stimulants" "universal cyber enhancements" "remote neural links" "combined training regimens with the special force">> @@ -520,11 +520,16 @@ Due to the deterioration of the old world countries, organized crime focuses mor is <</switch>> being developed with the aim of enhancing _current.unit' _current.purpose. - <<if $SecExp.buildings.weapManu.upgrades.current.time <= 0>> + <<if $SecExp.buildings.weapManu.upgrades.queue[0].time <= 0>> Reports indicate it is ready for deployment and will be issued in the following days. <<set $SecExp.buildings.weapManu.upgrades.completed.push(_current.ID)>> - <<set $SecExp.buildings.weapManu.upgrades.current = {time: 0}>> + <<run $SecExp.buildings.weapManu.upgrades.queue.splice(0, 1)>> <<else>> - It will be finished in <<= numberWithPluralOne($SecExp.buildings.weapManu.upgrades.current.time, "week")>>. + It will be finished in <<= numberWithPluralOne($SecExp.buildings.weapManu.upgrades.queue[0].time, "week")>>. <</if>> + <<for _i = 1; _i < $SecExp.buildings.weapManu.upgrades.queue.length; _i++>> + <<set _current = App.SecExp.weapManuUpgrade.current($SecExp.buildings.weapManu.upgrades.queue[_i].ID)>> + <br><<= ordinalSuffix(_i + 1)>> in queue: + _current.dec for _current.unit. It will enhance their _current.purpose. + <</for>> <</if>> \ No newline at end of file