diff --git a/devNotes/limb functions.md b/devNotes/limb functions.md index 94bf3478a9bd3078e391821ecb566abb28fb62d3..891727b6b155a3b349ae3c6001da62f49d78000f 100644 --- a/devNotes/limb functions.md +++ b/devNotes/limb functions.md @@ -1,4 +1,4 @@ -## Basic documentation for the limb access functions coming with the new limb system. +## Basic documentation for the limb access functions in the new limb system. ### ID system @@ -28,83 +28,75 @@ Most functions can be used like this, though some are more specialized. ### Functions: -`isAmputee(slave)`: +#### Read-only functions: + +* `isAmputee(slave)`: True if slave has no limbs, neither natural nor prosthetic. -`hasAnyNaturalLimbs(slave)`: +* `hasAnyNaturalLimbs(slave)`: True if slave has at least one natural limb. -`hasAnyProstheticLimbs(slave)`: +* `hasAnyProstheticLimbs(slave)`: True if slave has at least one prosthetic limb. -`hasAnyLegs(slave)`: +* `hasAnyLegs(slave)`: True if slave has at least one leg. -`hasAnyArms(slave)`: +* `hasAnyArms(slave)`: True if slave has at least one arm. -`hasAnyNaturalLegs(slave)`: +* `hasAnyNaturalLegs(slave)`: True if slave has at least one leg that is natural -`hasAnyNaturalArms(slave)`: +* `hasAnyNaturalArms(slave)`: True if slave has at least one arm that is natural -`hasAnyProstheticArms(slave)`: +* `hasAnyProstheticArms(slave)`: True if slave has at least one arm that is prosthetic -`hasBothLegs(slave)`: +* `hasBothLegs(slave)`: True if slave has both legs. -`hasBothArms(slave)`: +* `hasBothArms(slave)`: True if slave has both arms. -`hasBothNaturalLegs(slave)`: +* `hasBothNaturalLegs(slave)`: True if slave has both legs and they are natural. -`hasBothNaturalArms(slave)`: +* `hasBothNaturalArms(slave)`: True if slave has both arms and they are natural. -`hasAllLimbs(slave)`: +* `hasAllLimbs(slave)`: True if slave has all limbs. -`hasAllNaturalLimbs(slave)`: +* `hasAllNaturalLimbs(slave)`: True if slave has all limbs and all are natural. -`hasLeftArm(slave)`: +* `hasLeftArm(slave)`: True if slave has a left arm. -`hasRightArm(slave)`: +* `hasRightArm(slave)`: True if slave has a right arm. -`hasLeftLeg(slave)`: +* `hasLeftLeg(slave)`: True if slave has a left leg. -`hasRightLeg(slave)`: +* `hasRightLeg(slave)`: True if slave has a right leg. -`getLeftArmID(slave)`: +* `getLeftArmID(slave)`: Returns limb ID of the left arm. -`getRightArmID(slave)`: +* `getRightArmID(slave)`: Returns limb ID of the right arm. -`getLeftLegID(slave)`: +* `getLeftLegID(slave)`: Returns limb ID of the left leg. -`getRightLegID(slave)`: +* `getRightLegID(slave)`: Returns limb ID of the right leg. -`idToDescription(id)`: - Returns a very short description of the specified limb ID. - 0: "amputated"; - 1: "healthy"; - 2: "modern prosthetic"; - 3: "advanced, sex-focused prosthetic"; - 4: "advanced, beauty-focused prosthetic"; - 5: "advanced, combat-focused prosthetic"; - 6: "highly advanced cybernetic"; - -`getLimbCount(slave, id)`: +* `getLimbCount(slave, id)`: Returns count of specified limb ID. Can also be used to check for groups: 101: any limbs that are not amputated @@ -113,19 +105,47 @@ Most functions can be used like this, though some are more specialized. 104: beauty-prosthetic 105: combat-prosthetic -103-105 mean the sum of 3-5 and 6 respectfully. + 103-105 mean the sum of 3-5 and 6 respectfully. -`getLegCount(slave, id)`: +* `getLegCount(slave, id)`: Returns count of legs with specified limb ID. -`getArmCount(slave, id)`: +* `getArmCount(slave, id)`: Returns count of arms with specified limb ID. -`armsAndLegs(slave, arms, arm, legs, leg)`: +#### String functions + +* `idToDescription(id)`: + Returns a very short description of the specified limb ID. + 0: "amputated"; + 1: "healthy"; + 2: "modern prosthetic"; + 3: "advanced, sex-focused prosthetic"; + 4: "advanced, beauty-focused prosthetic"; + 5: "advanced, combat-focused prosthetic"; + 6: "highly advanced cybernetic"; + +* `armsAndLegs(slave, arms, arm, legs, leg)`: Returns a string depending on the limbs a slave has. By default this is a - variation of `arms and legs`, but this can be changed via parameters. + variation of `arms and legs`, but this can be changed via parameters. + + Examples: + `armsAndLegs(slave, "hands", "hand", "feet", foot)` returns `hands and feet` for a slave with all limbs, + `hand and foot` for a slave with one limb each and `feet` for a slave with two legs, but no arms. + + Expects the slave to have at least one limb. Only the first parameter is mandatory, the rest defaults to the + equivalent of `armsAndLegs(slave, "arms", "arm", "legs", "leg")` + +#### Write-only functions + +* `removeLimbs(slave, limb`: + Removes a slave's limbs. Allowed values for limb: `"left arm"`, `"right arm"`, `"left leg"`, `"right leg"`, `"all"`. -Examples: -`armsAndLegs(slave, "hands", "hand", "feet", foot)` returns `hands and feet` for a slave with all limbs, `hand and foot` for a slave with one limb each and `feet` for a slave with two legs, but no arms. +* `attachLimbs(slave, limb, id)`: + Attaches a limb of the specified id. Expects amputated limbs. Will overwrite existing limbs. + Allowed values for limb: `"left arm"`, `"right arm"`, `"left leg"`, `"right leg"`, `"all"`. -Expects the slave to have at least one limb. Only the first parameter is mandatory, the rest defaults to the equivalent of `armsAndLegs(slave, "arms", "arm", "legs", "leg")` +* `configureLimbs(slave, limb, id)`: + Sets the slave's limb to the specified id and sets all limb related variables to their correct values. + Intended for use during slave generation and events. + Allowed values for limb: `"left arm"`, `"right arm"`, `"left leg"`, `"right leg"`, `"all"`. \ No newline at end of file diff --git a/src/Mods/SpecialForce/SpecialForce.js b/src/Mods/SpecialForce/SpecialForce.js index 96b72ae2d045fd34049b3edb83d21d0eb8241ddf..77f17dc9116b53dccde7725f78510e981426980b 100644 --- a/src/Mods/SpecialForce/SpecialForce.js +++ b/src/Mods/SpecialForce/SpecialForce.js @@ -2598,7 +2598,7 @@ App.SF.AAR = function(endWeekCall = 1) { r += `<br> <<link "Some Accountability">> <<set $SF.Regs = "some">> <<replace "#accountability">>''Some Accountability''<</replace>> <</link>> //Does not adjust force depravity.//`; r += `<br> <<link "No Accountability">> <<set $SF.Regs = "none">> <<replace "#accountability">>''No Accountability''<</replace>> <</link>> //Increases force depravity.//`; - r += `<br><br>Force depravity effects trade.`; + r += `<br><br>Force depravity affects trade.`; if (V.SF.MercCon.CanAttend === 1) { V.SF.MercCon.Income = 0; diff --git a/src/facilities/nursery/nursery.tw b/src/facilities/nursery/nursery.tw index 1fadd82fe4b915efe231920640a5f08f6e9abccc..98a737cb994bed67b6508296a542cc0f1dbe6765 100644 --- a/src/facilities/nursery/nursery.tw +++ b/src/facilities/nursery/nursery.tw @@ -378,7 +378,7 @@ Target age for release: <<textbox "$targetAgeNursery" $targetAgeNursery "Nursery <<if $nurseryUpgradeHormones>> <<if $nurseryHormonesSetting>> Artificial hormone levels ''are'' being managed; children may experience precocious puberty. - [Disable|Nursery][$nurseryHormonesSetting = 0]] + [[Disable|Nursery][$nurseryHormonesSetting = 0]] <<else>> Artificial hormones ''are not'' being given; children will undergo normal puberty. [[Activate|Nursery][$nurseryHormonesSetting = 1]] diff --git a/src/js/surgery.js b/src/js/surgery.js index 23168c51f3ea5d45fa5118c29bdfa649a553bdf4..b49e8082ff555321e7e851646e822a6ca713fe3c 100644 --- a/src/js/surgery.js +++ b/src/js/surgery.js @@ -1,4 +1,3 @@ - App.Medicine.Surgery = {}; /** * Composes the Procedure object from its parts @@ -137,6 +136,7 @@ App.Medicine.Surgery.ListHelpers = class { this._V = State.variables; this._showCCs = showCCs; } + /** * @param {string} name * @param {number} implantType @@ -559,6 +559,9 @@ window.removeLimbs = function(slave, limb) { switch (limb) { case "left arm": + if (!hasLeftArm(slave)) { + return; + } remove("arm", "left"); delete slave.brand["left upper arm"]; delete slave.brand["left lower arm"]; @@ -571,6 +574,9 @@ window.removeLimbs = function(slave, limb) { } break; case "right arm": + if (!hasRightArm(slave)) { + return; + } remove("arm", "right"); delete slave.brand["right upper arm"]; delete slave.brand["right lower arm"]; @@ -583,6 +589,9 @@ window.removeLimbs = function(slave, limb) { } break; case "left leg": + if (!hasLeftLeg(slave)) { + return; + } remove("leg", "left"); delete slave.brand["left thigh"]; delete slave.brand["left calf"]; @@ -597,6 +606,9 @@ window.removeLimbs = function(slave, limb) { } break; case "right leg": + if (!hasRightLeg(slave)) { + return; + } remove("leg", "right"); delete slave.brand["right thigh"]; delete slave.brand["right calf"]; @@ -666,6 +678,72 @@ window.attachLimbs = function(slave, limb, id) { } }; +/** + * Changes a slaves limbs to the specified value AND sets all related variables. + * Intended for giving prosthetics during slave generation and events. + * + * @param {App.Entity.SlaveState} slave + * @param {string} limb + * @param {number} id + */ +window.configureLimbs = function(slave, limb, id) { + if (limb === "all") { + configureLimbs(slave, "left arm", id); + configureLimbs(slave, "right arm", id); + configureLimbs(slave, "left leg", id); + configureLimbs(slave, "right leg", id); + return; + } + + let p = limbToProsthetic(id); + if (p) { + addProsthetic(slave, p); + } + + if (id >= 6 && slave.PLimb < 2) { + slave.PLimb = 2; + addProsthetic(slave, "interfaceP2"); + } else if (id >= 2 && slave.PLimb < 1) { + slave.PLimb = 1; + addProsthetic(slave, "interfaceP1"); + } + + switch (limb) { + case "left arm": + if (id !== getLeftArmID(slave)) { + removeLimbs(slave, "left arm"); + if (id > 0) { + attachLimbs(slave, "left arm", id); + } + } + break; + case "right arm": + if (id !== getRightArmID(slave)) { + removeLimbs(slave, "right arm"); + if (id > 0) { + attachLimbs(slave, "right arm", id); + } + } + break; + case "left leg": + if (id !== getLeftLegID(slave)) { + removeLimbs(slave, "left leg"); + if (id > 0) { + attachLimbs(slave, "left leg", id); + } + } + break; + case "right leg": + if (id !== getRightLegID(slave)) { + removeLimbs(slave, "right leg"); + if (id > 0) { + attachLimbs(slave, "right leg", id); + } + } + break; + } +}; + /** * Prepare and set up for new Fuckdoll * @param {App.Entity.SlaveState} slave diff --git a/src/npc/databases/dSlavesDatabase.tw b/src/npc/databases/dSlavesDatabase.tw index d60eb9e51ae1f590755635b0594fdf914396f454..81c7d88c448d6242efdebf034d35025917a61b18 100644 --- a/src/npc/databases/dSlavesDatabase.tw +++ b/src/npc/databases/dSlavesDatabase.tw @@ -214,10 +214,7 @@ <<set _HS = App.Entity.SlaveState.makeSkeleton()>> <<set _HS.slaveName = "Vivienne", _HS.birthName = "Vivienne", _HS.origin = "$He is a former soldier who was sold into slavery after losing $his leg to an IED.", _HS.ID = _i++, _HS.birthWeek = random(0,51), _HS.actualAge = 39, _HS.physicalAge = 39, _HS.visualAge = 39, _HS.ovaryAge = 39, _HS.health = 20, _HS.devotion = 90, _HS.race = "white", _HS.eyeColor = "green", _HS.hColor = "red", _HS.pubicHColor = "red", _HS.skin = "white", _HS.hStyle = "long", _HS.boobs = 400, _HS.butt = 3, _HS.vagina = 1, _HS.vaginaLube = 1, _HS.anus = 1, _HS.skill.vaginal = 15, _HS.skill.oral = 15, _HS.skill.anal = 15, _HS.skill.combat = 1, _HS.intelligence = 25, _HS.intelligenceImplant = 30, _HS.attrXY = 1, _HS.fetishKnown = 1, _HS.backTat = "$He has a military tattoo on $his back.", _HS.custom.desc = "$His left leg is artificial, and $he has a number of scars on $his thigh and shoulder and a burn near $his temple.", _HS.career = "a soldier">> -<<run attachLimbs(_HS, "left leg", 2), - addProsthetic(_HS, "basicL"), - _HS.PLimb = 1 ->> +<<run configureLimbs(_HS, "left leg", 2)>> <<set $heroSlaves.push(_HS)>> /*missing left leg, burn scar, low sex drive, fighter*/ /*Added customdesc, fixed tattoo syntax, added combat skill, eye color and origin -BoneyM*/ diff --git a/src/uncategorized/reRecruit.tw b/src/uncategorized/reRecruit.tw index d739ebe89f9cca988355348c3aab0b4b85fa1350..3ef5cb36ee8a9a535ab62c34e80538476962293c 100644 --- a/src/uncategorized/reRecruit.tw +++ b/src/uncategorized/reRecruit.tw @@ -1715,7 +1715,7 @@ <<set $one_time_age_overrides_pedo_mode = 1>> <<set $oneTimeDisableDisability = 1>> <<set $activeSlave = GenerateNewSlave("XX")>> -<<run attachLimbs($activeSlave, "all", 2), addProsthetic($activeSlave, "basicL"), $activeSlave.PLimb = 1>> +<<run configureLimbs($activeSlave, "all", 2)>> <<set $activeSlave.origin = "You helped free $him from a POW camp after being abandoned by $his country, leaving $him deeply indebted to you.">> <<set $activeSlave.devotion = random(0,20)>> <<set $activeSlave.trust = random(0,20)>> @@ -1793,7 +1793,7 @@ <<set $activeSlave.weight = random(-11 -30)>> <<set $activeSlave.waist = random(-11, -40)>> <<set $activeSlave.skill.combat = 1>> -<<run attachLimbs($activeSlave, "all", 6), addProsthetic($activeSlave, "cyberneticL"), $activeSlave.PLimb = 2>> +<<run configureLimbs($activeSlave, "all", 6)>> <<set $activeSlave.teeth = "pointy">> <<set $activeSlave.muscles = random(30,70)>> <<set $activeSlave.height = Math.round(Height.random($activeSlave, {skew: 3, spread: .2, limitMult: [1, 4]}))>> @@ -2406,7 +2406,7 @@ While digging through the database of a POW camp for anything of value, you find <<if $seeExtreme == 1>> the traces of $his wounds, that $he has been greatly modified for war, and that $he had been raped, repeatedly, despite $his powerful body. <<set $activeSlave.teeth = "pointy", $activeSlave.muscles = random(30,70), $activeSlave.height = Math.round(Height.random($activeSlave, {skew: 3, spread: .2, limitMult: [1, 4]})), $activeSlave.chem = 1000, $activeSlave.attrXX = 0, $activeSlave.attrXY = 0>> - <<run attachLimbs($activeSlave, "all", 6), addProsthetic($activeSlave, "cyberneticL"), $activeSlave.PLimb = 2>> + <<run configureLimbs($activeSlave, "all", 6)>> <<else>> the traces of $his wounds, that $he had been left bound long enough for $his body to atrophy, and that $he had been raped, repeatedly. <</if>> diff --git a/src/utility/slaveCreationWidgets.tw b/src/utility/slaveCreationWidgets.tw index 574e787bdfceb2844d7ef08a68a28ef5ff57a6fd..e991469dab8ee3acd882f3f2fc6338583b476ee9 100644 --- a/src/utility/slaveCreationWidgets.tw +++ b/src/utility/slaveCreationWidgets.tw @@ -802,7 +802,7 @@ <<case "Bodyguard">> <<set $activeSlave.devotion = 90, $activeSlave.muscles = random(30,70), $activeSlave.height = Math.round(Height.random($activeSlave, {skew: 3, spread: .2, limitMult: [1, 4]})), $activeSlave.weight = random(-10,10), $activeSlave.teeth = either("normal", "pointy"), $activeSlave.skill.combat = 1>> <<if jsRandom(0, 2) === 0>> - <<run attachLimbs($activeSlave, "all", 5), addProsthetic($activeSlave, "combatL"), $activeSlave.PLimb = 1>> + <<run configureLimbs($activeSlave, "all", 5)>> <</if>> <<set $activeSlave.career = either("a bodyguard", "a kunoichi", "a law enforcement officer", "a military brat", "a revolutionary", "a soldier", "a transporter", "an assassin", "in a militia")>> <<case "Wardeness">>