Fixed #7 masturbation counted as sex with a partner
Updated selection of place near bucket to masturbate
This commit is contained in:
parent
6bb4c091d4
commit
50f48bdeb5
|
@ -5,6 +5,7 @@ using RJWSexperience.Cum;
|
||||||
using RJWSexperience.Logs;
|
using RJWSexperience.Logs;
|
||||||
using RJWSexperience.SexHistory;
|
using RJWSexperience.SexHistory;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using Verse;
|
using Verse;
|
||||||
|
|
||||||
|
@ -44,7 +45,7 @@ namespace RJWSexperience
|
||||||
LustUtility.UpdateLust(props, satisfaction, base_sat_per_fuck);
|
LustUtility.UpdateLust(props, satisfaction, base_sat_per_fuck);
|
||||||
CumUtility.FillCumBuckets(props);
|
CumUtility.FillCumBuckets(props);
|
||||||
props.pawn.records?.Increment(VariousDefOf.OrgasmCount);
|
props.pawn.records?.Increment(VariousDefOf.OrgasmCount);
|
||||||
if (SexperienceMod.Settings.EnableSexHistory && props.partner != null)
|
if (SexperienceMod.Settings.EnableSexHistory && props.hasPartner())
|
||||||
props.pawn.TryGetComp<SexHistoryComp>()?.RecordSatisfaction(props.partner, props, satisfaction);
|
props.pawn.TryGetComp<SexHistoryComp>()?.RecordSatisfaction(props.partner, props, satisfaction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,7 +81,7 @@ namespace RJWSexperience
|
||||||
{
|
{
|
||||||
RJWUtility.UpdateSextypeRecords(props);
|
RJWUtility.UpdateSextypeRecords(props);
|
||||||
|
|
||||||
if (!SexperienceMod.Settings.EnableSexHistory || props.partner == null)
|
if (!SexperienceMod.Settings.EnableSexHistory || !props.hasPartner())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
props.pawn.TryGetComp<SexHistoryComp>()?.RecordSex(props.partner, props);
|
props.pawn.TryGetComp<SexHistoryComp>()?.RecordSex(props.partner, props);
|
||||||
|
@ -93,7 +94,7 @@ namespace RJWSexperience
|
||||||
{
|
{
|
||||||
public static void Postfix(JobDriver_SexBaseInitiator __instance)
|
public static void Postfix(JobDriver_SexBaseInitiator __instance)
|
||||||
{
|
{
|
||||||
if (__instance.Partner != null)
|
if (__instance.Sexprops.hasPartner())
|
||||||
{
|
{
|
||||||
__instance.pawn.PoptheCherry(__instance.Partner, __instance.Sexprops);
|
__instance.pawn.PoptheCherry(__instance.Partner, __instance.Sexprops);
|
||||||
__instance.Partner.PoptheCherry(__instance.pawn, __instance.Sexprops);
|
__instance.Partner.PoptheCherry(__instance.pawn, __instance.Sexprops);
|
||||||
|
@ -110,10 +111,10 @@ namespace RJWSexperience
|
||||||
/// <param name="pawn"></param>
|
/// <param name="pawn"></param>
|
||||||
/// <param name="partner"></param>
|
/// <param name="partner"></param>
|
||||||
/// <param name="__result"></param>
|
/// <param name="__result"></param>
|
||||||
/// <returns></returns>
|
/// <returns>Run original method</returns>
|
||||||
public static bool Prefix(Pawn pawn, Pawn partner, ref IntVec3 __result)
|
public static bool Prefix(Pawn pawn, Pawn partner, ref IntVec3 __result)
|
||||||
{
|
{
|
||||||
if (partner != null)
|
if (partner != null && partner != pawn)
|
||||||
return true; // Not masturbation
|
return true; // Not masturbation
|
||||||
|
|
||||||
var log = LogManager.GetLogger<DebugLogProvider>("RJW_Patch_CasualSex_Helper_FindSexLocation");
|
var log = LogManager.GetLogger<DebugLogProvider>("RJW_Patch_CasualSex_Helper_FindSexLocation");
|
||||||
|
@ -129,13 +130,51 @@ namespace RJWSexperience
|
||||||
|
|
||||||
if (bucket == null)
|
if (bucket == null)
|
||||||
{
|
{
|
||||||
log.Message("Bucket not found");
|
log.Message("404 Bucket not found");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
__result = bucket.RandomAdjacentCell8Way();
|
Room bucketRoom = bucket.GetRoom();
|
||||||
log.Message($"Bucket location: {__result}");
|
|
||||||
return false;
|
List<IntVec3> cellsAroundBucket = GenAdjFast.AdjacentCells8Way(bucket.Position);
|
||||||
|
IntVec3 doorNearBucket = IntVec3.Invalid;
|
||||||
|
|
||||||
|
foreach (IntVec3 cell in cellsAroundBucket.InRandomOrder())
|
||||||
|
{
|
||||||
|
if (!cell.Standable(bucket.Map))
|
||||||
|
{
|
||||||
|
log.Message($"Discarded {cell}: not standable");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cell.GetRoom(bucket.Map) != bucketRoom)
|
||||||
|
{
|
||||||
|
if (cell.GetDoor(bucket.Map) != null)
|
||||||
|
{
|
||||||
|
doorNearBucket = cell;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.Message($"Discarded {cell}: different room");
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
__result = cell;
|
||||||
|
log.Message($"Masturbate at location: {__result}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (doorNearBucket != IntVec3.Invalid)
|
||||||
|
{
|
||||||
|
__result = doorNearBucket;
|
||||||
|
log.Message($"No proper place found, go jack off in the doorway: {__result}");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Message($"Failed to find situable location near the bucket at {bucket.Position}");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,8 @@ namespace RJWSexperience.SexHistory
|
||||||
|
|
||||||
public Gizmo Gizmo { get; private set; }
|
public Gizmo Gizmo { get; private set; }
|
||||||
|
|
||||||
|
public Pawn ParentPawn => parent as Pawn;
|
||||||
|
|
||||||
public SexPartnerHistoryRecord GetFirstPartnerHistory => histories.TryGetValue(first);
|
public SexPartnerHistoryRecord GetFirstPartnerHistory => histories.TryGetValue(first);
|
||||||
|
|
||||||
public SexPartnerHistoryRecord GetMostPartnerHistory
|
public SexPartnerHistoryRecord GetMostPartnerHistory
|
||||||
|
@ -245,17 +247,16 @@ namespace RJWSexperience.SexHistory
|
||||||
|
|
||||||
public void RecordSex(Pawn partner, SexProps props)
|
public void RecordSex(Pawn partner, SexProps props)
|
||||||
{
|
{
|
||||||
Pawn pawn = parent as Pawn;
|
|
||||||
RecordFirst(partner, props);
|
RecordFirst(partner, props);
|
||||||
GetPartnerRecord(partner)?.RecordSex(props);
|
GetPartnerRecord(partner)?.RecordSex(props);
|
||||||
recentPartner = partner.ThingID;
|
recentPartner = partner.ThingID;
|
||||||
recentSex = props.sexType;
|
recentSex = props.sexType;
|
||||||
sextypeCount[(int)props.sexType]++;
|
sextypeCount[(int)props.sexType]++;
|
||||||
sextypeRecentTickAbs[(int)props.sexType] = GenTicks.TicksAbs;
|
sextypeRecentTickAbs[(int)props.sexType] = GenTicks.TicksAbs;
|
||||||
if (partner.IsIncest(pawn)) incestuous++;
|
if (partner.IsIncest(ParentPawn)) incestuous++;
|
||||||
if (partner.Dead) corpsefuck++;
|
if (partner.Dead) corpsefuck++;
|
||||||
if (props.IsBestiality()) bestiality++;
|
if (props.IsBestiality()) bestiality++;
|
||||||
else if (pawn.def != partner.def) interspecies++;
|
else if (ParentPawn.def != partner.def) interspecies++;
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -275,7 +276,7 @@ namespace RJWSexperience.SexHistory
|
||||||
first = partner.ThingID;
|
first = partner.ThingID;
|
||||||
SexHistoryComp history = partner.TryGetComp<SexHistoryComp>();
|
SexHistoryComp history = partner.TryGetComp<SexHistoryComp>();
|
||||||
firstSexTickAbs = GenTicks.TicksAbs;
|
firstSexTickAbs = GenTicks.TicksAbs;
|
||||||
history?.TakeSomeonesVirgin(parent as Pawn);
|
history?.TakeSomeonesVirgin(ParentPawn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,12 +289,9 @@ namespace RJWSexperience.SexHistory
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
SexPartnerHistoryRecord newRecord = new SexPartnerHistoryRecord(partner, partner.IsIncest(parent as Pawn));
|
SexPartnerHistoryRecord newRecord = new SexPartnerHistoryRecord(partner, partner.IsIncest(ParentPawn));
|
||||||
histories.Add(partnerId, newRecord);
|
histories.Add(partnerId, newRecord);
|
||||||
if (parent is Pawn pawn)
|
ParentPawn.records.Increment(VariousDefOf.SexPartnerCount);
|
||||||
{
|
|
||||||
pawn.records.Increment(VariousDefOf.SexPartnerCount);
|
|
||||||
}
|
|
||||||
return newRecord;
|
return newRecord;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,15 +416,15 @@ namespace RJWSexperience.SexHistory
|
||||||
|
|
||||||
protected bool VirginCheck()
|
protected bool VirginCheck()
|
||||||
{
|
{
|
||||||
if (histories.TryGetValue(first) != null) return false;
|
if (histories.TryGetValue(first) != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
Pawn pawn = parent as Pawn;
|
return ParentPawn.IsVirgin();
|
||||||
return pawn?.IsVirgin() == true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<Gizmo> CompGetGizmosExtra()
|
public override IEnumerable<Gizmo> CompGetGizmosExtra()
|
||||||
{
|
{
|
||||||
if (SexperienceMod.Settings.HideGizmoWhenDrafted && (parent as Pawn)?.Drafted == true)
|
if (SexperienceMod.Settings.HideGizmoWhenDrafted && ParentPawn.Drafted)
|
||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
if (Find.Selector.NumSelected > 1)
|
if (Find.Selector.NumSelected > 1)
|
||||||
|
@ -447,7 +445,7 @@ namespace RJWSexperience.SexHistory
|
||||||
hotKey = VariousDefOf.OpenSexStatistics,
|
hotKey = VariousDefOf.OpenSexStatistics,
|
||||||
action = delegate
|
action = delegate
|
||||||
{
|
{
|
||||||
UI.SexStatusWindow.ToggleWindow(parent as Pawn, this);
|
UI.SexStatusWindow.ToggleWindow(ParentPawn, this);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,7 +223,7 @@ namespace RJWSexperience.SexHistory.UI
|
||||||
DrawBaseSexInfoLeft(leftRect.ContractedBy(4f));
|
DrawBaseSexInfoLeft(leftRect.ContractedBy(4f));
|
||||||
|
|
||||||
//Center section
|
//Center section
|
||||||
DrawBaseSexInfoCenter(centerRect.ContractedBy(4f), history.parent as Pawn);
|
DrawBaseSexInfoCenter(centerRect.ContractedBy(4f), history.ParentPawn);
|
||||||
|
|
||||||
//Right section
|
//Right section
|
||||||
DrawBaseSexInfoRight(rightRect.ContractedBy(4f));
|
DrawBaseSexInfoRight(rightRect.ContractedBy(4f));
|
||||||
|
|
Loading…
Reference in New Issue