vegapnk / RJW-Genes

Rimworld Biotech Genes related to RJW
MIT License
34 stars 38 forks source link

Animal Genes for Menstruation Eggs #67

Open vegapnk opened 1 year ago

vegapnk commented 1 year ago

I got a report that menstruation eggs do not fully work with the Animal Gene Inheritance.

Original chat:

H> Something odd going on in regards the biotech multi preg setting. 
Also @Vegapnk Something strange happening with animal gene inheritance. 
Its throwing an error dunno if I messed something up with the genedef for them and Im not sure if its because its a kyulen 
or because its paired with menstruation. 
When the child was born it had the kyulen race genes but didn't inherit the human 
fathers genes this doesn't appear to happen with other animals. 
Specifically i've had anima fox and house maid neko produce mixed gene types just fine.
[...]
So the first baby has completely broken genes
The other 3 [kyulen] babies that get added after all inherited the fathers genes and not the animals
V> for menstruation pregnancy (which is what you get when the mother is an animal), 
menstruation simply calls PregnancyUtility.GetInheritedGenes(father, mother), 
a vanilla function, to determine the baby's genes 
H> Yea so now I think the problem is on vega's end on to figure out how to apply the inheritance to every egg.
Also need to figure out why genital type isn't being applied by genes on birth
It worked when inherited from kyulen but not when inherited from human 

image image image image

Racedef:

<Defs>
<RJW_BGS.RaceGeneDef>
<defName>NinetailedFox</defName>
<!--
defName can be anything you want, as long as it is unique 
-->
<raceGroup>Ninetail_Group</raceGroup>
<!--
RJW.Racegroupdef, all animals in the raceGroup will be part of this group, RJW race support uses this so those can be used to quickly add a group 
-->
<raceNames>
<li>Ninetailfox</li>
<li>Ninetailfoxwt</li>
</raceNames>
<!--
For more direct control you can use raceNames directly. Use the defName of the animal. Can also use modded animals.
-->
<!--

        <pawnKindNames>
            <li> </li>
        </pawnKindNames>
        For even more direct control you can use pawnKindNames. 

        The RaceGeneDef for an animal will first be decided by if it is in the pawnkindNames, after that racenames and lastly racegroup,
        so if there is for a wolf a RaceGeneDef with the canine group and a second which has wolf under raceNames it will always use the second one to determine
        which genes can be inherited

-->
<genes>
<li>
<defName>Kyulen_Trait</defName>
<chance>1</chance>
</li>
<li>
<defName>AFU_BA_NineTailedFox</defName>
<chance>1</chance>
</li>
<li>
<defName>AFU_HA_FoxEar</defName>
<chance>1</chance>
</li>
<li>
<defName>StrongStomach</defName>
<chance>1</chance>
</li>
<li>
<defName>MoveSpeed_Quick</defName>
<chance>1</chance>
</li>
<li>
<defName>rjw_genes_big_breasts</defName>
<chance>1</chance>
</li>
<li>
<defName>rjw_genes_evergrowth</defName>
<chance>1</chance>
</li>
<li>
<defName>rjw_genes_canine_genitalia</defName>
<chance>1</chance>
</li>
<li>
<defName>rjw_genes_female_only</defName>
<chance>1</chance>
</li>
<li>
<defName>rjw_genes_extra_breasts</defName>
<chance>1</chance>
</li>
<!--
<li>
                <defName>rjw_genes_lifeforce_empath</defName>
                <chance>1</chance>
            </li>
            <li>
                <defName>rjw_genes_pussyhealing</defName>
                <chance>1</chance>
            </li> 
-->
</genes>
<!--
The genes which may be inherited. Use the defName of the gene, you can also add modded genes. 
-->
<!--
WIP, the chance of each gene to be inherited. Is in same order as genes, so for the second gene the chance to inherit is based on the second line in geweights. 
-->
</RJW_BGS.RaceGeneDef>
</Defs>
vegapnk commented 1 year ago

I got another error regarding this:

Error creating pregnancy in Nightmare's womb, father Campos: System.NullReferenceException: Object reference not set to an instance of an object
  at RJW_BGS.RaceGeneDef_Helper.ValidRaceGeneDefs (Verse.Pawn pawn) [0x0007f] in <60ac45948c154fe6924434a0fe654285>:0 
  at RJW_BGS.RaceGeneDef_Helper.GetRaceGeneDefInternal (Verse.Pawn pawn) [0x00000] in <60ac45948c154fe6924434a0fe654285>:0 
  at RJW_BGS.InheritanceUtility.SelectGenes (Verse.Pawn pawn) [0x00006] in <60ac45948c154fe6924434a0fe654285>:0 
  at RJW_BGS.InheritanceUtility.AnimalInheritedGenes (Verse.Pawn father, Verse.Pawn mother) [0x000b8] in <60ac45948c154fe6924434a0fe654285>:0 
  at RJW_BGS.Patch_RJW_BestialityPregnancyUtility.AddGenes (Verse.Pawn mother, Verse.Pawn dad, rjw.Hediff_BasePregnancy& __instance) [0x0008c] in <60ac45948c154fe6924434a0fe654285>:0 
  at (wrapper dynamic-method) rjw.Hediff_BasePregnancy.rjw.Hediff_BasePregnancy.Initialize_Patch1(rjw.Hediff_BasePregnancy,Verse.Pawn,Verse.Pawn,rjw.Hediff_BasePregnancy/DnaGivingParent)
  at rjw.Hediff_BasePregnancy.Create[T] (Verse.Pawn mother, Verse.Pawn father, rjw.Hediff_BasePregnancy+DnaGivingParent dnaGivingParent) [0x000ac] in <e70496b985674ea2bc0c6d308d5fad5e>:0 
  at rjw.Hediff_BasePregnancy.Create[T] (Verse.Pawn mother, Verse.Pawn father) [0x00009] in <e70496b985674ea2bc0c6d308d5fad5e>:0 
  at (wrapper dynamic-method) RJW_Menstruation.HediffComp_Menstruation.RJW_Menstruation.HediffComp_Menstruation.Implant_Patch0(RJW_Menstruation.HediffComp_Menstruation)
UnityEngine.StackTraceUtility:ExtractStackTrace ()
(wrapper dynamic-method) Verse.Log:Verse.Log.Error_Patch4 (string)
(wrapper dynamic-method) RJW_Menstruation.HediffComp_Menstruation:RJW_Menstruation.HediffComp_Menstruation.Implant_Patch0 (RJW_Menstruation.HediffComp_Menstruation)
RJW_Menstruation.HediffComp_Menstruation:LutealAction ()
RJW_Menstruation.HediffComp_PeriodicOvulator:LutealAction ()
(wrapper dynamic-method) RJW_Menstruation.HediffComp_Menstruation:RJW_Menstruation.HediffComp_Menstruation.CompPostTick_Patch0 (RJW_Menstruation.HediffComp_Menstruation,single&)
Verse.HediffWithComps:PostTick ()
(wrapper dynamic-method) Verse.Pawn_HealthTracker:Verse.Pawn_HealthTracker.HealthTick_Patch0 (Verse.Pawn_HealthTracker)
(wrapper dynamic-method) Verse.Pawn:Verse.Pawn.Tick_Patch2 (Verse.Pawn)
HardworkingNinetail.Ninetail:Tick ()
Verse.TickList:Tick ()
(wrapper dynamic-method) Verse.TickManager:Verse.TickManager.DoSingleTick_Patch3 (Verse.TickManager)
Verse.TickManager:TickManagerUpdate ()
(wrapper dynamic-method) Verse.Game:Verse.Game.UpdatePlay_Patch2 (Verse.Game)
Verse.Root_Play:Update ()
Hawkeye32 commented 7 months ago

Not sure if I ever mentioned it but the reason this wasn't working ending up having to do with race support not being configured properly for the animal. It didn't have a base animal to inherit from so it was failing. Once I added Kyulen to the canine group they worked properly.

Just thought I'd mention it in case I hadn't.

vegapnk commented 2 months ago

Then I will close this for now ... this seems to be more of a XML-Needs-To-Be-Complete thing on a race-by-race-basis. Let's keep a note about this here and somewhere else and if someone comes around with the same issue we look here.

vegapnk commented 4 weeks ago

Reopened because the issue seems to persist; This time with less "niche" things than the multi egg pregnancy.

grafik

all of those traits are gene given
mother is a boomalope
boomalopes don't have a defined racegendef
I'm not sure why only some of the traits are being inherited I guess brawler and tough can't be passed down but the rest can?
I think because its set to inherit via rjw preg
This is the father

grafik grafik

Suggestion by Hawk:

I think the easiest solution to this would be to have a null check for not  having a racegenedef and default to human parents xenotype if none exists.

I am not 100% sure what is going on, but I believe it's because of menstruations animal pregnancy. The argument about missing race-defs is sound, but I believe this can't really be the issue.

The Animal Genes are just added on top of a normal birth, they do not "remove" anything.

Here Humanlike Babies get an empty set of genes, but I am not sure if thats it. Also I don't see why it would ever not have the xenotype name then. The HumanMother Pregnancy Also just adds on top.

vegapnk commented 3 weeks ago

I got more feedback:

So follow up. This is without any gene mods except yours using base rjw pregnancy. Birthed five babies in total two sets of twins and 1 single. Debug log was from the last set of twins. Based on debug messages it might be that not having a defined set of genes just causes rjw to error out when trying to apply genes. But as expected when its more than one child the first seems to get the error and the rest end up inheriting genes just fine. They do end up as baseliners though.

These are the first batch of screenshots provided for this: b7 b6 b5 b2 b4 b3

Some more:

With a 2 baby birth using menstruation this time. One baby born without genes or xenotype one born with genes. Born as baseliner. This time an error did occur. So the error is from whatever is happening between rjw-genes and menstruation. The end results however are the same regardless of menstruations presence. 

With the following screenshots:

b8 b11 b10 b9