Skip to content
Snippets Groups Projects
Commit 15dbe061 authored by svornost's avatar svornost
Browse files

Don't directly iterate the slavelist from slaveInteract in twinescript; do it...

Don't directly iterate the slavelist from slaveInteract in twinescript; do it in Javascript instead.
parent 8b891bdb
No related branches found
No related tags found
No related merge requests found
...@@ -347,41 +347,28 @@ FIXME: ...@@ -347,41 +347,28 @@ FIXME:
<</link>> <</link>>
<<if $seeIncest == 1>> <<if $seeIncest == 1>>
<<if $familyTesting == 1>> <<if $familyTesting == 1>>
<<for $i = 0; $i < _SL; $i++>> <<set _availRelatives = availableRelatives($activeChild)>>
<<if $activeChild.mother == $slaves[$i].ID>> <<if _availRelatives.mother>>
<<if isSlaveAvailable($slaves[$i])>> | <<link "Fuck $him with $his mother">>
| <<link "Fuck $him with $his mother">> <<replace "#miniscene">>
<<replace "#miniscene">> <<set $partner = "mother">>
<<set $partner = "mother">> <<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>>
<<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>> <</link>>
<</link>> <<elseif _availRelatives.motherName !== null>>
<<else>> //$His mother, _availRelatives.motherName, is unavailable//
//$His mother, $slaves[$i].slaveName, is unavailable// <</if>>
<</if>> /*
<</if>> <<if _availRelatives.father>>
/* | <<link "Fuck $him with $his father">>
<<if $activeChild.father == $slaves[$i].ID>> <<replace "#miniscene">><<set $partner = "father">>
<<if isSlaveAvailable($slaves[$i])>> <<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>>
| <<link "Fuck $him with $his father">> <</link>>
<<replace "#miniscene">> <<elseif _availRelatives.fatherName !== null>>
<<set $partner = "father">> //$His father, _availRelatives.fatherName, is unavailable//
<<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>> <</if>>
<</link>> */
<<else>>
//$His father, $slaves[$i].slaveName, is unavailable//
<</if>>
<</if>>
*/
<</for>>
<<if $activeChild.sisters > 0>> <<if $activeChild.sisters > 0>>
<<set $relation = 0>> <<if _availRelatives.sisters == 0>>
<<for $i = 0; $i < _SL; $i++>>
<<setLocalPronouns $slaves[$i] 2>>
<<if areSisters($activeChild, $slaves[$i]) > 0 && !isSlaveAvailable($slaves[$i])>>
<<set $relation++>>
<</if>>
<</for>>
<<if $relation == $activeChild.sisters>>
<<if $activeChild.sisters == 1>> <<if $activeChild.sisters == 1>>
//$His _sister2 is unavailable// //$His _sister2 is unavailable//
<<else>> <<else>>
...@@ -1538,21 +1525,6 @@ Hormones: <b><span id="hormones">$activeChild.hormones</span>.</b> ...@@ -1538,21 +1525,6 @@ Hormones: <b><span id="hormones">$activeChild.hormones</span>.</b>
<</link>> <</link>>
<br><br>__Behavior__:<br> <br><br>__Behavior__:<br>
<<set $dormitoryPopulation = 0, $roomsPopulation = 0>>
<<for $i = 0; $i < _SL; $i++>>
<<if $slaves[$i].assignmentVisible && ($slaves[$i].assignment != "be your Head Girl" || $HGSuite != 1) && ($slaves[$i].assignment != "guard you" || $dojo <= 1)>>
<<if $slaves[$i].rules.living == "luxurious">>
<<if $slaves[$i].relationship >= 4>>
<<set $roomsPopulation += 0.5>>
<<else>>
<<set $roomsPopulation++>>
<</if>>
<<else>>
<<set $dormitoryPopulation++>>
<</if>>
<</if>>
<</for>>
Living standard: <b><span id="livingRules">$activeChild.rules.living</span>.</b> Living standard: <b><span id="livingRules">$activeChild.rules.living</span>.</b>
//$His living conditions are managed by $nurseryName's décor.// //$His living conditions are managed by $nurseryName's décor.//
......
...@@ -369,6 +369,41 @@ window.randomAvailableParent = function(slave) { ...@@ -369,6 +369,41 @@ window.randomAvailableParent = function(slave) {
}); });
}; };
/**
* @param {App.Entity.SlaveState} slave
* @returns {Object}
*/
window.availableRelatives = function(slave) {
let avail = {
mother: false, motherName: null, father: false, fatherName: null, sisters: 0, daughters: 0
};
V.slaves.forEach((other) => {
if (slave.mother === other.ID) {
avail.motherName = other.slaveName;
}
if (slave.father === other.ID) {
avail.fatherName = other.slaveName;
}
if (isSlaveAvailable(other)) {
if (slave.mother === other.ID) {
avail.mother = true;
}
if (slave.father === other.ID) {
avail.father = true;
}
if (slave.ID === other.mother || slave.ID === other.father) {
avail.daughters++;
}
if (areSisters(slave, other) > 0) {
avail.sisters++;
}
}
});
return avail;
};
window.totalPlayerRelatives = function(pc) { window.totalPlayerRelatives = function(pc) {
let relatives = 0; let relatives = 0;
if (pc.mother > 0) { if (pc.mother > 0) {
......
...@@ -243,33 +243,21 @@ ...@@ -243,33 +243,21 @@
| <<link "Abuse $him">><<replace "#miniscene">><<include "FAbuse">><</replace>><</link>> | <<link "Abuse $him">><<replace "#miniscene">><<include "FAbuse">><</replace>><</link>>
<<if $seeIncest == 1>> <<if $seeIncest == 1>>
<<if $familyTesting == 1>> <<if $familyTesting == 1>>
<<for $i = 0; $i < _SL; $i++>> <<set _availRelatives = availableRelatives($activeSlave)>>
<<if $activeSlave.mother == $slaves[$i].ID>> <<if _availRelatives.mother>>
<<if isSlaveAvailable($slaves[$i])>> | <<link "Fuck $him with $his mother">><<replace "#miniscene">><<set $partner = "mother">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>>
| <<link "Fuck $him with $his mother">><<replace "#miniscene">><<set $partner = "mother">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>> <<elseif _availRelatives.motherName !== null>>
<<else>> //$His mother, _availRelatives.motherName, is unavailable//
//$His mother, $slaves[$i].slaveName, is unavailable// <</if>>
<</if>> /*
<</if>> <<if _availRelatives.father>>
/* | <<link "Fuck $him with $his father">><<replace "#miniscene">><<set $partner = "father">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>>
<<if $activeSlave.father == $slaves[$i].ID>> <<elseif _availRelatives.fatherName !== null>>
<<if isSlaveAvailable($slaves[$i])>> //$His father, _availRelatives.fatherName, is unavailable//
| <<link "Fuck $him with $his father">><<replace "#miniscene">><<set $partner = "father">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>> <</if>>
<<else>> */
//$His father, $slaves[$i].slaveName, is unavailable//
<</if>>
<</if>>
*/
<</for>>
<<if $activeSlave.daughters > 0>> <<if $activeSlave.daughters > 0>>
<<set $relation = 0>> <<if _availRelatives.daughters == 0>>
<<for $i = 0; $i < _SL; $i++>>
<<setLocalPronouns $slaves[$i] 2>>
<<if ($activeSlave.ID == $slaves[$i].father || $activeSlave.ID == $slaves[$i].mother) && !isSlaveAvailable($slaves[$i])>>
<<set $relation++>>
<</if>>
<</for>>
<<if $relation == $activeSlave.daughters>>
<<if $activeSlave.daughters == 1>> <<if $activeSlave.daughters == 1>>
//$His _daughter2 is unavailable// //$His _daughter2 is unavailable//
<<else>> <<else>>
...@@ -281,22 +269,15 @@ ...@@ -281,22 +269,15 @@
<<else>> <<else>>
| <<link "Fuck $him with one of $his daughters">><<replace "#miniscene">><<set $partner = "daughter">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>> | <<link "Fuck $him with one of $his daughters">><<replace "#miniscene">><<set $partner = "daughter">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>>
<</if>> <</if>>
/*
<<if _availRelatives.daughters > 1>>
| <<link "Fuck $him with $his daughters">><<replace "#miniscene">><<set $partner = "daughters">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>>
<</if>>
*/
<</if>> <</if>>
<</if>> <</if>>
/*
<<if $activeSlave.daughters > 1>>
| <<link "Fuck $him with $his daughters">><<replace "#miniscene">><<set $partner = "daughters">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>>
<</if>>
*/
<<if $activeSlave.sisters > 0>> <<if $activeSlave.sisters > 0>>
<<set $relation = 0>> <<if _availRelatives.sisters == 0>>
<<for $i = 0; $i < _SL; $i++>>
<<setLocalPronouns $slaves[$i] 2>>
<<if areSisters($activeSlave, $slaves[$i]) > 0 && !isSlaveAvailable($slaves[$i])>>
<<set $relation++>>
<</if>>
<</for>>
<<if $relation == $activeSlave.sisters>>
<<if $activeSlave.sisters == 1>> <<if $activeSlave.sisters == 1>>
//$His _sister2 is unavailable// //$His _sister2 is unavailable//
<<else>> <<else>>
...@@ -308,13 +289,13 @@ ...@@ -308,13 +289,13 @@
<<else>> <<else>>
| <<link "Fuck $him with one of $his sisters">><<replace "#miniscene">><<set $partner = "sister">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>> | <<link "Fuck $him with one of $his sisters">><<replace "#miniscene">><<set $partner = "sister">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>>
<</if>> <</if>>
/*
<<if _availRelatives.sisters > 1>>
| <<link "Fuck $him with $his sisters">><<replace "#miniscene">><<set $partner = "sisters">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>>
<</if>>
*/
<</if>> <</if>>
<</if>> <</if>>
/*
<<if $activeSlave.sisters > 1>>
| <<link "Fuck $him with $his sisters">><<replace "#miniscene">><<set $partner = "sisters">><<include "FRelation">><br>&nbsp;&nbsp;&nbsp;&nbsp;<</replace>><</link>>
<</if>>
*/
<<else>> <<else>>
<<if ($activeSlave.relation != 0)>> <<if ($activeSlave.relation != 0)>>
<<set _assayedSlave = getSlave($activeSlave.relationTarget)>> <<set _assayedSlave = getSlave($activeSlave.relationTarget)>>
...@@ -1527,20 +1508,10 @@ Hormones: <strong><span id="hormones"> ...@@ -1527,20 +1508,10 @@ Hormones: <strong><span id="hormones">
<<if $activeSlave.fuckdoll > 0>> <<if $activeSlave.fuckdoll > 0>>
//Rules have little meaning for living sex toys// //Rules have little meaning for living sex toys//
<<else>> <<else>>
<<set $dormitoryPopulation = 0, $roomsPopulation = 0>> <<set _visibleSlaves = $slaves.filter(s => s.assignmentVisible == 1 && (s.assignment != "be your Head Girl" || $HGSuite != 1) && (s.assignment != "guard you" || $dojo <= 1)),
<<for $i = 0; $i < _SL; $i++>> $dormitoryPopulation = _visibleSlaves.filter(s => s.rules.living != "luxurious").length,
<<if $slaves[$i].assignmentVisible == 1 && ($slaves[$i].assignment != "be your Head Girl" || $HGSuite != 1) && ($slaves[$i].assignment != "guard you" || $dojo <= 1)>> $roomsPopulation = $slavesVisible - $dormitoryPopulation - _visibleSlaves.filter(s => s.rules.living == "luxurious" && s.relationship >= 4).length * 0.5>>
<<if $slaves[$i].rules.living == "luxurious">>
<<if $slaves[$i].relationship >= 4>>
<<set $roomsPopulation += 0.5>>
<<else>>
<<set $roomsPopulation++>>
<</if>>
<<else>>
<<set $dormitoryPopulation++>>
<</if>>
<</if>>
<</for>>
Living standard: ''<span id="livingRules">$activeSlave.rules.living</span>.'' Living standard: ''<span id="livingRules">$activeSlave.rules.living</span>.''
<<if setup.facilityCareers.includes($activeSlave.assignment)>> <<if setup.facilityCareers.includes($activeSlave.assignment)>>
//$His living conditions are managed by $his assignment.// //$His living conditions are managed by $his assignment.//
......
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