Last 1.3 changes

This commit is contained in:
amevarashi 2022-10-22 10:12:18 +05:00
parent 92e9569e63
commit a8218a852d
5 changed files with 21 additions and 52 deletions

View file

@ -3,28 +3,17 @@
<!-- Issues --> <!-- Issues -->
<IssueDef> <IssueDef>
<defName>Sex_Proselytizing</defName> <defName>SexProselytizing</defName>
<label>sex type</label> <label>sex type</label>
<iconPath>UI/Issues/Submissive</iconPath> <iconPath>UI/Issues/Submissive</iconPath>
</IssueDef> </IssueDef>
<!-- Currently does not work as intended!
<PreceptDef>
<defName>Proselyzing_By_Sex</defName>
<issue>Sex_Proselytizing</issue>
<label>Sexual Proselyzing</label>
<description>Sex converts both partners towards this ideology.</description>
<impact>Low</impact>
<displayOrderInIssue>40</displayOrderInIssue>
<displayOrderInImpact>300</displayOrderInImpact>
</PreceptDef>
-->
<PreceptDef> <PreceptDef>
<defName>Proselyzing_By_Orgasm</defName> <defName>ProselyzingByOrgasm</defName>
<issue>Sex_Proselytizing</issue> <issue>SexProselytizing</issue>
<label>Orgasm Proselyzing</label> <label>Sexual Proselyzing</label>
<description>Orgasms converts both partners towards this ideology.</description> <description>Giving orgasm converts partner towards this ideology.</description>
<impact>Low</impact> <impact>Medium</impact>
<displayOrderInIssue>50</displayOrderInIssue> <displayOrderInIssue>50</displayOrderInIssue>
<displayOrderInImpact>400</displayOrderInImpact> <displayOrderInImpact>400</displayOrderInImpact>
</PreceptDef> </PreceptDef>

View file

@ -49,7 +49,7 @@ namespace RJWSexperience.Ideology
// Option A: Partner has same Ideo as Pawn, increase certainty // Option A: Partner has same Ideo as Pawn, increase certainty
if (sameIdeo) if (sameIdeo)
{ {
pawn.ideo.OffsetCertainty(severity); partner.ideo.OffsetCertainty(severity);
} }
// Option B: Partner as different Ideo, try to convert // Option B: Partner as different Ideo, try to convert
else else

View file

@ -210,42 +210,23 @@ namespace RJWSexperience.Ideology.Patches
ideo = mother?.Ideo; ideo = mother?.Ideo;
return mother?.Faction ?? baby.Faction; return mother?.Faction ?? baby.Faction;
} }
}
[HarmonyPatch(typeof(JobDriver_Sex), "Roll_Orgasm_Duration_Reset")] [HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))]
public static class RJW_Patch_Orgasm_IdeoConversion public static class RJW_Patch_Orgasm_IdeoConversion
{
public static void Postfix(SexProps props)
{ {
public static void Postfix(JobDriver_Sex __instance) // ShortCuts: Exit Early if Pawn or Partner are null (can happen with Animals or Masturbation)
{ if (props.pawn != null && props.hasPartner())
// ShortCuts: Exit Early if Pawn or Partner are null (can happen with Animals or Masturbation) return;
// TODO: From my Tests, this does still invoke on masturbation
if (__instance.pawn == null || __instance.Partner == null)
return;
// Orgasm is called "all the time" - it exits early when the sex is still going.
// Hence, we hijack the "Roll_Orgasm_Duration_Reset" which is fired after the real orgasm happened
// But we have to check for one edge case, namely the function is also done when sex is initialized (which we catch by checking for orgasm > 0
if (__instance.orgasms <= 0) return;
if (__instance.Partner.Ideo.HasPrecept(VariousDefOf.Proselyzing_By_Orgasm)) if (props.partner.Ideo?.HasPrecept(VariousDefOf.ProselyzingByOrgasm) == true)
{ {
// Pawn is the one having the orgasm // Pawn is the one having the orgasm
// Partner is "giving" the orgasm, hence the pawn will be converted towards the partners ideology // Partner is "giving" the orgasm, hence the pawn will be converted towards the partners ideology
IdeoUtility.ConvertPawnBySex(__instance.pawn, __instance.Partner, 0.03f); IdeoUtility.ConvertPawnBySex(props.pawn, props.partner, 0.03f);
}
} }
} }
// TODO: This does not work as intended!
// Something is wrong with this, it's not called correctly.I expect this to be the wrong Harmony Patch Point
[HarmonyPatch(typeof(SexUtility), "Aftersex", new Type[] { typeof(SexProps) })]
public static class RJW_Patch_Aftersex_IdeoConversion
{
// This is not exactly where I should put it (Maybe after The JobDriver_Sex Finishes??)
public static void Postfix(SexProps props)
{
IdeoUtility.ConvertPawnBySex(props.pawn, props.partner, props.orgasms * 0.03f);
}
}
} }
} }

View file

@ -21,7 +21,6 @@ namespace RJWSexperience.Ideology
[MayRequireIdeology] public static readonly PreceptDef BabyFaction_AlwaysColony; [MayRequireIdeology] public static readonly PreceptDef BabyFaction_AlwaysColony;
[MayRequireIdeology] public static readonly PreceptDef Submissive_Male; [MayRequireIdeology] public static readonly PreceptDef Submissive_Male;
[MayRequireIdeology] public static readonly PreceptDef Submissive_Female; [MayRequireIdeology] public static readonly PreceptDef Submissive_Female;
[MayRequireIdeology] public static readonly PreceptDef Proselyzing_By_Orgasm; [MayRequireIdeology] public static readonly PreceptDef ProselyzingByOrgasm;
//[MayRequireIdeology] public static readonly PreceptDef Proselyzing_By_Sex;
} }
} }