From 208aa75b82e30872c096713f94cadb0316f51c2a Mon Sep 17 00:00:00 2001 From: Frankly George <franklygeorgy@gmail.com> Date: Sat, 29 Mar 2025 15:16:08 -0400 Subject: [PATCH 1/3] fix #5674 --- src/cheats/cheatEditActor.js | 127 ++++++++++++++++++++++--- src/js/wombJS.js | 9 -- src/npc/startingGirls/startingGirls.js | 10 +- 3 files changed, 116 insertions(+), 30 deletions(-) diff --git a/src/cheats/cheatEditActor.js b/src/cheats/cheatEditActor.js index bbbb1a6c394..d60f911f09d 100644 --- a/src/cheats/cheatEditActor.js +++ b/src/cheats/cheatEditActor.js @@ -84,14 +84,14 @@ App.UI.Cheat.cheatEditActor = function(actor) { tabBar.addTab("Family", "family", App.Intro.editFamily(actor, true)); } if (slave || citizen) { - tabBar.addTab("Body Mods", "body-mods", App.UI.bodyModification(actor, true)); + tabBar.addTab("Body Mods", "body-mods", App.UI.bodyModification(slave ?? citizen, true)); } if (player){ - tabBar.addTab("Salon", "salon", App.UI.playerSalon(actor, true)); + tabBar.addTab("Salon", "salon", App.UI.playerSalon(player, true)); } else if (!infant && !tankSlave) { tabBar.addTab("Salon", "salon", App.UI.salon(actor, true)); } - + if (V.seeExtreme) { tabBar.addTab("Extreme", "extreme", extreme()); } @@ -282,9 +282,9 @@ App.UI.Cheat.cheatEditActor = function(actor) { } if (slave) { - const origin = App.StartingGirls.playerOrigin(actor).preview; + const origin = App.StartingGirls.playerOrigin(slave).preview; options.addOption("Origin story", "origin", actor) - .customButton("Customize", () => App.StartingGirls.playerOrigin(actor).apply(), "") + .customButton("Customize", () => App.StartingGirls.playerOrigin(slave).apply(), "") .showTextBox() .addComment(origin === "" ? "No origin available" : pronounsForSlaveProp(actor, origin)); } @@ -1277,7 +1277,6 @@ App.UI.Cheat.cheatEditActor = function(actor) { option.showTextBox(); options.addOption("Births", "birthsTotal", actor.counter).showTextBox().addComment(`Absolute total number of births, not just in current game.`); - options.addOption("Number of babies", "pregType", actor).showTextBox(); if (V.seeHyperPreg && V.seeExtreme && actor.broodmother === 1) { options.addOption("Babies produced per week", "broodmotherFetuses", actor).showTextBox(); } @@ -1309,14 +1308,9 @@ App.UI.Cheat.cheatEditActor = function(actor) { ]); } } + App.Interact.ActorEdit.fetusFatherSelector(actor, options, cheat); + App.Interact.ActorEdit.fetusCount(actor, options); - if (actor.preg > 0) { - option = options.addOption("Father of child", "pregSource", actor); - if (canBreed(V.PC, actor)) { - option.addValueList([["Your child", -1], ["Not yours", 0]]); - } - option.showTextBox().addComment("Use slave's ID"); - } options.addOption("Breeding mark", "breedingMark", actor) .addValue("No", 0).off() .addValue("Yes", 1).on(); @@ -2297,3 +2291,110 @@ App.UI.Cheat.cheatEditActor = function(actor) { } } }; + +// TODO: move code shared by starting player editor, starting girls editor, and/or the cheat actor editor to here +App.Interact.ActorEdit = {}; + +/** + * @param {FC.HumanState} actor + * @param {InstanceType<App.UI.OptionsGroup>} options + */ +App.Interact.ActorEdit.fetusCount = (actor, options) => { + options.addOption("Number of babies in their womb", "a", {a: actor.pregType}) + .showTextBox() + .addGlobalCallback((count) => { + let change = count - actor.pregType; + actor.pregType = count; + if (change > 0) { + WombImpregnate(actor, change, actor.pregSource, 0); + } else if (change < 0) { + while (change < 0) { + change++; + WombRemoveFetus(actor, actor.womb.length -1); + } + } + }).addComment(`Setting this number to less than it already is will remove fetuses.`); +}; + +/** + * @param {FC.HumanState} actor + * @param {InstanceType<App.UI.OptionsGroup>} options + * @param {boolean} [cheat] + */ +App.Interact.ActorEdit.fetusFatherSelector = (actor, options, cheat=(V.cheatMode === 1)) => { + let option; + if (actor.preg > 0) { + // pregSource + option = options.addOption(`Set the father of their future child${actor.womb.length > 1 ? "ren" : ""} to`, "a", {a: actor.pregSource}); + if (canBreed(V.PC, actor)) { + option.addValue(`Yourself`, V.PC.ID); + } + if (canBreed(actor, actor)) { + option.addValue(`Themself`, actor.ID); + } + option.addValueList([ + ["An unknown source", 0], + ["Another arcology's owner", -4], + ["A citizen", -2], + ["An unknown rapist", -10], + ]); + if (isPCCareerInCategory("servant")) { + option.addValue("Your former master", -3); + } + if (isPCCareerInCategory("escort")) { + option.addValue("One of your clients", -5); + } + getSlaves().forEach((s) => { + if (s.ID !== actor.ID && canBreed(s, actor)) { + option.addValue(SlaveFullName(s), s.ID); + } + }); + option.pulldown(); + option.addGlobalCallback( + /** @param {FC.HumanID} fatherID */ + (fatherID) => { + actor.pregSource = fatherID; + } + ); + if (cheat) { + option.showTextBox(); + } + + // existing children + option = options.addOption(`Set the father of their existing child${actor.womb.length > 1 ? "ren" : ""} to`, "a", {a: -10532052305}); + option.addValue(`Don't change`, -10532052305); + if (canBreed(V.PC, actor)) { + option.addValue(`Yourself`, V.PC.ID); + } + if (canBreed(actor, actor)) { + option.addValue(`Themself`, actor.ID); + } + option.addValueList([ + ["An unknown source", 0], + ["Another arcology's owner", -4], + ["A citizen", -2], + ["An unknown rapist", -10], + ]); + if (isPCCareerInCategory("servant")) { + option.addValue("Your former master", -3); + } + if (isPCCareerInCategory("escort")) { + option.addValue("One of your clients", -5); + } + getSlaves().forEach((s) => { + if (s.ID !== actor.ID && canBreed(s, actor)) { + option.addValue(SlaveFullName(s), s.ID); + } + }); + option.pulldown(); + option.addGlobalCallback( + /** @param {FC.HumanID} fatherID */ + (fatherID) => { + WombForceFatherID(actor, fatherID); + } + ); + if (cheat) { + option.showTextBox(); + } + } +}; diff --git a/src/js/wombJS.js b/src/js/wombJS.js index 4f2225c6172..be442400203 100644 --- a/src/js/wombJS.js +++ b/src/js/wombJS.js @@ -526,10 +526,6 @@ globalThis.WombNormalizePreg = function(mother) { mother.preg = 0.1; } - if (mother.pregSource !== 0) { - mother.pregSource = 0; - } - if (mother.pregWeek > 0) { mother.pregWeek = 0; } @@ -558,7 +554,6 @@ globalThis.WombNormalizePreg = function(mother) { } mother.pregType = mother.womb.length; - mother.pregSource = mother.womb[0].fatherID; } else if (mother.womb.length === 0 && mother.broodmother < 1) { // not broodmother // console.log("preg fixing"); @@ -569,10 +564,6 @@ globalThis.WombNormalizePreg = function(mother) { mother.preg = 0; } - if (mother.pregSource !== 0) { - mother.pregSource = 0; - } - // We can't properly set postpartum here, // but can normalize obvious error with forgotten property. if (mother.pregWeek > 0) { diff --git a/src/npc/startingGirls/startingGirls.js b/src/npc/startingGirls/startingGirls.js index 2f8d9e377f7..32afd187863 100644 --- a/src/npc/startingGirls/startingGirls.js +++ b/src/npc/startingGirls/startingGirls.js @@ -1648,14 +1648,8 @@ App.StartingGirls.lower = function(slave, cheat = false) { ["Asexual", "asexual"], ]); } - - option = options.addOption("Father of child", "pregSource", slave); - if (V.PC.dick > 0 && slave.preg > 0) { - option.addValueList([["Your child", -1], ["Not yours", 0]]); - } - if (cheat) { - option.showTextBox().addComment("Use slave's ID"); - } + App.Interact.ActorEdit.fetusFatherSelector(slave, options, cheat); + App.Interact.ActorEdit.fetusCount(slave, options); } if (V.seeDicks !== 0 || V.makeDicks === 1) { -- GitLab From 41a11b9b30e1f7409ffda50e2257298a94c6f61b Mon Sep 17 00:00:00 2001 From: Frankly George <franklygeorgy@gmail.com> Date: Sat, 29 Mar 2025 15:19:15 -0400 Subject: [PATCH 2/3] cleanup --- src/cheats/cheatEditActor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cheats/cheatEditActor.js b/src/cheats/cheatEditActor.js index d60f911f09d..fac6b9e34b7 100644 --- a/src/cheats/cheatEditActor.js +++ b/src/cheats/cheatEditActor.js @@ -2325,7 +2325,7 @@ App.Interact.ActorEdit.fetusFatherSelector = (actor, options, cheat=(V.cheatMode let option; if (actor.preg > 0) { // pregSource - option = options.addOption(`Set the father of their future child${actor.womb.length > 1 ? "ren" : ""} to`, "a", {a: actor.pregSource}); + option = options.addOption(`Set the father of their future children to`, "a", {a: actor.pregSource}); if (canBreed(V.PC, actor)) { option.addValue(`Yourself`, V.PC.ID); } -- GitLab From 27afa440d10aac3cc5a962ec0b61adf43e63e700 Mon Sep 17 00:00:00 2001 From: Frankly George <franklygeorgy@gmail.com> Date: Sat, 29 Mar 2025 15:30:06 -0400 Subject: [PATCH 3/3] added missing gate --- src/cheats/cheatEditActor.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/cheats/cheatEditActor.js b/src/cheats/cheatEditActor.js index fac6b9e34b7..fc7e13ee63d 100644 --- a/src/cheats/cheatEditActor.js +++ b/src/cheats/cheatEditActor.js @@ -2300,20 +2300,22 @@ App.Interact.ActorEdit = {}; * @param {InstanceType<App.UI.OptionsGroup>} options */ App.Interact.ActorEdit.fetusCount = (actor, options) => { - options.addOption("Number of babies in their womb", "a", {a: actor.pregType}) - .showTextBox() - .addGlobalCallback((count) => { - let change = count - actor.pregType; - actor.pregType = count; - if (change > 0) { - WombImpregnate(actor, change, actor.pregSource, 0); - } else if (change < 0) { - while (change < 0) { - change++; - WombRemoveFetus(actor, actor.womb.length -1); + if (actor.preg > 0) { + options.addOption("Number of babies in their womb", "a", {a: actor.pregType}) + .showTextBox() + .addGlobalCallback((count) => { + let change = count - actor.pregType; + actor.pregType = count; + if (change > 0) { + WombImpregnate(actor, change, actor.pregSource, 0); + } else if (change < 0) { + while (change < 0) { + change++; + WombRemoveFetus(actor, actor.womb.length -1); + } } - } - }).addComment(`Setting this number to less than it already is will remove fetuses.`); + }).addComment(`Setting this number to less than it already is will remove fetuses.`); + } }; /** -- GitLab