diff --git a/src/interaction/universalRules.js b/src/interaction/universalRules.js index 96e0f24a0ee525b9466587a40f27b54eefbda860..aeba46dd1d7537692192f5936f61538607869202 100644 --- a/src/interaction/universalRules.js +++ b/src/interaction/universalRules.js @@ -248,6 +248,20 @@ App.UI.universalRules = function() { .addValue("Slave orphanage", "an orphanage", () => V.universalRulesChildrenBecomeBreeders = 0) .addValue("Citizen school", "a citizen school", () => V.universalRulesChildrenBecomeBreeders = 0) .addValue("Private school", "a private school", () => V.universalRulesChildrenBecomeBreeders = 0); + if (V.incubator.capacity > 0) { + if (App.Entity.facilities.incubator.capacity - (V.incubator.tanks.length + FetusGlobalReserveCount("incubator")) > 0) { + option.addValue(`${capFirstChar(V.incubator.name)}`, "the incubator", () => V.universalRulesChildrenBecomeBreeders = 0); + } else { + frag.append(`${capFirstChar(V.incubator.name)} has no empy tanks. Either build more or reduce reservations.`); + } + } + if (V.nursery > 0) { + if (App.Entity.facilities.nursery.capacity - (V.nurseryChildren + FetusGlobalReserveCount("nursery")) > 0) { + option.addValue(`${capFirstChar(V.nurseryName)}`, "the nursery", () => V.universalRulesChildrenBecomeBreeders = 0); + } else { + frag.append(`${capFirstChar(V.nurseryName)} is full.`); + } + } if (V.policies.cash4Babies > 0) { option.addValue("Market", "the market"); diff --git a/src/js/birth/birth.js b/src/js/birth/birth.js index 2e18409f4f17f229ba55b56012b1f9902d0984ca..b95a48a7dd45422311fd9b5f22c5e476e58fa528 100644 --- a/src/js/birth/birth.js +++ b/src/js/birth/birth.js @@ -1502,13 +1502,17 @@ globalThis.birth = function(slave, {birthStorm = false, cSection = false} = {}) let babyCost; let choices; let choice; + let sendAll = false; for (const baby of babiesBeingBorn) { - if (baby.reserve === "incubator") { + if (baby.reserve === "incubator" || V.DefaultBirthDestination === "the incubator") { cToIncubator++; - } else if (baby.reserve === "nursery") { + } else if (baby.reserve === "nursery" || V.DefaultBirthDestination === "the nursery") { cToNursery++; } } + if (["the incubator", "the nursery"].includes(V.DefaultBirthDestination)) { + sendAll = true; + } /* ----------------------- incubator/nursery adding subsection. There is support for broodmothers too. */ if ((cToIncubator + cToNursery > 0) && numBeingBorn > 0) { // TODO: Do we need keep child checks? @@ -1518,9 +1522,14 @@ globalThis.birth = function(slave, {birthStorm = false, cSection = false} = {}) } else { r.push(`${His} child`); } + if (cToIncubator > 0) { if (numBeingBorn > 1) { - r.push(`${cToIncubator}`); + if (numBeingBorn !== cToIncubator) { + r.push(`${cToIncubator}`); + } else { + r.push(`all`); + } } if (cToIncubator === 1) { r.push(`was`); @@ -1534,7 +1543,11 @@ globalThis.birth = function(slave, {birthStorm = false, cSection = false} = {}) } if (cToNursery > 0) { if (numBeingBorn > 1) { - r.push(`${cToNursery}`); + if (numBeingBorn !== cToNursery) { + r.push(`${cToNursery}`); + } else { + r.push(`all`); + } } if (cToNursery === 1) { r.push(`was`); @@ -1545,11 +1558,11 @@ globalThis.birth = function(slave, {birthStorm = false, cSection = false} = {}) } r.push(r.pop() + `.`); if (cToIncubator + cToNursery > 0) { - babiesBeingBorn = sendNewbornsToFacility(slave, babiesBeingBorn); + babiesBeingBorn = sendNewbornsToFacility(slave, babiesBeingBorn, sendAll); } numBeingBorn = babiesBeingBorn.length; - // <br><br> - if (numBeingBorn > 0) { + + if (numBeingBorn > 0 && !sendAll) { r.push(`After sending ${his} reserved ${children} to`); if (cToIncubator > 0 && cToNursery > 0) { r.push(`${V.incubator.name} and ${V.nurseryName},`); @@ -1560,6 +1573,7 @@ globalThis.birth = function(slave, {birthStorm = false, cSection = false} = {}) } r.push(`it's time to decide the fate of the ${(numBeingBorn > 0) ? `others` : `other`}.`); } + App.Events.addParagraph(el, r); } /* ------------------------ Fate of other babies ---------------------------------------*/ @@ -9122,12 +9136,12 @@ globalThis.birth = function(slave, {birthStorm = false, cSection = false} = {}) * @param {object[]} babiesBeingBorn ovum objects (FIXME: need defined type) * @returns {object[]} remaining ova */ -globalThis.sendNewbornsToFacility = function(mom, babiesBeingBorn) { +globalThis.sendNewbornsToFacility = function(mom, babiesBeingBorn, sendAll) { const remainingBabies = []; for (const ovum of babiesBeingBorn) { - if (ovum.reserve === "incubator" && V.incubator.tanks.length < V.incubator.capacity) { + if ((ovum.reserve === "incubator" || sendAll) && V.incubator.tanks.length < V.incubator.capacity) { App.Facilities.Incubator.newChild(generateChild(mom, ovum, true)); - } else if (ovum.reserve === "nursery" && V.cribs.length < V.nursery) { + } else if ((ovum.reserve === "nursery" || sendAll) && V.cribs.length < V.nursery) { App.Facilities.Nursery.newChild(generateChild(mom, ovum)); } else { remainingBabies.push(ovum);