diff --git a/js/002-config/fc-js-init.js b/js/002-config/fc-js-init.js index 6141ced53d9bf02b955a9cb84d686eb01cbfaffc..e26f28d0aaddc8eeb43c1ce630275db8d1ca1c3c 100644 --- a/js/002-config/fc-js-init.js +++ b/js/002-config/fc-js-init.js @@ -40,6 +40,7 @@ App.Facilities.Club = {}; App.Facilities.Dairy = {}; App.Facilities.Farmyard = {}; App.Facilities.HGSuite = {}; +App.Facilities.Incubator = {}; App.Facilities.MasterSuite = {}; App.Facilities.Nursery = {}; App.Facilities.Schoolroom = {}; diff --git a/src/facilities/incubator/incubatorUtils.js b/src/facilities/incubator/incubatorUtils.js new file mode 100644 index 0000000000000000000000000000000000000000..9c04341f013130b9f9dd35c4b79c9245e615ccbd --- /dev/null +++ b/src/facilities/incubator/incubatorUtils.js @@ -0,0 +1,23 @@ +/** + * Sends a child to the Incubator if it has room + * @param {App.Entity.SlaveState|App.Entity.InfantState} child + */ +App.Facilities.Incubator.newChild = function(child) { + if (V.tanks.length < V.incubator) { + let fullAdapt; + child.growTime = Math.trunc(V.targetAge * 52); + child.incubatorPregAdaptationPower = V.incubatorPregAdaptationPower; + if (V.incubatorPregAdaptationPower === 1) { + fullAdapt = 45000 / 2000; + } else if (V.incubatorPregAdaptationPower === 2) { + fullAdapt = 100000 / 2000; + } else if (V.incubatorPregAdaptationPower === 3) { + fullAdapt = 150000 / 2000; + } else { + fullAdapt = 15000 / 2000; + } + child.incubatorPregAdaptationInWeek = (fullAdapt - child.pregAdaptation) / child.growTime; + V.tanks.push(child); + V.incubatorSlaves++; + } +}; diff --git a/src/npc/interaction/passage/birthStorm.tw b/src/npc/interaction/passage/birthStorm.tw index e498ac768869c65fca14594d1541a38e46d912f2..57dc12376410734030fd3c819c98385ac011bebf 100644 --- a/src/npc/interaction/passage/birthStorm.tw +++ b/src/npc/interaction/passage/birthStorm.tw @@ -212,8 +212,7 @@ The remote surgery allows the removal of the pregnancy generator through convent <<if _cToIncub > 0 || _cToNursery > 0>> <<for _cb = 0; _cb < _curBabies; _cb++>> /* if there is no reserved children, code in loop will not trigger */ <<if $mom.curBabies[_cb].reserve == "incubator">> - <<set $activeChild = generateChild($mom, $mom.curBabies[_cb], 1)>> - <<include "Incubator Workaround">> + <<run App.Facilities.Incubator.newChild(generateChild($mom, $mom.curBabies[_cb], 1))>> <<run $mom.curBabies.splice($mom.curBabies[_cb], 1)>> <<set _cb--, _curBabies-->> <<elseif $mom.curBabies[_cb].reserve == "nursery">> diff --git a/src/npc/interaction/passage/csec.tw b/src/npc/interaction/passage/csec.tw index e801074869aeb3ee2e5f6364ed814a9f1bbfae78..bd222891501e52d6a47dc3fcd4c4df9d64727d96 100644 --- a/src/npc/interaction/passage/csec.tw +++ b/src/npc/interaction/passage/csec.tw @@ -183,8 +183,7 @@ Performing a cesarean section is trivial for the remote surgery to carry out. << <<if _cToIncub > 0 || _cToNursery > 0>> <<for _cb = 0; _cb < _curBabies; _cb++>> /* if there is no reserved children, code in loop will not trigger */ <<if $mom.curBabies[_cb].reserve == "incubator">> - <<set $activeChild = generateChild($mom, $mom.curBabies[_cb], 1)>> - <<include "Incubator Workaround">> + <<run App.Facilities.Incubator.newChild(generateChild($mom, $mom.curBabies[_cb], 1))>> <<run $mom.curBabies.splice($mom.curBabies[_cb], 1)>> <<set _cb--, _curBabies-->> <<elseif $mom.curBabies[_cb].reserve == "nursery">> diff --git a/src/pregmod/incubatorWorkaround.tw b/src/pregmod/incubatorWorkaround.tw deleted file mode 100644 index ec8ade7be3a57b3e0022a2ce59f07167307d2ee7..0000000000000000000000000000000000000000 --- a/src/pregmod/incubatorWorkaround.tw +++ /dev/null @@ -1,18 +0,0 @@ -:: Incubator Workaround [nobr] - -<<if $tanks.length < $incubator>> - <<set $activeChild.growTime = Math.trunc($targetAge*52)>> - <<set $activeChild.incubatorPregAdaptationPower = $incubatorPregAdaptationPower>> - <<if $incubatorPregAdaptationPower == 1>> - <<set _fullAdapt = 45000 / 2000>> - <<elseif $incubatorPregAdaptationPower == 2>> - <<set _fullAdapt = 100000 / 2000>> - <<elseif $incubatorPregAdaptationPower == 3>> - <<set _fullAdapt = 150000 / 2000>> - <<else>> - <<set _fullAdapt = 15000 / 2000>> - <</if>> - <<set $activeChild.incubatorPregAdaptationInWeek = (_fullAdapt - $activeChild.pregAdaptation) / $activeChild.growTime>> - <<set $tanks.push($activeChild)>> - <<set $incubatorSlaves++>> -<</if>> \ No newline at end of file diff --git a/src/pregmod/seBurst.tw b/src/pregmod/seBurst.tw index ba406970fc8b9919fe2ece54d5995edaec480d54..f127e69fe6337138edbbddc00eb30752b94b1336 100644 --- a/src/pregmod/seBurst.tw +++ b/src/pregmod/seBurst.tw @@ -175,8 +175,7 @@ <<if _cToIncub > 0 || _cToNursery > 0>> <<for _cb = 0; _cb < _curBabies; _cb++>> /* if there is no reserved children, code in loop will not trigger */ <<if $slaves[_b].curBabies[_cb].reserve == "incubator">> - <<set $activeChild = generateChild($slaves[_b], $slaves[_b].curBabies[_cb], 1)>> - <<include "Incubator Workaround">> + <<run App.Facilities.Incubator.newChild(generateChild($slaves[_b], $slaves[_b].curBabies[_cb], 1))>> <<run $slaves[_b].curBabies.splice($slaves[_b].curBabies[_cb], 1)>> <<set _cb--, _curBabies-->> <<elseif $slaves[_b].curBabies[_cb].reserve == "nursery">> diff --git a/src/pregmod/sePlayerBirth.tw b/src/pregmod/sePlayerBirth.tw index 59f461ca1492d0e339e30ff0a6537cf0ea62af26..24c421de65e592d441605054e098d0b78d5cf01b 100644 --- a/src/pregmod/sePlayerBirth.tw +++ b/src/pregmod/sePlayerBirth.tw @@ -378,8 +378,7 @@ You arrange yourself to give birth, relaxing until your body urges you to begin <<if $PC.curBabies[0].reserve === "incubator">> @@.pink;You set <<if _gender == "XX">>her<<else>>him<</if>> aside for incubation.@@ - <<set $activeChild = generateChild($PC, $PC.curBabies[0], 1)>> - <<include "Incubator Workaround">> + <<run App.Facilities.Incubator.newChild(generateChild($PC, $PC.curBabies[0], 1))>> <<elseif $PC.curBabies[0].reserve === "nursery">> @@.pink;You set <<if _gender == "XX">>her<<else>>him<</if>> aside for incubation.@@ <<set $activeChild = generateChild($PC, $PC.curBabies[0])>> @@ -428,8 +427,7 @@ You arrange yourself to give birth, relaxing until your body urges you to begin <</if>> <<if $PC.curBabies[_p].reserve == "incubator">> @@.pink;You set <<if $PC.curBabies[_p].genetics.gender == "XX">>her<<else>>him<</if>> aside for incubation.@@ - <<set $activeChild = generateChild($PC, $PC.curBabies[_p], 1)>> - <<include "Incubator Workaround">> + <<run App.Facilities.Incubator.newChild(generateChild($PC, $PC.curBabies[_p], 1))>> <<run $PC.curBabies.splice($PC.curBabies[_p], 1)>> <<set _p--, _curBabies-->> <<elseif $PC.curBabies[_p].reserve == "nursery">> diff --git a/src/pregmod/widgets/seBirthWidgets.tw b/src/pregmod/widgets/seBirthWidgets.tw index 2da2dbffe97fef29e9db8190885aa5642f34dd40..224a0cacd07c6574bfd5ec6400c39d6d8f91872e 100644 --- a/src/pregmod/widgets/seBirthWidgets.tw +++ b/src/pregmod/widgets/seBirthWidgets.tw @@ -896,8 +896,7 @@ All in all, <<if _cToIncub + _cToNursery > 0>> <<for _cb = 0; _cb < _curBabies; _cb++>> /* if there are no reserved children, code in loop will not trigger */ <<if $slaves[$i].curBabies[_cb].reserve == "incubator">> - <<set $activeChild = generateChild($slaves[$i], $slaves[$i].curBabies[_cb], 1)>> - <<include "Incubator Workaround">> + <<run App.Facilities.Incubator.newChild(generateChild($slaves[$i], $slaves[$i].curBabies[_cb], 1))>> <<run $slaves[$i].curBabies.splice($slaves[$i].curBabies[_cb], 1)>> <<set _cb--, _curBabies-->> <<elseif $slaves[$i].curBabies[_cb].reserve == "nursery">>