From 31a5ed2440e82a4f343b7aeb9a6a7deb11fd550c Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Wed, 24 May 2023 06:59:09 +0200 Subject: [PATCH 1/5] minor changes to scenario --- CHANGELOG.md | 9 ++++++-- Common/Defs/Scenarios/Halamyr_Hive.xml | 17 ++++++++------- TODOS.md | 29 +++++++++++++------------- 3 files changed, 30 insertions(+), 25 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ff0057..df95576 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # 1.2 +**Since beta-1**: + +- Fix of icon-names (#36) +- Changes to the scenario (more building items, throne for start). Wealth is now at 12k, which is the same as crashlanded and lost tribe. + **Changes:** - Cocoon Weaver Gene @@ -50,8 +55,8 @@ I disabled the specific gender and the oviparious reproduction (when you have rj I recommend using alpha genes for the Hive-Playthroughs, as otherwise the Halamyr look a bit ... boring? But i don't want to add a bunch of cosmetic genes on top of things. -*And what the fuck is a halamyr?* Well I had to name my little ants somehow. But I didn't want to call them `myr` as I maybe want to make some TiTs xenotypes separately. -And I am aware that the TiTs-Myr work different than the things I built now. +*And what the fuck is a halamyr?* Well I had to name my little ants somehow. But I didn't want to call them `myr` as I maybe want to make some [TiTs](https://www.fenoxo.com/play-games/) xenotypes separately. +And I am aware that the TiTs-Myr work different than the things I made now. # 1.1.4 diff --git a/Common/Defs/Scenarios/Halamyr_Hive.xml b/Common/Defs/Scenarios/Halamyr_Hive.xml index 338a611..7bffe07 100644 --- a/Common/Defs/Scenarios/Halamyr_Hive.xml +++ b/Common/Defs/Scenarios/Halamyr_Hive.xml @@ -80,12 +80,12 @@
  • StartingThing_Defined Silver - 200 + 400
  • StartingThing_Defined Pemmican - 150 + 250
  • StartingThing_Defined @@ -102,15 +102,11 @@ MeleeWeapon_Club WoodLog
  • -
  • - StartingThing_Defined - MeleeWeapon_Knife - Jade -
  • StartingThing_Defined - Pila + Throne + Jade
  • StartingAnimal @@ -141,6 +137,11 @@ Jade 100
  • +
  • + ScatterThingsNearPlayerStart + Steel + 200 +
  • diff --git a/TODOS.md b/TODOS.md index cdd40a5..c28f2ac 100644 --- a/TODOS.md +++ b/TODOS.md @@ -20,11 +20,9 @@ Any help is very appreciated, even if it is just pointing me to existing similar **Cum-Drugs** eating cum has an effect similar to Go-Juice (including (separate?) addiction) -**Self-Fertilizing Eggs** Pawns fertilize eggs that are put inside them (with themselves as a parent) - **Death-Rest** until the pawn is cumflated. -**Alpha / Beta Genes** that you can only have one alpha, and the alpha makes mostly beta children (1:10). This might fit with the xenotypes below. As this is an RJW mod, this should also somewhat affect sex (e.g. betas cannot impregnate betas). +**STD Immunity** & maybe a potential to be carrier, but not suffer effects. ## Planned Xenotypes @@ -39,17 +37,6 @@ Any help is very appreciated, even if it is just pointing me to existing similar Can't help but think about Rexxar Porn now I am a bad person. -**Hive Mother:** - -- [X] Spawn the small scarabs -- [X] Fertilise Eggs inside her -- [X] Produce cocoons -- [] Maybe: Insert "dropped" Insect eggs -- [] Very fragile, no use except breeding -- [] Maybe: can only eat insect jelly -- [X] Should look like a nice green-yellow alien as we all know fuckable insects would look like. -- [X] There can only be one Hive Mother, some penalties if there are others. This could be implement with an "Alpha Gene" that gives heavy penalties when other Alpha exists. - ## Genes with Abilities and more Effects There were some suggestions on the Discord I saved them somewhere else. I am far away from making that work, but to have them here: @@ -62,4 +49,16 @@ There were some suggestions on the Discord I saved them somewhere else. I am far - Streamline Filenames / Names to either be LifeForce or Fertilin (e.g. `Hediffs_Fertilin.xml` but `Pawnkind_LifeForce.xml`). I think most things are called LifeForce. - Similar cleanup for the patches, and make a note what to find where in the patches -- Change Project structure to the 1.3, 1.4 Structure of other mods \ No newline at end of file +- Change Project structure to the 1.3, 1.4 Structure of other mods + +## Split: + +I plan to split this mod. +Namely, I want to make a + +1. base-mod (with genitalia and size genes, anything alternating all base stats) +2. bonus-mod, with Fertilin and other complex genes +3. xenotype-mod (only xenotypes + scenarios) +4. animal genes inheritance (Yes, bit of a meme that it was separate mod earlier) + +I first want to make a bit more content, and then I hope there will be a "breaking change" in RJW so I can also do a breaking change on top of that. \ No newline at end of file From b785ee518b6154d30d11b2913f1dc0db2747f663 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Sat, 3 Jun 2023 07:16:14 +0200 Subject: [PATCH 2/5] Typo in Settings --- Source/Settings/RJW_Genes_Settings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Settings/RJW_Genes_Settings.cs b/Source/Settings/RJW_Genes_Settings.cs index 71cf028..f6e2f83 100644 --- a/Source/Settings/RJW_Genes_Settings.cs +++ b/Source/Settings/RJW_Genes_Settings.cs @@ -17,7 +17,7 @@ namespace RJW_Genes listing_Standard.ColumnWidth = rect.width / 2.05f; listing_Standard.Begin(rect); listing_Standard.Gap(24f); - listing_Standard.Label("Fertlin-Gain from Animals" + ": " + + listing_Standard.Label("Fertilin-Gain from Animals" + ": " + Math.Round((double)(RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor * 100f), 0).ToString() + "%", -1f, "of fertilin gained (compared to human-baseline)."); RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor = listing_Standard.Slider(RJW_Genes_Settings.rjw_genes_fertilin_from_animals_factor, 0f, 3f); From 5159535400eba73c9ab4ed187ebbeec8f03f2738 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Sat, 3 Jun 2023 08:06:50 +0200 Subject: [PATCH 3/5] Hardened Incubator Up-Ticking - seems smooth and robust now --- Source/Genes/Hive/Genes/Gene_InsectIncubator.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Source/Genes/Hive/Genes/Gene_InsectIncubator.cs b/Source/Genes/Hive/Genes/Gene_InsectIncubator.cs index d102a8a..559ec2c 100644 --- a/Source/Genes/Hive/Genes/Gene_InsectIncubator.cs +++ b/Source/Genes/Hive/Genes/Gene_InsectIncubator.cs @@ -15,6 +15,8 @@ namespace RJW_Genes /// 1. Is it fertilized ? => tick it down "extra". /// 2. Is it not fertilized? => fertilize it with the Incubator as parent /// + /// To save performance, this gene fires (default) every 0.5h, which also means a slight delay until fertilization happens. + /// /// Important: The other half of the behavior for the gene (more egg-capacity) is in `Patch_InsectINcubator_PregnancyHelper`. /// public class Gene_InsectIncubator : Gene @@ -42,7 +44,8 @@ namespace RJW_Genes egg.Fertilize(pawn); if (RJW_Genes_Settings.rjw_genes_detailed_debug) ModLog.Message($"Gene_InsectIncubator: fertilized egg {egg} in {pawn}"); } - else if (egg.fertilized) + // DevNote: There is an issue with Eggs reaching too much gestation progress (>100%), which causes DownStream bugs. To avoid this, there are some extra checks in place. + else if (egg.fertilized && egg.GestationProgress <= .93) { egg.lastTick += TICK_INTERVAL; } From cfa6078c12c69998a7892e95b217e91be7853c21 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Sat, 3 Jun 2023 08:12:08 +0200 Subject: [PATCH 4/5] Tweaks to Halamyr XMLs --- Common/Defs/GeneDefs/Xenotype_Hive.xml | 10 ++++++---- Common/Defs/Scenarios/Halamyr_Hive.xml | 9 ++------- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/Common/Defs/GeneDefs/Xenotype_Hive.xml b/Common/Defs/GeneDefs/Xenotype_Hive.xml index 91f6023..7d8b31b 100644 --- a/Common/Defs/GeneDefs/Xenotype_Hive.xml +++ b/Common/Defs/GeneDefs/Xenotype_Hive.xml @@ -97,25 +97,27 @@ false 0.8 - The Halamyr breeders are the last backbone of the hive. Their special genes allow them to carry more eggs and hatch them faster, enabling a steady output of hivelings. To support their position in the hive, breeders spend most of their life in the queens cocoon, a task which they gladly accept. + The Halamyr breeders are the backbone of the hive. Their special genes allow them to carry more eggs and hatch them faster, enabling a steady output of hivelings. To support their position in the hive, breeders spend most of their life in the queens cocoon, a task which they gladly accept. Made for incubating Halamyr eggs, breeders spend most of their life in the queens cocoon.
  • AG_Spinnerets
  • AG_InsectBlood
  • AG_InsectJellyProduction
  • +
  • AG_FormicAntennas
  • +
  • Fertile
  • +
  • AG_FastGestation
  • FireTerror
  • VerySleepy
  • rjw_genes_bisexual
  • -
  • AG_BeeMandibles
  • Skin_DeepRed
  • AptitudeStrong_Social
  • -
  • rjw_genes_ovipositor_genitalia
  • -
  • rjw_genes_unbreakable
  • rjw_genes_drone
  • rjw_genes_female_only
  • rjw_genes_zealous_loyalty
  • rjw_genes_insectincubator
  • +
  • rjw_genes_zoophile
  • +
  • rjw_genes_no_vagina
  • diff --git a/Common/Defs/Scenarios/Halamyr_Hive.xml b/Common/Defs/Scenarios/Halamyr_Hive.xml index 7bffe07..0c9387a 100644 --- a/Common/Defs/Scenarios/Halamyr_Hive.xml +++ b/Common/Defs/Scenarios/Halamyr_Hive.xml @@ -47,7 +47,7 @@
  • Baseliner - 1 + 2
  • @@ -95,7 +95,7 @@
  • StartingThing_Defined MedicineHerbal - 20 + 30
  • StartingThing_Defined @@ -103,11 +103,6 @@ WoodLog
  • -
  • - StartingThing_Defined - Throne - Jade -
  • StartingAnimal Spelopede From 47a78073bfe0652f480dad7b39c4d53abbef7df8 Mon Sep 17 00:00:00 2001 From: Vegapnk Date: Sat, 3 Jun 2023 08:32:19 +0200 Subject: [PATCH 5/5] New Patch for Egg Births - undetected Queen Parents :/ --- ...Patch_InsectEggs_BirthBaby_SetHiveGenes.cs | 153 ++++++++++++++++++ Source/Rjw-Genes.csproj | 1 + 2 files changed, 154 insertions(+) create mode 100644 Source/Genes/Hive/Patches/Patch_InsectEggs_BirthBaby_SetHiveGenes.cs diff --git a/Source/Genes/Hive/Patches/Patch_InsectEggs_BirthBaby_SetHiveGenes.cs b/Source/Genes/Hive/Patches/Patch_InsectEggs_BirthBaby_SetHiveGenes.cs new file mode 100644 index 0000000..e65986e --- /dev/null +++ b/Source/Genes/Hive/Patches/Patch_InsectEggs_BirthBaby_SetHiveGenes.cs @@ -0,0 +1,153 @@ +using HarmonyLib; +using RimWorld; +using rjw; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace RJW_Genes +{ + /// + /// Patches the method `ProcessHumanLikeInsectEgg` from `Hediff_InsectEgg`. + /// + /// The 'ProcessHumanLikeInsectEgg' returns the finished baby, for which we alter the pawn according to our xenotypes. + /// + + [HarmonyPatch(typeof(Hediff_InsectEgg), "ProcessHumanLikeInsectEgg")] + public class Patch_InsectEgg_BirthBaby_SetHiveGenes + { + + + [HarmonyPostfix] + static void HandleHiveBasedInheritance(ref Thing __result) + { + + // Check: Was the born thing a pawn? + if (__result == null || !(__result is Pawn)) + { + if (RJW_Genes_Settings.rjw_genes_detailed_debug) ModLog.Message("There was a birth of something non-human - not entering logic for queen-drone-xenotype inheritance."); + return; + } + + Pawn pawn = (Pawn)__result; + + // Important: Not all pawns have mother/father. Some Pawns are born in Growth-Vats or born from mod. + bool hasQueenParent = TryFindParentQueenXenotype(pawn) != null; + bool hasDroneParent = TryFindParentDroneXenotype(pawn) != null; + + if (hasQueenParent) + { + if (RJW_Genes_Settings.rjw_genes_detailed_debug) ModLog.Message($"PostFix PregnancyUtility::ApplyBirthOutcome - Checking Hive Inheritance because {pawn} has a queen parent."); + + XenotypeDef queenDef = TryFindParentQueenXenotype(pawn); + HiveOffspringChanceDef hiveOffspringChanceDef = HiveUtility.LookupHiveInheritanceChances(queenDef); + + // Case 1: Mother is Queen, Father is something else. Produce Worker. + if (!hasDroneParent) + { + if (RJW_Genes_Settings.rjw_genes_detailed_debug) ModLog.Message($"{pawn} was born as a worker, as it did not have Drone Father ({100}% chance)"); + MakeWorker(pawn, queenDef); + } + // Case 2: Mother is Queen, Father is drone. Apply xenotype as per chance. + else + { + double roll = (new Random()).NextDouble(); + // Case 2.a: New Queen born + if (roll < hiveOffspringChanceDef.queenChance) + { + pawn.genes.SetXenotype(queenDef); + if (RJW_Genes_Settings.rjw_genes_detailed_debug) ModLog.Message($"{pawn} born as a new queen with xenotype {queenDef.defName} ({hiveOffspringChanceDef.queenChance * 100}% chance,rolled {roll})"); + // TODO: Make a letter ? + } + // Case 2.b: New Drone born + else if (roll < hiveOffspringChanceDef.droneChance + hiveOffspringChanceDef.queenChance) + { + XenotypeDef droneDef = TryFindParentDroneXenotype(pawn); + pawn.genes.SetXenotype(droneDef); + if (RJW_Genes_Settings.rjw_genes_detailed_debug) ModLog.Message($"{pawn} born as a new drone with xenotype {droneDef.defName} ({(hiveOffspringChanceDef.droneChance + hiveOffspringChanceDef.queenChance) * 100}% chance,rolled {roll}))"); + } + // Case 2.c: Worker + else { + if (RJW_Genes_Settings.rjw_genes_detailed_debug) ModLog.Message($"{pawn} born as a worker ({(hiveOffspringChanceDef.workerChance) * 100}% chance,rolled {roll}))"); + MakeWorker(pawn, queenDef); + } + } + } else + { + if (RJW_Genes_Settings.rjw_genes_detailed_debug) ModLog.Message("There was an egg-birth without a (detected) queen-parent"); + } + } + + /// + /// Turns a given pawn into a worker, by looking up the relevant genes as per queen. + /// + /// If the queen xenotype has no mapping, the "rjw_genes_default_worker_xenotype" are used instead. + /// The genes are added as endogenes, so the worker can still become a xenotype. + /// + /// The pawn for which the genes are added. + /// The xenotype of the queen, used for lookup. + private static void MakeWorker(Pawn pawnTobeWorker, XenotypeDef queenDef) + { + if (pawnTobeWorker == null) + return; + + var mappings = HiveUtility.GetQueenWorkerMappings(); + + var genes = mappings.TryGetValue(queenDef, HiveUtility.LookupDefaultWorkerGenes()); + + foreach (var gene in genes) + pawnTobeWorker.genes.AddGene(gene, false); + + } + + /// + /// Looks up if there is a Xenotype with Drone-Gene for the pawns parents. + /// This is to account that maybe father or mother are the drone (instead of hardcoding things for father). + /// If both are drones, the mothers is returned. + /// + /// The pawn for whichs parent the xenotypes is looked up. + /// The Drone-Xenotype of a parent or null. If both are drones, mothers are preferred. + private static XenotypeDef TryFindParentDroneXenotype(Pawn pawn) + { + if (pawn == null) + return null; + + var motherXenotype = HiveUtility.TryGetDroneXenotype(pawn.GetMother()); + var fatherXenotype = HiveUtility.TryGetDroneXenotype(pawn.GetFather()); + + if (motherXenotype != null) + return motherXenotype; + if (fatherXenotype != null) + return fatherXenotype; + + return null; + } + + + /// + /// Looks up if there is a Xenotype with Queen-Gene for the pawns parents. + /// This is to account that maybe father or mother are the queen (instead of hardcoding things for father). + /// If both are queens, the mothers is returned. + /// + /// The pawn for whichs parent the xenotypes is looked up. + /// The Queen-Xenotype of a parent or null. If both are queens, mothers are preferred. + private static XenotypeDef TryFindParentQueenXenotype(Pawn pawn) + { + if (pawn == null) + return null; + + var motherXenotype = HiveUtility.TryGetQueenXenotype(pawn.GetMother()); + var fatherXenotype = HiveUtility.TryGetQueenXenotype(pawn.GetFather()); + + if (motherXenotype != null) + return motherXenotype; + if (fatherXenotype != null) + return fatherXenotype; + + return null; + } + } +} diff --git a/Source/Rjw-Genes.csproj b/Source/Rjw-Genes.csproj index 21e7967..ff8360b 100644 --- a/Source/Rjw-Genes.csproj +++ b/Source/Rjw-Genes.csproj @@ -47,6 +47,7 @@ +