Skip to content
Snippets Groups Projects
Commit f2e1a444 authored by lowercasedonkey's avatar lowercasedonkey
Browse files

incubator workaround to JS

parent bbf12c87
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,7 @@ App.Facilities.Club = {}; ...@@ -40,6 +40,7 @@ App.Facilities.Club = {};
App.Facilities.Dairy = {}; App.Facilities.Dairy = {};
App.Facilities.Farmyard = {}; App.Facilities.Farmyard = {};
App.Facilities.HGSuite = {}; App.Facilities.HGSuite = {};
App.Facilities.Incubator = {};
App.Facilities.MasterSuite = {}; App.Facilities.MasterSuite = {};
App.Facilities.Nursery = {}; App.Facilities.Nursery = {};
App.Facilities.Schoolroom = {}; App.Facilities.Schoolroom = {};
......
/**
* 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++;
}
};
...@@ -212,8 +212,7 @@ The remote surgery allows the removal of the pregnancy generator through convent ...@@ -212,8 +212,7 @@ The remote surgery allows the removal of the pregnancy generator through convent
<<if _cToIncub > 0 || _cToNursery > 0>> <<if _cToIncub > 0 || _cToNursery > 0>>
<<for _cb = 0; _cb < _curBabies; _cb++>> /* if there is no reserved children, code in loop will not trigger */ <<for _cb = 0; _cb < _curBabies; _cb++>> /* if there is no reserved children, code in loop will not trigger */
<<if $mom.curBabies[_cb].reserve == "incubator">> <<if $mom.curBabies[_cb].reserve == "incubator">>
<<set $activeChild = generateChild($mom, $mom.curBabies[_cb], 1)>> <<run App.Facilities.Incubator.newChild(generateChild($mom, $mom.curBabies[_cb], 1))>>
<<include "Incubator Workaround">>
<<run $mom.curBabies.splice($mom.curBabies[_cb], 1)>> <<run $mom.curBabies.splice($mom.curBabies[_cb], 1)>>
<<set _cb--, _curBabies-->> <<set _cb--, _curBabies-->>
<<elseif $mom.curBabies[_cb].reserve == "nursery">> <<elseif $mom.curBabies[_cb].reserve == "nursery">>
......
...@@ -183,8 +183,7 @@ Performing a cesarean section is trivial for the remote surgery to carry out. << ...@@ -183,8 +183,7 @@ Performing a cesarean section is trivial for the remote surgery to carry out. <<
<<if _cToIncub > 0 || _cToNursery > 0>> <<if _cToIncub > 0 || _cToNursery > 0>>
<<for _cb = 0; _cb < _curBabies; _cb++>> /* if there is no reserved children, code in loop will not trigger */ <<for _cb = 0; _cb < _curBabies; _cb++>> /* if there is no reserved children, code in loop will not trigger */
<<if $mom.curBabies[_cb].reserve == "incubator">> <<if $mom.curBabies[_cb].reserve == "incubator">>
<<set $activeChild = generateChild($mom, $mom.curBabies[_cb], 1)>> <<run App.Facilities.Incubator.newChild(generateChild($mom, $mom.curBabies[_cb], 1))>>
<<include "Incubator Workaround">>
<<run $mom.curBabies.splice($mom.curBabies[_cb], 1)>> <<run $mom.curBabies.splice($mom.curBabies[_cb], 1)>>
<<set _cb--, _curBabies-->> <<set _cb--, _curBabies-->>
<<elseif $mom.curBabies[_cb].reserve == "nursery">> <<elseif $mom.curBabies[_cb].reserve == "nursery">>
......
:: 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
...@@ -175,8 +175,7 @@ ...@@ -175,8 +175,7 @@
<<if _cToIncub > 0 || _cToNursery > 0>> <<if _cToIncub > 0 || _cToNursery > 0>>
<<for _cb = 0; _cb < _curBabies; _cb++>> /* if there is no reserved children, code in loop will not trigger */ <<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">> <<if $slaves[_b].curBabies[_cb].reserve == "incubator">>
<<set $activeChild = generateChild($slaves[_b], $slaves[_b].curBabies[_cb], 1)>> <<run App.Facilities.Incubator.newChild(generateChild($slaves[_b], $slaves[_b].curBabies[_cb], 1))>>
<<include "Incubator Workaround">>
<<run $slaves[_b].curBabies.splice($slaves[_b].curBabies[_cb], 1)>> <<run $slaves[_b].curBabies.splice($slaves[_b].curBabies[_cb], 1)>>
<<set _cb--, _curBabies-->> <<set _cb--, _curBabies-->>
<<elseif $slaves[_b].curBabies[_cb].reserve == "nursery">> <<elseif $slaves[_b].curBabies[_cb].reserve == "nursery">>
......
...@@ -378,8 +378,7 @@ You arrange yourself to give birth, relaxing until your body urges you to begin ...@@ -378,8 +378,7 @@ You arrange yourself to give birth, relaxing until your body urges you to begin
<<if $PC.curBabies[0].reserve === "incubator">> <<if $PC.curBabies[0].reserve === "incubator">>
@@.pink;You set <<if _gender == "XX">>her<<else>>him<</if>> aside for incubation.@@ @@.pink;You set <<if _gender == "XX">>her<<else>>him<</if>> aside for incubation.@@
<<set $activeChild = generateChild($PC, $PC.curBabies[0], 1)>> <<run App.Facilities.Incubator.newChild(generateChild($PC, $PC.curBabies[0], 1))>>
<<include "Incubator Workaround">>
<<elseif $PC.curBabies[0].reserve === "nursery">> <<elseif $PC.curBabies[0].reserve === "nursery">>
@@.pink;You set <<if _gender == "XX">>her<<else>>him<</if>> aside for incubation.@@ @@.pink;You set <<if _gender == "XX">>her<<else>>him<</if>> aside for incubation.@@
<<set $activeChild = generateChild($PC, $PC.curBabies[0])>> <<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 ...@@ -428,8 +427,7 @@ You arrange yourself to give birth, relaxing until your body urges you to begin
<</if>> <</if>>
<<if $PC.curBabies[_p].reserve == "incubator">> <<if $PC.curBabies[_p].reserve == "incubator">>
@@.pink;You set <<if $PC.curBabies[_p].genetics.gender == "XX">>her<<else>>him<</if>> aside for incubation.@@ @@.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)>> <<run App.Facilities.Incubator.newChild(generateChild($PC, $PC.curBabies[_p], 1))>>
<<include "Incubator Workaround">>
<<run $PC.curBabies.splice($PC.curBabies[_p], 1)>> <<run $PC.curBabies.splice($PC.curBabies[_p], 1)>>
<<set _p--, _curBabies-->> <<set _p--, _curBabies-->>
<<elseif $PC.curBabies[_p].reserve == "nursery">> <<elseif $PC.curBabies[_p].reserve == "nursery">>
......
...@@ -896,8 +896,7 @@ All in all, ...@@ -896,8 +896,7 @@ All in all,
<<if _cToIncub + _cToNursery > 0>> <<if _cToIncub + _cToNursery > 0>>
<<for _cb = 0; _cb < _curBabies; _cb++>> /* if there are no reserved children, code in loop will not trigger */ <<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">> <<if $slaves[$i].curBabies[_cb].reserve == "incubator">>
<<set $activeChild = generateChild($slaves[$i], $slaves[$i].curBabies[_cb], 1)>> <<run App.Facilities.Incubator.newChild(generateChild($slaves[$i], $slaves[$i].curBabies[_cb], 1))>>
<<include "Incubator Workaround">>
<<run $slaves[$i].curBabies.splice($slaves[$i].curBabies[_cb], 1)>> <<run $slaves[$i].curBabies.splice($slaves[$i].curBabies[_cb], 1)>>
<<set _cb--, _curBabies-->> <<set _cb--, _curBabies-->>
<<elseif $slaves[$i].curBabies[_cb].reserve == "nursery">> <<elseif $slaves[$i].curBabies[_cb].reserve == "nursery">>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment