mirror of
				https://gitgud.io/c0ffeeeeeeee/coffees-rjw-ideology-addons.git
				synced 2024-08-14 23:57:38 +00:00 
			
		
		
		
	RJW ideology stuff
This commit is contained in:
		
							parent
							
								
									b3901c7dfc
								
							
						
					
					
						commit
						9f4ac93bf9
					
				
					 6 changed files with 200 additions and 0 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -66,8 +66,12 @@
 | 
			
		|||
    </Reference>
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Compile Include="Source\CRIAUtility.cs" />
 | 
			
		||||
    <Compile Include="Source\Patches\Harmony_PatchAll.cs" />
 | 
			
		||||
    <Compile Include="Properties\AssemblyInfo.cs" />
 | 
			
		||||
    <Compile Include="Source\Patches\RJW\LovinEventDefs\HarmonyPatch_JobDriver_SexBaseInitiator.cs" />
 | 
			
		||||
    <Compile Include="Source\Patches\RJW\LovinPrecepts\HarmonyPatch_CasualSex_Helper.cs" />
 | 
			
		||||
    <Compile Include="Source\Patches\RJW\LovinPrecepts\HarmonyPatch_RMB_Menu.cs" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Folder Include="About\" />
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										47
									
								
								Source/CRIAUtility.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								Source/CRIAUtility.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,47 @@
 | 
			
		|||
using HarmonyLib;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace C0ffee_s_RJW_Ideology_Addons
 | 
			
		||||
{
 | 
			
		||||
    public static class CRIAUtility
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public static bool TwoPawnsWillingToHaveSex(Pawn fucker, Pawn fucked)
 | 
			
		||||
        {
 | 
			
		||||
            
 | 
			
		||||
            if (fucker == fucked) return true; //pawns are always allowed to masturbate
 | 
			
		||||
 | 
			
		||||
            if (DesignatorsData.rjwComfort.Contains(fucker) || DesignatorsData.rjwComfort.Contains(fucked)) return true; //designated comfort pawns allowed to have sex with
 | 
			
		||||
 | 
			
		||||
            if (!IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucker) || !IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucked))
 | 
			
		||||
            {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (fucker.relations.GetDirectRelation(PawnRelationDefOf.Spouse, fucked) != null)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                if (!IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_Spouse, fucker) || !IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_Spouse, fucked))
 | 
			
		||||
                {
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
            else if (!IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, fucker) || !IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, fucked))
 | 
			
		||||
            {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,49 @@
 | 
			
		|||
using HarmonyLib;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Reflection;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace C0ffee_s_RJW_Ideology_Addons
 | 
			
		||||
{
 | 
			
		||||
    [HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "End")]
 | 
			
		||||
    public static class HarmonyPatch_JobDriver_SexBaseInitiator_End
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public static void Prefix(JobDriver_SexBaseInitiator __instance)
 | 
			
		||||
        {
 | 
			
		||||
            
 | 
			
		||||
            HistoryEventDef def = __instance.pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, __instance.Partner) ? HistoryEventDefOf.GotLovin_Spouse : HistoryEventDefOf.GotLovin_NonSpouse;
 | 
			
		||||
 | 
			
		||||
            if (!(__instance is JobDriver_Rape && IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner))) //ensure raped pawns don't enjoy
 | 
			
		||||
            {
 | 
			
		||||
                Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.GotLovin, __instance.Partner.Named(HistoryEventArgsNames.Doer)), true);
 | 
			
		||||
                Find.HistoryEventsManager.RecordEvent(new HistoryEvent(def, __instance.Partner.Named(HistoryEventArgsNames.Doer)), true);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.GotLovin, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true);
 | 
			
		||||
            Find.HistoryEventsManager.RecordEvent(new HistoryEvent(def, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true);
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    [HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")]
 | 
			
		||||
    public static class HarmonyPatch_JobDriver_SexBaseInitiator_Start
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public static void Prefix(JobDriver_SexBaseInitiator __instance)
 | 
			
		||||
        {
 | 
			
		||||
            Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.InitiatedLovin, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true);
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,49 @@
 | 
			
		|||
using HarmonyLib;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
using System.Reflection.Emit;
 | 
			
		||||
 | 
			
		||||
namespace C0ffee_s_RJW_Ideology_Addons
 | 
			
		||||
{
 | 
			
		||||
    [HarmonyPatch(typeof(CasualSex_Helper), "FindBestPartner")]
 | 
			
		||||
    public static class HarmonyPatch_CasualSex_Helper
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> codeInstructions)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            var ins = codeInstructions.ToList();
 | 
			
		||||
            for(int i = 0; i < ins.Count; i++)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                if(ins[i].OperandIs(AccessTools.DeclaredMethod(typeof(CasualSex_Helper), "HookupAllowedViaSettings")))
 | 
			
		||||
                {
 | 
			
		||||
 | 
			
		||||
                    yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(HarmonyPatch_CasualSex_Helper), "HookupAllowed"));
 | 
			
		||||
 | 
			
		||||
                }
 | 
			
		||||
                else
 | 
			
		||||
                {
 | 
			
		||||
                    yield return ins[i];
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static bool HookupAllowed(Pawn pawn1, Pawn pawn2)
 | 
			
		||||
        {
 | 
			
		||||
            if(CRIAUtility.TwoPawnsWillingToHaveSex(pawn1, pawn2))
 | 
			
		||||
            {
 | 
			
		||||
                return CasualSex_Helper.HookupAllowedViaSettings(pawn1, pawn2);
 | 
			
		||||
            }
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										51
									
								
								Source/Patches/RJW/LovinPrecepts/HarmonyPatch_RMB_Menu.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								Source/Patches/RJW/LovinPrecepts/HarmonyPatch_RMB_Menu.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,51 @@
 | 
			
		|||
using HarmonyLib;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Verse;
 | 
			
		||||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
using System.Reflection.Emit;
 | 
			
		||||
 | 
			
		||||
namespace C0ffee_s_RJW_Ideology_Addons
 | 
			
		||||
{
 | 
			
		||||
    [StaticConstructorOnStartup]
 | 
			
		||||
    public static class HarmonyPatch_RMB_Menu
 | 
			
		||||
    {
 | 
			
		||||
        static HarmonyPatch_RMB_Menu()
 | 
			
		||||
        {
 | 
			
		||||
            (new Harmony("C0ffeeRIA")).Patch(AccessTools.Method(AccessTools.TypeByName("rjw.RMB_Menu"), "GenerateSexOptions"),
 | 
			
		||||
                            postfix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_RMB_Menu), "Postfix")));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static void Postfix(ref List<FloatMenuOption> __result, Pawn pawn, LocalTargetInfo target)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            if (target.Pawn != null)
 | 
			
		||||
            {
 | 
			
		||||
 | 
			
		||||
                if (!CRIAUtility.TwoPawnsWillingToHaveSex(pawn, target.Pawn))
 | 
			
		||||
                {
 | 
			
		||||
                    for(int i = 0; i < __result.Count; i++)
 | 
			
		||||
                    {
 | 
			
		||||
 | 
			
		||||
                        if(__result[i].Label.StartsWith("RJW_RMB_Sex".Translate()))
 | 
			
		||||
                        {
 | 
			
		||||
                            __result[i].Label += " (sinful)";
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return;
 | 
			
		||||
            
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue