diff --git a/src/facilities/farmyard/farmyard.js b/src/facilities/farmyard/farmyard.js index e208f0a3adcb0563e58f8a896a1bbeb065df8610..aaf407d04eec51efa86c7bb21d726c01b511084b 100644 --- a/src/facilities/farmyard/farmyard.js +++ b/src/facilities/farmyard/farmyard.js @@ -1,3 +1,60 @@ +App.Facilities.Farmyard.expand = function() { + const + frag = new DocumentFragment(), + + desc = document.createElement("div"), + link = document.createElement("div"), + note = document.createElement("span"), + cost = document.createElement("span"), + + upgradeCost = Math.trunc(V.farmyard * 1000 * V.upgradeMultiplierArcology); + + link.classList.add("indent"); + note.classList.add("note"); + cost.classList.add("yellowgreen"); + + cost.append(cashFormat(upgradeCost)); + + desc.append(`It can support ${V.farmyard} farmhands. Currently there ${V.farmyard === 1 ? `is` : `are`} ${V.farmyard} ${V.farmyard === 1 ? `farmhand` : `farmhands`} in ${V.farmyardName}. `); + note.append(` Costs `, cost, ` and will increase upkeep costs`); + + link.append(App.UI.DOM.passageLink(`Expand ${V.farmyardName}`, "Farmyard", () => { + cashX(forceNeg(cost)); + V.farmyard += 5; + V.PC.skill.engineering += .1; + })); + + link.append(note); + desc.append(link); + frag.append(desc); + + if (V.farmyardFarmers || V.farmyardShowgirls) { + const + removeLink = document.createElement("div"), + warning = document.createElement("span"), + + count = App.Entity.facilities.farmyard.totalEmployeesCount, + newPop = count + V.dormitoryPopulation; + + removeLink.classList.add("indent"); + warning.classList.add("red"); + + warning.append(` Dormitory capacity will be exceeded.`); + + removeLink.append(App.UI.DOM.passageLink("Remove all slaves", "Farmyard", () => { + App.Utils.moveFacilityWorkers(App.Entity.facilities.farmyard); + })); + + if (newPop > V.dormitory) { + removeLink.append(warning); + } + + frag.append(removeLink); + } + + return frag; +}; + App.Facilities.Farmyard.transferMenials = function() { const frag = new DocumentFragment(), diff --git a/src/facilities/farmyard/farmyard.tw b/src/facilities/farmyard/farmyard.tw index 69286f1c8b47e48864c2063eda5f5cdad82c67f5..b7675f7b242cd6b6242351bc3324decd5f9b75ea 100644 --- a/src/facilities/farmyard/farmyard.tw +++ b/src/facilities/farmyard/farmyard.tw @@ -88,19 +88,7 @@ </p> <div id="farmhandcount"> - <<set _Tmult0 = Math.trunc($farmyard*1000*$upgradeMultiplierArcology)>> - It can support $farmyard farmhands. Currently there <<if _FyL == 1>>is<<else>>are<</if>> _FyL farmhand<<if _FyL != 1>>s<</if>> at $farmyardName. - <div class= "choices"> - [[Expand the farmyard|Farmyard][cashX(forceNeg(_Tmult0), "capEx"), $farmyard += 5, $PC.skill.engineering += .1]] - <span class="note"> - Costs <<print cashFormat(_Tmult0)>> and will increase upkeep costs - </span> - </div> - <div class= "choices"> - <<if _FyL > 0>> - <<removeFacilityWorkers "farmyard" "rest" "rest">> - <</if>> - </div> +<<includeDOM App.Facilities.Farmyard.expand()>> </div> <div id="menials">