mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
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
3 changed files with 61 additions and 24 deletions
|
@ -5,6 +5,7 @@ using RJWSexperience.Cum;
|
|||
using RJWSexperience.Logs;
|
||||
using RJWSexperience.SexHistory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
|
@ -44,7 +45,7 @@ namespace RJWSexperience
|
|||
LustUtility.UpdateLust(props, satisfaction, base_sat_per_fuck);
|
||||
CumUtility.FillCumBuckets(props);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +81,7 @@ namespace RJWSexperience
|
|||
{
|
||||
RJWUtility.UpdateSextypeRecords(props);
|
||||
|
||||
if (!SexperienceMod.Settings.EnableSexHistory || props.partner == null)
|
||||
if (!SexperienceMod.Settings.EnableSexHistory || !props.hasPartner())
|
||||
return;
|
||||
|
||||
props.pawn.TryGetComp<SexHistoryComp>()?.RecordSex(props.partner, props);
|
||||
|
@ -93,7 +94,7 @@ namespace RJWSexperience
|
|||
{
|
||||
public static void Postfix(JobDriver_SexBaseInitiator __instance)
|
||||
{
|
||||
if (__instance.Partner != null)
|
||||
if (__instance.Sexprops.hasPartner())
|
||||
{
|
||||
__instance.pawn.PoptheCherry(__instance.Partner, __instance.Sexprops);
|
||||
__instance.Partner.PoptheCherry(__instance.pawn, __instance.Sexprops);
|
||||
|
@ -110,10 +111,10 @@ namespace RJWSexperience
|
|||
/// <param name="pawn"></param>
|
||||
/// <param name="partner"></param>
|
||||
/// <param name="__result"></param>
|
||||
/// <returns></returns>
|
||||
/// <returns>Run original method</returns>
|
||||
public static bool Prefix(Pawn pawn, Pawn partner, ref IntVec3 __result)
|
||||
{
|
||||
if (partner != null)
|
||||
if (partner != null && partner != pawn)
|
||||
return true; // Not masturbation
|
||||
|
||||
var log = LogManager.GetLogger<DebugLogProvider>("RJW_Patch_CasualSex_Helper_FindSexLocation");
|
||||
|
@ -129,13 +130,51 @@ namespace RJWSexperience
|
|||
|
||||
if (bucket == null)
|
||||
{
|
||||
log.Message("Bucket not found");
|
||||
log.Message("404 Bucket not found");
|
||||
return true;
|
||||
}
|
||||
|
||||
__result = bucket.RandomAdjacentCell8Way();
|
||||
log.Message($"Bucket location: {__result}");
|
||||
return false;
|
||||
Room bucketRoom = bucket.GetRoom();
|
||||
|
||||
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 Pawn ParentPawn => parent as Pawn;
|
||||
|
||||
public SexPartnerHistoryRecord GetFirstPartnerHistory => histories.TryGetValue(first);
|
||||
|
||||
public SexPartnerHistoryRecord GetMostPartnerHistory
|
||||
|
@ -245,17 +247,16 @@ namespace RJWSexperience.SexHistory
|
|||
|
||||
public void RecordSex(Pawn partner, SexProps props)
|
||||
{
|
||||
Pawn pawn = parent as Pawn;
|
||||
RecordFirst(partner, props);
|
||||
GetPartnerRecord(partner)?.RecordSex(props);
|
||||
recentPartner = partner.ThingID;
|
||||
recentSex = props.sexType;
|
||||
sextypeCount[(int)props.sexType]++;
|
||||
sextypeRecentTickAbs[(int)props.sexType] = GenTicks.TicksAbs;
|
||||
if (partner.IsIncest(pawn)) incestuous++;
|
||||
if (partner.IsIncest(ParentPawn)) incestuous++;
|
||||
if (partner.Dead) corpsefuck++;
|
||||
if (props.IsBestiality()) bestiality++;
|
||||
else if (pawn.def != partner.def) interspecies++;
|
||||
else if (ParentPawn.def != partner.def) interspecies++;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
|
@ -275,7 +276,7 @@ namespace RJWSexperience.SexHistory
|
|||
first = partner.ThingID;
|
||||
SexHistoryComp history = partner.TryGetComp<SexHistoryComp>();
|
||||
firstSexTickAbs = GenTicks.TicksAbs;
|
||||
history?.TakeSomeonesVirgin(parent as Pawn);
|
||||
history?.TakeSomeonesVirgin(ParentPawn);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -288,12 +289,9 @@ namespace RJWSexperience.SexHistory
|
|||
return record;
|
||||
}
|
||||
|
||||
SexPartnerHistoryRecord newRecord = new SexPartnerHistoryRecord(partner, partner.IsIncest(parent as Pawn));
|
||||
SexPartnerHistoryRecord newRecord = new SexPartnerHistoryRecord(partner, partner.IsIncest(ParentPawn));
|
||||
histories.Add(partnerId, newRecord);
|
||||
if (parent is Pawn pawn)
|
||||
{
|
||||
pawn.records.Increment(VariousDefOf.SexPartnerCount);
|
||||
}
|
||||
ParentPawn.records.Increment(VariousDefOf.SexPartnerCount);
|
||||
return newRecord;
|
||||
}
|
||||
|
||||
|
@ -418,15 +416,15 @@ namespace RJWSexperience.SexHistory
|
|||
|
||||
protected bool VirginCheck()
|
||||
{
|
||||
if (histories.TryGetValue(first) != null) return false;
|
||||
if (histories.TryGetValue(first) != null)
|
||||
return false;
|
||||
|
||||
Pawn pawn = parent as Pawn;
|
||||
return pawn?.IsVirgin() == true;
|
||||
return ParentPawn.IsVirgin();
|
||||
}
|
||||
|
||||
public override IEnumerable<Gizmo> CompGetGizmosExtra()
|
||||
{
|
||||
if (SexperienceMod.Settings.HideGizmoWhenDrafted && (parent as Pawn)?.Drafted == true)
|
||||
if (SexperienceMod.Settings.HideGizmoWhenDrafted && ParentPawn.Drafted)
|
||||
yield break;
|
||||
|
||||
if (Find.Selector.NumSelected > 1)
|
||||
|
@ -447,7 +445,7 @@ namespace RJWSexperience.SexHistory
|
|||
hotKey = VariousDefOf.OpenSexStatistics,
|
||||
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));
|
||||
|
||||
//Center section
|
||||
DrawBaseSexInfoCenter(centerRect.ContractedBy(4f), history.parent as Pawn);
|
||||
DrawBaseSexInfoCenter(centerRect.ContractedBy(4f), history.ParentPawn);
|
||||
|
||||
//Right section
|
||||
DrawBaseSexInfoRight(rightRect.ContractedBy(4f));
|
||||
|
|
Loading…
Reference in a new issue