Skip to content
Snippets Groups Projects
Commit 0f577c59 authored by Pregmodder's avatar Pregmodder
Browse files

Merge branch 'pregmod-newcontent1_0-fixes' into 'pregmod-newcontent1_0'

Pregmod newcontent1 0 fixes

See merge request !2936
parents 7ed1187e fb2c7eda
Branches
Tags
2 merge requests!3002Pregmod v1032 initial merge,!2936Pregmod newcontent1 0 fixes
...@@ -28,6 +28,7 @@ $slave.bellyPreg = WombGetWolume($slave) - return double, with current womb volu ...@@ -28,6 +28,7 @@ $slave.bellyPreg = WombGetWolume($slave) - return double, with current womb volu
//Init womb system. //Init womb system.
window.WombInit = function(actor) { window.WombInit = function(actor) {
if (!Array.isArray(actor.womb)) { if (!Array.isArray(actor.womb)) {
//alert("creating new womb"); //debugging //alert("creating new womb"); //debugging
actor.womb = []; actor.womb = [];
...@@ -46,10 +47,11 @@ window.WombInit = function(actor) { ...@@ -46,10 +47,11 @@ window.WombInit = function(actor) {
//backward compatibility setup. Fully accurate for normal pregnancy only. //backward compatibility setup. Fully accurate for normal pregnancy only.
if (actor.womb.length > 0 && actor.broodmother == 0 && actor.womb[0].genetics == undefined) { if (actor.womb.length > 0 && actor.broodmother == 0 && actor.womb[0].genetics == undefined) {
var i; var i=0
for (i=0; i<actor.womb.length; i++) { actor.womb.forEach(function(ft){
ft.genetics = generateGenetics(actor.ID, actor.pregSource, i+1); ft.genetics = generateGenetics(actor.ID, actor.pregSource, i);
} i++;
});
} else if (actor.womb.length == 0 && actor.pregType != 0 && actor.broodmother == 0) { } else if (actor.womb.length == 0 && actor.pregType != 0 && actor.broodmother == 0) {
WombImpregnate(actor, actor.pregType, actor.pregSource, actor.preg); WombImpregnate(actor, actor.pregType, actor.pregSource, actor.preg);
} else if (actor.womb.length == 0 && actor.pregType != 0 && actor.broodmother > 0 && actor.broodmotherOnHold < 1) { } else if (actor.womb.length == 0 && actor.pregType != 0 && actor.broodmother > 0 && actor.broodmotherOnHold < 1) {
...@@ -322,13 +324,15 @@ window.fetalSplit = function(actor) { ...@@ -322,13 +324,15 @@ window.fetalSplit = function(actor) {
}; };
//safe alternative to .womb.length. //safe alternative to .womb.length.
window.WombFetusCount(actor){ window.WombFetusCount = function(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. //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)
return actor.womb[fetusNum]; return actor.womb[fetusNum];
...@@ -337,7 +341,8 @@ window.WombGetFetus = function(actor, fetusNum){ ...@@ -337,7 +341,8 @@ window.WombGetFetus = function(actor, fetusNum){
} }
//give reference to fetus object, and remove it form the womb. //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){
ft = actor.womb[fetusNum]; ft = actor.womb[fetusNum];
...@@ -348,7 +353,7 @@ window.WombRemoveFetus = function(actor, fetusNum){ ...@@ -348,7 +353,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. /*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);
...@@ -357,17 +362,59 @@ window.WombAddFetus = function(actor, fetus) ...@@ -357,17 +362,59 @@ window.WombAddFetus = function(actor, fetus)
} }
// change property for all fetuses. Like fetus.age = X. // change property for all fetuses. Like fetus.age = X.
window.WombChangeFetus = function(actor, propName, newValue){ window.WombChangeFetus = function(actor, propName, newValue)
{
WombInit(actor); WombInit(actor);
actor.womb.forEach(ft => ft[propName] = newValue); actor.womb.forEach(ft => ft[propName] = newValue);
} }
// change genetic property of all fetuses. Like fetus.genetic.intelligence = X // change genetic property of all fetuses. Like fetus.genetic.intelligence = X
window.WombChangeGene = function(actor, geneName, newValue){ window.WombChangeGene = function(actor, geneName, newValue)
{
WombInit(actor); WombInit(actor);
actor.womb.forEach(ft => ft.genetic[geneName] = newValue); actor.womb.forEach(ft => ft.genetic[geneName] = newValue);
} }
window.FetusReserveCount = function(reserveType)
{
var cnt = 0;
var SV = State.variables;
if (typeof reserveType != 'string' )
return 0;
SV.slaves.forEach(function(slave){
slave.womb.forEach(function(ft){
if (ft.reserved == reserveType)
cnt++;
});
});
SV.PC.womb.forEach(function(ft){
if (ft.reserved == reserveType)
cnt++;
});
return cnt;
}
window.BCReserveInit = function()
{
var SV = State.variables;
SV.slaves.forEach(function(slave){
slave.womb.forEach(function(ft){
if (typeof ft.reserved != 'string')
ft.reserved = "";
});
});
SV.PC.womb.forEach(function(ft){
if (typeof ft.reserved != 'string')
ft.reserved = "";
});
}
/* alt /* alt
window.fetalSplit = function(actor) window.fetalSplit = function(actor)
{ {
......
...@@ -366,6 +366,7 @@ ...@@ -366,6 +366,7 @@
<</if>> <</if>>
<</if>> <</if>>
<<run PCDatatypeCleanup()>> <<run PCDatatypeCleanup()>>
<<run BCReserveInit()>>
<<if ndef $universalRulesImmobileSlavesMaintainMuscles>> <<if ndef $universalRulesImmobileSlavesMaintainMuscles>>
<<set $universalRulesImmobileSlavesMaintainMuscles = 0>> <<set $universalRulesImmobileSlavesMaintainMuscles = 0>>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment