Skip to content
Snippets Groups Projects
Commit c51d5f35 authored by pregmodfan's avatar pregmodfan
Browse files

more functions work and comments

parent 1ebf116c
No related branches found
No related tags found
No related merge requests found
...@@ -319,11 +319,13 @@ window.fetalSplit = function(actor) { ...@@ -319,11 +319,13 @@ window.fetalSplit = function(actor) {
WombNormalizePreg(actor); WombNormalizePreg(actor);
}; };
//safe alternative to .womb.length.
window.WombFetusCount(actor){ window.WombFetusCount(actor){
WombInit(actor); WombInit(actor);
return actor.womb.length; return actor.womb.length;
} }
//give reference to fetus object, but not remove fetus, use for manupulation in the womb.
window.WombGetFetus = function(actor, fetusNum){ window.WombGetFetus = function(actor, fetusNum){
WombInit(actor); WombInit(actor);
if (actor.womb.length >= fetusNum) if (actor.womb.length >= fetusNum)
...@@ -332,6 +334,7 @@ window.WombGetFetus = function(actor, fetusNum){ ...@@ -332,6 +334,7 @@ window.WombGetFetus = function(actor, fetusNum){
return null; return null;
} }
//give reference to fetus object, and remove it form the womb.
window.WombRemoveFetus = function(actor, fetusNum){ window.WombRemoveFetus = function(actor, fetusNum){
WombInit(actor); WombInit(actor);
if (actor.womb.length >= fetusNum){ if (actor.womb.length >= fetusNum){
...@@ -343,6 +346,7 @@ window.WombRemoveFetus = function(actor, fetusNum){ ...@@ -343,6 +346,7 @@ window.WombRemoveFetus = function(actor, fetusNum){
return null; return null;
} }
//to add fetus object in the womb. Be warned - you can add one single fetus to many wombs, or even add it many times to one womb. It's will not show error, but behavior become strange, as fetus object will be the same - it's reference, not full copies. If this not desired - use deepCopy on fetus before adding.
window.WombAddFetus = function(actor, fetus) window.WombAddFetus = function(actor, fetus)
{ {
WombInit(actor); WombInit(actor);
...@@ -350,6 +354,18 @@ window.WombAddFetus = function(actor, fetus) ...@@ -350,6 +354,18 @@ window.WombAddFetus = function(actor, fetus)
WombSort(actor); WombSort(actor);
} }
// change property for all fetuses. Like fetus.age = X.
window.WombChangeFetus = function(actor, propName, newValue){
WombInit(actor);
actor.womb.forEach(ft => ft[propName] = newValue);
}
// change genetic property of all fetuses. Like fetus.genetic.intelligence = X
window.WombChangeGene = function(actor, geneName, newValue){
WombInit(actor);
actor.womb.forEach(ft => ft.genetic[geneName] = newValue);
}
/* alt /* alt
window.fetalSplit = function(actor) window.fetalSplit = function(actor)
{ {
......
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