From 02798ef250b74034944cf066c10bd48847bcf833 Mon Sep 17 00:00:00 2001 From: ezsh <ezsh.junk@gmail.com> Date: Tue, 13 Oct 2020 20:33:09 +0200 Subject: [PATCH] Type annotations 3 --- devTools/types/FC/desc.d.ts | 2 +- devTools/types/FC/gameState.d.ts | 2 +- devTools/types/FC/misc.d.ts | 12 ++-- devTools/types/SugarCubeExtensions.d.ts | 2 + js/003-data/gameVariableData.js | 9 ++- js/003-data/miscData.js | 41 ++++++------- src/002-config/Serializable.js | 2 +- src/004-base/arcologyBuilding.js | 7 ++- src/Mods/SecExp/js/Unit.js | 4 +- src/arcologyBuilding/apartments.js | 5 +- src/arcologyBuilding/base.js | 2 +- src/arcologyBuilding/decorative.js | 2 +- src/arcologyBuilding/manufacturing.js | 5 +- src/arcologyBuilding/markets.js | 5 +- src/arcologyBuilding/penthouse.js | 4 +- src/arcologyBuilding/presets.js | 4 +- src/arcologyBuilding/shops.js | 5 +- src/events/eventUtils.js | 2 +- src/facilities/incubator/incubatorInteract.js | 6 +- src/js/DefaultRules.js | 48 +++++++++++---- src/js/SlaveState.js | 9 +-- src/js/assignJS.js | 2 +- src/js/economyJS.js | 2 +- src/js/eventHandlers.js | 4 +- src/js/findSlave.js | 2 +- src/js/futureSocietyJS.js | 30 ++++++---- src/js/relationshipChecks.js | 4 +- src/js/salon.js | 25 ++++---- src/js/sexActsJS.js | 2 +- src/js/slaveListing.js | 4 +- src/js/speech.js | 11 +--- src/js/statsChecker/eyeChecker.js | 52 ++++++++-------- src/js/statsChecker/limbChecker.js | 60 +++++++++---------- src/js/statsChecker/statsChecker.js | 2 +- src/js/storyJS.js | 12 ++-- src/js/utilsDOM.js | 5 +- src/js/utilsSC.js | 5 +- .../specificMarkets/customSlaveMarket.js | 4 +- src/npc/descriptions/belly/belly.js | 4 +- src/npc/descriptions/belly/bellyImplant.js | 4 +- src/npc/descriptions/belly/bellyInflation.js | 4 +- src/npc/descriptions/boobs/boobs.js | 16 ++--- src/npc/descriptions/butt/anus.js | 4 +- src/npc/descriptions/butt/butt.js | 4 +- src/npc/descriptions/butt/buttplug.js | 4 +- src/npc/descriptions/crotch/crotch.js | 4 +- src/npc/descriptions/crotch/dick.js | 4 +- src/npc/descriptions/crotch/vagina.js | 4 +- src/npc/descriptions/descriptionWidgets.js | 2 +- src/npc/descriptions/eyes.js | 10 ++-- src/npc/descriptions/heels.js | 4 +- src/npc/descriptions/limbs.js | 6 +- src/npc/descriptions/longSlave.js | 2 +- src/npc/descriptions/mind.js | 3 + src/npc/descriptions/sceneIntro.js | 4 +- src/npc/descriptions/skin.js | 4 +- src/npc/descriptions/style/clothing.js | 4 +- src/npc/descriptions/womb/pregnancy.js | 4 +- src/npc/descriptions/womb/superfetation.js | 2 +- src/npc/generate/slaveGenerationJS.js | 6 +- src/npc/surgery/surgery.js | 6 +- src/player/js/PlayerState.js | 2 + src/pregmod/managePersonalAffairs.tw | 4 +- tsconfig.json | 3 +- 64 files changed, 290 insertions(+), 232 deletions(-) diff --git a/devTools/types/FC/desc.d.ts b/devTools/types/FC/desc.d.ts index f6c660b3e9d..d3b8667c1db 100644 --- a/devTools/types/FC/desc.d.ts +++ b/devTools/types/FC/desc.d.ts @@ -5,7 +5,7 @@ declare namespace FC { * 0 if the slave is not for sale. Otherwise a string with the name of the market, * partially to determine if laws apply to the market or not. */ - market?: Zeroable<string>; + market?: Zeroable<SlaveMarketName>; eventDescription?: boolean; prisonCrime?: string; noArt?: boolean; diff --git a/devTools/types/FC/gameState.d.ts b/devTools/types/FC/gameState.d.ts index 4cbcd1c8167..616d6ba916c 100644 --- a/devTools/types/FC/gameState.d.ts +++ b/devTools/types/FC/gameState.d.ts @@ -120,7 +120,7 @@ declare namespace FC { */ interface TemporaryVariablesInTheGameState { gameover?: string; - slaveMarket?: "TSS" | "GRI" | "SCP" | "LDE" | "TGA" | "HA" | "TFS" | "TCR" | "NUL" | "corporate"; + slaveMarket?: SlaveMarketName; prisonCrime?: Zeroable<string>; enunciate?: Enunciation; activeSlaveOneTimeMinAge?: number; diff --git a/devTools/types/FC/misc.d.ts b/devTools/types/FC/misc.d.ts index e1d36dbcbbf..f87d71ab846 100644 --- a/devTools/types/FC/misc.d.ts +++ b/devTools/types/FC/misc.d.ts @@ -1,9 +1,13 @@ declare namespace FC { - export type Gingering = Zeroable<"antidepressant" | "depressant" | "stimulant" | "vasoconstrictor" | "vasodilator" | "aphrodisiac" | "ginger">; - export type GingeringDetection = Zeroable<"slaver" | "mercenary" | "force">; + type SlaveSchoolName = "GRI" | "HA" | "NUL" | "SCP" | "TCR" | "TFS" | "TGA" | "TSS" | "LDE" | "TUO"; + type LawlessMarkets = "generic" | "gangs and smugglers" | "heap" | "indentures" | "low tier criminals" | "military prison" | "neighbor" | + "wetware" | "white collar" | SlaveSchoolName; + type SlaveMarketName = LawlessMarkets | "corporate"; + type Gingering = Zeroable<"antidepressant" | "depressant" | "stimulant" | "vasoconstrictor" | "vasodilator" | "aphrodisiac" | "ginger">; + type GingeringDetection = Zeroable<"slaver" | "mercenary" | "force">; - export namespace SlaveSummary { - export interface SmartPiercing { + namespace SlaveSummary { + interface SmartPiercing { setting: { off: string, submissive: string, diff --git a/devTools/types/SugarCubeExtensions.d.ts b/devTools/types/SugarCubeExtensions.d.ts index 9c8d0bafddf..56e7b3adb81 100644 --- a/devTools/types/SugarCubeExtensions.d.ts +++ b/devTools/types/SugarCubeExtensions.d.ts @@ -98,7 +98,9 @@ declare module "twine-sugarcube" { youngCareers: string[]; fakeBellies: string[]; + filterRaces: string[]; filterRacesLowercase: FC.Race[]; + filterRegions: string[]; heightBoostingShoes: string[]; highHeels: string[]; humiliatingClothes: string[]; diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js index a632beba1a2..b91b7c0be7f 100644 --- a/js/003-data/gameVariableData.js +++ b/js/003-data/gameVariableData.js @@ -474,6 +474,7 @@ App.Data.resetOnNGPlus = { enduringDevotion: 0, /** @type {FC.RA.Rule[]} */ defaultRules: [], + /** @type {Object.<string, number[]>} */ rulesToApplyOnce: {}, REFeminizationCheckinIDs: [], @@ -1375,9 +1376,13 @@ App.Data.resetOnNGPlus = { murderAttemptWeek: 80, illegalDeals: { - military: 0, trade: 0, /* { week: number, company: string } */ + /** @type {FC.Zeroable<{week: number, company: string}>} */ + military: 0, + /** @type {FC.Zeroable<{week: number, company: string}>} */ + trade: 0, menialDrug: 0, - slave: 0 /* { type: string, company: string */ + /** @type {FC.Zeroable<{type: string, company: string}>} */ + slave: 0 }, tempEventToggle: 0, /** diff --git a/js/003-data/miscData.js b/js/003-data/miscData.js index fcbf269784f..564534e3909 100644 --- a/js/003-data/miscData.js +++ b/js/003-data/miscData.js @@ -1949,6 +1949,27 @@ App.Data.misc = { whoringAssignments: [Job.WHORE, Job.BROTHEL, Job.PUBLIC, Job.CLUB], secExCombatPrestige: ["$He is well known for being a great commander.", "$He is famous for being an incredible commander.", "$He is known as a legendary commander all over the world."], + + schools: ["GRI", "HA", "NUL", "SCP", "TCR", "TFS", "TGA", "TSS", "LDE", "TUO"], + + bioreactorFluids: { + XX: { + femCum: 2, + milk: 800 + }, + XY: { + cum: 100, + milk: 600 + }, + herm: { + cum: 100, + femCum: 2, + milk: 600 + }, + barren: { + milk: 700 + } + } }; /* Nationalities based on $continent value. Note that $continent can be undefined! */ @@ -1968,8 +1989,6 @@ App.Data.misc.nationalityPoolSelector = { "Brazil": App.Data.misc.southAmericaNationalities }; -App.Data.misc.schools = ["GRI", "HA", "NUL", "SCP", "TCR", "TFS", "TGA", "TSS", "LDE", "TUO"]; - // these markets are exempt from law compliance App.Data.misc.lawlessMarkets = [ "generic", @@ -2149,21 +2168,3 @@ App.Data.weather = { ], }; -App.Data.misc.bioreactorFluids = { - XX: { - femCum: 2, - milk: 800 - }, - XY: { - cum: 100, - milk: 600 - }, - herm: { - cum: 100, - femCum: 2, - milk: 600 - }, - barren: { - milk: 700 - } -}; diff --git a/src/002-config/Serializable.js b/src/002-config/Serializable.js index 16ce68b8cb9..05d742450c2 100644 --- a/src/002-config/Serializable.js +++ b/src/002-config/Serializable.js @@ -36,7 +36,7 @@ App.Entity.Serializable = class { /** * @param {object} config * @param {boolean} clean - * @returns {App.Entity.Serializable} + * @returns {this} * @protected */ _init(config, clean = false) { diff --git a/src/004-base/arcologyBuilding.js b/src/004-base/arcologyBuilding.js index 70ea4fb08bb..e596b090e05 100644 --- a/src/004-base/arcologyBuilding.js +++ b/src/004-base/arcologyBuilding.js @@ -181,7 +181,7 @@ App.Arcology.Cell.BaseCell = class extends App.Entity.Serializable { /** * @returns {string|Node} - * @private + * @protected */ _setting() { return "baseCell"; @@ -189,7 +189,7 @@ App.Arcology.Cell.BaseCell = class extends App.Entity.Serializable { /** * @returns {Node} - * @private + * @protected */ _body() { return document.createDocumentFragment(); @@ -237,8 +237,9 @@ App.Arcology.Cell.BaseCell = class extends App.Entity.Serializable { // BC code } + /** @return {App.Arcology.Cell.BaseCell} */ clone() { - return (new App.Arcology.Cell.BaseCell())._init(this); + return new App.Arcology.Cell.BaseCell(this.owner)._init(this); } get className() { return "App.Arcology.Cell.BaseCell"; } diff --git a/src/Mods/SecExp/js/Unit.js b/src/Mods/SecExp/js/Unit.js index 0528619da8e..2c9b03766eb 100644 --- a/src/Mods/SecExp/js/Unit.js +++ b/src/Mods/SecExp/js/Unit.js @@ -507,7 +507,9 @@ App.SecExp.getEdictUpgradeVal = (function() { return getNetEffect; })(); -/** @typedef {object} BaseUnit +/** + * @interface + * @typedef {object} BaseUnit * @property {number} attack * @property {number} defense * @property {number} morale diff --git a/src/arcologyBuilding/apartments.js b/src/arcologyBuilding/apartments.js index 40c8541b01e..03c088276cb 100644 --- a/src/arcologyBuilding/apartments.js +++ b/src/arcologyBuilding/apartments.js @@ -51,7 +51,7 @@ App.Arcology.Cell.Apartment = class extends App.Arcology.Cell.BaseCell { /** * @returns {string|Node} - * @private + * @override @protected */ _setting() { let r = ""; @@ -79,7 +79,7 @@ App.Arcology.Cell.Apartment = class extends App.Arcology.Cell.BaseCell { /** * @returns {Node} - * @private + * @override @protected */ _body() { const fragment = document.createDocumentFragment(); @@ -119,6 +119,7 @@ App.Arcology.Cell.Apartment = class extends App.Arcology.Cell.BaseCell { // BC code } + /** @returns {App.Arcology.Cell.Apartment} */ clone() { return (new App.Arcology.Cell.Apartment(this.owner))._init(this); } diff --git a/src/arcologyBuilding/base.js b/src/arcologyBuilding/base.js index ad4ff6b7487..43209901ab5 100644 --- a/src/arcologyBuilding/base.js +++ b/src/arcologyBuilding/base.js @@ -12,7 +12,7 @@ App.Arcology.getCellLink = function(path, message) { * Intended for use on guaranteed single hits. * * @param {App.Arcology.Building} building - * @param {ObjectConstructor} cellClass + * @param {typeof App.Arcology.Cell.BaseCell} cellClass * @param {*} cellType * @param {*} newType * @param {string} [key="type"] diff --git a/src/arcologyBuilding/decorative.js b/src/arcologyBuilding/decorative.js index 8ab1cde9b8d..9bd146f3494 100644 --- a/src/arcologyBuilding/decorative.js +++ b/src/arcologyBuilding/decorative.js @@ -8,7 +8,7 @@ App.Arcology.Cell.Decorative = class extends App.Arcology.Cell.BaseCell { * @param {number} [params.cellHeight=0] in px, if default height is not enough to stop stuff going offscreen * @param {number} [params.absoluteWidth=0] 0/1, if width and xOffset should be read as absolute pixels */ - constructor({width, xOffset = 0, yOffset = 0, rotation = 0, cellHeight = 0, absoluteWidth = 0} = {}) { + constructor({width, xOffset = 0, yOffset = 0, rotation = 0, cellHeight = 0, absoluteWidth = 0}) { super(1); this._width = width; this._xOffset = xOffset; diff --git a/src/arcologyBuilding/manufacturing.js b/src/arcologyBuilding/manufacturing.js index 3e285e2392b..3740265670b 100644 --- a/src/arcologyBuilding/manufacturing.js +++ b/src/arcologyBuilding/manufacturing.js @@ -70,7 +70,7 @@ App.Arcology.Cell.Manufacturing = class extends App.Arcology.Cell.BaseCell { /** * @returns {string|Node} - * @private + * @protected @override */ _setting() { let r = ""; @@ -105,7 +105,7 @@ App.Arcology.Cell.Manufacturing = class extends App.Arcology.Cell.BaseCell { /** * @returns {Node} - * @private + * @protected @override */ _body() { const fragment = document.createDocumentFragment(); @@ -273,6 +273,7 @@ App.Arcology.Cell.Manufacturing = class extends App.Arcology.Cell.BaseCell { // BC code } + /** @returns {App.Arcology.Cell.Manufacturing} */ clone() { return (new App.Arcology.Cell.Manufacturing(this.owner))._init(this); } diff --git a/src/arcologyBuilding/markets.js b/src/arcologyBuilding/markets.js index 83e1cadcc77..4d3caebf3da 100644 --- a/src/arcologyBuilding/markets.js +++ b/src/arcologyBuilding/markets.js @@ -71,7 +71,7 @@ App.Arcology.Cell.Market = class extends App.Arcology.Cell.BaseCell { /** * @returns {string|Node} - * @private + * @protected @override */ _setting() { /* no need to check type, since you can only get here with the basic type */ @@ -85,7 +85,7 @@ App.Arcology.Cell.Market = class extends App.Arcology.Cell.BaseCell { /** * @returns {Node} - * @private + * @protected @override */ _body() { const fragment = document.createDocumentFragment(); @@ -148,6 +148,7 @@ App.Arcology.Cell.Market = class extends App.Arcology.Cell.BaseCell { // BC code } + /** @returns {App.Arcology.Cell.Market} */ clone() { return (new App.Arcology.Cell.Market(this.owner))._init(this); } diff --git a/src/arcologyBuilding/penthouse.js b/src/arcologyBuilding/penthouse.js index 89c31269931..9f810a8cf8f 100644 --- a/src/arcologyBuilding/penthouse.js +++ b/src/arcologyBuilding/penthouse.js @@ -80,6 +80,7 @@ App.Arcology.Cell.Penthouse = class extends App.Arcology.Cell.BaseCell { return fragment; /** + * @param {ParentNode} outer * @returns {HTMLDivElement} */ function getWrapper(outer) { @@ -121,8 +122,9 @@ App.Arcology.Cell.Penthouse = class extends App.Arcology.Cell.BaseCell { // BC code } + /** @returns {App.Arcology.Cell.Penthouse} */ clone() { - return (new App.Arcology.Cell.Penthouse())._init(this); + return new App.Arcology.Cell.Penthouse()._init(this); } get className() { return "App.Arcology.Cell.Penthouse"; } diff --git a/src/arcologyBuilding/presets.js b/src/arcologyBuilding/presets.js index bd0f9adf947..9157e8bfc5c 100644 --- a/src/arcologyBuilding/presets.js +++ b/src/arcologyBuilding/presets.js @@ -74,7 +74,7 @@ App.Arcology.presets = (function() { }; /** - * @param {buildingTemplate} template + * @param {sectionTemplate[]} template * @returns {App.Arcology.Building} */ function templateToBuilding(template) { @@ -178,7 +178,7 @@ App.Arcology.presets = (function() { */ function addFsShop(building, fs) { function randomShop() { - return building.findCells(cell => cell instanceof App.Arcology.Cell.Shop).random(); + return /** @type {App.Arcology.Cell.Shop} */(building.findCells(cell => cell instanceof App.Arcology.Cell.Shop).random()); } switch (fs) { diff --git a/src/arcologyBuilding/shops.js b/src/arcologyBuilding/shops.js index 8428cfc67a6..725b030be4a 100644 --- a/src/arcologyBuilding/shops.js +++ b/src/arcologyBuilding/shops.js @@ -50,7 +50,7 @@ App.Arcology.Cell.Shop = class extends App.Arcology.Cell.BaseCell { /** * @returns {DocumentFragment} - * @private + * @protected @override */ _setting() { const A = V.arcologies[0]; @@ -307,7 +307,7 @@ App.Arcology.Cell.Shop = class extends App.Arcology.Cell.BaseCell { /** * @returns {Node} - * @private + * @protected @override */ _body() { const fragment = document.createDocumentFragment(); @@ -715,6 +715,7 @@ App.Arcology.Cell.Shop = class extends App.Arcology.Cell.BaseCell { // BC code } + /** @returns {App.Arcology.Cell.Shop} */ clone() { return (new App.Arcology.Cell.Shop(this.owner))._init(this); } diff --git a/src/events/eventUtils.js b/src/events/eventUtils.js index f0c3ca72d92..da56dda3a44 100644 --- a/src/events/eventUtils.js +++ b/src/events/eventUtils.js @@ -145,7 +145,7 @@ App.Events.addParagraph = function(node, sentences) { /** assemble an element from an array of DOM nodes, sentences or sentence fragments (which may contain HTML) * @param {Node} node - * @param {Array<string|HTMLElement|DocumentFragment|Node>} sentences + * @param {Array<string|HTMLElement|DocumentFragment>} sentences * @param {string} [element] */ App.Events.addNode = function(node, sentences, element) { diff --git a/src/facilities/incubator/incubatorInteract.js b/src/facilities/incubator/incubatorInteract.js index 76553d603cf..6bc9b4db831 100644 --- a/src/facilities/incubator/incubatorInteract.js +++ b/src/facilities/incubator/incubatorInteract.js @@ -170,9 +170,9 @@ App.UI.incubator = function() { momEl.id = _slaveId; momEl.classList.add("possible"); - momEl.setAttribute("data-preg-count", slave.womb.length); - momEl.setAttribute("data-reserved-spots", _reservedIncubator); - momEl.setAttribute("data-preg-week", _pregWeek); + momEl.setAttribute("data-preg-count", slave.womb.length.toString()); + momEl.setAttribute("data-reserved-spots", _reservedIncubator.toString()); + momEl.setAttribute("data-preg-week", _pregWeek.toString()); momEl.setAttribute("data-name", _slaveName); linkArray = []; diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js index 8d8a956ee2c..b6ceabccf72 100644 --- a/src/js/DefaultRules.js +++ b/src/js/DefaultRules.js @@ -1005,7 +1005,7 @@ globalThis.DefaultRules = (function() { /** * @param {App.Entity.SlaveState} slave - * @param {object} volume + * @param {number} volume */ function BellySurgery(slave, volume) { // this is a port of the belly implant portion of surgeryDegradation.tw @@ -1173,10 +1173,13 @@ globalThis.DefaultRules = (function() { return; } + /** @typedef {"lips" | "boobs" | "butt" | "dick" | "balls"} DrugTarget */ + // Asset Growth const growthDrugs = new Set(["breast injections", "breast redistributors", "butt injections", "butt redistributors", "hyper breast injections", "hyper butt injections", "hyper penis enhancement", "hyper testicle enhancement", "intensive breast injections", "intensive butt injections", "intensive penis enhancement", "intensive testicle enhancement", "lip atrophiers", "lip injections", "penis atrophiers", "penis enhancement", "testicle atrophiers", "testicle enhancement"]); // WARNING: property names in fleshFunc, growDrugs, and shrinkDrugs must be identical and this fact is used by the drugs() below + /** @type {Record<DrugTarget, (s: App.Entity.SlaveState) => number>} */ const fleshFunc = { lips: s => s.lips - s.lipsImplant, boobs: s => s.boobs - s.boobsImplant - s.boobsMilk, @@ -1185,6 +1188,7 @@ globalThis.DefaultRules = (function() { balls: s => s.balls, }; + /** @type {Record<DrugTarget, number>} */ const maxAssetSize = { lips: V.seeExtreme ? 95 : 85, boobs: 48000, @@ -1193,6 +1197,7 @@ globalThis.DefaultRules = (function() { balls: 125 }; + /** @type {Record<DrugTarget, FC.Drug>} */ const growDrugs = { lips: "lip injections", boobs: "breast injections", @@ -1228,6 +1233,7 @@ globalThis.DefaultRules = (function() { } } + /** @type {Record<DrugTarget, FC.Drug>} */ const shrinkDrugs = { lips: null, boobs: null, @@ -1252,9 +1258,9 @@ globalThis.DefaultRules = (function() { /** * @param {App.Entity.SlaveState} slave - * @param {string} asset + * @param {DrugTarget} asset * @param {FC.RA.NumericTarget} target - * @param {Array} priorities + * @param {{drug: FC.Drug, weight: number}[]} priorities * @param {number} step */ function drugs(slave, asset, target, priorities, step) { @@ -1276,6 +1282,7 @@ globalThis.DefaultRules = (function() { } } + /** @type {{drug: FC.Drug, weight: number}[]} */ let _priorities = []; drugs(slave, "boobs", rule.growth.boobs, _priorities, 200); drugs(slave, "butt", rule.growth.butt, _priorities, 1); @@ -1538,7 +1545,6 @@ globalThis.DefaultRules = (function() { * @param {App.Entity.SlaveState} slave * @param {FC.RA.RuleSetters} rule */ - function ProcessPit(slave, rule) { if (rule.pitRules !== undefined && rule.pitRules !== null) { if (V.pit) { @@ -2978,7 +2984,9 @@ globalThis.DefaultRules = (function() { r += `<br>Highlights of ${slave.slaveName}'s sex life ${yesno} being released.`; } - /** @param {App.Entity.SlaveState} slave */ + /** @param {App.Entity.SlaveState} slave + * @param {FC.RA.RuleSetters} rule + */ function ProcessPorn(slave, rule) { if ((rule.pornFameSpending !== undefined) && (rule.pornFameSpending !== null)) { if (slave.porn.prestige < 3) { @@ -3034,6 +3042,10 @@ globalThis.DefaultRules = (function() { } } + return DefaultRules; +})(); + +globalThis.RuleHasError = function() { const rxCheckEqual = /[^!=<>]=[^=<>]/gi; const compileCheck = function(code) { try { @@ -3044,17 +3056,29 @@ globalThis.DefaultRules = (function() { } return true; }; - globalThis.RuleHasError = (rule) => rule.condition.function === "custom" - && (rule.condition.data.match(rxCheckEqual) - || !compileCheck(rule.condition.data)); - globalThis.DefaultRulesError = () => V.defaultRules.some(r => RuleHasError(r)); - return DefaultRules; -})(); + /** + * @param {FC.RA.Rule} rule + * @returns {boolean} + */ + function check(rule) { + return rule.condition.function === "custom" + && (rule.condition.data.match(rxCheckEqual) + || !compileCheck(rule.condition.data)); + } + + return check; +}(); + +globalThis.DefaultRulesError = () => V.defaultRules.some(r => RuleHasError(r)); + +/** + * @param {App.Entity.SlaveState} slave + */ globalThis.removeFromRulesToApplyOnce = function(slave) { for (const rule of Object.keys(V.rulesToApplyOnce)) { if (V.rulesToApplyOnce[rule].includes(slave.ID)) { V.rulesToApplyOnce[rule].delete(slave.ID); } } -}; \ No newline at end of file +}; diff --git a/src/js/SlaveState.js b/src/js/SlaveState.js index c4b70ef5bc3..93054bd17f9 100644 --- a/src/js/SlaveState.js +++ b/src/js/SlaveState.js @@ -690,7 +690,8 @@ App.Entity.SlaveState = class SlaveState { * -1: -10 cm, 0: none, 1: +10 cm * @type {FC.HeightImplant} */ this.heightImplant = 0; - /** slave's nationality */ + /** slave's nationality + * @type {string} */ this.nationality = "slave"; /** slave's race * @type {FC.Race} */ @@ -1001,7 +1002,7 @@ App.Entity.SlaveState = class SlaveState { * * "Sacrilege" * * "Possessive" * * "Paternalist" - * @type {string | number} + * @type {FC.Zeroable<string>} */ this.boobsTat = 0; /** slave lactation @@ -1160,7 +1161,7 @@ App.Entity.SlaveState = class SlaveState { * * "Sacrilege" * * "Possessive" * * "Paternalist" - * @type {string|number} */ + * @type {FC.Zeroable<string>} */ this.lipsTat = 0; /** * teeth type @@ -1219,7 +1220,7 @@ App.Entity.SlaveState = class SlaveState { * * "Sacrilege" * * "Possessive" * * "Paternalist" - * @type {string|number} */ + * @type {FC.Zeroable<string>} */ this.vaginaTat = 0; /** * pregnancy time or state.See Pregnancy Control section for more. diff --git a/src/js/assignJS.js b/src/js/assignJS.js index ff7837a2959..ad3c86e7414 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -960,7 +960,7 @@ globalThis.assignmentTransition = function(slave, assignTo, passage) { * @param {string} facilityName * @param {FC.Assignment} [managerAssignment] * @param {FC.Assignment} [workerAssignment] - * @returns {Node} + * @returns {DocumentFragment} */ globalThis.removeFacilityWorkers = function(facilityName, managerAssignment, workerAssignment) { const facility = App.Entity.facilities[facilityName]; diff --git a/src/js/economyJS.js b/src/js/economyJS.js index 9f5186ba583..09715cd6a34 100644 --- a/src/js/economyJS.js +++ b/src/js/economyJS.js @@ -2268,7 +2268,7 @@ The third category, the "slave slot" is completely optional. Sometimes you just /** Spend or gain money and record the transaction for accounting * @param {number} cost * @param {string} what - @see App.Data.Records.LastWeeksCash() for a full list - * @param {App.Entity.SlaveState} [who] - the slave whose ledger the transaction should be recorded to. V.PC may be passed but will be ignored. + * @param {FC.HumanState} [who] - the slave whose ledger the transaction should be recorded to. V.PC may be passed but will be ignored. */ globalThis.cashX = function(cost, what, who) { if (!Number.isFinite(cost)) { diff --git a/src/js/eventHandlers.js b/src/js/eventHandlers.js index d5af291a10c..eb50a55dcb8 100644 --- a/src/js/eventHandlers.js +++ b/src/js/eventHandlers.js @@ -1,6 +1,6 @@ App.EventHandlers = function() { /** - * @param {SugarCubeLib.SaveObject} save + * @param {TwineSugarCube.SaveObject} save */ function onLoad(save) { const v = save.state.history[0].variables; @@ -19,7 +19,7 @@ App.EventHandlers = function() { } /** - * @param {SugarCubeLib.SaveObject} save + * @param {TwineSugarCube.SaveObject} save */ function onSave(save) { } diff --git a/src/js/findSlave.js b/src/js/findSlave.js index c0f8f9e39d4..3ce15a0cc31 100644 --- a/src/js/findSlave.js +++ b/src/js/findSlave.js @@ -2,7 +2,7 @@ App.FindSlave = {}; /** * Fragment searching: See if every needle can found somewhere in the field of haystacks - * @param {string[]} haystacks + * @param {FC.Zeroable<string>[]} haystacks * @param {RegExp[]} needles * @returns {boolean} */ diff --git a/src/js/futureSocietyJS.js b/src/js/futureSocietyJS.js index b2b53e07c8c..32c14eda04d 100644 --- a/src/js/futureSocietyJS.js +++ b/src/js/futureSocietyJS.js @@ -34,9 +34,12 @@ globalThis.FutureSocieties = (function() { PetiteAdmiration: "FSPetiteAdmiration", StatuesqueGlorification: "FSStatuesqueGlorification" }; + /** @type {FC.FutureSociety[]} */ const SocietyList = [...new Set(Object.keys(FSString2Property).map(key => FSString2Property[key]))]; // This returns an array containing the unique values of FSString2Property. E.g. "FSSupremacist" and "FSSubjugationist" + /** @type {FC.FutureSociety[]} */ const NPCSocietyList = [ "FSCummunism", "FSIncestFetishist" ]; // NPC arcologies may use these FSes, but the PC can't + /** @type {FC.FutureSociety[][]} */ const FSMutexGroups = [ [ "FSSupremacist" ], [ "FSSubjugationist" ], @@ -55,6 +58,7 @@ globalThis.FutureSocieties = (function() { [ "FSPetiteAdmiration", "FSStatuesqueGlorification"] ]; + /** @type {Record<FC.FutureSociety, {noun: FC.FutureSocietyNoun, adj: FC.FutureSocietyAdj}} */ const DisplayName = { FSSupremacist: {noun: "Racial Supremacism", adj: "Supremacist"}, FSSubjugationist: {noun: "Racial Subjugationism", adj: "Subjugationist"}, @@ -112,7 +116,7 @@ globalThis.FutureSocieties = (function() { /** get the list of FSes active for a particular arcology * helper function, not callable externally * @param {number} arcologyID - * @returns {Array<string>} + * @returns {FC.FutureSociety[]} */ function activeFSes(arcologyID) { let isSet = (fs) => V.arcologies[arcologyID][fs] !== "unset"; @@ -174,8 +178,8 @@ globalThis.FutureSocieties = (function() { } /** determines whether two named FSes are naturally conflicting or not - * @param {string} left FS - * @param {string} right FS + * @param {FC.FutureSociety} left FS + * @param {FC.FutureSociety} right FS * @returns {boolean} */ function conflictingFSes(left, right) { @@ -191,7 +195,7 @@ globalThis.FutureSocieties = (function() { /** returns an array of all of the FSes that would be valid for this arcology to adopt right now * @param {number} arcID - * @returns {string[]} + * @returns {FC.FutureSociety[]} */ function validAdoptions(arcID) { const arcology = V.arcologies[arcID]; @@ -226,10 +230,13 @@ globalThis.FutureSocieties = (function() { * call as FutureSocieties.diplomaticFSes(arc1ID, arc2ID) * @param {number} arc1ID * @param {number} arc2ID - * @returns {{shared: string[], conflicting: string[][]}} + * @returns {{shared: FC.FutureSociety[], conflicting: FC.FutureSociety[][]}} */ function diplomaticFSes(arc1ID, arc2ID) { - let shared = [], conflicting = []; + /** @type {FC.FutureSociety[]} */ + let shared = []; + /** @type {FC.FutureSociety[][]} */ + let conflicting = []; const arc1FSes = activeFSes(arc1ID); const arc2FSes = activeFSes(arc2ID); // find ordinary shared and conflicting FSes @@ -273,16 +280,16 @@ globalThis.FutureSocieties = (function() { } /** returns the future society display name (typically an "ism") for the given property - * @param {string} FSProp - * @returns {string} + * @param {FC.FutureSociety} FSProp + * @returns {FC.FutureSocietyNoun} */ function displayName(FSProp) { return DisplayName[FSProp].noun; } /** returns the future society adjective (typically an "ist") for the given property - * @param {string} FSProp - * @returns {string} + * @param {FC.FutureSociety} FSProp + * @returns {FC.FutureSocietyAdj} */ function displayAdj(FSProp) { return DisplayName[FSProp].adj; @@ -291,11 +298,12 @@ globalThis.FutureSocieties = (function() { /** decays all the FSes adopted by a particular arcology (for example, because of government instability) * call as FutureSocieties.decay(arcologyID) * @param {number} arcologyID - * @returns {Array<string>} FSes which purged completely + * @returns {FC.FutureSociety[]} FSes which purged completely */ function decayFSes(arcologyID) { const fses = activeFSes(arcologyID); const arc = V.arcologies[arcologyID]; + /** @type {FC.FutureSociety[]} */ let purged = []; for (const fs of fses) { if (fs !== "FSNull") { // exempt for some reason? diff --git a/src/js/relationshipChecks.js b/src/js/relationshipChecks.js index a5969128a77..f3274538f7e 100644 --- a/src/js/relationshipChecks.js +++ b/src/js/relationshipChecks.js @@ -66,8 +66,8 @@ globalThis.PCrelationshipTerm = function(id) { * If there is no known relationship between them, returns the name alone. * Use this function instead of just printing the slave's name when you'd like to let the player to know if two actors are related, * even though it's not going to have any mechanical impact on the scene. - * @param {App.Entity.SlaveState|App.Entity.PlayerState} context - * @param {App.Entity.SlaveState|App.Entity.PlayerState} actor + * @param {FC.HumanState} context + * @param {FC.HumanState} actor * @param {boolean|string} [asLink=false] - when true, instead of using the slave's first name, use their full name with a (SC Markup) link to the slave description dialog. when "DOM", generate a DOM link and return a DocumentFragment. * @param {boolean} [insertComma=false] - when true, if a relationship is found, it will be separated from the actor's name by a comma ("her father, Dave" instead of "her father Dave") * @returns {string|DocumentFragment} diff --git a/src/js/salon.js b/src/js/salon.js index e1a2e9a9ad7..9a0e8ccdfd5 100644 --- a/src/js/salon.js +++ b/src/js/salon.js @@ -1,11 +1,12 @@ /** - * @param {App.Entity.PlayerState|App.Entity.SlaveState} entity - * @param {boolean} player + * @param {FC.HumanState} entity * @returns {HTMLDivElement} */ -App.Medicine.Modification.eyeSelector = function(entity, player = false) { +App.Medicine.Modification.eyeSelector = function(entity) { const {He, him, his} = getPronouns(entity); + const player = entity === V.PC; + let selectedSide = "none"; let selectedIris = "none"; let selectedPupil = "none"; @@ -45,7 +46,7 @@ App.Medicine.Modification.eyeSelector = function(entity, player = false) { /** * @param {string} name * @param {Array<string>} list - * @param {Function}callback + * @param {function(string):void}callback * @param {string} selected * @returns {HTMLDivElement} */ @@ -64,7 +65,7 @@ App.Medicine.Modification.eyeSelector = function(entity, player = false) { /** * @param {string} value - * @param {Function} callback + * @param {(value: string) => void} callback * @param {Array<HTMLAnchorElement>} links * @param {boolean} [disabled] */ @@ -204,6 +205,10 @@ App.Medicine.Modification.eyeSelector = function(entity, player = false) { } } + /** + * @param {string} text + * @param {() => void} callback + */ function removeLink(text, callback) { const a = document.createElement("a"); a.append(text); @@ -219,9 +224,9 @@ App.Medicine.Modification.eyeSelector = function(entity, player = false) { * Update ears in salon * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number|string} [params.primaryEarColor] - * @param {string} [params.secondaryEarColor] - * @returns {node} + * @param {number|string} [params.primaryEarColor=0] + * @param {string} [params.secondaryEarColor=""] + * @returns {JQuery<HTMLElement>} */ App.Medicine.Salon.ears = function(slave, {primaryEarColor = 0, secondaryEarColor = ""} = {}) { const frag = new DocumentFragment(); @@ -317,7 +322,7 @@ App.Medicine.Salon.ears = function(slave, {primaryEarColor = 0, secondaryEarColo * @param {object} params * @param {number|string} [params.primaryHairColor] * @param {string} [params.secondaryHairColor] - * @returns {node} + * @returns {JQuery<HTMLElement>} */ App.Medicine.Salon.hair = function(slave, {primaryHairColor = 0, secondaryHairColor = ""} = {}) { const frag = new DocumentFragment(); @@ -689,7 +694,7 @@ App.Medicine.Salon.hair = function(slave, {primaryHairColor = 0, secondaryHairCo * @param {object} params * @param {number|string} [params.primaryTailColor] * @param {string} [params.secondaryTailColor] - * @returns {node} + * @returns {JQuery<HTMLElement>} */ App.Medicine.Salon.tail = function(slave, {primaryTailColor = 0, secondaryTailColor = ""} = {}) { const frag = new DocumentFragment(); diff --git a/src/js/sexActsJS.js b/src/js/sexActsJS.js index c3a42134b2d..8c28f0f0e78 100644 --- a/src/js/sexActsJS.js +++ b/src/js/sexActsJS.js @@ -474,7 +474,7 @@ globalThis.actX = function(slave, act, count = 1) { * Sex is between two. This is a handy wrapper for actX that emphasizes that. * @param {App.Entity.SlaveState} slave1 always a slave * @param {string} act1 oral, anal, etc - * @param {App.Entity.SlaveState | App.Entity.PlayerState | string} slave2 slave or PC or "public" + * @param {FC.HumanState | "public"} slave2 slave or PC or "public" * @param {string} act2 oral, anal, etc * @param {number} count */ diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js index 64051f6a7a9..8e668e6bee4 100644 --- a/src/js/slaveListing.js +++ b/src/js/slaveListing.js @@ -410,7 +410,7 @@ App.UI.SlaveList.render = function() { quickIndexBtn.id = `quick-list-toggle${listID}`; quickIndexBtn.setAttribute('data-quick-index', listID.toString()); quickIndexBtn.onclick = function(ev) { - let which = ev.target.attributes["data-quick-index"].value; + let which = /** @type {HTMLElement} */ (ev.target).attributes["data-quick-index"].value; let quick = $("div#list_index" + which); quick.toggleClass("ql-hidden"); }; @@ -728,7 +728,7 @@ App.UI.SlaveList.listNGPSlaves = function() { let imported = []; let nonImported = []; for (const slave of V.slaves) { - /* handle the legacy assignment string */ + // @ts-ignore: handle the legacy assignment string if (slave.assignment === "be imported") { slave.assignment = Job.IMPORTED; } diff --git a/src/js/speech.js b/src/js/speech.js index e3457dd84d7..1995b7a06ac 100644 --- a/src/js/speech.js +++ b/src/js/speech.js @@ -1,15 +1,6 @@ /** Get all the enunciations used by a particular slave as a destructurable object. * @param {App.Entity.SlaveState} slave - * @returns {{title: string, say: string, - * s: string, S: string, ss: string, - * c: string, C: string, cc: string, - * z: string, Z: string, zz: string, - * ch: string, Ch: string, - * ps: string, Ps: string, - * sh: string, Sh: string, - * sc: string, Sc: string, - * sch: string, Sch: string, - * x: string, X: string}} + * @returns {FC.Enunciation} */ globalThis.getEnunciation = function(slave) { let ret = {}; diff --git a/src/js/statsChecker/eyeChecker.js b/src/js/statsChecker/eyeChecker.js index b1e31054c39..afd7bfa8094 100644 --- a/src/js/statsChecker/eyeChecker.js +++ b/src/js/statsChecker/eyeChecker.js @@ -1,7 +1,7 @@ /** * True if slave has at least one eye * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.hasAnyEyes = function(slave) { @@ -11,7 +11,7 @@ globalThis.hasAnyEyes = function(slave) { /** * True if slave has at least one eye that is natural * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.hasAnyNaturalEyes = function(slave) { @@ -21,7 +21,7 @@ globalThis.hasAnyNaturalEyes = function(slave) { /** * True if slave has at least one eye that is prosthetic (cyber or glass) * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.hasAnyProstheticEyes = function(slave) { @@ -31,7 +31,7 @@ globalThis.hasAnyProstheticEyes = function(slave) { /** * True if slave has at least one eye that is cybernetic * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.hasAnyCyberneticEyes = function(slave) { @@ -41,7 +41,7 @@ globalThis.hasAnyCyberneticEyes = function(slave) { /** * True if slave has both eyes * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.hasBothEyes = function(slave) { @@ -51,7 +51,7 @@ globalThis.hasBothEyes = function(slave) { /** * True if slave has both eyes and they are natural * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.hasBothNaturalEyes = function(slave) { @@ -61,7 +61,7 @@ globalThis.hasBothNaturalEyes = function(slave) { /** * True if slave has both eyes and they are prosthetic (cyber or glass) * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.hasBothProstheticEyes = function(slave) { @@ -71,7 +71,7 @@ globalThis.hasBothProstheticEyes = function(slave) { /** * True if slave has both eyes and they are cybernetic * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.hasBothCyberneticEyes = function(slave) { @@ -81,7 +81,7 @@ globalThis.hasBothCyberneticEyes = function(slave) { /** * True if slave has left eye * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.hasLeftEye = function(slave) { @@ -90,7 +90,7 @@ globalThis.hasLeftEye = function(slave) { /** * True if slave has right eye * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.hasRightEye = function(slave) { @@ -100,7 +100,7 @@ globalThis.hasRightEye = function(slave) { /** * Returns type of the left eye. * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {number} */ globalThis.getLeftEyeType = function(slave) { @@ -114,7 +114,7 @@ globalThis.getLeftEyeType = function(slave) { /** * Returns type of the right eye. * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {number} */ globalThis.getRightEyeType = function(slave) { @@ -126,7 +126,7 @@ globalThis.getRightEyeType = function(slave) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {number} */ globalThis.getLeftEyeVision = function(slave) { @@ -138,7 +138,7 @@ globalThis.getLeftEyeVision = function(slave) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {number} */ globalThis.getRightEyeVision = function(slave) { @@ -150,7 +150,7 @@ globalThis.getRightEyeVision = function(slave) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {number} */ globalThis.getBestVision = function(slave) { @@ -158,7 +158,7 @@ globalThis.getBestVision = function(slave) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {number} */ globalThis.getWorstVision = function(slave) { @@ -167,7 +167,7 @@ globalThis.getWorstVision = function(slave) { /** * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @param {number} vision * @returns {boolean} */ @@ -176,7 +176,7 @@ globalThis.anyVisionEquals = function(slave, vision) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {string} */ globalThis.getLeftEyeColor = function(slave) { @@ -188,7 +188,7 @@ globalThis.getLeftEyeColor = function(slave) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {string} */ globalThis.getRightEyeColor = function(slave) { @@ -200,7 +200,7 @@ globalThis.getRightEyeColor = function(slave) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {string} */ globalThis.getLeftEyePupil = function(slave) { @@ -212,7 +212,7 @@ globalThis.getLeftEyePupil = function(slave) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {string} */ globalThis.getRightEyePupil = function(slave) { @@ -224,7 +224,7 @@ globalThis.getRightEyePupil = function(slave) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {string} */ globalThis.getLeftEyeSclera = function(slave) { @@ -236,7 +236,7 @@ globalThis.getLeftEyeSclera = function(slave) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {string} */ globalThis.getRightEyeSclera = function(slave) { @@ -248,7 +248,7 @@ globalThis.getRightEyeSclera = function(slave) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.hasVisibleHeterochromia = function(slave) { @@ -258,7 +258,7 @@ globalThis.hasVisibleHeterochromia = function(slave) { /** * Gives the genetic color of the specified eye. * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} playerOrSlave + * @param {FC.HumanState} playerOrSlave * @param {string} side * @returns {string} */ @@ -280,7 +280,7 @@ globalThis.getGeneticEyeColor = function(playerOrSlave, side) { /** * Counts the number of eyes that are not the genetic color * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {number} */ globalThis.getLenseCount = function(slave) { diff --git a/src/js/statsChecker/limbChecker.js b/src/js/statsChecker/limbChecker.js index 1c44af28507..f13e66a1f3b 100644 --- a/src/js/statsChecker/limbChecker.js +++ b/src/js/statsChecker/limbChecker.js @@ -3,7 +3,7 @@ /** * True if slave has no limbs, neither natural nor prosthetic * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.isAmputee = function(slave) { @@ -13,7 +13,7 @@ globalThis.isAmputee = function(slave) { /** * True if slave has at least one natural limb * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasAnyNaturalLimbs = function(slave) { @@ -23,7 +23,7 @@ globalThis.hasAnyNaturalLimbs = function(slave) { /** * True if slave has at least one prosthetic limb * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasAnyProstheticLimbs = function(slave) { @@ -33,7 +33,7 @@ globalThis.hasAnyProstheticLimbs = function(slave) { /** * True if slave has at least one leg * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasAnyLegs = function(slave) { @@ -43,7 +43,7 @@ globalThis.hasAnyLegs = function(slave) { /** * True if slave has at least one arm * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasAnyArms = function(slave) { @@ -53,7 +53,7 @@ globalThis.hasAnyArms = function(slave) { /** * True if slave has at least one leg that is natural * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasAnyNaturalLegs = function(slave) { @@ -63,7 +63,7 @@ globalThis.hasAnyNaturalLegs = function(slave) { /** * True if slave has at least one arm that is natural * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasAnyNaturalArms = function(slave) { @@ -73,7 +73,7 @@ globalThis.hasAnyNaturalArms = function(slave) { /** * True if slave has at least one leg that is prosthetic * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasAnyProstheticLegs = function(slave) { @@ -83,7 +83,7 @@ globalThis.hasAnyProstheticLegs = function(slave) { /** * True if slave has at least one arm that is prosthetic * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasAnyProstheticArms = function(slave) { @@ -93,7 +93,7 @@ globalThis.hasAnyProstheticArms = function(slave) { /** * True if slave has both legs * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasBothLegs = function(slave) { @@ -103,7 +103,7 @@ globalThis.hasBothLegs = function(slave) { /** * True if slave has both arms * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasBothArms = function(slave) { @@ -113,7 +113,7 @@ globalThis.hasBothArms = function(slave) { /** * True if slave has both legs and they are natural * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasBothNaturalLegs = function(slave) { @@ -123,7 +123,7 @@ globalThis.hasBothNaturalLegs = function(slave) { /** * True if slave has both arms and they are natural * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasBothNaturalArms = function(slave) { @@ -133,7 +133,7 @@ globalThis.hasBothNaturalArms = function(slave) { /** * True if slave has both arms and they are artificial * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasBothProstheticArms = function(slave) { @@ -143,7 +143,7 @@ globalThis.hasBothProstheticArms = function(slave) { /** * True if slave has both legs and they are artificial * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasBothProstheticLegs = function(slave) { @@ -153,7 +153,7 @@ globalThis.hasBothProstheticLegs = function(slave) { /** * True if slave has any limbs * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasAnyLimbs = function(slave) { @@ -163,7 +163,7 @@ globalThis.hasAnyLimbs = function(slave) { /** * True if slave has all limbs * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasAllLimbs = function(slave) { @@ -173,7 +173,7 @@ globalThis.hasAllLimbs = function(slave) { /** * True if slave has all limbs and all are natural * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasAllNaturalLimbs = function(slave) { @@ -183,7 +183,7 @@ globalThis.hasAllNaturalLimbs = function(slave) { /** * True if slave has left arm * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasLeftArm = function(slave) { @@ -193,7 +193,7 @@ globalThis.hasLeftArm = function(slave) { /** * True if slave has right arm * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasRightArm = function(slave) { @@ -203,7 +203,7 @@ globalThis.hasRightArm = function(slave) { /** * True if slave has left leg * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasLeftLeg = function(slave) { @@ -213,7 +213,7 @@ globalThis.hasLeftLeg = function(slave) { /** * True if slave has right leg * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {boolean} */ globalThis.hasRightLeg = function(slave) { @@ -223,7 +223,7 @@ globalThis.hasRightLeg = function(slave) { /** * Returns limb ID of the left arm. Uses new IDs. * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {number} */ globalThis.getLeftArmID = function(slave) { @@ -237,7 +237,7 @@ globalThis.getLeftArmID = function(slave) { /** * Returns limb ID of the right arm. Uses new IDs. * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {number} */ globalThis.getRightArmID = function(slave) { @@ -251,7 +251,7 @@ globalThis.getRightArmID = function(slave) { /** * Returns limb ID of the left leg. Uses new IDs. * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {number} */ globalThis.getLeftLegID = function(slave) { @@ -265,7 +265,7 @@ globalThis.getLeftLegID = function(slave) { /** * Returns limb ID of the right leg. Uses new IDs. * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @returns {number} */ globalThis.getRightLegID = function(slave) { @@ -324,7 +324,7 @@ globalThis.idToDescription = function(id) { * * No ID means all limbs = 101 * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @param {number} [id] * @returns {number} */ @@ -364,7 +364,7 @@ globalThis.getLimbCount = function(slave, id = 101) { /** * Returns count of specified leg type. Uses new limb IDs. * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @param {number} id * @returns {number} */ @@ -384,7 +384,7 @@ globalThis.getLegCount = function(slave, id) { /** * Returns count of specified arm type. Uses new limb IDs. * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @param {number} id * @returns {number} */ @@ -406,7 +406,7 @@ globalThis.getArmCount = function(slave, id) { * By default a variation of "arms and legs", but this can be changed via parameters. * Expects the slave to at least have one limb. * - * @param {App.Entity.SlaveState} slave + * @param {FC.LimbsState} slave * @param {string} [arms] * @param {string} [arm] * @param {string} [legs] diff --git a/src/js/statsChecker/statsChecker.js b/src/js/statsChecker/statsChecker.js index 1d6dc69f1a9..5982f0690fd 100644 --- a/src/js/statsChecker/statsChecker.js +++ b/src/js/statsChecker/statsChecker.js @@ -619,7 +619,7 @@ globalThis.isEliteBreeder = function(slave) { }; /** - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {boolean} */ globalThis.canGetPregnant = function(slave) { diff --git a/src/js/storyJS.js b/src/js/storyJS.js index f4b6d76ecdc..308b7503bd9 100644 --- a/src/js/storyJS.js +++ b/src/js/storyJS.js @@ -69,8 +69,8 @@ globalThis.filterInPlace = function(arr, callback, thisArg) { }; /** pregmod: are slave2's sperm compatible with slave1's eggs? - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave1 - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave2 + * @param {FC.HumanState} slave1 + * @param {FC.HumanState} slave2 * @returns {boolean} */ globalThis.canBreed = function(slave1, slave2) { @@ -83,8 +83,8 @@ globalThis.canBreed = function(slave1, slave2) { /** assuming slave1 is fertile, could slave2 impregnate slave1? * slave2 must have dick and balls with compatible sperm; * both slaves must not be in chastity; slave2 need not achieve erection - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave1 - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave2 + * @param {FC.HumanState} slave1 + * @param {FC.HumanState} slave2 * @returns {boolean} */ globalThis.canImpreg = function(slave1, slave2) { @@ -114,8 +114,8 @@ globalThis.canImpreg = function(slave1, slave2) { /** assuming slave1 is fertile, could slave2 impregnate slave1? * slave2 must have balls with compatible sperm; * a special function intended for tribbing scenes; - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave1 - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave2 + * @param {FC.HumanState} slave1 + * @param {FC.HumanState} slave2 * @returns {boolean} */ globalThis.canFemImpreg = function(slave1, slave2) { diff --git a/src/js/utilsDOM.js b/src/js/utilsDOM.js index e8b63d953cf..a904b1117d5 100644 --- a/src/js/utilsDOM.js +++ b/src/js/utilsDOM.js @@ -67,9 +67,10 @@ App.UI.DOM.assignmentLink = function(slave, assignment, passage, action, linkTex /** * Creates a markup for a SugarCube link which executes given function with given arguments * + * @template {function(...any):void} F * @param {string} linkText link text - * @param {function(...any):void} handler callable object - * @param {any|Array<any>} args arguments + * @param {F} handler callable object + * @param {Parameters<F>} [args] arguments * @param {string} [passage] the passage name to link to * @param {string} [tooltip] * @returns {HTMLAnchorElement} link in SC markup diff --git a/src/js/utilsSC.js b/src/js/utilsSC.js index ecf2ec5c071..baf505a24ab 100644 --- a/src/js/utilsSC.js +++ b/src/js/utilsSC.js @@ -69,11 +69,12 @@ App.UI.link = function() { /** * Creates a markup for a SugarCube link which executes given function with given arguments - * @template {Function} F + * @template {function(...any):void} F * @param {string} linkText link text * @param {F} handler callable object - * @param {Parameters<F>} args arguments + * @param {Parameters<F>} [args] arguments * @param {string} [passage] the passage name to link to + * @param {string} [tooltip] * @returns {string} link in SC markup */ function makeLink(linkText, handler, args = [], passage = '', tooltip = '') { diff --git a/src/markets/specificMarkets/customSlaveMarket.js b/src/markets/specificMarkets/customSlaveMarket.js index 3b83064f9f4..2a6c7ad6d3b 100644 --- a/src/markets/specificMarkets/customSlaveMarket.js +++ b/src/markets/specificMarkets/customSlaveMarket.js @@ -72,14 +72,14 @@ App.Markets["Custom Slave"] = function() { } else if (high > V.retirementAge) { const option = document.createElement("option"); option.text = `${low}+`; - option.value = low; + option.value = low.toString(); select.append(option); break; } const option = document.createElement("option"); option.text = `${low}-${high}`; - option.value = high; + option.value = high.toString(); if (slave.age === option.value) { option.selected = true; } diff --git a/src/npc/descriptions/belly/belly.js b/src/npc/descriptions/belly/belly.js index 2dd07baec9e..4d0e4ec15f9 100644 --- a/src/npc/descriptions/belly/belly.js +++ b/src/npc/descriptions/belly/belly.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.belly = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/belly/bellyImplant.js b/src/npc/descriptions/belly/bellyImplant.js index 01ff82c8a75..88a9154692e 100644 --- a/src/npc/descriptions/belly/bellyImplant.js +++ b/src/npc/descriptions/belly/bellyImplant.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.bellyImplant = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/belly/bellyInflation.js b/src/npc/descriptions/belly/bellyInflation.js index 623f8001e4a..516e8b3226e 100644 --- a/src/npc/descriptions/belly/bellyInflation.js +++ b/src/npc/descriptions/belly/bellyInflation.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.bellyInflation = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/boobs/boobs.js b/src/npc/descriptions/boobs/boobs.js index 7dc7dfeed9c..fa376797fdd 100644 --- a/src/npc/descriptions/boobs/boobs.js +++ b/src/npc/descriptions/boobs/boobs.js @@ -218,8 +218,8 @@ App.Desc.boobs = function() { /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number | string} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ function describe(slave, {market, eventDescription} = {}) { @@ -1441,8 +1441,8 @@ App.Desc.boobs = function() { /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.boobsExtra = function(slave, {market, eventDescription} = {}) { @@ -1636,8 +1636,8 @@ App.Desc.boobsExtra = function(slave, {market, eventDescription} = {}) { /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number | string} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.nipples = function(slave, {market, eventDescription} = {}) { @@ -1832,8 +1832,8 @@ App.Desc.nipples = function(slave, {market, eventDescription} = {}) { /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.areola = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/butt/anus.js b/src/npc/descriptions/butt/anus.js index 09988a307e1..901843c1d23 100644 --- a/src/npc/descriptions/butt/anus.js +++ b/src/npc/descriptions/butt/anus.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.anus = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/butt/butt.js b/src/npc/descriptions/butt/butt.js index 62314f515a7..53cc54a8b21 100644 --- a/src/npc/descriptions/butt/butt.js +++ b/src/npc/descriptions/butt/butt.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.butt = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/butt/buttplug.js b/src/npc/descriptions/butt/buttplug.js index a5414d79d19..bf8bfd502df 100644 --- a/src/npc/descriptions/butt/buttplug.js +++ b/src/npc/descriptions/butt/buttplug.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.buttplug = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/crotch/crotch.js b/src/npc/descriptions/crotch/crotch.js index 02c1596859d..73c21d99778 100644 --- a/src/npc/descriptions/crotch/crotch.js +++ b/src/npc/descriptions/crotch/crotch.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.crotch = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/crotch/dick.js b/src/npc/descriptions/crotch/dick.js index 670e9c3e552..69275681cd9 100644 --- a/src/npc/descriptions/crotch/dick.js +++ b/src/npc/descriptions/crotch/dick.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.dick = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/crotch/vagina.js b/src/npc/descriptions/crotch/vagina.js index 22886aa8c2f..bd8d936cf2f 100644 --- a/src/npc/descriptions/crotch/vagina.js +++ b/src/npc/descriptions/crotch/vagina.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.vagina = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/descriptionWidgets.js b/src/npc/descriptions/descriptionWidgets.js index 4a063e8da9c..6853a91f83a 100644 --- a/src/npc/descriptions/descriptionWidgets.js +++ b/src/npc/descriptions/descriptionWidgets.js @@ -63,7 +63,7 @@ App.Desc.makeup = function(slave) { /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] * @param {number} [params.eventDescription] * @returns {string} Slave's eyes */ diff --git a/src/npc/descriptions/eyes.js b/src/npc/descriptions/eyes.js index be99d013ef4..d2b8f17939f 100644 --- a/src/npc/descriptions/eyes.js +++ b/src/npc/descriptions/eyes.js @@ -2,7 +2,7 @@ * returned string fits in a sentence like this: * She has {return}. * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {string} */ App.Desc.eyesType = function(slave) { @@ -51,7 +51,7 @@ App.Desc.eyeTypeToString = function(type) { * Intentionally leaves out some information to make it flow nicer and have less grammatical restrictions. * Use App.Desc.eyesColorLong for a complete eye description. * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @param {string} [adj] * @param {string} [eye] * @param {string} [eyes] @@ -101,7 +101,7 @@ App.Desc.eyesColor = function(slave, adj = "", eye = "eye", eyes = "eyes", a = t * Returns a description of a given slave's eyes. * WARNING: Expects .,:;!? after the string, otherwise there might be grammatical errors! * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {string} */ App.Desc.eyesColorLong = function(slave) { @@ -208,7 +208,7 @@ App.Desc.eyesColorLong = function(slave) { * Prefer App.Desc.eyesColor if possible as it works reliably with only one eye. * Example where this is better: {return}-eyed gaze * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {string} Slave's eye color */ App.Desc.eyeColor = function(slave) { @@ -235,7 +235,7 @@ App.Desc.eyeColor = function(slave) { * returned string fits in a sentence like this: * She has {return}. * - * @param {App.Entity.SlaveState|App.Entity.PlayerState} slave + * @param {FC.HumanState} slave * @returns {string} */ App.Desc.eyesVision = function(slave) { diff --git a/src/npc/descriptions/heels.js b/src/npc/descriptions/heels.js index dd159688cb9..23b1a47a5c6 100644 --- a/src/npc/descriptions/heels.js +++ b/src/npc/descriptions/heels.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.heels = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/limbs.js b/src/npc/descriptions/limbs.js index 1d18a1c071b..e520c228261 100644 --- a/src/npc/descriptions/limbs.js +++ b/src/npc/descriptions/limbs.js @@ -41,7 +41,7 @@ App.Desc.limbChange = function() { /** * @param {App.Entity.SlaveState} slave - * @param {{}} oldLimbs + * @param {FC.LimbsState} oldLimbs * @param {string} returnTo * @returns {string} */ @@ -87,7 +87,7 @@ App.Desc.limbChange = function() { /** * @param {App.Entity.SlaveState} slave - * @param {{}} oldLimbs + * @param {FC.LimbsState} oldLimbs * @param {string} returnTo * @returns {string} */ @@ -237,7 +237,7 @@ App.Desc.limbChange = function() { /** * @param {App.Entity.SlaveState} slave - * @param {{}} oldLimbs + * @param {FC.LimbsState} oldLimbs * @param {string} returnTo * @returns {string} */ diff --git a/src/npc/descriptions/longSlave.js b/src/npc/descriptions/longSlave.js index 7d75b6a30e2..50c046a11c5 100644 --- a/src/npc/descriptions/longSlave.js +++ b/src/npc/descriptions/longSlave.js @@ -213,7 +213,7 @@ App.Desc.longSlave = function(slave = V.activeSlave, {market = 0, eventDescripti r.push(App.Desc.mind(slave, {market: market})); if (!market) { - if (eventDescription === 0) { + if (!eventDescription) { if (canSee(slave)) { if (slave.attrKnown === 1) { if ((slave.assignment !== "work in the dairy") || (V.dairyRestraintsSetting > 1)) { diff --git a/src/npc/descriptions/mind.js b/src/npc/descriptions/mind.js index 841e07912f9..db3a4f6894f 100644 --- a/src/npc/descriptions/mind.js +++ b/src/npc/descriptions/mind.js @@ -1,5 +1,8 @@ /** * @param {App.Entity.SlaveState} slave + * @param {object} params + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.mind = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/sceneIntro.js b/src/npc/descriptions/sceneIntro.js index 869674d018a..015ee8697e6 100644 --- a/src/npc/descriptions/sceneIntro.js +++ b/src/npc/descriptions/sceneIntro.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.sceneIntro = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/skin.js b/src/npc/descriptions/skin.js index ce7392890f5..b042181f1fc 100644 --- a/src/npc/descriptions/skin.js +++ b/src/npc/descriptions/skin.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number | string} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.skin = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/style/clothing.js b/src/npc/descriptions/style/clothing.js index b87c7f70461..97e5712d6fa 100644 --- a/src/npc/descriptions/style/clothing.js +++ b/src/npc/descriptions/style/clothing.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number | string} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.clothing = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/womb/pregnancy.js b/src/npc/descriptions/womb/pregnancy.js index 39f787d7a92..46642bde30b 100644 --- a/src/npc/descriptions/womb/pregnancy.js +++ b/src/npc/descriptions/womb/pregnancy.js @@ -1,8 +1,8 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number| string} [params.market] - * @param {number} [params.eventDescription] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] + * @param {boolean} [params.eventDescription] * @returns {string} */ App.Desc.pregnancy = function(slave, {market, eventDescription} = {}) { diff --git a/src/npc/descriptions/womb/superfetation.js b/src/npc/descriptions/womb/superfetation.js index 47e49d634bb..38538fec09b 100644 --- a/src/npc/descriptions/womb/superfetation.js +++ b/src/npc/descriptions/womb/superfetation.js @@ -1,7 +1,7 @@ /** * @param {App.Entity.SlaveState} slave * @param {object} params - * @param {number} [params.market] + * @param {FC.Zeroable<FC.SlaveMarketName>} [params.market] * @param {number} [params.eventDescription] * @returns {string} */ diff --git a/src/npc/generate/slaveGenerationJS.js b/src/npc/generate/slaveGenerationJS.js index ac8f4fe2ea5..adfa6f02920 100644 --- a/src/npc/generate/slaveGenerationJS.js +++ b/src/npc/generate/slaveGenerationJS.js @@ -31,7 +31,7 @@ globalThis.raceToNationality = function(slave) { * @param {string | object} nationality * @param {string | object} race * @param {boolean} male - * @param {undefined} [filter] Default: allow all + * @param {(name: string) => boolean} [filter] Default: allow all * @returns {string} */ globalThis.generateName = function(nationality, race, male, filter = _.stubTrue) { @@ -50,7 +50,7 @@ globalThis.generateName = function(nationality, race, male, filter = _.stubTrue) * @param {string | number} nationality * @param {any} race * @param {any} male - * @param {Function} [filter] Default: allow all + * @param {(name: string) => boolean} [filter] Default: allow all * @returns {string} */ globalThis.generateSurname = function(nationality, race, male, filter = _.stubTrue) { @@ -1578,7 +1578,7 @@ globalThis.applyAgeImplantOlder = function(slave) { /** * Determine whether a given market should apply SMR laws or not. - * @param {string} [market] + * @param {FC.Zeroable<FC.SlaveMarketName>} [market] * @returns {number} [1|0] */ diff --git a/src/npc/surgery/surgery.js b/src/npc/surgery/surgery.js index 7b13dac8462..611388f00dd 100644 --- a/src/npc/surgery/surgery.js +++ b/src/npc/surgery/surgery.js @@ -637,7 +637,7 @@ globalThis.surgeryAmp = function(slave, part) { }; /** - * @param {App.Entity.SlaveState} slave + * @param {FC.HumanState} slave * @param {string} side * @param {string} action */ @@ -721,7 +721,7 @@ globalThis.setEyeColor = function(slave, color, side = "both") { /** * Set all colors of the eye. * - * @param {App.Entity.SlaveState} slave + * @param {FC.HumanState} slave * @param {string} iris * @param {string} pupil * @param {string} sclera @@ -766,7 +766,7 @@ globalThis.setGeneticEyeColor = function(slave, color, heterochromia = false) { * Sets the eye color to the genetic color. * Takes heterochromia and albinism into account. * - * @param {App.Entity.SlaveState} slave + * @param {FC.HumanState} slave * @param {string} [side] */ globalThis.resetEyeColor = function(slave, side = "both") { diff --git a/src/player/js/PlayerState.js b/src/player/js/PlayerState.js index 4f3ad52d09a..df6db7a0388 100644 --- a/src/player/js/PlayerState.js +++ b/src/player/js/PlayerState.js @@ -2019,6 +2019,8 @@ App.Entity.PlayerState = class PlayerState { if (false) { // eslint-disable-line /** @type {string|undefined} */ this.customTitle = undefined; + /** @type {string|undefined} */ + this.customTitleLisp = undefined; /** @type {FC.PregnancyData | undefined} */ this.pregData = undefined; /** @type {App.Entity.Fetus[] | undefined} */ diff --git a/src/pregmod/managePersonalAffairs.tw b/src/pregmod/managePersonalAffairs.tw index 922e5d9ee74..91c652644ef 100644 --- a/src/pregmod/managePersonalAffairs.tw +++ b/src/pregmod/managePersonalAffairs.tw @@ -51,7 +51,7 @@ <<if $playerSurgery == 0>>[[Visit your plastic surgeon.|Elective Surgery][$playerSurgery = 4]]<<elseif $playerSurgery == 1>>Your favorite plastic surgeon is booked solid for the next week.<<else>>Your favorite plastic surgeon is booked solid for the next $playerSurgery weeks.<</if>> </div> - <<includeDOM App.Medicine.Modification.eyeSelector($PC, true)>> + <<includeDOM App.Medicine.Modification.eyeSelector($PC)>> <div> You have a selection of hair dyes available: @@ -688,4 +688,4 @@ <<if $propOutcome == 1 && $arcologies[0].FSRestart != "unset">> <h2>Elite Breeder Qualifications</h2> <p> <<print eliteBreedingExam()>> </p> -<</if>> \ No newline at end of file +<</if>> diff --git a/tsconfig.json b/tsconfig.json index 409eefbb428..15bd704fb06 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,7 +5,8 @@ "allowJs": true, "checkJs": true, "noEmit": true, - "target": "ESNext" + "target": "ESNext", + "noImplicitAny": false }, "include": [ "js/**/*.js", -- GitLab