rjw-fh/1.5/Source/Mod/fh.cs
2024-05-24 15:02:14 +03:00

252 lines
6.7 KiB
C#

using HarmonyLib;
using RimWorld;
using Verse;
using System;
using System.Collections.Generic;
using rjw;
using rjw.Modules.Interactions.Enums;
using System.Linq;
using System.Reflection;
namespace rjwfh
{
[StaticConstructorOnStartup]
internal static class InitHarmonyPatches
{
static InitHarmonyPatches()
{
var har = new Harmony("rjw.FH");
har.PatchAll(Assembly.GetExecutingAssembly());
}
}
[HarmonyPatch(typeof(AfterSexUtility), "think_about_sex", new Type[] { typeof(Pawn), typeof(Pawn), typeof(bool), typeof(SexProps), typeof(bool)})]
[StaticConstructorOnStartup]
static class Holefuck_AfterSexUtility_think_about_sex
{
public static readonly ThoughtDef RJW_fucker = DefDatabase<ThoughtDef>.GetNamed("RJW_Holefucker");
public static readonly ThoughtDef RJW_fucked = DefDatabase<ThoughtDef>.GetNamed("RJW_Holefucked");
[HarmonyPostfix]
private static void think_about_sex_Patch(Pawn pawn, Pawn partner, bool isReceiving, SexProps props, bool whoring = false)
{
try
{
if (pawn == null)
{
return;
}
if (partner == null)
{
return;
}
Pawn p1 = pawn;
Pawn p2 = partner;
List<Hediff> p1p = new List<Hediff>();
List<Hediff> p2p = new List<Hediff>();
List<Hediff> p1pf = new List<Hediff>();
List<Hediff> p2pf = new List<Hediff>();
Hediff pp = null;
Hediff hole = null;
ThoughtDef T = null;
int size = 0;
//Log.Message("p1 " + p1.Name);
//Log.Message("p2 " + p2.Name);
if (props.sexType == xxx.rjwSextype.Vaginal)
{
//Log.Message("Vaginal");
var interaction = rjw.Modules.Interactions.Helpers.InteractionHelper.GetWithExtension(props.dictionaryKey);
//pp fucks hole
if (interaction.DominantHasTag(GenitalTag.CanPenetrate) &&
interaction.SubmissiveHasFamily(GenitalFamily.Vagina))
{
//initiator fucks reciever
//Log.Message("straight");
if (!isReceiving)
{//p1(initiator) fucks p2(reciever)
p1pf.AddRange(p1.GetGenitalsList().Where(x => Genital_Helper.is_penis(x)));
p2pf.AddRange(p2.GetGenitalsList().Where(x => Genital_Helper.is_vagina(x)));
T = RJW_fucker;
pp = p1pf.FirstOrDefault();
hole = p2pf.FirstOrDefault();
}
else
{//p1(reciever) fucked by p2(initiator)
p1pf.AddRange(p1.GetGenitalsList().Where(x => Genital_Helper.is_vagina(x)));
p2pf.AddRange(p2.GetGenitalsList().Where(x => Genital_Helper.is_penis(x)));
T = RJW_fucked;
pp = p2pf.FirstOrDefault();
hole = p1pf.FirstOrDefault();
}
if (pp == null)
return;
if (hole == null)
return;
}
//hole "fucks" pp
else if (interaction.DominantHasFamily(GenitalFamily.Vagina) &&
interaction.SubmissiveHasTag(GenitalTag.CanPenetrate) &&
interaction.HasInteractionTag(InteractionTag.Reverse))
{
//initiator fucks (reverse fucked by/rides) reciever
//Log.Message("reverse");
if (!isReceiving)
{//p1(initiator) fucked by p2(reciever)
p1pf.AddRange(p1.GetGenitalsList().Where(x => Genital_Helper.is_vagina(x)));
p2pf.AddRange(p2.GetGenitalsList().Where(x => Genital_Helper.is_penis(x)));
T = RJW_fucked;
pp = p2pf.FirstOrDefault();
hole = p1pf.FirstOrDefault();
}
else
{//p1(reciever) fucks p2(initiator)
p2pf.AddRange(p2.GetGenitalsList().Where(x => Genital_Helper.is_vagina(x)));
p1pf.AddRange(p1.GetGenitalsList().Where(x => Genital_Helper.is_penis(x)));
T = RJW_fucker;
pp = p1pf.FirstOrDefault();
hole = p2pf.FirstOrDefault();
}
if (pp == null)
return;
if (hole == null)
return;
}
else
{
return;
}
}
else if (props.sexType == xxx.rjwSextype.Anal)
{
//Log.Message("Anal");
var interaction = rjw.Modules.Interactions.Helpers.InteractionHelper.GetWithExtension(props.dictionaryKey);
//pp fucks hole
if (interaction.DominantHasTag(GenitalTag.CanPenetrate) &&
interaction.SubmissiveHasFamily(GenitalFamily.Anus))
{
//initiator fucks reciever
//Log.Message("straight");
if (!isReceiving)
{//p1(initiator) fucks p2(reciever)
p1pf.AddRange(p1.GetGenitalsList().Where(x => Genital_Helper.is_penis(x)));
p2pf.AddRange(p2.GetAnusList());
T = RJW_fucker;
pp = p1pf.FirstOrDefault();
hole = p2pf.FirstOrDefault();
}
else
{//p1(reciever) fucked by p2(initiator)
p1pf.AddRange(p1.GetAnusList());
p2pf.AddRange(p2.GetGenitalsList().Where(x => Genital_Helper.is_penis(x)));
T = RJW_fucked;
pp = p2pf.FirstOrDefault();
hole = p1pf.FirstOrDefault();
}
if (pp == null)
return;
if (hole == null)
return;
}
//hole "fucks" pp
else if (interaction.DominantHasFamily(GenitalFamily.Anus) &&
interaction.SubmissiveHasTag(GenitalTag.CanPenetrate) &&
interaction.HasInteractionTag(InteractionTag.Reverse))
{
//initiator fucks (reverse fucked by/rides) reciever
//Log.Message("reverse");
if (!isReceiving)
{//p1(initiator) fucked by p2(reciever)
p1pf.AddRange(p1.GetAnusList());
p2pf.AddRange(p2.GetGenitalsList().Where(x => Genital_Helper.is_penis(x)));
T = RJW_fucked;
pp = p2pf.FirstOrDefault();
hole = p1pf.FirstOrDefault();
}
else
{//p1(reciever) fucks p2(initiator)
p2pf.AddRange(p2.GetAnusList());
p1pf.AddRange(p1.GetGenitalsList().Where(x => Genital_Helper.is_penis(x)));
T = RJW_fucker;
pp = p1pf.FirstOrDefault();
hole = p2pf.FirstOrDefault();
}
if (pp == null)
return;
if (hole == null)
return;
}
else
{
return;
}
}
else if (props.sexType == xxx.rjwSextype.DoublePenetration)
{
//Log.Message("BP");
//todo, maybe
return;
}
else
{
return;
}
var stage = -1;
size = size_check(pp, hole);
if (size != 0)
{
if (size < 0)
stage = 0;
else
stage = 1;
if (stage != -1)
p1?.needs?.mood?.thoughts?.memories?.TryGainMemory(ThoughtMaker.MakeThought(T, stage), null);
}
return;
}
catch (Exception e)
{
Log.Error(e.ToString());
}
}
public static int size_check(Hediff pp, Hediff hole)
{
var i = 0;
//Log.Message("size_check:");
//Log.Message("pp " + pp.Severity);
//Log.Message("hole " + hole.Severity);
//Log.Message("dif " + (pp.Severity - hole.Severity));
if (pp.Severity - hole.Severity >= 0.2) // tight
{
//Log.Message("tight");
i++;
}
else if (pp.Severity - hole.Severity <= -0.2) // loose
{
//Log.Message("loose");
i--;
}
else // okayish
{
//Log.Message("okayish");
}
return i;
}
}
}