vegapnk / RJW-Genes

Rimworld Biotech Genes related to RJW
MIT License
33 stars 35 forks source link

Eating Cum does not Increase Fertilin #41

Closed vegapnk closed 1 year ago

vegapnk commented 1 year ago

I got 2 reports on Discord that eating the Sexperience Cum does not increase Fertilin. This was reportedly v1.1.4 and v.1.2-beta2

Also, I got the following trace:

Exception in rjw.ThinkNode_ConditionalSexChecks TryIssueJobPackage: System.InvalidOperationException: Sequence contains no matching element
  at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00011] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 
  at RJW_Genes.JobGiver_GetLifeForce.TryGiveJob (Verse.Pawn pawn) [0x0005a] in <958aef1980a941a7ab5875b00fade900>:0 
  at Verse.AI.ThinkNode_JobGiver.TryIssueJobPackage (Verse.Pawn pawn, Verse.AI.JobIssueParams jobParams) [0x00000] in <badc476ef0d446b498e5b20480e435f8>:0 
  at Verse.AI.ThinkNode_Priority.TryIssueJobPackage (Verse.Pawn pawn, Verse.AI.JobIssueParams jobParams) [0x00022] in <badc476ef0d446b498e5b20480e435f8>:0 
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Verse.Log:Error (string)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_Conditional:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_Conditional:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_SubtreesByTag:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.ThinkNode_Priority:TryIssueJobPackage (Verse.Pawn,Verse.AI.JobIssueParams)
Verse.AI.Pawn_JobTracker:DetermineNextJob (Verse.ThinkTreeDef&)
Verse.AI.Pawn_JobTracker:TryFindAndStartJob ()
Verse.AI.Pawn_JobTracker:EndCurrentJob (Verse.AI.JobCondition,bool,bool)
Verse.AI.Pawn_JobTracker:JobTrackerTick ()
(wrapper dynamic-method) Verse.Pawn:Verse.Pawn.Tick_Patch1 (Verse.Pawn)
Verse.TickList:Tick ()
Verse.TickManager:DoSingleTick ()
Verse.TickManager:TickManagerUpdate ()
Verse.Game:UpdatePlay ()
Verse.Root_Play:Update ()

My code shows up in there but not sure how related this is.

Also, not sure how much #39 is related, but I think not too much.

vegapnk commented 1 year ago

According to some Discord Discussion, this is the likely conflict: https://www.loverslab.com/topic/193448-mod-rjw-sexperience-continued/page/3/#comment-3912678

I think because it also patches an Ingestion-Outcome-Doer:

<?xml version="1.0" encoding="utf-8" ?>
<Patch>
    <Operation Class="PatchOperationFindMod">
        <mods>
            <li>RJW Sexperience</li>
        </mods>
        <match Class="PatchOperationRemove">
            <xpath>/Defs/ChemicalDef[defName="Cum"]/generateAddictionGenes</xpath>
        </match>
    </Operation>

    <Operation Class="PatchOperationFindMod">
        <mods>
            <li>RJW Sexperience</li>
        </mods>
        <match Class="PatchOperationReplace">
            <xpath>/Defs/ThingDef[defName="GatheredCum"]</xpath>
            <value>

<ThingDef Name="GatheredCum" ParentName="DrugBase">
        <defName>GatheredCum</defName>
        <label>cum</label>
        <description>Gathered cum.</description>
        <thingCategories>
            <li>AnimalProductRaw</li>
        </thingCategories>
        <graphicData>
            <texPath>Things/Item/GatheredCum</texPath>
            <drawSize>1</drawSize>
            <graphicClass>Graphic_StackCount</graphicClass>
        </graphicData>
        <socialPropernessMatters>true</socialPropernessMatters>
        <statBases>
            <MarketValue>0.1</MarketValue>
            <Mass>0.1</Mass>
            <Nutrition>0.01</Nutrition>
            <Beauty>-5</Beauty>
            <Cleanliness>-1</Cleanliness>
            <FoodPoisonChanceFixedHuman>0.00</FoodPoisonChanceFixedHuman>
            <DeteriorationRate>60</DeteriorationRate>
            <Flammability>0.1</Flammability>
        </statBases>
        <ingestible>
            <foodType>Fluid, AnimalProduct</foodType>
            <preferability>DesperateOnlyForHumanlikes</preferability>
            <drugCategory>Any</drugCategory>
            <tasteThought>AteCum</tasteThought>
            <specialThoughtAsIngredient>AteCum</specialThoughtAsIngredient>
            <optimalityOffsetHumanlikes>-10</optimalityOffsetHumanlikes>
            <optimalityOffsetFeedingAnimals>-10</optimalityOffsetFeedingAnimals>
            <outcomeDoers>
                <li Class="IngestionOutcomeDoer_GiveHediff">
                    <hediffDef>CumTolerance</hediffDef>
                    <severity>0.032</severity>
                    <divideByBodySize>true</divideByBodySize>
                </li>
                <li Class="IngestionOutcomeDoer_OffsetPsyfocus">
                    <offset>0.05</offset>
                </li>
                <li Class="RJWSexperience.Cum.IngestionOutcomeDoer_RecordEatenCum"/>
            </outcomeDoers>
        </ingestible>
        <ingredient>
            <mergeCompatibilityTags>
                <li MayRequire="Ludeon.RimWorld.Ideology">GatheredCum</li>
            </mergeCompatibilityTags>
        </ingredient>
        <comps>
            <li Class="CompProperties_Drug">
                <chemical>Cum</chemical>
                <addictiveness>0.050</addictiveness>
                <minToleranceToAddict>0.8</minToleranceToAddict>
                <existingAddictionSeverityOffset>0.1</existingAddictionSeverityOffset>
                <needLevelOffset>1</needLevelOffset>
                <listOrder>30</listOrder>
            </li>
        </comps>
    </ThingDef>

            </value>
        </match>
    </Operation>

    <Operation Class="PatchOperationFindMod">
        <mods>
            <li>RJW Sexperience</li>
        </mods>
        <match Class="PatchOperationAdd">
            <xpath>/Defs/ChemicalDef[defName="Cum"]</xpath>
                <value>
                    <generateAddictionGenes>true</generateAddictionGenes>
                </value>
        </match>
    </Operation>

</Patch>