mirror of
				https://gitgud.io/amevarashi/rjw-sexperience-ideology.git
				synced 2024-08-15 00:43:19 +00:00 
			
		
		
		
	Added a draft for proselyzing by sex
This commit is contained in:
		
							parent
							
								
									4af1890a0e
								
							
						
					
					
						commit
						05e9c5d273
					
				
					 4 changed files with 94 additions and 0 deletions
				
			
		
							
								
								
									
										32
									
								
								1.3/Defs/PreceptDefs/Precepts_SexProselytizing.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								1.3/Defs/PreceptDefs/Precepts_SexProselytizing.xml
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,32 @@
 | 
				
			||||||
 | 
					<?xml version="1.0" encoding="utf-8" ?>
 | 
				
			||||||
 | 
					<Defs>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  <!-- Issues -->
 | 
				
			||||||
 | 
					  <IssueDef>
 | 
				
			||||||
 | 
					    <defName>Sex_Proselytizing</defName>
 | 
				
			||||||
 | 
					    <label>sex type</label>
 | 
				
			||||||
 | 
					    <iconPath>UI/Issues/Submissive</iconPath>
 | 
				
			||||||
 | 
					  </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>
 | 
				
			||||||
 | 
					    <defName>Proselyzing_By_Orgasm</defName>
 | 
				
			||||||
 | 
					    <issue>Sex_Proselytizing</issue>
 | 
				
			||||||
 | 
					    <label>Orgasm Proselyzing</label>
 | 
				
			||||||
 | 
					    <description>Orgasms converts both partners towards this ideology.</description>
 | 
				
			||||||
 | 
					    <impact>Low</impact>
 | 
				
			||||||
 | 
					    <displayOrderInIssue>50</displayOrderInIssue>
 | 
				
			||||||
 | 
					    <displayOrderInImpact>400</displayOrderInImpact>
 | 
				
			||||||
 | 
					  </PreceptDef>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					</Defs>
 | 
				
			||||||
| 
						 | 
					@ -34,6 +34,26 @@ namespace RJWSexperience.Ideology
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			return finalMultiplier;
 | 
								return finalMultiplier;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							internal static void ConvertPawnBySex(Pawn pawn, Pawn partner, float severity = 0.01f)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								// Important Note: This is called on "orgasm" - hence when a pawn has the orgasm he is the "pawn" here.
 | 
				
			||||||
 | 
								// If Bob fucks Alice, Alice has the orgasm and Alice is the Pawn while Bob is the Partner.
 | 
				
			||||||
 | 
								// Hence, the Conversion happens from Partner -> Pawn and not the other way round!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// Short Circuit: Either pawn is null, exit early and do nothing
 | 
				
			||||||
 | 
								if (pawn == null || partner == null) return;
 | 
				
			||||||
 | 
								bool sameIdeo = pawn.Ideo == partner.Ideo;
 | 
				
			||||||
 | 
								// Option A: Partner has same Ideo as Pawn, increase certainty
 | 
				
			||||||
 | 
								if (sameIdeo)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									pawn.ideo.OffsetCertainty(severity);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								// Option B: Partner as different Ideo, try to convert
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									pawn.ideo.IdeoConversionAttempt(severity, partner.Ideo);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public static float getGenitalSize(Pawn p)
 | 
							public static float getGenitalSize(Pawn p)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -210,5 +210,42 @@ 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")]
 | 
				
			||||||
 | 
							public static class RJW_Patch_Orgasm_IdeoConversion
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								public static void Postfix(JobDriver_Sex __instance)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									// ShortCuts: Exit Early if Pawn or Partner are null (can happen with Animals or Masturbation)
 | 
				
			||||||
 | 
									// 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))
 | 
				
			||||||
 | 
									{
 | 
				
			||||||
 | 
										// Pawn is the one having the orgasm
 | 
				
			||||||
 | 
										// Partner is "giving" the orgasm, hence the pawn will be converted towards the partners ideology
 | 
				
			||||||
 | 
										IdeoUtility.ConvertPawnBySex(__instance.pawn, __instance.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);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,5 +21,10 @@ 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 Proselyzing_By_Sex;
 | 
				
			||||||
 | 
							[MayRequireIdeology] public static readonly PreceptDef GenitalSize_Approved;
 | 
				
			||||||
 | 
							[MayRequireIdeology] public static readonly PreceptDef GenitalSize_Disapproved;
 | 
				
			||||||
 | 
							[MayRequireIdeology] public static readonly PreceptDef GenitalSize_NoRules;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue