mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
Rename source folder
This commit is contained in:
parent
0a412a0060
commit
a4c046a841
55 changed files with 0 additions and 0 deletions
31
Source/RJWSexperience.sln
Normal file
31
Source/RJWSexperience.sln
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32630.192
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RJWSexperience", "RJWSexperience\RJWSexperience.csproj", "{9C728E06-573B-4B04-A07F-ACBF60CB424D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RJWSexperienceCum", "RJWSexperienceCum\RJWSexperienceCum.csproj", "{73CB4597-22BD-4A3E-A3CE-6D65DD080F65}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{9C728E06-573B-4B04-A07F-ACBF60CB424D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{9C728E06-573B-4B04-A07F-ACBF60CB424D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9C728E06-573B-4B04-A07F-ACBF60CB424D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9C728E06-573B-4B04-A07F-ACBF60CB424D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{73CB4597-22BD-4A3E-A3CE-6D65DD080F65}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{73CB4597-22BD-4A3E-A3CE-6D65DD080F65}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{73CB4597-22BD-4A3E-A3CE-6D65DD080F65}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{73CB4597-22BD-4A3E-A3CE-6D65DD080F65}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {03C87A93-F76D-49B3-AE25-67E14F20EACD}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
106
Source/RJWSexperience/Configurations.cs
Normal file
106
Source/RJWSexperience/Configurations.cs
Normal file
|
@ -0,0 +1,106 @@
|
|||
using UnityEngine;
|
||||
using Verse;
|
||||
using RJWSexperience.Settings;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public class Configurations : ModSettings, ITab
|
||||
{
|
||||
public string Label => Keyed.TabLabelMain;
|
||||
public const int CurrentSettingsVersion = 1;
|
||||
|
||||
// Defaults
|
||||
public const float LustEffectPowerDefault = 0.5f;
|
||||
public const bool EnableBastardRelationDefault = true;
|
||||
public const float LustLimitDefault = SettingsTabHistory.MaxLustDeviationDefault / 3f;
|
||||
public const float MaxSingleLustChangeDefault = 0.5f;
|
||||
public const bool SexCanFillBucketsDefault = false;
|
||||
public const bool selectionLockedDefault = false;
|
||||
|
||||
// Private attributes
|
||||
private float lustEffectPower = LustEffectPowerDefault;
|
||||
private bool enableBastardRelation = EnableBastardRelationDefault;
|
||||
private float lustLimit = LustLimitDefault;
|
||||
private float maxSingleLustChange = MaxSingleLustChangeDefault;
|
||||
private bool sexCanFillBuckets = SexCanFillBucketsDefault;
|
||||
private bool selectionLocked = selectionLockedDefault;
|
||||
private SettingsTabHistory history = SettingsTabHistory.CreateDefault();
|
||||
private SettingsTabDebug debug = new SettingsTabDebug();
|
||||
|
||||
//Public read-only properties
|
||||
public float LustEffectPower => lustEffectPower;
|
||||
public bool EnableBastardRelation => enableBastardRelation;
|
||||
public float LustLimit => lustLimit;
|
||||
public float MaxSingleLustChange => maxSingleLustChange;
|
||||
public bool SexCanFillBuckets => sexCanFillBuckets;
|
||||
public SettingsTabHistory History => history;
|
||||
public SettingsTabDebug Debug => debug;
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S2292:Trivial properties should be auto-implemented", Justification = "Can't scribe property")]
|
||||
public bool SelectionLocked { get => selectionLocked; set => selectionLocked = value; }
|
||||
|
||||
public void ResetToDefault()
|
||||
{
|
||||
lustEffectPower = LustEffectPowerDefault;
|
||||
enableBastardRelation = EnableBastardRelationDefault;
|
||||
lustLimit = LustLimitDefault;
|
||||
maxSingleLustChange = MaxSingleLustChangeDefault;
|
||||
sexCanFillBuckets = SexCanFillBucketsDefault;
|
||||
}
|
||||
|
||||
public override void ExposeData()
|
||||
{
|
||||
int version = CurrentSettingsVersion;
|
||||
Scribe_Values.Look(ref version, "SettingsVersion", 0);
|
||||
Scribe_Values.Look(ref lustEffectPower, "LustEffectPower", LustEffectPowerDefault);
|
||||
Scribe_Values.Look(ref enableBastardRelation, "EnableBastardRelation", EnableBastardRelationDefault);
|
||||
Scribe_Values.Look(ref lustLimit, "LustLimit", LustLimitDefault);
|
||||
Scribe_Values.Look(ref maxSingleLustChange, "maxSingleLustChange", MaxSingleLustChangeDefault);
|
||||
Scribe_Values.Look(ref selectionLocked, "SelectionLocked", selectionLockedDefault);
|
||||
Scribe_Values.Look(ref sexCanFillBuckets, "SexCanFillBuckets", SexCanFillBucketsDefault);
|
||||
Scribe_Deep.Look(ref history, "History");
|
||||
Scribe_Deep.Look(ref debug, "Debug");
|
||||
base.ExposeData();
|
||||
|
||||
if (Scribe.mode != LoadSaveMode.LoadingVars)
|
||||
return;
|
||||
|
||||
if (history == null)
|
||||
{
|
||||
history = new SettingsTabHistory();
|
||||
// Previously history settings were in Configurations. Direct call to try read old data
|
||||
history.ExposeData();
|
||||
}
|
||||
|
||||
if (debug == null)
|
||||
{
|
||||
debug = new SettingsTabDebug();
|
||||
debug.Reset();
|
||||
}
|
||||
}
|
||||
|
||||
public void DoTabContents(Rect inRect)
|
||||
{
|
||||
const float lineHeight = SettingsWidgets.lineHeight;
|
||||
|
||||
Listing_Standard listmain = new Listing_Standard();
|
||||
listmain.maxOneColumn = true;
|
||||
listmain.Begin(inRect);
|
||||
|
||||
SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_2_Label + " x" + lustEffectPower, Keyed.Option_2_Desc, ref lustEffectPower, 0f, 2f, 0.01f);
|
||||
SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_8_Label + " " + lustLimit, Keyed.Option_8_Desc, ref lustLimit, 0f, 5000f, 1f);
|
||||
SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_MaxSingleLustChange_Label + " " + maxSingleLustChange, Keyed.Option_MaxSingleLustChange_Desc, ref maxSingleLustChange, 0f, 10f, 0.05f);
|
||||
|
||||
listmain.CheckboxLabeled(Keyed.Option_EnableBastardRelation_Label, ref enableBastardRelation, Keyed.Option_EnableBastardRelation_Desc);
|
||||
listmain.CheckboxLabeled(Keyed.Option_SexCanFillBuckets_Label, ref sexCanFillBuckets, Keyed.Option_SexCanFillBuckets_Desc);
|
||||
|
||||
if (SexperienceMod.Settings.Debug.DevMode)
|
||||
LustUtility.DrawGraph(listmain.GetRect(300f));
|
||||
|
||||
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
|
||||
{
|
||||
ResetToDefault();
|
||||
}
|
||||
listmain.End();
|
||||
}
|
||||
}
|
||||
}
|
77
Source/RJWSexperience/Cum/Building_Cumbucket.cs
Normal file
77
Source/RJWSexperience/Cum/Building_Cumbucket.cs
Normal file
|
@ -0,0 +1,77 @@
|
|||
using RimWorld;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience // Used in Menstruation with this namespace
|
||||
{
|
||||
public class Building_CumBucket : Building_Storage
|
||||
{
|
||||
protected float storedDecimalRemainder = 0f;
|
||||
protected float totalGathered = 0f;
|
||||
|
||||
public int StoredStackCount
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!slotGroup.HeldThings.Any())
|
||||
return 0;
|
||||
return slotGroup.HeldThings.Select(thing => thing.stackCount).Aggregate((sum, x) => sum + x);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData()
|
||||
{
|
||||
Scribe_Values.Look(ref storedDecimalRemainder, "storedcum", 0f);
|
||||
Scribe_Values.Look(ref totalGathered, "totalgathered", 0f);
|
||||
base.ExposeData();
|
||||
}
|
||||
|
||||
public override string GetInspectString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
|
||||
string baseString = base.GetInspectString();
|
||||
if (!baseString.NullOrEmpty())
|
||||
{
|
||||
stringBuilder.AppendLine(baseString);
|
||||
}
|
||||
|
||||
stringBuilder.Append(Keyed.RSTotalGatheredCum).AppendFormat("{0:0.##}ml", totalGathered);
|
||||
|
||||
if (SexperienceMod.Settings.Debug.DevMode)
|
||||
{
|
||||
stringBuilder.AppendLine();
|
||||
stringBuilder.AppendLine($"[Debug] stored: {StoredStackCount}");
|
||||
stringBuilder.Append($"[Debug] storedDecimalRemainder: {storedDecimalRemainder}");
|
||||
}
|
||||
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
public void AddCum(float amount)
|
||||
{
|
||||
AddCum(amount, VariousDefOf.GatheredCum);
|
||||
}
|
||||
|
||||
public void AddCum(float amount, ThingDef cumDef)
|
||||
{
|
||||
Thing cum = ThingMaker.MakeThing(cumDef);
|
||||
AddCum(amount, cum);
|
||||
}
|
||||
|
||||
public void AddCum(float amount, Thing cum)
|
||||
{
|
||||
storedDecimalRemainder += amount;
|
||||
totalGathered += amount;
|
||||
int num = (int)storedDecimalRemainder;
|
||||
|
||||
cum.stackCount = num;
|
||||
if (cum.stackCount > 0 && !GenPlace.TryPlaceThing(cum, PositionHeld, Map, ThingPlaceMode.Direct, out Thing res))
|
||||
{
|
||||
FilthMaker.TryMakeFilth(PositionHeld, Map, VariousDefOf.FilthCum, num);
|
||||
}
|
||||
storedDecimalRemainder -= num;
|
||||
}
|
||||
}
|
||||
}
|
160
Source/RJWSexperience/Cum/CumUtility.cs
Normal file
160
Source/RJWSexperience/Cum/CumUtility.cs
Normal file
|
@ -0,0 +1,160 @@
|
|||
using rjw;
|
||||
using rjw.Modules.Interactions.Enums;
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
using RJWSexperience.Logs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Cum
|
||||
{
|
||||
public static class CumUtility
|
||||
{
|
||||
private static readonly rjw.Modules.Shared.Logs.ILog log = LogManager.GetLogger<DebugLogProvider>("CumUtility");
|
||||
|
||||
public static float GetOnePartCumVolume(Pawn pawn)
|
||||
{
|
||||
List<Hediff> hediffs = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn));
|
||||
if (hediffs.NullOrEmpty())
|
||||
return 0f;
|
||||
|
||||
float result = GetCumVolume(pawn, GetOneBodyPartComp(hediffs));
|
||||
log.Message($"GetOnePartCumVolume({pawn.NameShortColored}) = {result}");
|
||||
return result;
|
||||
}
|
||||
|
||||
public static float GetCumVolume(Pawn pawn)
|
||||
{
|
||||
List<Hediff> hediffs = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn));
|
||||
if (hediffs.NullOrEmpty())
|
||||
return 0f;
|
||||
float result = GetCumVolume(pawn, GetAllBodyPartComps(hediffs));
|
||||
log.Message($"GetCumVolume({pawn.NameShortColored}) = {result}");
|
||||
return result;
|
||||
}
|
||||
|
||||
public static float GetCumVolume(Pawn pawn, List<CompHediffBodyPart> parts)
|
||||
{
|
||||
return parts.Select(part => GetCumVolume(pawn, part)).Aggregate((sum, x) => sum + x);
|
||||
}
|
||||
|
||||
public static float GetCumVolume(Pawn pawn, CompHediffBodyPart part)
|
||||
{
|
||||
float res;
|
||||
|
||||
try
|
||||
{
|
||||
res = part.FluidAmmount * part.FluidModifier * pawn.BodySize / pawn.RaceProps.baseBodySize * Rand.Range(0.8f, 1.2f) * 0.3f;
|
||||
}
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
res = 0.0f;
|
||||
}
|
||||
if (pawn.Has(Quirk.Messy)) res *= Rand.Range(4.0f, 8.0f);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
public static List<CompHediffBodyPart> GetAllBodyPartComps(List<Hediff> hediffs)
|
||||
{
|
||||
List<CompHediffBodyPart> bodyPartComps = new List<CompHediffBodyPart>();
|
||||
|
||||
foreach (Hediff bodyPart in hediffs)
|
||||
{
|
||||
CompHediffBodyPart bodyPartComp = bodyPart.TryGetComp<CompHediffBodyPart>();
|
||||
if (bodyPartComp != null)
|
||||
bodyPartComps.Add(bodyPartComp);
|
||||
}
|
||||
|
||||
return bodyPartComps;
|
||||
}
|
||||
|
||||
public static CompHediffBodyPart GetOneBodyPartComp(List<Hediff> hediffs)
|
||||
{
|
||||
CompHediffBodyPart part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp<CompHediffBodyPart>();
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
public static void TryFeedCum(SexProps props)
|
||||
{
|
||||
if (!Genital_Helper.has_penis_fertile(props.pawn))
|
||||
return;
|
||||
|
||||
if (!PawnsPenisIsInPartnersMouth(props))
|
||||
return;
|
||||
|
||||
float cumAmount = CumUtility.GetOnePartCumVolume(props.pawn);
|
||||
|
||||
if (cumAmount <= 0)
|
||||
return;
|
||||
|
||||
FeedCum(props.partner, cumAmount);
|
||||
}
|
||||
|
||||
private static bool PawnsPenisIsInPartnersMouth(SexProps props)
|
||||
{
|
||||
var interaction = rjw.Modules.Interactions.Helpers.InteractionHelper.GetWithExtension(props.dictionaryKey);
|
||||
|
||||
if (props.pawn == props.GetInteractionInitiator())
|
||||
{
|
||||
if (!interaction.DominantHasTag(GenitalTag.CanPenetrate) && !interaction.DominantHasFamily(GenitalFamily.Penis))
|
||||
return false;
|
||||
var requirement = interaction.SelectorExtension.submissiveRequirement;
|
||||
if (!requirement.mouth && !requirement.beak && !requirement.mouthORbeak)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!interaction.SubmissiveHasTag(GenitalTag.CanPenetrate) && !interaction.SubmissiveHasFamily(GenitalFamily.Penis))
|
||||
return false;
|
||||
var requirement = interaction.SelectorExtension.dominantRequirement;
|
||||
if (!requirement.mouth && !requirement.beak && !requirement.mouthORbeak)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void FeedCum(Pawn pawn, float amount)
|
||||
{
|
||||
const float allOf = 1000f;
|
||||
|
||||
log.Message($"FeedCum({pawn.NameShortColored}, {amount})");
|
||||
Thing cum = ThingMaker.MakeThing(VariousDefOf.GatheredCum);
|
||||
cum.stackCount = (int)Math.Ceiling(amount);
|
||||
log.Message($"Created a stack of {cum.stackCount} cum");
|
||||
cum.Ingested(pawn, allOf);
|
||||
log.Message($"{pawn.NameShortColored} ingested cum");
|
||||
}
|
||||
|
||||
public static void FillCumBuckets(SexProps props)
|
||||
{
|
||||
xxx.rjwSextype sextype = props.sexType;
|
||||
|
||||
bool sexFillsCumbuckets =
|
||||
// Base: Fill Cumbuckets on Masturbation. Having no partner means it must be masturbation too
|
||||
sextype == xxx.rjwSextype.Masturbation || props.partner == null
|
||||
// Depending on configuration, also fill cumbuckets when certain sextypes are matched
|
||||
|| (SexperienceMod.Settings.SexCanFillBuckets && (sextype == xxx.rjwSextype.Boobjob || sextype == xxx.rjwSextype.Footjob || sextype == xxx.rjwSextype.Handjob));
|
||||
|
||||
if (!sexFillsCumbuckets)
|
||||
return;
|
||||
|
||||
IEnumerable<Building_CumBucket> buckets = props.pawn.GetAdjacentBuildings<Building_CumBucket>();
|
||||
|
||||
if (buckets?.EnumerableCount() > 0)
|
||||
{
|
||||
var initialCum = CumUtility.GetCumVolume(props.pawn);
|
||||
foreach (Building_CumBucket bucket in buckets)
|
||||
{
|
||||
bucket.AddCum(initialCum / buckets.EnumerableCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Cum.FilterWorkers
|
||||
{
|
||||
public class SpecialThingFilterWorker_Cum : SpecialThingFilterWorker_CumBase
|
||||
{
|
||||
public override bool Matches(Thing t)
|
||||
{
|
||||
return IsCum(t) || IsFoodWithCum(t);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Cum.FilterWorkers
|
||||
{
|
||||
public abstract class SpecialThingFilterWorker_CumBase : SpecialThingFilterWorker
|
||||
{
|
||||
public override bool CanEverMatch(ThingDef def)
|
||||
{
|
||||
return def.IsIngestible && def.IsProcessedFood;
|
||||
}
|
||||
|
||||
protected bool IsCum(Thing t) => IsCum(t.def);
|
||||
|
||||
protected bool IsCum(ThingDef t) => t == VariousDefOf.GatheredCum;
|
||||
|
||||
protected bool IsFoodWithCum(Thing food)
|
||||
{
|
||||
CompIngredients compIngredients = food.TryGetComp<CompIngredients>();
|
||||
|
||||
if (compIngredients == null)
|
||||
return false;
|
||||
|
||||
foreach (ThingDef ingredient in compIngredients.ingredients)
|
||||
{
|
||||
if (IsCum(ingredient))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Cum.FilterWorkers
|
||||
{
|
||||
public class SpecialThingFilterWorker_NoCum : SpecialThingFilterWorker_CumBase
|
||||
{
|
||||
public override bool Matches(Thing t)
|
||||
{
|
||||
return !IsCum(t) && !IsFoodWithCum(t);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Cum
|
||||
{
|
||||
public class IngestionOutcomeDoer_RecordEatenCum : IngestionOutcomeDoer
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public float unitAmount = 1.0f;
|
||||
|
||||
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
|
||||
{
|
||||
int amount = ingested.stackCount * (int)unitAmount;
|
||||
Logs.LogManager.GetLogger<IngestionOutcomeDoer_RecordEatenCum, Logs.DebugLogProvider>().Message($"Record {pawn.NameShortColored} eating {amount} ml of cum");
|
||||
pawn.records.Increment(VariousDefOf.NumofEatenCum);
|
||||
pawn.records.AddTo(VariousDefOf.AmountofEatenCum, amount);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
using RimWorld;
|
||||
using rjw.Modules.Interactions.Contexts;
|
||||
using rjw.Modules.Interactions.Enums;
|
||||
using rjw.Modules.Interactions.Rules.PartKindUsageRules;
|
||||
using rjw.Modules.Shared;
|
||||
using RJWSexperience.Logs;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Cum.Interactions
|
||||
{
|
||||
public class CumAddictPartKindUsageRule : IPartPreferenceRule
|
||||
{
|
||||
public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context)
|
||||
{
|
||||
if (context.Internals.Submissive.Parts.Penises.Any())
|
||||
return GetForCumAddict(context.Internals.Dominant.Pawn);
|
||||
|
||||
if (AddictionUtility.IsAddicted(context.Internals.Submissive.Pawn, VariousDefOf.Cum))
|
||||
return GetForPartner();
|
||||
|
||||
return Enumerable.Empty<Weighted<LewdablePartKind>>();
|
||||
}
|
||||
|
||||
public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context)
|
||||
{
|
||||
if (context.Internals.Dominant.Parts.Penises.Any())
|
||||
return GetForCumAddict(context.Internals.Submissive.Pawn);
|
||||
|
||||
if (AddictionUtility.IsAddicted(context.Internals.Dominant.Pawn, VariousDefOf.Cum))
|
||||
return GetForPartner();
|
||||
|
||||
return Enumerable.Empty<Weighted<LewdablePartKind>>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Addict wants to use mouth
|
||||
/// </summary>
|
||||
private IEnumerable<Weighted<LewdablePartKind>> GetForCumAddict(Pawn pawn)
|
||||
{
|
||||
var log = LogManager.GetLogger<CumAddictPartKindUsageRule, DebugLogProvider>();
|
||||
log.Message($"Called for {pawn.NameShortColored}");
|
||||
|
||||
if (!(pawn.needs?.TryGetNeed(VariousDefOf.Chemical_Cum) is Need_Chemical cumNeed))
|
||||
yield break;
|
||||
|
||||
log.Message($"{pawn.NameShortColored} is cum addict, current desire level: {cumNeed.CurCategory}");
|
||||
|
||||
yield return new Weighted<LewdablePartKind>(Multipliers.DoubledPlus, LewdablePartKind.Mouth);
|
||||
|
||||
// In dire need also they are also refuse to use other orifices
|
||||
switch (cumNeed.CurCategory)
|
||||
{
|
||||
case DrugDesireCategory.Desire:
|
||||
yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Anus);
|
||||
yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Vagina);
|
||||
break;
|
||||
|
||||
case DrugDesireCategory.Withdrawal:
|
||||
yield return new Weighted<LewdablePartKind>(Multipliers.Never, LewdablePartKind.Anus);
|
||||
yield return new Weighted<LewdablePartKind>(Multipliers.Never, LewdablePartKind.Vagina);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Addict asks partner to use penis
|
||||
/// </summary>
|
||||
private IEnumerable<Weighted<LewdablePartKind>> GetForPartner()
|
||||
{
|
||||
yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Penis);
|
||||
}
|
||||
}
|
||||
}
|
39
Source/RJWSexperience/Cum/Thought_AteCum.cs
Normal file
39
Source/RJWSexperience/Cum/Thought_AteCum.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using RimWorld;
|
||||
|
||||
namespace RJWSexperience // Change in namespace will lead to save incompatibility
|
||||
{
|
||||
public class Thought_AteCum : Thought_Recordbased
|
||||
{
|
||||
public override int CurStageIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
if (pawn?.health?.hediffSet?.HasHediff(VariousDefOf.CumAddiction) ?? false)
|
||||
return def.stages.Count - 1;
|
||||
return base.CurStageIndex;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool TryMergeWithExistingMemory(out bool showBubble)
|
||||
{
|
||||
ThoughtHandler thoughts = pawn.needs.mood.thoughts;
|
||||
if (thoughts.memories.NumMemoriesInGroup(this) >= def.stackLimit)
|
||||
{
|
||||
Thought_AteCum thought_Memory = (Thought_AteCum)thoughts.memories.OldestMemoryInGroup(this);
|
||||
if (thought_Memory != null)
|
||||
{
|
||||
showBubble = thought_Memory.age > thought_Memory.def.DurationTicks / 2;
|
||||
thought_Memory.Merged();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
showBubble = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected virtual void Merged()
|
||||
{
|
||||
age = 0;
|
||||
}
|
||||
}
|
||||
}
|
107
Source/RJWSexperience/DebugAction.cs
Normal file
107
Source/RJWSexperience/DebugAction.cs
Normal file
|
@ -0,0 +1,107 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using RJWSexperience.SexHistory;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public static class DebugToolsSexperience
|
||||
{
|
||||
[DebugAction("RJW Sexperience", "Reset pawn's record", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void ResetRecords(Pawn p)
|
||||
{
|
||||
Trait virgin = p.story?.traits?.GetTrait(VariousDefOf.Virgin);
|
||||
if (virgin != null) p.story.traits.RemoveTrait(virgin);
|
||||
ResetRecord(p, true);
|
||||
if (ResetRecord(p, false))
|
||||
Virginity.TraitHandler.GenerateVirginTrait(p);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!");
|
||||
}
|
||||
|
||||
[DebugAction("RJW Sexperience", "Reset pawn's record(virgin)", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void ResetRecordsZero(Pawn p)
|
||||
{
|
||||
ResetRecord(p, true);
|
||||
Virginity.TraitHandler.AddVirginTrait(p);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Records resetted!\nVirginified!");
|
||||
}
|
||||
|
||||
[DebugAction("RJW Sexperience", "Reset lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void ResetLust(Pawn p)
|
||||
{
|
||||
float lust = RecordRandomizer.RandomizeLust(p);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + lust);
|
||||
}
|
||||
|
||||
[DebugAction("RJW Sexperience", "Set lust to 0", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void SetLust(Pawn p)
|
||||
{
|
||||
p.records.SetTo(VariousDefOf.Lust, 0);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: 0");
|
||||
}
|
||||
|
||||
|
||||
[DebugAction("RJW Sexperience", "Add 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void AddLust(Pawn p)
|
||||
{
|
||||
p.records.AddTo(VariousDefOf.Lust, 10);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust));
|
||||
}
|
||||
|
||||
[DebugAction("RJW Sexperience", "Subtract 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)]
|
||||
private static void SubtractLust(Pawn p)
|
||||
{
|
||||
p.records.AddTo(VariousDefOf.Lust, -10);
|
||||
MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust));
|
||||
}
|
||||
|
||||
private static bool ResetRecord(Pawn pawn, bool allzero)
|
||||
{
|
||||
if (!allzero)
|
||||
{
|
||||
if (SexperienceMod.Settings.History.EnableRecordRandomizer && xxx.is_human(pawn))
|
||||
{
|
||||
return RecordRandomizer.Randomize(pawn);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pawn.records.SetTo(VariousDefOf.Lust, 0);
|
||||
pawn.records.SetTo(VariousDefOf.NumofEatenCum, 0);
|
||||
pawn.records.SetTo(VariousDefOf.AmountofEatenCum, 0);
|
||||
pawn.records.SetTo(VariousDefOf.VaginalSexCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.AnalSexCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.OralSexCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.BlowjobCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.CunnilingusCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.GenitalCaressCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.HandjobCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.FingeringCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.FootjobCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.MiscSexualBehaviorCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.SexPartnerCount, 0);
|
||||
pawn.records.SetTo(VariousDefOf.OrgasmCount, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByAnimals, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByHumanlikes, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByInsects, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBeenRapedByOthers, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBirthAnimal, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBirthEgg, 0);
|
||||
pawn.records.SetTo(xxx.CountOfBirthHuman, 0);
|
||||
pawn.records.SetTo(xxx.CountOfFappin, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedAnimals, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedHumanlikes, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedInsects, 0);
|
||||
pawn.records.SetTo(xxx.CountOfRapedOthers, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSex, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithAnimals, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithCorpse, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithHumanlikes, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithInsects, 0);
|
||||
pawn.records.SetTo(xxx.CountOfSexWithOthers, 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
97
Source/RJWSexperience/ExtensionMethods/PawnExtensions.cs
Normal file
97
Source/RJWSexperience/ExtensionMethods/PawnExtensions.cs
Normal file
|
@ -0,0 +1,97 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public static class PawnExtensions
|
||||
{
|
||||
public static bool IsIncest(this Pawn pawn, Pawn otherpawn)
|
||||
{
|
||||
if (otherpawn == null)
|
||||
return false;
|
||||
|
||||
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(otherpawn);
|
||||
if (relations.EnumerableNullOrEmpty())
|
||||
return false;
|
||||
|
||||
foreach (PawnRelationDef relation in relations)
|
||||
{
|
||||
if (relation.incestOpinionOffset < 0)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static float GetSexStat(this Pawn pawn)
|
||||
{
|
||||
if (xxx.is_human(pawn) && !pawn.Dead)
|
||||
return pawn.GetStatValue(VariousDefOf.SexAbility);
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
public static T GetAdjacentBuilding<T>(this Pawn pawn) where T : Building
|
||||
{
|
||||
if (!pawn.Spawned)
|
||||
return null;
|
||||
|
||||
EdificeGrid edifice = pawn.Map.edificeGrid;
|
||||
if (edifice[pawn.Position] is T building)
|
||||
return building;
|
||||
foreach (IntVec3 pos in GenAdjFast.AdjacentCells8Way(pawn.Position))
|
||||
{
|
||||
if (edifice[pos] is T adjBuilding)
|
||||
return adjBuilding;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static IEnumerable<T> GetAdjacentBuildings<T>(this Pawn pawn) where T : Building
|
||||
{
|
||||
var results = new List<T>();
|
||||
|
||||
if (!pawn.Spawned)
|
||||
return results;
|
||||
|
||||
EdificeGrid edifice = pawn.Map.edificeGrid;
|
||||
if (edifice[pawn.Position] is T building)
|
||||
results.Add(building);
|
||||
foreach (IntVec3 pos in GenAdjFast.AdjacentCells8Way(pawn.Position))
|
||||
{
|
||||
if (edifice[pos] is T adjBuilding)
|
||||
results.Add(adjBuilding);
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the pawn is virgin, return true.
|
||||
/// </summary>
|
||||
public static bool IsVirgin(this Pawn pawn)
|
||||
{
|
||||
return pawn.records.GetValue(VariousDefOf.VaginalSexCount) == 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If pawn is virgin, lose his/her virginity.
|
||||
/// </summary>
|
||||
public static void PoptheCherry(this Pawn pawn, Pawn partner, SexProps props)
|
||||
{
|
||||
if (props?.sexType != xxx.rjwSextype.Vaginal)
|
||||
return;
|
||||
|
||||
int? removedDegree = Virginity.TraitHandler.RemoveVirginTrait(pawn);
|
||||
|
||||
if (pawn.IsVirgin())
|
||||
{
|
||||
pawn.TryGetComp<SexHistory.SexHistoryComp>()?.RecordFirst(partner, props);
|
||||
if (removedDegree != null)
|
||||
Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true);
|
||||
}
|
||||
|
||||
if (removedDegree != null)
|
||||
RJWUtility.ThrowVirginHistoryEvent(pawn, partner, props, (int)removedDegree);
|
||||
}
|
||||
}
|
||||
}
|
29
Source/RJWSexperience/ExtensionMethods/SexPropsExtensions.cs
Normal file
29
Source/RJWSexperience/ExtensionMethods/SexPropsExtensions.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using Verse;
|
||||
using rjw;
|
||||
|
||||
namespace RJWSexperience.ExtensionMethods
|
||||
{
|
||||
public static class SexPropsExtensions
|
||||
{
|
||||
public static Pawn GetInteractionInitiator(this SexProps props)
|
||||
{
|
||||
if (props.isReceiver)
|
||||
{
|
||||
return props.partner;
|
||||
}
|
||||
else
|
||||
{
|
||||
return props.pawn;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsBestiality(this SexProps props)
|
||||
{
|
||||
if (props.partner != null)
|
||||
{
|
||||
return props.pawn.IsAnimal() ^ props.partner.IsAnimal();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
8
Source/RJWSexperience/GlobalSuppressions.cs
Normal file
8
Source/RJWSexperience/GlobalSuppressions.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// This file is used by Code Analysis to maintain SuppressMessage
|
||||
// attributes that are applied to this project.
|
||||
// Project-level suppressions either have no target or are given
|
||||
// a specific target and scoped to a namespace, type, member, etc.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
[assembly: SuppressMessage("Minor Code Smell", "S101:Types should be named in PascalCase", Justification = "Rimworld naming conventions")]
|
33
Source/RJWSexperience/Harmony.cs
Normal file
33
Source/RJWSexperience/Harmony.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
using Verse;
|
||||
using rjw.Modules.Interactions.Internals.Implementation;
|
||||
using rjw.Modules.Interactions.Rules.PartKindUsageRules;
|
||||
using System.Collections.Generic;
|
||||
using rjw;
|
||||
using RJWSexperience.Logs;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
[StaticConstructorOnStartup]
|
||||
internal static class First
|
||||
{
|
||||
static First()
|
||||
{
|
||||
var har = new Harmony("RJW_Sexperience");
|
||||
har.PatchAll(Assembly.GetExecutingAssembly());
|
||||
Pawn_GetGizmos.DoConditionalPatch(har);
|
||||
|
||||
InjectIntoRjwInteractionServices();
|
||||
}
|
||||
|
||||
public static void InjectIntoRjwInteractionServices()
|
||||
{
|
||||
var log = LogManager.GetLogger("StaticConstructorOnStartup");
|
||||
|
||||
List<IPartPreferenceRule> partKindUsageRules = Unprivater.GetProtectedValue<List<IPartPreferenceRule>>("_partKindUsageRules", typeof(PartPreferenceDetectorService));
|
||||
partKindUsageRules.Add(new Cum.Interactions.CumAddictPartKindUsageRule());
|
||||
log.Message("Added 1 rule to PartPreferenceDetectorService._partKindUsageRules");
|
||||
}
|
||||
}
|
||||
}
|
67
Source/RJWSexperience/JobGiver_Orgy.cs
Normal file
67
Source/RJWSexperience/JobGiver_Orgy.cs
Normal file
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public class JobGiver_Orgy : ThinkNode_JobGiver
|
||||
{
|
||||
/// <summary> Checks all of our potential partners to see if anyone's eligible, returning the most attractive and convenient one. </summary>
|
||||
protected override Job TryGiveJob(Pawn pawn)
|
||||
{
|
||||
if (!RJWHookupSettings.HookupsEnabled || !RJWHookupSettings.QuickHookupsEnabled)
|
||||
return null;
|
||||
|
||||
if (pawn.Drafted)
|
||||
return null;
|
||||
|
||||
if (!SexUtility.ReadyForHookup(pawn))
|
||||
return null;
|
||||
|
||||
// We increase the time right away to prevent the fairly expensive check from happening too frequently
|
||||
SexUtility.IncreaseTicksToNextHookup(pawn);
|
||||
|
||||
// If the pawn is a whore, or recently had sex, skip the job unless they're really horny
|
||||
if (!xxx.is_frustrated(pawn) && (xxx.is_whore(pawn) || !SexUtility.ReadyForLovin(pawn)))
|
||||
return null;
|
||||
|
||||
// This check attempts to keep groups leaving the map, like guests or traders, from turning around to hook up
|
||||
if (pawn.mindState?.duty?.def == DutyDefOf.TravelOrLeave)
|
||||
{
|
||||
// TODO: Some guest pawns keep the TravelOrLeave duty the whole time, I think the ones assigned to guard the pack animals.
|
||||
// That's probably ok, though it wasn't the intention.
|
||||
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($" Quickie.TryGiveJob:({xxx.get_pawnname(pawn)}): has TravelOrLeave, no time for lovin!");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (pawn.CurJob == null)
|
||||
{
|
||||
//--Log.Message(" checking pawn and abilities");
|
||||
if (CasualSex_Helper.CanHaveSex(pawn))
|
||||
{
|
||||
//--Log.Message(" finding partner");
|
||||
Pawn partner = CasualSex_Helper.find_partner(pawn, pawn.Map, false);
|
||||
|
||||
//--Log.Message(" checking partner");
|
||||
if (partner == null)
|
||||
return null;
|
||||
|
||||
// Interrupt current job.
|
||||
if (pawn.CurJob != null && pawn.jobs.curDriver != null)
|
||||
pawn.jobs.curDriver.EndJobWith(JobCondition.InterruptForced);
|
||||
|
||||
//--Log.Message(" returning job");
|
||||
return JobMaker.MakeJob(xxx.quick_sex, partner);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
155
Source/RJWSexperience/Keyed.cs
Normal file
155
Source/RJWSexperience/Keyed.cs
Normal file
|
@ -0,0 +1,155 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using RJWSexperience.SexHistory.UI;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public static class Keyed
|
||||
{
|
||||
public static string RS_LostVirgin(string pawn, string partner) => "RS_LostVirgin".Translate(pawn.Colorize(Color.yellow), partner.Colorize(Color.yellow));
|
||||
public static string RS_Sex_Info(string sextype, string sexcount) => "RS_Sex_Info".Translate(sextype, sexcount);
|
||||
public static string RS_SAT_AVG(string avgsat) => "RS_SAT_AVG".Translate(avgsat);
|
||||
public static string RS_HadBestSexDaysAgo(string days) => "RS_HadBestSexDaysAgo".Translate(days);
|
||||
|
||||
public static readonly string Mod_Title = "RS_Mod_Title".Translate();
|
||||
public static readonly string RSTotalGatheredCum = "RSTotalGatheredCum".Translate();
|
||||
public static readonly string RS_Best_Sextype = "RS_Best_Sextype".Translate();
|
||||
public static readonly string RS_Recent_Sextype = "RS_Recent_Sextype".Translate();
|
||||
public static readonly string RS_Sex_Partners = "RS_Sex_Partners".Translate();
|
||||
public static readonly string RS_Cum_Swallowed = "RS_Cum_Swallowed".Translate();
|
||||
public static readonly string RS_Selected_Partner = "RS_Selected_Partner".Translate();
|
||||
public static readonly string RS_Sex_Count = "RS_Sex_Count".Translate();
|
||||
public static readonly string RS_Orgasms = "RS_Orgasms".Translate();
|
||||
public static readonly string RS_Recent_Sex_Partner = "RS_Recent_Sex_Partner".Translate();
|
||||
public static readonly string RS_First_Sex_Partner = "RS_First_Sex_Partner".Translate();
|
||||
public static readonly string RS_Most_Sex_Partner = "RS_Most_Sex_Partner".Translate();
|
||||
public static readonly string RS_Best_Sex_Partner = "RS_Best_Sex_Partner".Translate();
|
||||
public static readonly string RS_VirginsTaken = "RS_VirginsTaken".Translate();
|
||||
public static readonly string RS_TotalSexHad = "RS_TotalSexHad".Translate();
|
||||
public static readonly string RS_Recent_Sex_Partner_ToolTip = "RS_Recent_Sex_Partner_ToolTip".Translate();
|
||||
public static readonly string RS_First_Sex_Partner_ToolTip = "RS_First_Sex_Partner_ToolTip".Translate();
|
||||
public static readonly string RS_Most_Sex_Partner_ToolTip = "RS_Most_Sex_Partner_ToolTip".Translate();
|
||||
public static readonly string RS_Best_Sex_Partner_ToolTip = "RS_Best_Sex_Partner_ToolTip".Translate();
|
||||
public static readonly string RS_Raped = "RS_Raped".Translate();
|
||||
public static readonly string RS_RapedMe = "RS_RapedMe".Translate();
|
||||
public static readonly string RS_Sex_History = "RS_Sex_History".Translate();
|
||||
public static readonly string RS_Statistics = "RS_Statistics".Translate();
|
||||
public static readonly string RS_PartnerList = "RS_PartnerList".Translate();
|
||||
public static readonly string RS_Sexuality = "RS_Sexuality".Translate();
|
||||
public static readonly string RS_BeenRaped = "RS_BeenRaped".Translate();
|
||||
public static readonly string RS_RapedSomeone = "RS_RapedSomeone".Translate();
|
||||
public static readonly string RS_PreferRace = "RS_PreferRace".Translate();
|
||||
public static readonly string Lust = "Lust".Translate();
|
||||
public static readonly string Unknown = "Unknown".Translate();
|
||||
public static readonly string Incest = "Incest".Translate();
|
||||
public static readonly string None = "None".Translate();
|
||||
public static readonly string RS_Bestiality = "RS_Bestiality".Translate();
|
||||
public static readonly string RS_Interspecies = "RS_Interspecies".Translate();
|
||||
public static readonly string RS_Necrophile = "RS_Necrophile".Translate();
|
||||
public static readonly string RS_SexSkill = "RS_SexSkill".Translate();
|
||||
public static readonly string RS_NumofTimes = "RS_NumofTimes".Translate();
|
||||
public static readonly string RS_Ago = "RS_Ago".Translate();
|
||||
public static readonly string RS_LastSex = "RS_LastSex".Translate();
|
||||
[MayRequireRoyalty] public static readonly string Slave = "Slave".Translate();
|
||||
|
||||
public static readonly string TabLabelMain = "RSTabLabelMain".Translate();
|
||||
public static readonly string TabLabelHistory = "RSTabLabelHistory".Translate();
|
||||
public static readonly string TabLabelDebug = "RSTabLabelDebug".Translate();
|
||||
|
||||
public static readonly string Option_1_Label = "RSOption_1_Label".Translate();
|
||||
public static readonly string Option_1_Desc = "RSOption_1_Desc".Translate();
|
||||
public static readonly string Option_2_Label = "RSOption_2_Label".Translate();
|
||||
public static readonly string Option_2_Desc = "RSOption_2_Desc".Translate();
|
||||
public static readonly string Option_3_Label = "RSOption_3_Label".Translate();
|
||||
public static readonly string Option_3_Desc = "RSOption_3_Desc".Translate();
|
||||
public static readonly string Option_4_Label = "RSOption_4_Label".Translate();
|
||||
public static readonly string Option_4_Desc = "RSOption_4_Desc".Translate();
|
||||
public static readonly string Option_5_Label = "RSOption_5_Label".Translate();
|
||||
public static readonly string Option_5_Desc = "RSOption_5_Desc".Translate();
|
||||
public static readonly string Option_6_Label = "RSOption_6_Label".Translate();
|
||||
public static readonly string Option_6_Desc = "RSOption_6_Desc".Translate();
|
||||
public static readonly string Option_7_Label = "RSOption_7_Label".Translate();
|
||||
public static readonly string Option_7_Desc = "RSOption_7_Desc".Translate();
|
||||
public static readonly string Option_8_Label = "RSOption_8_Label".Translate();
|
||||
public static readonly string Option_8_Desc = "RSOption_8_Desc".Translate();
|
||||
public static readonly string Option_9_Label = "RSOption_9_Label".Translate();
|
||||
public static readonly string Option_9_Desc = "RSOption_9_Desc".Translate();
|
||||
public static readonly string Option_10_Label = "RSOption_10_Label".Translate();
|
||||
public static readonly string Option_10_Desc = "RSOption_10_Desc".Translate();
|
||||
public static readonly string Option_MinSexableFromLifestage_Label = "RSOption_MinSexableFromLifestage_Label".Translate();
|
||||
public static readonly string Option_MinSexableFromLifestage_Desc = "RSOption_MinSexableFromLifestage_Desc".Translate();
|
||||
public static readonly string Option_MaxSingleLustChange_Label = "RSOption_MaxSingleLustChange_Label".Translate();
|
||||
public static readonly string Option_MaxSingleLustChange_Desc = "RSOption_MaxSingleLustChange_Desc".Translate();
|
||||
public static readonly string Option_EnableBastardRelation_Label = "RSOption_EnableBastardRelation_Label".Translate();
|
||||
public static readonly string Option_EnableBastardRelation_Desc = "RSOption_EnableBastardRelation_Desc".Translate();
|
||||
public static readonly string Option_SexCanFillBuckets_Label = "RSOption_SexCanFillBuckets_Label".Translate();
|
||||
public static readonly string Option_SexCanFillBuckets_Desc = "RSOption_SexCanFillBuckets_Desc".Translate();
|
||||
public static readonly string Option_Debug_Label = "RSOption_Debug_Label".Translate();
|
||||
public static readonly string Option_Debug_Desc = "RSOption_Debug_Desc".Translate();
|
||||
public static readonly string Option_EnableSexHistory_Label = "RSOption_EnableSexHistory_Label".Translate();
|
||||
public static readonly string Option_EnableSexHistory_Desc = "RSOption_EnableSexHistory_Desc".Translate();
|
||||
public static readonly string Option_HideGizmoWhenDrafted_Label = "RSOption_HideGizmoWhenDrafted_Label".Translate();
|
||||
public static readonly string Option_HideGizmoWhenDrafted_Desc = "RSOption_HideGizmoWhenDrafted_Desc".Translate();
|
||||
public static readonly string Option_HideGizmoWithRJW_Label = "RSOption_HideGizmoWithRJW_Label".Translate();
|
||||
public static readonly string Option_HideGizmoWithRJW_Desc = "RSOption_HideGizmoWithRJW_Desc".Translate();
|
||||
public static readonly string Button_ResetToDefault = "Button_ResetToDefault".Translate();
|
||||
|
||||
public static string Translate(this PartnerOrderMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case PartnerOrderMode.Normal:
|
||||
default:
|
||||
return "RS_PONormal".Translate();
|
||||
case PartnerOrderMode.Recent:
|
||||
return "RS_PoRecent".Translate();
|
||||
case PartnerOrderMode.Most:
|
||||
return "RS_PoMost".Translate();
|
||||
case PartnerOrderMode.Name:
|
||||
return "RS_PoName".Translate();
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly string[] Sextype =
|
||||
{
|
||||
((xxx.rjwSextype)0).ToString().Translate(),
|
||||
((xxx.rjwSextype)1).ToString().Translate(),
|
||||
((xxx.rjwSextype)2).ToString().Translate(),
|
||||
((xxx.rjwSextype)3).ToString().Translate(),
|
||||
((xxx.rjwSextype)4).ToString().Translate(),
|
||||
((xxx.rjwSextype)5).ToString().Translate(),
|
||||
((xxx.rjwSextype)6).ToString().Translate(),
|
||||
((xxx.rjwSextype)7).ToString().Translate(),
|
||||
((xxx.rjwSextype)8).ToString().Translate(),
|
||||
((xxx.rjwSextype)9).ToString().Translate(),
|
||||
((xxx.rjwSextype)10).ToString().Translate(),
|
||||
((xxx.rjwSextype)11).ToString().Translate(),
|
||||
((xxx.rjwSextype)12).ToString().Translate(),
|
||||
((xxx.rjwSextype)13).ToString().Translate(),
|
||||
((xxx.rjwSextype)14).ToString().Translate(),
|
||||
((xxx.rjwSextype)15).ToString().Translate(),
|
||||
((xxx.rjwSextype)16).ToString().Translate(),
|
||||
((xxx.rjwSextype)17).ToString().Translate(),
|
||||
((xxx.rjwSextype)18).ToString().Translate(),
|
||||
((xxx.rjwSextype)19).ToString().Translate(),
|
||||
((xxx.rjwSextype)20).ToString().Translate()
|
||||
};
|
||||
|
||||
public static readonly string[] Sexuality =
|
||||
{
|
||||
((Orientation)0).ToString().Translate(),
|
||||
((Orientation)1).ToString().Translate(),
|
||||
((Orientation)2).ToString().Translate(),
|
||||
((Orientation)3).ToString().Translate(),
|
||||
((Orientation)4).ToString().Translate(),
|
||||
((Orientation)5).ToString().Translate(),
|
||||
((Orientation)6).ToString().Translate(),
|
||||
((Orientation)7).ToString().Translate(),
|
||||
((Orientation)8).ToString().Translate(),
|
||||
((Orientation)9).ToString().Translate(),
|
||||
((Orientation)10).ToString().Translate()
|
||||
};
|
||||
}
|
||||
}
|
9
Source/RJWSexperience/Logs/DebugLogProvider.cs
Normal file
9
Source/RJWSexperience/Logs/DebugLogProvider.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using rjw.Modules.Shared.Logs;
|
||||
|
||||
namespace RJWSexperience.Logs
|
||||
{
|
||||
public class DebugLogProvider : ILogProvider
|
||||
{
|
||||
public bool IsActive => SexperienceMod.Settings.Debug.DevMode;
|
||||
}
|
||||
}
|
113
Source/RJWSexperience/Logs/LogManager.cs
Normal file
113
Source/RJWSexperience/Logs/LogManager.cs
Normal file
|
@ -0,0 +1,113 @@
|
|||
using rjw.Modules.Shared.Logs;
|
||||
using System;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Logs
|
||||
{
|
||||
// Copy of RJW code because of hardcoded mod name prefix. Maybe TODO: update RJW's version to accept prefix from LogProvider
|
||||
public static class LogManager
|
||||
{
|
||||
public const string LogPrefix = "[Sexperience]";
|
||||
|
||||
private class Logger : ILog
|
||||
{
|
||||
private readonly string _loggerTypeName;
|
||||
private readonly ILogProvider _logProvider;
|
||||
|
||||
public Logger(string typeName, ILogProvider logProvider = null)
|
||||
{
|
||||
_loggerTypeName = typeName;
|
||||
_logProvider = logProvider;
|
||||
}
|
||||
|
||||
public void Debug(string message)
|
||||
{
|
||||
LogDebug(CreateLogMessage(message));
|
||||
}
|
||||
public void Debug(string message, Exception e)
|
||||
{
|
||||
LogDebug(CreateLogMessage(message, e));
|
||||
}
|
||||
|
||||
public void Message(string message)
|
||||
{
|
||||
LogMessage(CreateLogMessage(message));
|
||||
}
|
||||
public void Message(string message, Exception e)
|
||||
{
|
||||
LogMessage(CreateLogMessage(message, e));
|
||||
}
|
||||
|
||||
public void Warning(string message)
|
||||
{
|
||||
LogWarning(CreateLogMessage(message));
|
||||
}
|
||||
public void Warning(string message, Exception e)
|
||||
{
|
||||
LogWarning(CreateLogMessage(message, e));
|
||||
}
|
||||
|
||||
public void Error(string message)
|
||||
{
|
||||
LogError(CreateLogMessage(message));
|
||||
}
|
||||
public void Error(string message, Exception e)
|
||||
{
|
||||
LogError(CreateLogMessage(message, e));
|
||||
}
|
||||
|
||||
private string CreateLogMessage(string message)
|
||||
{
|
||||
return $"{LogPrefix} [{_loggerTypeName}] {message}";
|
||||
}
|
||||
private string CreateLogMessage(string message, Exception exception)
|
||||
{
|
||||
return $"{CreateLogMessage(message)}{Environment.NewLine}{exception}";
|
||||
}
|
||||
|
||||
private void LogDebug(string message)
|
||||
{
|
||||
if (_logProvider?.IsActive != false)
|
||||
{
|
||||
Log.Message(message);
|
||||
}
|
||||
}
|
||||
private void LogMessage(string message)
|
||||
{
|
||||
if (_logProvider?.IsActive != false)
|
||||
{
|
||||
Log.Message(message);
|
||||
}
|
||||
}
|
||||
private void LogWarning(string message)
|
||||
{
|
||||
if (_logProvider?.IsActive != false)
|
||||
{
|
||||
Log.Warning(message);
|
||||
}
|
||||
}
|
||||
private void LogError(string message)
|
||||
{
|
||||
if (_logProvider?.IsActive != false)
|
||||
{
|
||||
Log.Error(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static ILog GetLogger<TType, TLogProvider>()
|
||||
where TLogProvider : ILogProvider, new()
|
||||
{
|
||||
return new Logger(typeof(TType).Name, new TLogProvider());
|
||||
}
|
||||
public static ILog GetLogger<TLogProvider>(string staticTypeName)
|
||||
where TLogProvider : ILogProvider, new()
|
||||
{
|
||||
return new Logger(staticTypeName, new TLogProvider());
|
||||
}
|
||||
public static ILog GetLogger(string staticTypeName)
|
||||
{
|
||||
return new Logger(staticTypeName);
|
||||
}
|
||||
}
|
||||
}
|
108
Source/RJWSexperience/LustUtility.cs
Normal file
108
Source/RJWSexperience/LustUtility.cs
Normal file
|
@ -0,0 +1,108 @@
|
|||
using rjw;
|
||||
using RJWSexperience.Logs;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public static class LustUtility
|
||||
{
|
||||
/// <summary>
|
||||
/// ~0.023.
|
||||
/// No need to calculate this every call
|
||||
/// </summary>
|
||||
private static readonly float magicNum1 = Mathf.Log(10f) / 100;
|
||||
|
||||
/// <summary>
|
||||
/// Transforms lust value into a stat multiplier
|
||||
/// </summary>
|
||||
/// <param name="lust"></param>
|
||||
/// <returns>Positive value</returns>
|
||||
public static float GetLustFactor(float lust)
|
||||
{
|
||||
float effectiveLust = lust * SexperienceMod.Settings.LustEffectPower;
|
||||
if (effectiveLust < 0)
|
||||
{
|
||||
effectiveLust = Mathf.Exp((effectiveLust + 200f) * magicNum1) - 100f;
|
||||
}
|
||||
else
|
||||
{
|
||||
effectiveLust = Mathf.Sqrt((effectiveLust + 25f) * 100f) - 50f;
|
||||
}
|
||||
|
||||
return 1 + (effectiveLust / 100f);
|
||||
}
|
||||
|
||||
public static void DrawGraph(Rect graphRect)
|
||||
{
|
||||
List<SimpleCurveDrawInfo> curves = new List<SimpleCurveDrawInfo>();
|
||||
FloatRange lustRange = new FloatRange(-300f, 300f);
|
||||
|
||||
SimpleCurveDrawInfo simpleCurveDrawInfo = new SimpleCurveDrawInfo
|
||||
{
|
||||
color = Color.yellow,
|
||||
label = "Sex freq mult",
|
||||
valueFormat = "x{0}",
|
||||
curve = new SimpleCurve()
|
||||
};
|
||||
for (float lust = lustRange.min; lust <= lustRange.max; lust++)
|
||||
{
|
||||
simpleCurveDrawInfo.curve.Add(new CurvePoint(lust, GetLustFactor(lust)), false);
|
||||
}
|
||||
|
||||
curves.Add(simpleCurveDrawInfo);
|
||||
|
||||
SimpleCurveDrawerStyle curveDrawerStyle = new SimpleCurveDrawerStyle
|
||||
{
|
||||
UseFixedSection = true,
|
||||
FixedSection = lustRange,
|
||||
UseFixedScale = true,
|
||||
FixedScale = new Vector2(0f, GetLustFactor(lustRange.max)),
|
||||
DrawPoints = false,
|
||||
DrawBackgroundLines = true,
|
||||
DrawCurveMousePoint = true,
|
||||
DrawMeasures = true,
|
||||
MeasureLabelsXCount = 8,
|
||||
MeasureLabelsYCount = 3,
|
||||
XIntegersOnly = true,
|
||||
YIntegersOnly = false,
|
||||
LabelX = Keyed.Lust
|
||||
};
|
||||
SimpleCurveDrawer.DrawCurves(graphRect, curves, curveDrawerStyle);
|
||||
}
|
||||
|
||||
public static void UpdateLust(SexProps props, float satisfaction, float baseSatisfaction)
|
||||
{
|
||||
float? lust = props.pawn.records?.GetValue(VariousDefOf.Lust);
|
||||
|
||||
if (lust == null)
|
||||
return;
|
||||
|
||||
float lustDelta;
|
||||
|
||||
if (props.sexType != xxx.rjwSextype.Masturbation)
|
||||
{
|
||||
lustDelta = satisfaction - baseSatisfaction;
|
||||
if (Mathf.Sign(lustDelta) == Mathf.Sign((float)lust)) // Only if getting closer to the limit
|
||||
lustDelta *= LustIncrementFactor((float)lust);
|
||||
lustDelta = Mathf.Clamp(lustDelta, -SexperienceMod.Settings.MaxSingleLustChange, SexperienceMod.Settings.MaxSingleLustChange); // If the sex is satisfactory, lust grows up. Declines at the opposite.
|
||||
}
|
||||
else
|
||||
{
|
||||
lustDelta = Mathf.Clamp(satisfaction * satisfaction * LustIncrementFactor((float)lust), 0, SexperienceMod.Settings.MaxSingleLustChange); // Masturbation always increases lust.
|
||||
}
|
||||
|
||||
if (lustDelta == 0)
|
||||
return;
|
||||
|
||||
LogManager.GetLogger<DebugLogProvider>("LustUtility").Message($"{props.pawn.NameShortColored}'s lust changed by {lustDelta} (from {lust})");
|
||||
props.pawn.records.AddTo(VariousDefOf.Lust, lustDelta);
|
||||
}
|
||||
|
||||
private static float LustIncrementFactor(float lust)
|
||||
{
|
||||
return Mathf.Exp(-Mathf.Pow(lust / SexperienceMod.Settings.LustLimit, 2));
|
||||
}
|
||||
}
|
||||
}
|
31
Source/RJWSexperience/Patches/DefInjection.cs
Normal file
31
Source/RJWSexperience/Patches/DefInjection.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using RJWSexperience.Logs;
|
||||
using RJWSexperience.SexHistory;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
[StaticConstructorOnStartup]
|
||||
public static class DefInjection
|
||||
{
|
||||
static DefInjection()
|
||||
{
|
||||
if (SexperienceMod.Settings.History.EnableSexHistory)
|
||||
InjectRaces();
|
||||
}
|
||||
|
||||
private static void InjectRaces()
|
||||
{
|
||||
IEnumerable<ThingDef> PawnDefs = DefDatabase<ThingDef>.AllDefs.Where(x => x.race != null && !x.race.IsMechanoid);
|
||||
if (PawnDefs.EnumerableNullOrEmpty())
|
||||
return;
|
||||
|
||||
CompProperties comp = new CompProperties(typeof(SexHistoryComp));
|
||||
foreach (ThingDef def in PawnDefs)
|
||||
def.comps.Add(comp);
|
||||
|
||||
LogManager.GetLogger<DebugLogProvider>("StaticConstructorOnStartup").Message($"Injected SexHistoryComp into {PawnDefs.Count()} pawn Defs");
|
||||
}
|
||||
}
|
||||
}
|
52
Source/RJWSexperience/Patches/GetGizmos.cs
Normal file
52
Source/RJWSexperience/Patches/GetGizmos.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
using HarmonyLib;
|
||||
using RJWSexperience.Logs;
|
||||
using RJWSexperience.SexHistory;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public static class Pawn_GetGizmos
|
||||
{
|
||||
private static Settings.SettingsTabHistory Settings => SexperienceMod.Settings.History;
|
||||
|
||||
public static void DoConditionalPatch(Harmony harmony)
|
||||
{
|
||||
if (!Settings.EnableSexHistory)
|
||||
return;
|
||||
|
||||
MethodInfo original = typeof(Pawn).GetMethod(nameof(Pawn.GetGizmos));
|
||||
MethodInfo postfix = typeof(Pawn_GetGizmos).GetMethod(nameof(Pawn_GetGizmos.Postfix));
|
||||
harmony.Patch(original, postfix: new HarmonyMethod(postfix));
|
||||
|
||||
LogManager.GetLogger<DebugLogProvider>(nameof(Pawn_GetGizmos)).Message("Applied conditional patch to Pawn.GetGizmos()");
|
||||
}
|
||||
|
||||
public static void Postfix(ref IEnumerable<Gizmo> __result, Pawn __instance)
|
||||
{
|
||||
if (Settings.HideGizmoWhenDrafted && __instance.Drafted)
|
||||
return;
|
||||
|
||||
if (Find.Selector.NumSelected > 1)
|
||||
return;
|
||||
|
||||
if (Settings.HideGizmoWithRJW && !rjw.RJWSettings.show_RJW_designation_box)
|
||||
return;
|
||||
|
||||
SexHistoryComp history = __instance.TryGetComp<SexHistoryComp>();
|
||||
if (history == null)
|
||||
return;
|
||||
|
||||
__result = AddHistoryGizmo(history.Gizmo, __result);
|
||||
}
|
||||
|
||||
private static IEnumerable<Gizmo> AddHistoryGizmo(Gizmo historyGizmo, IEnumerable<Gizmo> gizmos)
|
||||
{
|
||||
foreach (Gizmo gizmo in gizmos)
|
||||
yield return gizmo;
|
||||
|
||||
yield return historyGizmo;
|
||||
}
|
||||
}
|
||||
}
|
173
Source/RJWSexperience/Patches/RJW_Patch.cs
Normal file
173
Source/RJWSexperience/Patches/RJW_Patch.cs
Normal file
|
@ -0,0 +1,173 @@
|
|||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using RJWSexperience.Cum;
|
||||
using RJWSexperience.Logs;
|
||||
using RJWSexperience.SexHistory;
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
[HarmonyPatch(typeof(JobDriver_Sex), "Orgasm")]
|
||||
public static class RJW_Patch_Orgasm
|
||||
{
|
||||
public static void Postfix(JobDriver_Sex __instance)
|
||||
{
|
||||
if (__instance.Sexprops.sexType != xxx.rjwSextype.Masturbation && !(__instance is JobDriver_Masturbate))
|
||||
{
|
||||
if (__instance.Sexprops.isRape && __instance.Sexprops.isReceiver)
|
||||
{
|
||||
__instance.pawn?.skills?.Learn(VariousDefOf.Sex, 0.05f, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
__instance.pawn?.skills?.Learn(VariousDefOf.Sex, 0.35f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.SatisfyPersonal))]
|
||||
public static class RJW_Patch_SatisfyPersonal
|
||||
{
|
||||
private const float base_sat_per_fuck = 0.4f;
|
||||
|
||||
public static void Prefix(SexProps props, ref float satisfaction)
|
||||
{
|
||||
satisfaction = Mathf.Max(base_sat_per_fuck, satisfaction * props.partner.GetSexStat());
|
||||
}
|
||||
|
||||
public static void Postfix(SexProps props, ref float satisfaction)
|
||||
{
|
||||
LustUtility.UpdateLust(props, satisfaction, base_sat_per_fuck);
|
||||
CumUtility.FillCumBuckets(props);
|
||||
props.pawn.records?.Increment(VariousDefOf.OrgasmCount);
|
||||
if (SexperienceMod.Settings.History.EnableSexHistory && props.partner != null)
|
||||
props.pawn.TryGetComp<SexHistoryComp>()?.RecordSatisfaction(props.partner, props, satisfaction);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(SexUtility), "TransferNutrition")]
|
||||
public static class RJW_Patch_TransferNutrition
|
||||
{
|
||||
public static void Postfix(SexProps props)
|
||||
{
|
||||
CumUtility.TryFeedCum(props);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(Nymph_Generator), "set_skills")]
|
||||
public static class RJW_Patch_Nymph_set_skills
|
||||
{
|
||||
public static void Postfix(Pawn pawn)
|
||||
{
|
||||
SkillRecord sexskill = pawn.skills.GetSkill(VariousDefOf.Sex);
|
||||
if (sexskill != null)
|
||||
{
|
||||
sexskill.passion = Passion.Major;
|
||||
sexskill.Level = (int)Utility.RandGaussianLike(7f, 20.99f);
|
||||
sexskill.xpSinceLastLevel = sexskill.XpRequiredForLevelUp * Rand.Range(0.10f, 0.90f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(AfterSexUtility), "UpdateRecords")]
|
||||
public static class RJW_Patch_UpdateRecords
|
||||
{
|
||||
public static void Postfix(SexProps props)
|
||||
{
|
||||
RJWUtility.UpdateSextypeRecords(props);
|
||||
|
||||
if (!SexperienceMod.Settings.History.EnableSexHistory || props.partner == null)
|
||||
return;
|
||||
|
||||
props.pawn.TryGetComp<SexHistoryComp>()?.RecordSex(props.partner, props);
|
||||
props.partner.TryGetComp<SexHistoryComp>()?.RecordSex(props.pawn, props);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(JobDriver_SexBaseInitiator), "Start")]
|
||||
public static class RJW_Patch_LogSextype
|
||||
{
|
||||
public static void Postfix(JobDriver_SexBaseInitiator __instance)
|
||||
{
|
||||
if (__instance.Partner != null)
|
||||
{
|
||||
__instance.pawn.PoptheCherry(__instance.Partner, __instance.Sexprops);
|
||||
__instance.Partner.PoptheCherry(__instance.pawn, __instance.Sexprops);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(CasualSex_Helper), nameof(CasualSex_Helper.FindSexLocation))]
|
||||
public static class RJW_Patch_CasualSex_Helper_FindSexLocation
|
||||
{
|
||||
/// <summary>
|
||||
/// If masturbation and current map has a bucket, return location near the bucket
|
||||
/// </summary>
|
||||
/// <param name="pawn"></param>
|
||||
/// <param name="partner"></param>
|
||||
/// <param name="__result"></param>
|
||||
/// <returns></returns>
|
||||
public static bool Prefix(Pawn pawn, Pawn partner, ref IntVec3 __result)
|
||||
{
|
||||
if (partner != null)
|
||||
return true; // Not masturbation
|
||||
|
||||
var log = LogManager.GetLogger<DebugLogProvider>("RJW_Patch_CasualSex_Helper_FindSexLocation");
|
||||
log.Message($"Called for {pawn.NameShortColored}");
|
||||
|
||||
if (pawn.Faction?.IsPlayer != true && !pawn.IsPrisonerOfColony)
|
||||
{
|
||||
log.Message("Not a player's faction or a prisoner");
|
||||
return true;
|
||||
}
|
||||
|
||||
Building_CumBucket bucket = pawn.FindClosestBucket();
|
||||
|
||||
if (bucket == null)
|
||||
{
|
||||
log.Message("Bucket not found");
|
||||
return true;
|
||||
}
|
||||
|
||||
__result = bucket.RandomAdjacentCell8Way();
|
||||
log.Message($"Bucket location: {__result}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.Aftersex), new Type[] { typeof(SexProps) })]
|
||||
public static class RJW_Patch_SexUtility_Aftersex_RapeEffects
|
||||
{
|
||||
public static void Postfix(SexProps props)
|
||||
{
|
||||
if (!props.hasPartner() || !props.isRape || !xxx.is_human(props.partner))
|
||||
return;
|
||||
|
||||
if (props.partner.IsPrisoner)
|
||||
RapeEffectPrisoner(props.partner);
|
||||
|
||||
if (props.partner.IsSlave)
|
||||
RapeEffectSlave(props.partner);
|
||||
}
|
||||
|
||||
private static void RapeEffectPrisoner(Pawn victim)
|
||||
{
|
||||
victim.guest.will = Math.Max(0, victim.guest.will - 0.2f);
|
||||
}
|
||||
|
||||
private static void RapeEffectSlave(Pawn victim)
|
||||
{
|
||||
Need_Suppression suppression = victim.needs.TryGetNeed<Need_Suppression>();
|
||||
if (suppression != null)
|
||||
{
|
||||
Hediff broken = victim.health.hediffSet.GetFirstHediffOfDef(xxx.feelingBroken);
|
||||
if (broken != null) suppression.CurLevel += (0.3f * broken.Severity) + 0.05f;
|
||||
else suppression.CurLevel += 0.05f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
43
Source/RJWSexperience/Patches/Rimworld_Patch.cs
Normal file
43
Source/RJWSexperience/Patches/Rimworld_Patch.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using System;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
[HarmonyPatch(typeof(PawnGenerator), "GeneratePawn", new Type[] { typeof(PawnGenerationRequest) })]
|
||||
public static class Rimworld_Patch_GeneratePawn
|
||||
{
|
||||
public static void Postfix(PawnGenerationRequest request, ref Pawn __result)
|
||||
{
|
||||
if (__result == null)
|
||||
return;
|
||||
|
||||
bool doVirginTrait = true;
|
||||
|
||||
if (SexperienceMod.Settings.History.EnableRecordRandomizer && !request.Newborn && xxx.is_human(__result))
|
||||
doVirginTrait = SexHistory.RecordRandomizer.Randomize(__result);
|
||||
|
||||
if (doVirginTrait)
|
||||
Virginity.TraitHandler.GenerateVirginTrait(__result);
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ParentRelationUtility), nameof(ParentRelationUtility.SetMother))]
|
||||
public static class Rimworld_Patch_RemoveVirginOnSetMother
|
||||
{
|
||||
public static void Postfix(Pawn pawn, Pawn newMother)
|
||||
{
|
||||
if (!pawn.relations.DirectRelationExists(PawnRelationDefOf.Parent, newMother))
|
||||
return;
|
||||
|
||||
Trait virgin = newMother.story?.traits?.GetTrait(VariousDefOf.Virgin, Virginity.TraitDegree.FemaleVirgin);
|
||||
if (virgin != null)
|
||||
{
|
||||
newMother.story.traits.RemoveTrait(virgin);
|
||||
newMother.story.traits.GainTrait(new Trait(VariousDefOf.Virgin, Virginity.TraitDegree.FemaleAfterSurgery));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
24
Source/RJWSexperience/PawnRelationWorker_Bastard.cs
Normal file
24
Source/RJWSexperience/PawnRelationWorker_Bastard.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public class PawnRelationWorker_Bastard : PawnRelationWorker_Child
|
||||
{
|
||||
public override bool InRelation(Pawn me, Pawn other)
|
||||
{
|
||||
if (!SexperienceMod.Settings.EnableBastardRelation)
|
||||
return false;
|
||||
|
||||
Pawn mother = other.GetMother();
|
||||
Pawn father = other.GetFather();
|
||||
if (me != other && (mother == me || father == me))
|
||||
{
|
||||
if (mother == null || father == null) return true;
|
||||
else if (mother.relations != null) return !(mother.relations.DirectRelationExists(PawnRelationDefOf.Spouse, father) || mother.relations.DirectRelationExists(PawnRelationDefOf.ExSpouse, father));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
36
Source/RJWSexperience/Properties/AssemblyInfo.cs
Normal file
36
Source/RJWSexperience/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
|
||||
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이러한 특성 값을 변경하세요.
|
||||
[assembly: AssemblyTitle("RJWSexperience")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RJWSexperience")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2021")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("9c728e06-573b-4b04-a07f-acbf60cb424d")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
|
||||
// 기본값으로 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
102
Source/RJWSexperience/RJWSexperience.csproj
Normal file
102
Source/RJWSexperience/RJWSexperience.csproj
Normal file
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{9C728E06-573B-4B04-A07F-ACBF60CB424D}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>RJWSexperience</RootNamespace>
|
||||
<AssemblyName>RJWSexperience</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\..\Assemblies\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Assemblies\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="RJW">
|
||||
<HintPath>..\..\..\rjw\1.3\Assemblies\RJW.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Cum\Building_Cumbucket.cs" />
|
||||
<Compile Include="Configurations.cs" />
|
||||
<Compile Include="Cum\CumUtility.cs" />
|
||||
<Compile Include="DebugAction.cs" />
|
||||
<Compile Include="ExtensionMethods\PawnExtensions.cs" />
|
||||
<Compile Include="ExtensionMethods\SexPropsExtensions.cs" />
|
||||
<Compile Include="Cum\FilterWorkers\SpecialThingFilterWorker_CumBase.cs" />
|
||||
<Compile Include="Cum\FilterWorkers\SpecialThingFilterWorker_NoCum.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="Harmony.cs" />
|
||||
<Compile Include="Cum\IngestionOutcomeDoer_RecordEatenCum.cs" />
|
||||
<Compile Include="Cum\Interactions\CumAddictPartKindUsageRule.cs" />
|
||||
<Compile Include="Logs\DebugLogProvider.cs" />
|
||||
<Compile Include="Logs\LogManager.cs" />
|
||||
<Compile Include="LustUtility.cs" />
|
||||
<Compile Include="Patches\DefInjection.cs" />
|
||||
<Compile Include="Patches\GetGizmos.cs" />
|
||||
<Compile Include="Virginity\Recipe_HymenSurgery.cs" />
|
||||
<Compile Include="Settings\SettingsTabHistory.cs" />
|
||||
<Compile Include="Settings\SettingsTabDebug.cs" />
|
||||
<Compile Include="Settings\IResettable.cs" />
|
||||
<Compile Include="Settings\ITab.cs" />
|
||||
<Compile Include="Settings\SettingsWidgets.cs" />
|
||||
<Compile Include="SexHistory\RecordRandomizer.cs" />
|
||||
<Compile Include="RJWUtility.cs" />
|
||||
<Compile Include="SexHistory\HistoryUtility.cs" />
|
||||
<Compile Include="SexHistory\SexHistoryComp.cs" />
|
||||
<Compile Include="SexHistory\SexPartnerHistoryRecord.cs" />
|
||||
<Compile Include="PawnRelationWorker_Bastard.cs" />
|
||||
<Compile Include="Keyed.cs" />
|
||||
<Compile Include="Patches\Rimworld_Patch.cs" />
|
||||
<Compile Include="Patches\RJW_Patch.cs" />
|
||||
<Compile Include="SexperienceMod.cs" />
|
||||
<Compile Include="Cum\FilterWorkers\SpecialThingFilterWorker_Cum.cs" />
|
||||
<Compile Include="StatParts.cs" />
|
||||
<Compile Include="Thoughts\ThoughtDefExtension_StageFromRecord.cs" />
|
||||
<Compile Include="Cum\Thought_AteCum.cs" />
|
||||
<Compile Include="Thoughts\Thought_Recordbased.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SexHistory\UI\RJWUIUtility.cs" />
|
||||
<Compile Include="SexHistory\UI\SexStatus.cs" />
|
||||
<Compile Include="Utility.cs" />
|
||||
<Compile Include="VariousDefOf.cs" />
|
||||
<Compile Include="Virginity\TraitDegree.cs" />
|
||||
<Compile Include="Virginity\TraitHandler.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Krafs.Rimworld.Ref">
|
||||
<Version>1.3.3389</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Lib.Harmony">
|
||||
<Version>2.2.1</Version>
|
||||
<ExcludeAssets>runtime</ExcludeAssets>
|
||||
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
175
Source/RJWSexperience/RJWUtility.cs
Normal file
175
Source/RJWSexperience/RJWUtility.cs
Normal file
|
@ -0,0 +1,175 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using rjw.Modules.Interactions.Enums;
|
||||
using rjw.Modules.Interactions.Helpers;
|
||||
using rjw.Modules.Interactions.Objects;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public static class RJWUtility
|
||||
{
|
||||
/// <summary>
|
||||
/// For ideo patch
|
||||
/// </summary>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "All parameters are needed for the ideology patch")]
|
||||
public static void ThrowVirginHistoryEvent(Pawn exVirgin, Pawn partner, SexProps props, int degree)
|
||||
{
|
||||
//for non-ideo
|
||||
if (partner.Ideo == null)
|
||||
{
|
||||
partner.needs?.mood?.thoughts?.memories.TryGainMemory(xxx.took_virginity, exVirgin);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Uses RJW 4.9.0's new interactiondefs to determine giver and receiver based on reverse interactiontag
|
||||
*/
|
||||
|
||||
public static void DetermineGiversAndReceivers(SexProps props, out Pawn giver, out Pawn receiver)
|
||||
{
|
||||
InteractionWithExtension interaction = InteractionHelper.GetWithExtension(props.dictionaryKey);
|
||||
if (interaction.HasInteractionTag(InteractionTag.Reverse))
|
||||
{
|
||||
receiver = props.partner;
|
||||
giver = props.pawn;
|
||||
}
|
||||
else
|
||||
{
|
||||
receiver = props.pawn;
|
||||
giver = props.partner;
|
||||
}
|
||||
}
|
||||
|
||||
public static void UpdateSextypeRecords(SexProps props)
|
||||
{
|
||||
xxx.rjwSextype sextype = props.sexType;
|
||||
Pawn pawn = props.pawn;
|
||||
Pawn partner = props.partner;
|
||||
|
||||
DetermineGiversAndReceivers(props, out Pawn giver, out Pawn receiver);
|
||||
|
||||
if (partner != null)
|
||||
{
|
||||
switch (sextype)
|
||||
{
|
||||
case xxx.rjwSextype.Vaginal:
|
||||
case xxx.rjwSextype.Scissoring:
|
||||
IncreaseSameRecords(pawn, partner, VariousDefOf.VaginalSexCount);
|
||||
break;
|
||||
case xxx.rjwSextype.Anal:
|
||||
IncreaseSameRecords(pawn, partner, VariousDefOf.AnalSexCount);
|
||||
break;
|
||||
case xxx.rjwSextype.Oral:
|
||||
case xxx.rjwSextype.Fellatio:
|
||||
if (Genital_Helper.has_penis_fertile(giver) || Genital_Helper.has_penis_infertile(giver))
|
||||
{
|
||||
IncreaseRecords(giver, receiver, VariousDefOf.OralSexCount, VariousDefOf.BlowjobCount);
|
||||
}
|
||||
else if (Genital_Helper.has_penis_fertile(receiver) || Genital_Helper.has_penis_infertile(receiver))
|
||||
{
|
||||
IncreaseRecords(giver, receiver, VariousDefOf.BlowjobCount, VariousDefOf.OralSexCount);
|
||||
}
|
||||
break;
|
||||
case xxx.rjwSextype.Sixtynine:
|
||||
IncreaseSameRecords(pawn, partner, VariousDefOf.OralSexCount);
|
||||
RecordDef recordpawn, recordpartner;
|
||||
if (Genital_Helper.has_penis_fertile(pawn) || Genital_Helper.has_penis_infertile(pawn))
|
||||
{
|
||||
recordpartner = VariousDefOf.BlowjobCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
recordpartner = VariousDefOf.CunnilingusCount;
|
||||
}
|
||||
|
||||
if (Genital_Helper.has_penis_fertile(partner) || Genital_Helper.has_penis_infertile(partner))
|
||||
{
|
||||
recordpawn = VariousDefOf.BlowjobCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
recordpawn = VariousDefOf.CunnilingusCount;
|
||||
}
|
||||
IncreaseRecords(pawn, partner, recordpawn, recordpartner);
|
||||
break;
|
||||
case xxx.rjwSextype.Cunnilingus:
|
||||
if (Genital_Helper.has_vagina(giver))
|
||||
{
|
||||
IncreaseRecords(giver, receiver, VariousDefOf.OralSexCount, VariousDefOf.CunnilingusCount);
|
||||
}
|
||||
else if (Genital_Helper.has_vagina(receiver))
|
||||
{
|
||||
IncreaseRecords(giver, receiver, VariousDefOf.CunnilingusCount, VariousDefOf.OralSexCount);
|
||||
}
|
||||
break;
|
||||
case xxx.rjwSextype.Masturbation:
|
||||
break;
|
||||
case xxx.rjwSextype.Handjob:
|
||||
if (Genital_Helper.has_penis_fertile(giver) || Genital_Helper.has_penis_infertile(giver))
|
||||
{
|
||||
IncreaseRecords(giver, receiver, VariousDefOf.GenitalCaressCount, VariousDefOf.HandjobCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
IncreaseRecords(giver, receiver, VariousDefOf.HandjobCount, VariousDefOf.GenitalCaressCount);
|
||||
}
|
||||
break;
|
||||
case xxx.rjwSextype.Fingering:
|
||||
case xxx.rjwSextype.Fisting:
|
||||
if (Genital_Helper.has_vagina(giver))
|
||||
{
|
||||
IncreaseRecords(giver, receiver, VariousDefOf.GenitalCaressCount, VariousDefOf.FingeringCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
IncreaseRecords(giver, receiver, VariousDefOf.FingeringCount, VariousDefOf.GenitalCaressCount);
|
||||
}
|
||||
break;
|
||||
case xxx.rjwSextype.Footjob:
|
||||
IncreaseSameRecords(pawn, partner, VariousDefOf.FootjobCount);
|
||||
break;
|
||||
default:
|
||||
IncreaseSameRecords(pawn, partner, VariousDefOf.MiscSexualBehaviorCount);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void IncreaseSameRecords(Pawn pawn, Pawn partner, RecordDef record)
|
||||
{
|
||||
pawn.records?.AddTo(record, 1);
|
||||
partner.records?.AddTo(record, 1);
|
||||
}
|
||||
|
||||
public static void IncreaseRecords(Pawn pawn, Pawn partner, RecordDef recordforpawn, RecordDef recordforpartner)
|
||||
{
|
||||
pawn.records?.AddTo(recordforpawn, 1);
|
||||
partner.records?.AddTo(recordforpartner, 1);
|
||||
}
|
||||
|
||||
// Moved this method back because of Menstruation
|
||||
public static Building_CumBucket FindClosestBucket(this Pawn pawn)
|
||||
{
|
||||
List<Building> buckets = pawn.Map.listerBuildings.allBuildingsColonist.FindAll(x => x is Building_CumBucket bucket && bucket.StoredStackCount < VariousDefOf.GatheredCum.stackLimit);
|
||||
if (buckets.NullOrEmpty())
|
||||
return null;
|
||||
|
||||
Dictionary<Building, float> targets = new Dictionary<Building, float>();
|
||||
for (int i = 0; i < buckets.Count; i++)
|
||||
{
|
||||
if (pawn.CanReach(buckets[i], PathEndMode.ClosestTouch, Danger.None))
|
||||
{
|
||||
targets.Add(buckets[i], pawn.Position.DistanceTo(buckets[i].Position));
|
||||
}
|
||||
}
|
||||
if (!targets.NullOrEmpty())
|
||||
{
|
||||
return (Building_CumBucket)targets.MinBy(x => x.Value).Key;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
7
Source/RJWSexperience/Settings/IResettable.cs
Normal file
7
Source/RJWSexperience/Settings/IResettable.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace RJWSexperience.Settings
|
||||
{
|
||||
internal interface IResettable
|
||||
{
|
||||
void Reset();
|
||||
}
|
||||
}
|
10
Source/RJWSexperience/Settings/ITab.cs
Normal file
10
Source/RJWSexperience/Settings/ITab.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using UnityEngine;
|
||||
|
||||
namespace RJWSexperience.Settings
|
||||
{
|
||||
public interface ITab
|
||||
{
|
||||
string Label { get; }
|
||||
void DoTabContents(Rect inRect);
|
||||
}
|
||||
}
|
42
Source/RJWSexperience/Settings/SettingsTabDebug.cs
Normal file
42
Source/RJWSexperience/Settings/SettingsTabDebug.cs
Normal file
|
@ -0,0 +1,42 @@
|
|||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Settings
|
||||
{
|
||||
public class SettingsTabDebug : IExposable, IResettable, ITab
|
||||
{
|
||||
public string Label => Keyed.TabLabelDebug;
|
||||
|
||||
// Defaults
|
||||
public const bool DevModeDefault = false;
|
||||
|
||||
// Private attributes
|
||||
private bool devMode;
|
||||
|
||||
//Public read-only properties
|
||||
public bool DevMode => devMode;
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
devMode = DevModeDefault;
|
||||
}
|
||||
|
||||
public void ExposeData()
|
||||
{
|
||||
Scribe_Values.Look(ref devMode, "DevMode", DevModeDefault);
|
||||
}
|
||||
|
||||
public void DoTabContents(Rect inRect)
|
||||
{
|
||||
Listing_Standard listmain = new Listing_Standard();
|
||||
listmain.Begin(inRect);
|
||||
listmain.CheckboxLabeled(Keyed.Option_Debug_Label, ref devMode, Keyed.Option_Debug_Desc);
|
||||
|
||||
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
listmain.End();
|
||||
}
|
||||
}
|
||||
}
|
139
Source/RJWSexperience/Settings/SettingsTabHistory.cs
Normal file
139
Source/RJWSexperience/Settings/SettingsTabHistory.cs
Normal file
|
@ -0,0 +1,139 @@
|
|||
using RimWorld;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Settings
|
||||
{
|
||||
public class SettingsTabHistory : IExposable, IResettable, ITab
|
||||
{
|
||||
public string Label => Keyed.TabLabelHistory;
|
||||
|
||||
// Defaults
|
||||
public const bool EnableStatRandomizerDefault = true;
|
||||
public const float MaxLustDeviationDefault = 400f;
|
||||
public const float AvgLustDefault = 0f;
|
||||
public const float MaxSexCountDeviationDefault = 90f;
|
||||
public const float SexPerYearDefault = 30f;
|
||||
public const bool MinSexableFromLifestageDefault = true;
|
||||
public const float MinSexablePercentDefault = 0.2f;
|
||||
public const float VirginRatioDefault = 0.01f;
|
||||
public const bool SlavesBeenRapedExpDefault = true;
|
||||
public const bool EnableSexHistoryDefault = true;
|
||||
public const bool HideGizmoWhenDraftedDefault = true;
|
||||
public const bool HideGizmoWithRJWDefault = true;
|
||||
|
||||
// Private attributes
|
||||
private bool enableRecordRandomizer = EnableStatRandomizerDefault;
|
||||
private float maxLustDeviation = MaxLustDeviationDefault;
|
||||
private float avgLust = AvgLustDefault;
|
||||
private float maxSexCountDeviation = MaxSexCountDeviationDefault;
|
||||
private float sexPerYear = SexPerYearDefault;
|
||||
private bool minSexableFromLifestage = MinSexableFromLifestageDefault;
|
||||
private float minSexablePercent = MinSexablePercentDefault;
|
||||
private float virginRatio = VirginRatioDefault;
|
||||
private bool slavesBeenRapedExp = SlavesBeenRapedExpDefault;
|
||||
private bool enableSexHistory = EnableSexHistoryDefault;
|
||||
private bool hideGizmoWhenDrafted = HideGizmoWhenDraftedDefault;
|
||||
private bool hideGizmoWithRJW = HideGizmoWithRJWDefault;
|
||||
|
||||
//Public read-only properties
|
||||
public bool EnableRecordRandomizer => enableRecordRandomizer;
|
||||
public float MaxLustDeviation => maxLustDeviation;
|
||||
public float AvgLust => avgLust;
|
||||
public float MaxSexCountDeviation => maxSexCountDeviation;
|
||||
public float SexPerYear => sexPerYear;
|
||||
public bool MinSexableFromLifestage => minSexableFromLifestage;
|
||||
public float MinSexablePercent => minSexablePercent;
|
||||
public float VirginRatio => virginRatio;
|
||||
public bool SlavesBeenRapedExp => slavesBeenRapedExp;
|
||||
public bool EnableSexHistory => enableSexHistory;
|
||||
public bool HideGizmoWhenDrafted => hideGizmoWhenDrafted;
|
||||
public bool HideGizmoWithRJW => hideGizmoWithRJW;
|
||||
|
||||
public static SettingsTabHistory CreateDefault()
|
||||
{
|
||||
SettingsTabHistory history = new SettingsTabHistory();
|
||||
history.Reset();
|
||||
return history;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
enableRecordRandomizer = EnableStatRandomizerDefault;
|
||||
maxLustDeviation = MaxLustDeviationDefault;
|
||||
avgLust = AvgLustDefault;
|
||||
maxSexCountDeviation = MaxSexCountDeviationDefault;
|
||||
sexPerYear = SexPerYearDefault;
|
||||
minSexableFromLifestage = MinSexableFromLifestageDefault;
|
||||
minSexablePercent = MinSexablePercentDefault;
|
||||
virginRatio = VirginRatioDefault;
|
||||
slavesBeenRapedExp = SlavesBeenRapedExpDefault;
|
||||
enableSexHistory = EnableSexHistoryDefault;
|
||||
hideGizmoWhenDrafted = HideGizmoWhenDraftedDefault;
|
||||
hideGizmoWithRJW = HideGizmoWithRJWDefault;
|
||||
}
|
||||
|
||||
public void ExposeData()
|
||||
{
|
||||
Scribe_Values.Look(ref enableRecordRandomizer, "EnableRecordRandomizer", EnableStatRandomizerDefault);
|
||||
Scribe_Values.Look(ref maxLustDeviation, "MaxLustDeviation", MaxLustDeviationDefault);
|
||||
Scribe_Values.Look(ref avgLust, "AvgLust", AvgLustDefault);
|
||||
Scribe_Values.Look(ref maxSexCountDeviation, "MaxSexCountDeviation", MaxSexCountDeviationDefault);
|
||||
Scribe_Values.Look(ref sexPerYear, "SexPerYear", SexPerYearDefault);
|
||||
Scribe_Values.Look(ref minSexableFromLifestage, "MinSexableFromLifestage", MinSexableFromLifestageDefault);
|
||||
Scribe_Values.Look(ref minSexablePercent, "MinSexablePercent", MinSexablePercentDefault);
|
||||
Scribe_Values.Look(ref virginRatio, "VirginRatio", VirginRatioDefault);
|
||||
Scribe_Values.Look(ref slavesBeenRapedExp, "SlavesBeenRapedExp", SlavesBeenRapedExpDefault);
|
||||
Scribe_Values.Look(ref enableSexHistory, "EnableSexHistory", EnableSexHistoryDefault);
|
||||
Scribe_Values.Look(ref hideGizmoWhenDrafted, "HideGizmoWhenDrafted", HideGizmoWhenDraftedDefault);
|
||||
Scribe_Values.Look(ref hideGizmoWithRJW, "HideGizmoWithRJW", HideGizmoWithRJWDefault);
|
||||
}
|
||||
|
||||
public void DoTabContents(Rect inRect)
|
||||
{
|
||||
const float lineHeight = SettingsWidgets.lineHeight;
|
||||
|
||||
Listing_Standard listmain = new Listing_Standard();
|
||||
listmain.Begin(inRect);
|
||||
|
||||
listmain.CheckboxLabeled(Keyed.Option_1_Label, ref enableRecordRandomizer, Keyed.Option_1_Desc);
|
||||
if (enableRecordRandomizer)
|
||||
{
|
||||
float sectionHeight = 12f;
|
||||
if (!minSexableFromLifestage)
|
||||
sectionHeight += 2f;
|
||||
|
||||
Listing_Standard section = listmain.BeginSection(lineHeight * sectionHeight);
|
||||
|
||||
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_3_Label + " " + maxLustDeviation, Keyed.Option_3_Desc, ref maxLustDeviation, 0f, 2000f, 1f);
|
||||
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_4_Label + " " + avgLust, Keyed.Option_4_Desc, ref avgLust, -1000f, 1000f, 1f);
|
||||
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_5_Label + " " + maxSexCountDeviation, Keyed.Option_5_Desc, ref maxSexCountDeviation, 0f, 2000f, 1f);
|
||||
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_6_Label + " " + sexPerYear, Keyed.Option_6_Desc, ref sexPerYear, 0f, 2000f, 1f);
|
||||
|
||||
section.CheckboxLabeled(Keyed.Option_MinSexableFromLifestage_Label, ref minSexableFromLifestage, Keyed.Option_MinSexableFromLifestage_Desc);
|
||||
|
||||
if (!minSexableFromLifestage)
|
||||
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), $"{Keyed.Option_9_Label} {minSexablePercent:P1} {ThingDefOf.Human.race.lifeExpectancy * minSexablePercent} human years", Keyed.Option_9_Desc, ref minSexablePercent, 0, 1, 0.001f);
|
||||
|
||||
SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), $"{Keyed.Option_10_Label} {virginRatio:P1}", Keyed.Option_10_Desc, ref virginRatio, 0f, 1f, 0.001f);
|
||||
section.CheckboxLabeled(Keyed.Option_7_Label, ref slavesBeenRapedExp, Keyed.Option_7_Desc);
|
||||
|
||||
listmain.EndSection(section);
|
||||
}
|
||||
|
||||
listmain.CheckboxLabeled(Keyed.Option_EnableSexHistory_Label, ref enableSexHistory, Keyed.Option_EnableSexHistory_Desc);
|
||||
|
||||
if (enableSexHistory)
|
||||
{
|
||||
listmain.CheckboxLabeled(Keyed.Option_HideGizmoWhenDrafted_Label, ref hideGizmoWhenDrafted, Keyed.Option_HideGizmoWhenDrafted_Desc);
|
||||
listmain.CheckboxLabeled(Keyed.Option_HideGizmoWithRJW_Label, ref hideGizmoWithRJW, Keyed.Option_HideGizmoWithRJW_Desc);
|
||||
}
|
||||
|
||||
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
|
||||
{
|
||||
Reset();
|
||||
}
|
||||
listmain.End();
|
||||
}
|
||||
}
|
||||
}
|
36
Source/RJWSexperience/Settings/SettingsWidgets.cs
Normal file
36
Source/RJWSexperience/Settings/SettingsWidgets.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Settings
|
||||
{
|
||||
public static class SettingsWidgets
|
||||
{
|
||||
public const float lineHeight = 24f;
|
||||
|
||||
public static void LabelwithTextfield(Rect rect, string label, string tooltip, ref float value, float min, float max)
|
||||
{
|
||||
Rect textfieldRect = new Rect(rect.xMax - 100f, rect.y, 100f, rect.height);
|
||||
string valuestr = value.ToString();
|
||||
Widgets.Label(rect, label);
|
||||
Widgets.TextFieldNumeric(textfieldRect, ref value, ref valuestr, min, max);
|
||||
Widgets.DrawHighlightIfMouseover(rect);
|
||||
TooltipHandler.TipRegion(rect, tooltip);
|
||||
}
|
||||
|
||||
public static void SliderOption(Rect doublerect, string label, string tooltip, ref float value, float min, float max, float roundTo)
|
||||
{
|
||||
// Slider was fighting with textfield for "correct" decimals. Causes a repeating slider move sound
|
||||
float fieldValue = value;
|
||||
float sliderValue = value;
|
||||
float minChange = roundTo / 10f;
|
||||
|
||||
LabelwithTextfield(doublerect.TopHalf(), label, tooltip, ref fieldValue, min, max);
|
||||
sliderValue = Widgets.HorizontalSlider(doublerect.BottomHalf(), sliderValue, min, max, roundTo: roundTo);
|
||||
|
||||
if (Mathf.Abs(fieldValue - value) > minChange)
|
||||
value = fieldValue;
|
||||
else
|
||||
value = sliderValue;
|
||||
}
|
||||
}
|
||||
}
|
57
Source/RJWSexperience/SexHistory/HistoryUtility.cs
Normal file
57
Source/RJWSexperience/SexHistory/HistoryUtility.cs
Normal file
|
@ -0,0 +1,57 @@
|
|||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.SexHistory
|
||||
{
|
||||
[StaticConstructorOnStartup]
|
||||
public static class HistoryUtility
|
||||
{
|
||||
public static readonly Texture2D HistoryIcon = ContentFinder<Texture2D>.Get("UI/buttons/OpenStatsReport");
|
||||
public static readonly Texture2D UnknownPawn = ContentFinder<Texture2D>.Get("UI/Icon/UnknownPawn");
|
||||
public static readonly Texture2D FirstOverlay = ContentFinder<Texture2D>.Get("UI/Icon/FirstBG");
|
||||
public static readonly Texture2D Heart = ContentFinder<Texture2D>.Get("Things/Mote/Heart");
|
||||
public static readonly Texture2D Incest = ContentFinder<Texture2D>.Get("UI/Icon/Incest");
|
||||
public static readonly Texture2D Locked = ContentFinder<Texture2D>.Get("UI/Icon/RSLocked");
|
||||
public static readonly Texture2D Unlocked = ContentFinder<Texture2D>.Get("UI/Icon/RSUnlocked");
|
||||
public static readonly Texture2D Slaanesh = SolidColorMaterials.NewSolidColorTexture(0.686f, 0.062f, 0.698f, 1.0f);
|
||||
public static readonly Texture2D Khorne = SolidColorMaterials.NewSolidColorTexture(0.415f, 0.0f, 0.003f, 1.0f);
|
||||
public static readonly Texture2D Tzeentch = SolidColorMaterials.NewSolidColorTexture(0.082f, 0.453f, 0.6f, 1.0f);
|
||||
public static readonly Texture2D Nurgle = SolidColorMaterials.NewSolidColorTexture(0.6f, 0.83f, 0.35f, 1.0f);
|
||||
public static readonly Texture2D Partners = SolidColorMaterials.NewSolidColorTexture(0.843f, 0.474f, 0.6f, 1.0f);
|
||||
public static readonly Texture2D TotalSex = SolidColorMaterials.NewSolidColorTexture(0.878f, 0.674f, 0.411f, 1.0f);
|
||||
public static readonly Texture2D Satisfaction = SolidColorMaterials.NewSolidColorTexture(0.325f, 0.815f, 0.729f, 1.0f);
|
||||
public static readonly Color HistoryColor = new Color(0.9f, 0.5f, 0.5f);
|
||||
|
||||
public static readonly Texture2D[] SextypeColor = new Texture2D[]
|
||||
{
|
||||
Texture2D.linearGrayTexture, //None = 0,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.900f, 0.500f, 0.500f, 1.0f), //Vaginal = 1, Light Salmon Pink
|
||||
SolidColorMaterials.NewSolidColorTexture(0.529f, 0.313f, 0.113f, 1.0f), //Anal = 2, Brown
|
||||
SolidColorMaterials.NewSolidColorTexture(0.529f, 0.113f, 0.305f, 1.0f), //Oral = 3, Purple
|
||||
SolidColorMaterials.NewSolidColorTexture(0.000f, 0.819f, 0.219f, 1.0f), //Masturbation = 4, Slightly Dark Green
|
||||
SolidColorMaterials.NewSolidColorTexture(0.000f, 0.560f, 0.090f, 1.0f), //DoublePenetration = 5, Dark Green
|
||||
SolidColorMaterials.NewSolidColorTexture(0.839f, 0.850f, 0.505f, 1.0f), //Boobjob = 6,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.858f, 0.886f, 0.113f, 1.0f), //Handjob = 7,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.752f, 0.780f, 0.000f, 1.0f), //Footjob = 8,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.484f, 0.500f, 0.241f, 1.0f), //Fingering = 9,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.000f, 0.500f, 0.080f, 1.0f), //Scissoring = 10, Dark Green
|
||||
SolidColorMaterials.NewSolidColorTexture(0.588f, 0.576f, 0.431f, 1.0f), //MutualMasturbation = 11,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.741f, 0.000f, 0.682f, 1.0f), //Fisting = 12,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.121f, 0.929f, 1.000f, 1.0f), //MechImplant = 13,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.478f, 0.274f, 0.160f, 1.0f), //Rimming = 14,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.819f, 0.301f, 0.552f, 1.0f), //Fellatio = 15,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.819f, 0.301f, 0.552f, 1.0f), //Cunnilingus = 16,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.529f, 0.113f, 0.305f, 1.0f), //Sixtynine = 17
|
||||
Texture2D.linearGrayTexture, //? = 18
|
||||
Texture2D.linearGrayTexture, //? = 19
|
||||
Texture2D.linearGrayTexture //? = 20
|
||||
};
|
||||
|
||||
public static readonly Texture2D[] PassionBG = new Texture2D[]
|
||||
{
|
||||
Texture2D.blackTexture, //None = 0,
|
||||
SolidColorMaterials.NewSolidColorTexture(0.800f, 0.800f, 0.800f, 1.0f), //Minor = 1,
|
||||
SolidColorMaterials.NewSolidColorTexture(1.000f, 0.875f, 0.000f, 1.0f) //Major = 2,
|
||||
};
|
||||
}
|
||||
}
|
247
Source/RJWSexperience/SexHistory/RecordRandomizer.cs
Normal file
247
Source/RJWSexperience/SexHistory/RecordRandomizer.cs
Normal file
|
@ -0,0 +1,247 @@
|
|||
using rjw;
|
||||
using System;
|
||||
using Verse;
|
||||
using RimWorld;
|
||||
using UnityEngine;
|
||||
using RJWSexperience.Logs;
|
||||
|
||||
namespace RJWSexperience.SexHistory
|
||||
{
|
||||
public static class RecordRandomizer
|
||||
{
|
||||
private static readonly rjw.Modules.Shared.Logs.ILog log = LogManager.GetLogger<DebugLogProvider>("RecordRandomizer");
|
||||
|
||||
private static Settings.SettingsTabHistory Settings => SexperienceMod.Settings.History;
|
||||
|
||||
public static bool Randomize(Pawn pawn)
|
||||
{
|
||||
log.Message($"Randomize request for {pawn.NameShortColored}");
|
||||
|
||||
int avgsex = -500;
|
||||
bool isvirgin = Rand.Chance(Settings.VirginRatio);
|
||||
int totalsex = 0;
|
||||
int totalbirth = 0;
|
||||
|
||||
if (isvirgin)
|
||||
log.Message("Rand.Chance rolled virgin");
|
||||
|
||||
if (pawn.story != null)
|
||||
{
|
||||
int sexableage = 0;
|
||||
int minsexage = 0;
|
||||
if (Settings.MinSexableFromLifestage)
|
||||
{
|
||||
LifeStageAge lifeStageAges = pawn.RaceProps.lifeStageAges.Find(x => x.def.reproductive);
|
||||
if (lifeStageAges == null)
|
||||
{
|
||||
log.Message($"No reproductive life stage! {pawn.NameShortColored}'s randomization cancelled");
|
||||
return false;
|
||||
}
|
||||
minsexage = (int)lifeStageAges.minAge;
|
||||
}
|
||||
else
|
||||
{
|
||||
minsexage = (int)(pawn.RaceProps.lifeExpectancy * Settings.MinSexablePercent);
|
||||
}
|
||||
|
||||
log.Message($"Min sex age is {minsexage}");
|
||||
|
||||
float lust = RandomizeLust(pawn);
|
||||
log.Message($"Lust set to {lust}");
|
||||
|
||||
if (pawn.ageTracker.AgeBiologicalYears > minsexage)
|
||||
{
|
||||
sexableage = pawn.ageTracker.AgeBiologicalYears - minsexage;
|
||||
avgsex = (int)(sexableage * Settings.SexPerYear * LustUtility.GetLustFactor(lust));
|
||||
}
|
||||
|
||||
log.Message($"Generating {sexableage} years of sex life");
|
||||
log.Message($"Average sex/year: {avgsex}");
|
||||
|
||||
if (pawn.relations != null && pawn.gender == Gender.Female)
|
||||
{
|
||||
totalbirth += pawn.relations.ChildrenCount;
|
||||
totalsex += totalbirth;
|
||||
pawn.records?.AddTo(xxx.CountOfSexWithHumanlikes, totalbirth);
|
||||
pawn.records?.SetTo(xxx.CountOfBirthHuman, totalbirth);
|
||||
if (totalbirth > 0) isvirgin = false;
|
||||
}
|
||||
if (!isvirgin)
|
||||
{
|
||||
totalsex += GeneratePartnerTypeRecords(pawn, avgsex);
|
||||
|
||||
if (Settings.SlavesBeenRapedExp && pawn.IsSlave)
|
||||
{
|
||||
totalsex += RandomizeRecord(pawn, xxx.CountOfBeenRapedByAnimals, Rand.Range(-50, 10), Rand.Range(0, 10) * sexableage);
|
||||
totalsex += RandomizeRecord(pawn, xxx.CountOfBeenRapedByHumanlikes, 0, Rand.Range(0, 100) * sexableage);
|
||||
}
|
||||
}
|
||||
}
|
||||
pawn.records?.SetTo(xxx.CountOfSex, totalsex);
|
||||
log.Message($"Splitting {totalsex} sex acts between sex types");
|
||||
GenerateSextypeRecords(pawn, totalsex);
|
||||
log.Message($"{pawn.NameShortColored} randomized");
|
||||
return true;
|
||||
}
|
||||
|
||||
public static float RandomizeLust(Pawn pawn)
|
||||
{
|
||||
float value = Utility.RandGaussianLike(Settings.AvgLust - Settings.MaxLustDeviation, Settings.AvgLust + Settings.MaxLustDeviation);
|
||||
float minValue;
|
||||
|
||||
if (xxx.is_nympho(pawn))
|
||||
minValue = 0;
|
||||
else
|
||||
minValue = float.MinValue;
|
||||
|
||||
value = Mathf.Clamp(value, minValue, float.MaxValue);
|
||||
float recordvalue = pawn.records.GetValue(VariousDefOf.Lust);
|
||||
pawn.records.AddTo(VariousDefOf.Lust, value - recordvalue);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private static int RandomizeRecord(Pawn pawn, RecordDef record, int avg, int dist, int min = 0, int max = int.MaxValue)
|
||||
{
|
||||
int value = (int)Mathf.Clamp(Utility.RandGaussianLike(avg - dist, avg + dist), min, max);
|
||||
int recordvalue = pawn.records.GetAsInt(record);
|
||||
pawn.records.AddTo(record, value - recordvalue);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private static int GeneratePartnerTypeRecords(Pawn pawn, int avgsex)
|
||||
{
|
||||
int deviation = (int)Settings.MaxSexCountDeviation;
|
||||
int totalSexCount = 0;
|
||||
|
||||
if (xxx.is_rapist(pawn))
|
||||
{
|
||||
if (xxx.is_zoophile(pawn))
|
||||
{
|
||||
if (pawn.Has(Quirk.ChitinLover)) totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedInsects, avgsex, deviation);
|
||||
else totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedAnimals, avgsex, deviation);
|
||||
}
|
||||
else
|
||||
{
|
||||
totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedHumanlikes, avgsex, deviation);
|
||||
}
|
||||
|
||||
avgsex /= 8;
|
||||
}
|
||||
|
||||
if (xxx.is_zoophile(pawn))
|
||||
{
|
||||
if (pawn.Has(Quirk.ChitinLover)) totalSexCount += RandomizeRecord(pawn, xxx.CountOfRapedInsects, avgsex, deviation);
|
||||
else totalSexCount += RandomizeRecord(pawn, xxx.CountOfSexWithAnimals, avgsex, deviation);
|
||||
avgsex /= 10;
|
||||
}
|
||||
else if (xxx.is_necrophiliac(pawn))
|
||||
{
|
||||
totalSexCount += RandomizeRecord(pawn, xxx.CountOfSexWithCorpse, avgsex, deviation);
|
||||
avgsex /= 4;
|
||||
}
|
||||
|
||||
totalSexCount += RandomizeRecord(pawn, xxx.CountOfSexWithHumanlikes, avgsex, deviation);
|
||||
|
||||
if (totalSexCount > 0)
|
||||
pawn.records.AddTo(VariousDefOf.SexPartnerCount, Math.Max(1, Rand.Range(0, totalSexCount / 7)));
|
||||
|
||||
return totalSexCount;
|
||||
}
|
||||
|
||||
private static void GenerateSextypeRecords(Pawn pawn, int totalsex)
|
||||
{
|
||||
float totalweight =
|
||||
RJWPreferenceSettings.vaginal +
|
||||
RJWPreferenceSettings.anal +
|
||||
RJWPreferenceSettings.fellatio +
|
||||
RJWPreferenceSettings.cunnilingus +
|
||||
RJWPreferenceSettings.rimming +
|
||||
RJWPreferenceSettings.double_penetration +
|
||||
RJWPreferenceSettings.breastjob +
|
||||
RJWPreferenceSettings.handjob +
|
||||
RJWPreferenceSettings.mutual_masturbation +
|
||||
RJWPreferenceSettings.fingering +
|
||||
RJWPreferenceSettings.footjob +
|
||||
RJWPreferenceSettings.scissoring +
|
||||
RJWPreferenceSettings.fisting +
|
||||
RJWPreferenceSettings.sixtynine;
|
||||
Gender prefer = PreferredGender(pawn);
|
||||
int sex = (int)(totalsex * RJWPreferenceSettings.vaginal / totalweight);
|
||||
totalsex -= sex;
|
||||
pawn.records.AddTo(VariousDefOf.VaginalSexCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.anal / totalweight);
|
||||
totalsex -= sex;
|
||||
pawn.records.AddTo(VariousDefOf.AnalSexCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.fellatio / totalweight);
|
||||
totalsex -= sex;
|
||||
if (prefer == Gender.Male) pawn.records.AddTo(VariousDefOf.BlowjobCount, sex);
|
||||
else pawn.records.AddTo(VariousDefOf.OralSexCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.cunnilingus / totalweight);
|
||||
totalsex -= sex;
|
||||
if (prefer == Gender.Male) pawn.records.AddTo(VariousDefOf.OralSexCount, sex);
|
||||
else pawn.records.AddTo(VariousDefOf.CunnilingusCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.rimming / totalweight);
|
||||
totalsex -= sex;
|
||||
pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.double_penetration / totalweight) / 2;
|
||||
totalsex -= sex;
|
||||
totalsex -= sex;
|
||||
pawn.records.AddTo(VariousDefOf.VaginalSexCount, sex);
|
||||
pawn.records.AddTo(VariousDefOf.AnalSexCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.breastjob / totalweight);
|
||||
totalsex -= sex;
|
||||
pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.handjob / totalweight);
|
||||
totalsex -= sex;
|
||||
if (prefer == Gender.Male) pawn.records.AddTo(VariousDefOf.HandjobCount, sex);
|
||||
else pawn.records.AddTo(VariousDefOf.GenitalCaressCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.fingering / totalweight);
|
||||
totalsex -= sex;
|
||||
if (prefer == Gender.Female) pawn.records.AddTo(VariousDefOf.FingeringCount, sex);
|
||||
else pawn.records.AddTo(VariousDefOf.GenitalCaressCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.mutual_masturbation / totalweight);
|
||||
totalsex -= sex;
|
||||
if (prefer == Gender.Male) pawn.records.AddTo(VariousDefOf.HandjobCount, sex);
|
||||
else pawn.records.AddTo(VariousDefOf.FingeringCount, sex);
|
||||
pawn.records.AddTo(VariousDefOf.GenitalCaressCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.footjob / totalweight);
|
||||
totalsex -= sex;
|
||||
pawn.records.AddTo(VariousDefOf.FootjobCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.scissoring / totalweight);
|
||||
totalsex -= sex;
|
||||
pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex);
|
||||
|
||||
sex = (int)(totalsex * RJWPreferenceSettings.fisting / totalweight);
|
||||
totalsex -= sex;
|
||||
pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex);
|
||||
|
||||
pawn.records.AddTo(VariousDefOf.OralSexCount, totalsex);
|
||||
if (prefer == Gender.Male) pawn.records.AddTo(VariousDefOf.BlowjobCount, totalsex);
|
||||
else pawn.records.AddTo(VariousDefOf.CunnilingusCount, totalsex);
|
||||
}
|
||||
|
||||
private static Gender PreferredGender(Pawn pawn)
|
||||
{
|
||||
if (xxx.is_homosexual(pawn))
|
||||
return pawn.gender;
|
||||
|
||||
if (pawn.gender == Gender.Male)
|
||||
return Gender.Female;
|
||||
else
|
||||
return Gender.Male;
|
||||
}
|
||||
}
|
||||
}
|
444
Source/RJWSexperience/SexHistory/SexHistoryComp.cs
Normal file
444
Source/RJWSexperience/SexHistory/SexHistoryComp.cs
Normal file
|
@ -0,0 +1,444 @@
|
|||
using rjw;
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.SexHistory
|
||||
{
|
||||
public class SexHistoryComp : ThingComp
|
||||
{
|
||||
public const int ARRLEN = 20;
|
||||
|
||||
protected Dictionary<string, SexPartnerHistoryRecord> histories = new Dictionary<string, SexPartnerHistoryRecord>();
|
||||
protected string first = "";
|
||||
protected bool dirty = true;
|
||||
protected xxx.rjwSextype recentSex = xxx.rjwSextype.None;
|
||||
protected float recentSat = 0;
|
||||
protected string recentPartner = "";
|
||||
protected int[] sextypeCount = new int[ARRLEN];
|
||||
protected float[] sextypeSat = new float[ARRLEN];
|
||||
protected int[] sextypeRecentTickAbs = new int[ARRLEN];
|
||||
protected int virginsTaken = 0;
|
||||
protected int incestuous = 0;
|
||||
protected int bestiality = 0;
|
||||
protected int corpsefuck = 0;
|
||||
protected int interspecies = 0;
|
||||
protected int firstSexTickAbs = 0;
|
||||
|
||||
protected string mostPartnerCache = "";
|
||||
protected xxx.rjwSextype mostSextypeCache = xxx.rjwSextype.None;
|
||||
protected xxx.rjwSextype mostSatSextypeCache = xxx.rjwSextype.None;
|
||||
protected xxx.rjwSextype bestSextypeCache = xxx.rjwSextype.None;
|
||||
protected float bestSextypeSatCache = 0;
|
||||
protected string bestPartnerCache = "";
|
||||
protected int totalSexCache = 0;
|
||||
protected int totalRapedCache = 0;
|
||||
protected int totalBeenRapedCache = 0;
|
||||
protected ThingDef preferRaceCache = null;
|
||||
protected int preferRaceSexCountCache = 0;
|
||||
protected Pawn preferRacePawnCache = null;
|
||||
protected int recentSexTickAbsCache = 0;
|
||||
protected int mostSexTickAbsCache = 0;
|
||||
protected int bestSexTickAbsCache = 0;
|
||||
|
||||
public Gizmo Gizmo { get; private set; }
|
||||
|
||||
public SexPartnerHistoryRecord GetFirstPartnerHistory => histories.TryGetValue(first);
|
||||
|
||||
public SexPartnerHistoryRecord GetMostPartnerHistory
|
||||
{
|
||||
get
|
||||
{
|
||||
Update();
|
||||
return histories.TryGetValue(mostPartnerCache);
|
||||
}
|
||||
}
|
||||
public xxx.rjwSextype MostSextype
|
||||
{
|
||||
get
|
||||
{
|
||||
Update();
|
||||
return mostSextypeCache;
|
||||
}
|
||||
}
|
||||
public xxx.rjwSextype MostSatisfiedSex
|
||||
{
|
||||
get
|
||||
{
|
||||
Update();
|
||||
return mostSatSextypeCache;
|
||||
}
|
||||
}
|
||||
public SexPartnerHistoryRecord GetRecentPartnersHistory => histories.TryGetValue(recentPartner);
|
||||
public SexPartnerHistoryRecord GetBestSexPartnerHistory
|
||||
{
|
||||
get
|
||||
{
|
||||
Update();
|
||||
return histories.TryGetValue(bestPartnerCache);
|
||||
}
|
||||
}
|
||||
public float TotalSexHad
|
||||
{
|
||||
get
|
||||
{
|
||||
Update();
|
||||
return totalSexCache;
|
||||
}
|
||||
}
|
||||
public int VirginsTaken => virginsTaken;
|
||||
public List<SexPartnerHistoryRecord> PartnerList
|
||||
{
|
||||
get
|
||||
{
|
||||
List<SexPartnerHistoryRecord> res = null;
|
||||
Update();
|
||||
if (!histories.NullOrEmpty())
|
||||
{
|
||||
res = histories.Values.ToList();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
public int PartnerCount
|
||||
{
|
||||
get
|
||||
{
|
||||
if (histories == null) histories = new Dictionary<string, SexPartnerHistoryRecord>();
|
||||
return histories.Count;
|
||||
}
|
||||
}
|
||||
public int IncestuousCount => incestuous;
|
||||
public int RapedCount
|
||||
{
|
||||
get
|
||||
{
|
||||
Update();
|
||||
return totalRapedCache;
|
||||
}
|
||||
}
|
||||
public int BeenRapedCount
|
||||
{
|
||||
get
|
||||
{
|
||||
Update();
|
||||
return totalBeenRapedCache;
|
||||
}
|
||||
}
|
||||
public ThingDef PreferRace
|
||||
{
|
||||
get
|
||||
{
|
||||
Update();
|
||||
return preferRaceCache;
|
||||
}
|
||||
}
|
||||
public int PreferRaceSexCount
|
||||
{
|
||||
get
|
||||
{
|
||||
Update();
|
||||
return preferRaceSexCountCache;
|
||||
}
|
||||
}
|
||||
public int BestialityCount => bestiality;
|
||||
public int CorpseFuckCount => corpsefuck;
|
||||
public int InterspeciesCount => interspecies;
|
||||
public float AVGSat
|
||||
{
|
||||
get
|
||||
{
|
||||
Update();
|
||||
if (totalSexCache == 0) return 0;
|
||||
return sextypeSat.Sum() / totalSexCache;
|
||||
}
|
||||
}
|
||||
public int RecentSexTickAbs => recentSexTickAbsCache;
|
||||
public int FirstSexTickAbs => firstSexTickAbs;
|
||||
public int MostSexTickAbs => mostSexTickAbsCache;
|
||||
public int BestSexTickAbs => bestSexTickAbsCache;
|
||||
|
||||
public Pawn PreferRacePawn
|
||||
{
|
||||
get
|
||||
{
|
||||
Update();
|
||||
return preferRacePawnCache;
|
||||
}
|
||||
}
|
||||
|
||||
public float GetBestSextype(out xxx.rjwSextype sextype)
|
||||
{
|
||||
Update();
|
||||
sextype = bestSextypeCache;
|
||||
return bestSextypeSatCache;
|
||||
}
|
||||
|
||||
public float GetRecentSextype(out xxx.rjwSextype sextype)
|
||||
{
|
||||
Update();
|
||||
sextype = recentSex;
|
||||
return recentSat;
|
||||
}
|
||||
|
||||
public int GetSextypeRecentTickAbs(int sextype) => sextypeRecentTickAbs[sextype];
|
||||
|
||||
public float GetAVGSat(int index)
|
||||
{
|
||||
float res = sextypeSat[index] / sextypeCount[index];
|
||||
return float.IsNaN(res) ? 0f : res;
|
||||
}
|
||||
|
||||
public int GetSexCount(int sextype) => sextypeCount[sextype];
|
||||
|
||||
public override void PostExposeData()
|
||||
{
|
||||
List<int> sextypecountsave;
|
||||
List<float> sextypesatsave;
|
||||
List<int> sextyperecenttickabssave;
|
||||
|
||||
if (Scribe.mode == LoadSaveMode.Saving)
|
||||
{
|
||||
sextypecountsave = sextypeCount.ToList();
|
||||
sextypesatsave = sextypeSat.ToList();
|
||||
sextyperecenttickabssave = sextypeRecentTickAbs.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
sextypecountsave = new List<int>();
|
||||
sextypesatsave = new List<float>();
|
||||
sextyperecenttickabssave = new List<int>();
|
||||
}
|
||||
|
||||
Scribe_Collections.Look(ref histories, "histories", LookMode.Value, LookMode.Deep);
|
||||
Scribe_Values.Look(ref first, "first", string.Empty);
|
||||
Scribe_Values.Look(ref recentSex, "recentsex", xxx.rjwSextype.None);
|
||||
Scribe_Values.Look(ref recentSat, "recentsat", 0);
|
||||
Scribe_Values.Look(ref recentPartner, "recentpartner", string.Empty);
|
||||
Scribe_Values.Look(ref virginsTaken, "virginstaken", 0);
|
||||
Scribe_Values.Look(ref incestuous, "incestous", 0);
|
||||
Scribe_Values.Look(ref bestiality, "bestiality", 0);
|
||||
Scribe_Values.Look(ref corpsefuck, "corpsefuck", 0);
|
||||
Scribe_Values.Look(ref interspecies, "interspecies", 0);
|
||||
Scribe_Values.Look(ref firstSexTickAbs, "firstsextickabs", 0);
|
||||
Scribe_Collections.Look(ref sextypecountsave, "sextypecountsave", LookMode.Value);
|
||||
Scribe_Collections.Look(ref sextypesatsave, "sextypesatsave", LookMode.Value);
|
||||
Scribe_Collections.Look(ref sextyperecenttickabssave, "sextyperecenttickabssave", LookMode.Value);
|
||||
|
||||
if (histories == null)
|
||||
histories = new Dictionary<string, SexPartnerHistoryRecord>();
|
||||
|
||||
if (Scribe.mode == LoadSaveMode.LoadingVars)
|
||||
{
|
||||
sextypeCount = sextypecountsave?.ToArray() ?? new int[ARRLEN];
|
||||
sextypeSat = sextypesatsave?.ToArray() ?? new float[ARRLEN];
|
||||
sextypeRecentTickAbs = sextyperecenttickabssave?.ToArray() ?? new int[ARRLEN];
|
||||
|
||||
foreach (KeyValuePair<string, SexPartnerHistoryRecord> element in histories)
|
||||
{
|
||||
element.Value.PartnerID = element.Key;
|
||||
}
|
||||
}
|
||||
base.PostExposeData();
|
||||
}
|
||||
|
||||
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.Dead) corpsefuck++;
|
||||
if (props.IsBestiality()) bestiality++;
|
||||
else if (pawn.def != partner.def) interspecies++;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
public void RecordSatisfaction(Pawn partner, SexProps props, float satisfaction)
|
||||
{
|
||||
RecordFirst(partner, props);
|
||||
GetPartnerRecord(partner)?.RecordSatisfaction(props, satisfaction);
|
||||
recentSat = satisfaction;
|
||||
sextypeSat[(int)props.sexType] += satisfaction;
|
||||
dirty = true;
|
||||
}
|
||||
|
||||
public void RecordFirst(Pawn partner, SexProps props)
|
||||
{
|
||||
if (VirginCheck() && props.sexType == xxx.rjwSextype.Vaginal)
|
||||
{
|
||||
first = partner.ThingID;
|
||||
SexHistoryComp history = partner.TryGetComp<SexHistoryComp>();
|
||||
firstSexTickAbs = GenTicks.TicksAbs;
|
||||
history?.TakeSomeonesVirgin(parent as Pawn);
|
||||
}
|
||||
}
|
||||
|
||||
protected SexPartnerHistoryRecord GetPartnerRecord(Pawn partner)
|
||||
{
|
||||
string partnerId = partner.ThingID;
|
||||
|
||||
if (histories.TryGetValue(partnerId, out SexPartnerHistoryRecord record))
|
||||
{
|
||||
return record;
|
||||
}
|
||||
|
||||
SexPartnerHistoryRecord newRecord = new SexPartnerHistoryRecord(partner, partner.IsIncest(parent as Pawn));
|
||||
histories.Add(partnerId, newRecord);
|
||||
if (parent is Pawn pawn)
|
||||
{
|
||||
pawn.records.Increment(VariousDefOf.SexPartnerCount);
|
||||
}
|
||||
return newRecord;
|
||||
}
|
||||
|
||||
public void TakeSomeonesVirgin(Pawn partner)
|
||||
{
|
||||
GetPartnerRecord(partner)?.TookVirgin();
|
||||
virginsTaken++;
|
||||
}
|
||||
|
||||
#region Cache update
|
||||
|
||||
protected void Update()
|
||||
{
|
||||
if (dirty)
|
||||
{
|
||||
UpdateStatistics();
|
||||
UpdateBestSex();
|
||||
dirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void UpdateStatistics()
|
||||
{
|
||||
int max = 0;
|
||||
float maxsat = 0;
|
||||
float maxf = 0;
|
||||
int maxindex = 0;
|
||||
string mostID = Keyed.Unknown;
|
||||
string bestID = Keyed.Unknown;
|
||||
|
||||
totalSexCache = 0;
|
||||
totalRapedCache = 0;
|
||||
totalBeenRapedCache = 0;
|
||||
Dictionary<ThingDef, int> racetotalsat = new Dictionary<ThingDef, int>();
|
||||
List<Pawn> allpartners = new List<Pawn>();
|
||||
|
||||
foreach (KeyValuePair<string, SexPartnerHistoryRecord> element in histories)
|
||||
{
|
||||
SexPartnerHistoryRecord h = element.Value;
|
||||
|
||||
//find most sex partner
|
||||
if (max < h.TotalSexCount)
|
||||
{
|
||||
max = h.TotalSexCount;
|
||||
mostID = element.Key;
|
||||
}
|
||||
if (maxsat < h.BestSatisfaction)
|
||||
{
|
||||
maxsat = h.BestSatisfaction;
|
||||
bestID = element.Key;
|
||||
}
|
||||
|
||||
if (h.Partner != null)
|
||||
{
|
||||
Pawn partner = h.Partner;
|
||||
allpartners.Add(partner);
|
||||
if (racetotalsat.ContainsKey(h.Race))
|
||||
{
|
||||
racetotalsat[h.Race] += h.TotalSexCount - h.RapedMe;
|
||||
}
|
||||
else
|
||||
{
|
||||
racetotalsat.Add(h.Race, h.TotalSexCount - h.RapedMe);
|
||||
}
|
||||
}
|
||||
|
||||
totalSexCache += h.TotalSexCount;
|
||||
totalRapedCache += h.Raped;
|
||||
totalBeenRapedCache += h.RapedMe;
|
||||
}
|
||||
|
||||
if (!racetotalsat.NullOrEmpty())
|
||||
{
|
||||
KeyValuePair<ThingDef, int> prefer = racetotalsat.MaxBy(x => x.Value);
|
||||
preferRaceCache = prefer.Key;
|
||||
preferRaceSexCountCache = prefer.Value;
|
||||
preferRacePawnCache = allpartners.Find(x => x.def == preferRaceCache);
|
||||
}
|
||||
|
||||
for (int i = 0; i < sextypeCount.Length; i++)
|
||||
{
|
||||
float avgsat = sextypeSat[i] / sextypeCount[i];
|
||||
if (maxf < avgsat)
|
||||
{
|
||||
maxf = avgsat;
|
||||
maxindex = i;
|
||||
}
|
||||
}
|
||||
|
||||
mostSatSextypeCache = (xxx.rjwSextype)maxindex;
|
||||
mostSextypeCache = (xxx.rjwSextype)sextypeCount.FirstIndexOf(x => x == sextypeCount.Max());
|
||||
mostPartnerCache = mostID;
|
||||
bestPartnerCache = bestID;
|
||||
|
||||
recentSexTickAbsCache = histories.TryGetValue(recentPartner)?.RecentSexTickAbs ?? 0;
|
||||
mostSexTickAbsCache = histories.TryGetValue(mostPartnerCache)?.RecentSexTickAbs ?? 0;
|
||||
bestSexTickAbsCache = histories.TryGetValue(bestPartnerCache)?.BestSexTickAbs ?? 0;
|
||||
|
||||
racetotalsat.Clear();
|
||||
allpartners.Clear();
|
||||
}
|
||||
|
||||
protected void UpdateBestSex()
|
||||
{
|
||||
int bestindex = 0;
|
||||
float bestsat = 0;
|
||||
float avgsat;
|
||||
for (int i = 0; i < sextypeCount.Length; i++)
|
||||
{
|
||||
avgsat = sextypeSat[i] / sextypeCount[i];
|
||||
if (bestsat < avgsat)
|
||||
{
|
||||
bestindex = i;
|
||||
bestsat = avgsat;
|
||||
}
|
||||
}
|
||||
bestSextypeCache = (xxx.rjwSextype)bestindex;
|
||||
bestSextypeSatCache = bestsat;
|
||||
}
|
||||
|
||||
#endregion Cache update
|
||||
|
||||
protected bool VirginCheck()
|
||||
{
|
||||
if (histories.TryGetValue(first) != null) return false;
|
||||
|
||||
Pawn pawn = parent as Pawn;
|
||||
return pawn?.IsVirgin() == true;
|
||||
}
|
||||
|
||||
public override void Initialize(CompProperties props)
|
||||
{
|
||||
base.Initialize(props);
|
||||
|
||||
Gizmo = new Command_Action
|
||||
{
|
||||
defaultLabel = Keyed.RS_Sex_History,
|
||||
icon = HistoryUtility.HistoryIcon,
|
||||
defaultIconColor = HistoryUtility.HistoryColor,
|
||||
hotKey = VariousDefOf.OpenSexStatistics,
|
||||
action = delegate
|
||||
{
|
||||
UI.SexStatusWindow.ToggleWindow(parent as Pawn, this);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
163
Source/RJWSexperience/SexHistory/SexPartnerHistoryRecord.cs
Normal file
163
Source/RJWSexperience/SexHistory/SexPartnerHistoryRecord.cs
Normal file
|
@ -0,0 +1,163 @@
|
|||
using rjw;
|
||||
using RJWSexperience.ExtensionMethods;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.SexHistory
|
||||
{
|
||||
public class SexPartnerHistoryRecord : IExposable
|
||||
{
|
||||
public string PartnerID { get; set; }
|
||||
|
||||
protected Pawn partner = null;
|
||||
protected string labelCache;
|
||||
protected int totalSexCount = 0;
|
||||
protected int raped = 0;
|
||||
protected int rapedMe = 0;
|
||||
protected int orgasms = 0;
|
||||
protected xxx.rjwSextype bestSextype = xxx.rjwSextype.None;
|
||||
protected float bestSatisfaction = 0;
|
||||
protected bool iTookVirgin = false;
|
||||
protected bool incest = false;
|
||||
protected int recentSexTickAbs = 0;
|
||||
protected int bestSexTickAbs = 0;
|
||||
protected bool cannotLoadPawnData = false;
|
||||
protected ThingDef raceCache;
|
||||
|
||||
public xxx.rjwSextype BestSextype => bestSextype;
|
||||
public float BestSatisfaction => bestSatisfaction;
|
||||
public int TotalSexCount => totalSexCount;
|
||||
public int OrgasmCount => orgasms;
|
||||
public bool IamFirst => iTookVirgin;
|
||||
public bool Incest => incest;
|
||||
public int Raped => raped;
|
||||
public int RapedMe => rapedMe;
|
||||
public int RecentSexTickAbs => recentSexTickAbs;
|
||||
public int BestSexTickAbs => bestSexTickAbs;
|
||||
public int BestSexElapsedTicks => GenTicks.TicksAbs - bestSexTickAbs;
|
||||
public Pawn Partner
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!cannotLoadPawnData && partner == null)
|
||||
{
|
||||
LoadPartnerPawn(PartnerID);
|
||||
if (partner == null) cannotLoadPawnData = true;
|
||||
}
|
||||
return partner;
|
||||
}
|
||||
}
|
||||
public string Label
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Partner != null)
|
||||
labelCache = Partner.Label;
|
||||
return labelCache;
|
||||
}
|
||||
}
|
||||
public ThingDef Race
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Partner != null)
|
||||
raceCache = Partner.def;
|
||||
return raceCache;
|
||||
}
|
||||
}
|
||||
|
||||
public SexPartnerHistoryRecord() { }
|
||||
|
||||
public SexPartnerHistoryRecord(Pawn pawn, bool incest = false)
|
||||
{
|
||||
this.partner = pawn;
|
||||
this.labelCache = pawn.Label;
|
||||
this.incest = incest;
|
||||
this.raceCache = pawn.def;
|
||||
}
|
||||
|
||||
public void ExposeData()
|
||||
{
|
||||
Scribe_Values.Look(ref labelCache, "namecache");
|
||||
Scribe_Values.Look(ref totalSexCount, "totalsexhad", 0);
|
||||
Scribe_Values.Look(ref raped, "raped", 0);
|
||||
Scribe_Values.Look(ref rapedMe, "rapedme", 0);
|
||||
Scribe_Values.Look(ref orgasms, "orgasms", 0);
|
||||
Scribe_Values.Look(ref bestSextype, "bestsextype", xxx.rjwSextype.None);
|
||||
Scribe_Values.Look(ref bestSatisfaction, "bestsatisfaction", 0f);
|
||||
Scribe_Values.Look(ref iTookVirgin, "itookvirgin", false);
|
||||
Scribe_Values.Look(ref incest, "incest", false);
|
||||
Scribe_Values.Look(ref recentSexTickAbs, "recentsextickabs", 0);
|
||||
Scribe_Values.Look(ref bestSexTickAbs, "bestsextickabs", 0);
|
||||
Scribe_Defs.Look(ref raceCache, "race");
|
||||
}
|
||||
|
||||
public void RecordSex(SexProps props)
|
||||
{
|
||||
totalSexCount++;
|
||||
if (props.isRape)
|
||||
{
|
||||
if (partner == props.GetInteractionInitiator())
|
||||
rapedMe++;
|
||||
else
|
||||
raped++;
|
||||
}
|
||||
recentSexTickAbs = GenTicks.TicksAbs;
|
||||
}
|
||||
|
||||
public void RecordSatisfaction(SexProps props, float satisfaction)
|
||||
{
|
||||
orgasms++;
|
||||
|
||||
if (satisfaction > bestSatisfaction)
|
||||
{
|
||||
bestSextype = props.sexType;
|
||||
bestSatisfaction = satisfaction;
|
||||
bestSexTickAbs = GenTicks.TicksAbs;
|
||||
}
|
||||
}
|
||||
|
||||
public void TookVirgin()
|
||||
{
|
||||
iTookVirgin = true;
|
||||
}
|
||||
|
||||
protected void LoadPartnerPawn(string partnerID)
|
||||
{
|
||||
foreach (Map map in Find.Maps)
|
||||
{
|
||||
partner = map.mapPawns.AllPawns.Find(x => x.ThingID.Equals(partnerID));
|
||||
if (partner != null) return;
|
||||
}
|
||||
partner = Find.WorldPawns.AllPawnsAliveOrDead.Find(x => x.ThingID.Equals(partnerID));
|
||||
}
|
||||
|
||||
#region OrderComparers
|
||||
|
||||
public class RecentOrderComparer : IComparer<SexPartnerHistoryRecord>
|
||||
{
|
||||
public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
|
||||
{
|
||||
return y.RecentSexTickAbs.CompareTo(x.RecentSexTickAbs);
|
||||
}
|
||||
}
|
||||
|
||||
public class MostOrderComparer : IComparer<SexPartnerHistoryRecord>
|
||||
{
|
||||
public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
|
||||
{
|
||||
return y.TotalSexCount.CompareTo(x.TotalSexCount);
|
||||
}
|
||||
}
|
||||
|
||||
public class NameOrderComparer : IComparer<SexPartnerHistoryRecord>
|
||||
{
|
||||
public int Compare(SexPartnerHistoryRecord x, SexPartnerHistoryRecord y)
|
||||
{
|
||||
return x.Label.CompareTo(y.Label);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion OrderComparers
|
||||
}
|
||||
}
|
101
Source/RJWSexperience/SexHistory/UI/RJWUIUtility.cs
Normal file
101
Source/RJWSexperience/SexHistory/UI/RJWUIUtility.cs
Normal file
|
@ -0,0 +1,101 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.SexHistory.UI
|
||||
{
|
||||
public static class RJWUIUtility
|
||||
{
|
||||
public const float FONTHEIGHT = 22f;
|
||||
public const float CARDHEIGHT = 110f;
|
||||
public const float LISTPAWNSIZE = 100f;
|
||||
public const float BASESAT = 0.40f;
|
||||
public const float ICONSIZE = 30f;
|
||||
|
||||
public static void DrawQuirk(this Rect rect, Pawn pawn)
|
||||
{
|
||||
List<Quirk> quirks = Quirk.All.FindAll(x => pawn.Has(x));
|
||||
string quirkstr = quirks.Select(x => x.Key).ToCommaList();
|
||||
string tooltip = "";
|
||||
|
||||
Widgets.Label(rect, "Quirks".Translate() + quirkstr);
|
||||
|
||||
if (Mouse.IsOver(rect))
|
||||
{
|
||||
if (quirks.NullOrEmpty())
|
||||
{
|
||||
tooltip = "NoQuirks".Translate();
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
foreach (var q in quirks)
|
||||
{
|
||||
stringBuilder.AppendLine(q.Key.Colorize(Color.yellow));
|
||||
stringBuilder.AppendLine(q.LocaliztionKey.Translate(pawn.Named("pawn")).AdjustedFor(pawn).Resolve());
|
||||
stringBuilder.AppendLine("");
|
||||
}
|
||||
tooltip = stringBuilder.ToString().TrimEndNewlines();
|
||||
}
|
||||
Widgets.DrawHighlight(rect);
|
||||
}
|
||||
|
||||
TooltipHandler.TipRegion(rect, tooltip);
|
||||
}
|
||||
|
||||
public static void DrawSexuality(this Rect rect, CompRJW comp)
|
||||
{
|
||||
if (comp != null)
|
||||
{
|
||||
string sexuality = Keyed.Sexuality[(int)comp.orientation];
|
||||
Widgets.Label(rect, Keyed.RS_Sexuality + ": " + sexuality);
|
||||
Widgets.DrawHighlightIfMouseover(rect);
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetRelationsString(this Pawn pawn, Pawn otherpawn)
|
||||
{
|
||||
if (otherpawn != null)
|
||||
{
|
||||
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(otherpawn);
|
||||
if (!relations.EnumerableNullOrEmpty()) return relations.Select(x => x.GetGenderSpecificLabel(otherpawn)).ToCommaList().CapitalizeFirst();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static void DrawBorder(this Rect rect, Texture border, float thickness = 1f)
|
||||
{
|
||||
GUI.DrawTexture(new Rect(rect.x, rect.y, rect.width, thickness), border);
|
||||
GUI.DrawTexture(new Rect(rect.x + rect.width - thickness, rect.y, thickness, rect.height), border);
|
||||
GUI.DrawTexture(new Rect(rect.x, rect.y + rect.height - thickness, rect.width, thickness), border);
|
||||
GUI.DrawTexture(new Rect(rect.x, rect.y, thickness, rect.height), border);
|
||||
}
|
||||
|
||||
public static string GetStatExplanation(Pawn pawn, StatDef stat, float val)
|
||||
{
|
||||
if (!pawn.Dead)
|
||||
return stat.description + "\n" + stat.Worker.GetExplanationFull(StatRequest.For(pawn), ToStringNumberSense.Undefined, val);
|
||||
return "Dead".Translate();
|
||||
}
|
||||
|
||||
public static string GetSexDays(int absticks, bool printUnknown = false)
|
||||
{
|
||||
if (absticks != 0)
|
||||
return GenDate.ToStringTicksToDays(GenTicks.TicksAbs - absticks) + " " + Keyed.RS_Ago;
|
||||
else if (printUnknown)
|
||||
return Keyed.Unknown;
|
||||
return "";
|
||||
}
|
||||
|
||||
public static Texture GetRaceIcon(Pawn pawn, Vector2 size)
|
||||
{
|
||||
if (pawn != null)
|
||||
return PortraitsCache.Get(pawn, size, Rot4.South, default, 1, true, true, false, false);
|
||||
return HistoryUtility.UnknownPawn;
|
||||
}
|
||||
}
|
||||
}
|
654
Source/RJWSexperience/SexHistory/UI/SexStatus.cs
Normal file
654
Source/RJWSexperience/SexHistory/UI/SexStatus.cs
Normal file
|
@ -0,0 +1,654 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
using Verse.Sound;
|
||||
|
||||
namespace RJWSexperience.SexHistory.UI
|
||||
{
|
||||
public enum PartnerOrderMode
|
||||
{
|
||||
Normal = 0,
|
||||
Recent = 1,
|
||||
Most = 2,
|
||||
Name, MaxValue = 3
|
||||
};
|
||||
|
||||
public static class PartnerOrderModeExtension
|
||||
{
|
||||
public static PartnerOrderMode Next(this PartnerOrderMode mode)
|
||||
{
|
||||
return (PartnerOrderMode)(((int)mode + 1) % ((int)PartnerOrderMode.MaxValue + 1));
|
||||
}
|
||||
}
|
||||
|
||||
public class SexStatusWindow : Window
|
||||
{
|
||||
public const float WINDOW_WIDTH = 900f;
|
||||
public const float WINDOW_HEIGHT = 600f;
|
||||
public const float FONTHEIGHT = RJWUIUtility.FONTHEIGHT;
|
||||
public const float CARDHEIGHT = RJWUIUtility.CARDHEIGHT;
|
||||
public const float LISTPAWNSIZE = RJWUIUtility.LISTPAWNSIZE;
|
||||
public const float BASESAT = RJWUIUtility.BASESAT;
|
||||
public const float ICONSIZE = RJWUIUtility.ICONSIZE;
|
||||
|
||||
public static readonly int[] Sextype =
|
||||
{
|
||||
(int)xxx.rjwSextype.Vaginal,
|
||||
(int)xxx.rjwSextype.Anal,
|
||||
(int)xxx.rjwSextype.Oral,
|
||||
(int)xxx.rjwSextype.Fellatio,
|
||||
(int)xxx.rjwSextype.Cunnilingus,
|
||||
(int)xxx.rjwSextype.DoublePenetration,
|
||||
(int)xxx.rjwSextype.Boobjob,
|
||||
(int)xxx.rjwSextype.Handjob,
|
||||
(int)xxx.rjwSextype.Footjob,
|
||||
(int)xxx.rjwSextype.Fingering,
|
||||
(int)xxx.rjwSextype.Scissoring,
|
||||
(int)xxx.rjwSextype.MutualMasturbation,
|
||||
(int)xxx.rjwSextype.Fisting,
|
||||
(int)xxx.rjwSextype.Rimming,
|
||||
(int)xxx.rjwSextype.Sixtynine
|
||||
};
|
||||
|
||||
protected Pawn pawn;
|
||||
protected SexPartnerHistoryRecord selectedPawn;
|
||||
protected SexHistoryComp history;
|
||||
protected CompRJW rjwcomp;
|
||||
protected List<SexPartnerHistoryRecord> partnerList;
|
||||
protected PartnerOrderMode orderMode;
|
||||
|
||||
private static GUIStyle fontStyleCenter;
|
||||
private static GUIStyle fontStyleRight;
|
||||
private static GUIStyle fontStyleLeft;
|
||||
private static GUIStyle boxStyle;
|
||||
private static GUIStyle buttonStyle;
|
||||
|
||||
private static Vector2 LastWindowPosition { get; set; }
|
||||
private Vector2 scroll;
|
||||
|
||||
private static void InitStyles()
|
||||
{
|
||||
if (fontStyleCenter != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GUIStyleState fontStyleState = new GUIStyleState() { textColor = Color.white };
|
||||
GUIStyleState boxStyleState = GUI.skin.textArea.normal;
|
||||
GUIStyleState buttonStyleState = GUI.skin.button.normal;
|
||||
fontStyleCenter = new GUIStyle() { alignment = TextAnchor.MiddleCenter, normal = fontStyleState };
|
||||
fontStyleRight = new GUIStyle() { alignment = TextAnchor.MiddleRight, normal = fontStyleState };
|
||||
fontStyleLeft = new GUIStyle() { alignment = TextAnchor.MiddleLeft, normal = fontStyleState };
|
||||
boxStyle = new GUIStyle(GUI.skin.textArea) { hover = boxStyleState, onHover = boxStyleState, onNormal = boxStyleState };
|
||||
buttonStyle = new GUIStyle(GUI.skin.button) { hover = buttonStyleState, onHover = buttonStyleState, onNormal = buttonStyleState };
|
||||
}
|
||||
|
||||
public SexStatusWindow(Pawn pawn, SexHistoryComp history)
|
||||
{
|
||||
this.pawn = pawn;
|
||||
this.history = history;
|
||||
this.selectedPawn = null;
|
||||
this.rjwcomp = pawn.TryGetComp<CompRJW>();
|
||||
this.partnerList = history?.PartnerList;
|
||||
orderMode = PartnerOrderMode.Recent;
|
||||
SortPartnerList(orderMode);
|
||||
|
||||
soundClose = SoundDefOf.CommsWindow_Close;
|
||||
absorbInputAroundWindow = false;
|
||||
forcePause = false;
|
||||
preventCameraMotion = false;
|
||||
draggable = true;
|
||||
doCloseX = true;
|
||||
}
|
||||
|
||||
protected override void SetInitialSizeAndPosition()
|
||||
{
|
||||
base.SetInitialSizeAndPosition();
|
||||
|
||||
if (LastWindowPosition == Vector2.zero)
|
||||
return;
|
||||
|
||||
windowRect.x = LastWindowPosition.x;
|
||||
windowRect.y = LastWindowPosition.y;
|
||||
}
|
||||
|
||||
public override Vector2 InitialSize => new Vector2(WINDOW_WIDTH, WINDOW_HEIGHT);
|
||||
|
||||
public override void PreOpen()
|
||||
{
|
||||
base.PreOpen();
|
||||
InitStyles();
|
||||
}
|
||||
|
||||
public override void PreClose()
|
||||
{
|
||||
base.PreClose();
|
||||
LastWindowPosition = windowRect.position;
|
||||
}
|
||||
|
||||
public override void DoWindowContents(Rect inRect)
|
||||
{
|
||||
if (!SexperienceMod.Settings.SelectionLocked)
|
||||
{
|
||||
List<Pawn> selected = Find.Selector.SelectedPawns;
|
||||
if (selected.Count == 1)
|
||||
{
|
||||
Pawn p = selected.First();
|
||||
if (p != pawn)
|
||||
{
|
||||
SexHistoryComp h = p.TryGetComp<SexHistoryComp>();
|
||||
if (h != null) ChangePawn(p, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DrawSexStatus(inRect, history);
|
||||
}
|
||||
|
||||
public static void ToggleWindow(Pawn pawn, SexHistoryComp history)
|
||||
{
|
||||
SexStatusWindow window = (SexStatusWindow)Find.WindowStack.Windows.FirstOrDefault(x => x.GetType() == typeof(SexStatusWindow));
|
||||
if (window != null)
|
||||
{
|
||||
if (window.pawn != pawn)
|
||||
{
|
||||
SoundDefOf.TabOpen.PlayOneShotOnCamera();
|
||||
window.ChangePawn(pawn, history);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Find.WindowStack.Add(new SexStatusWindow(pawn, history));
|
||||
}
|
||||
}
|
||||
|
||||
public void ChangePawn(Pawn pawn, SexHistoryComp history)
|
||||
{
|
||||
List<Pawn> selected = Find.Selector.SelectedPawns;
|
||||
if (!selected.NullOrEmpty())
|
||||
{
|
||||
foreach (Pawn p in selected)
|
||||
{
|
||||
Find.Selector.Deselect(p);
|
||||
}
|
||||
}
|
||||
|
||||
this.pawn = pawn;
|
||||
this.history = history;
|
||||
this.selectedPawn = null;
|
||||
this.rjwcomp = pawn.TryGetComp<CompRJW>();
|
||||
this.partnerList = history?.PartnerList;
|
||||
if (!pawn.DestroyedOrNull() && Find.CurrentMap == pawn.Map) Find.Selector.Select(pawn);
|
||||
SortPartnerList(orderMode);
|
||||
}
|
||||
|
||||
public void SortPartnerList(PartnerOrderMode mode)
|
||||
{
|
||||
if (partnerList.NullOrEmpty()) return;
|
||||
switch (mode)
|
||||
{
|
||||
default:
|
||||
partnerList = history?.PartnerList;
|
||||
break;
|
||||
case PartnerOrderMode.Recent:
|
||||
partnerList.Sort(new SexPartnerHistoryRecord.RecentOrderComparer());
|
||||
break;
|
||||
case PartnerOrderMode.Most:
|
||||
partnerList.Sort(new SexPartnerHistoryRecord.MostOrderComparer());
|
||||
break;
|
||||
case PartnerOrderMode.Name:
|
||||
partnerList.Sort(new SexPartnerHistoryRecord.NameOrderComparer());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Main contents
|
||||
/// </summary>
|
||||
protected void DrawSexStatus(Rect mainrect, SexHistoryComp history)
|
||||
{
|
||||
float sectionwidth = mainrect.width / 3;
|
||||
|
||||
Rect leftRect = new Rect(mainrect.x, mainrect.y, sectionwidth, mainrect.height);
|
||||
Rect centerRect = new Rect(mainrect.x + sectionwidth, mainrect.y, sectionwidth, mainrect.height);
|
||||
Rect rightRect = new Rect(mainrect.x + (sectionwidth * 2), mainrect.y, sectionwidth, mainrect.height);
|
||||
|
||||
if (history != null)
|
||||
{
|
||||
//Left section
|
||||
DrawBaseSexInfoLeft(leftRect.ContractedBy(4f));
|
||||
|
||||
//Center section
|
||||
DrawBaseSexInfoCenter(centerRect.ContractedBy(4f), history.parent as Pawn);
|
||||
|
||||
//Right section
|
||||
DrawBaseSexInfoRight(rightRect.ContractedBy(4f));
|
||||
}
|
||||
}
|
||||
|
||||
protected void DrawInfoWithPortrait(Rect rect, SexPartnerHistoryRecord history, string tooltip = "")
|
||||
{
|
||||
Widgets.DrawMenuSection(rect);
|
||||
string str = tooltip;
|
||||
Rect portraitRect = new Rect(rect.x, rect.y, rect.height - FONTHEIGHT, rect.height - FONTHEIGHT);
|
||||
Rect nameRect = new Rect(rect.x + portraitRect.width, rect.y, rect.width - portraitRect.width, FONTHEIGHT);
|
||||
Rect sexinfoRect = new Rect(rect.x + portraitRect.width, rect.y + FONTHEIGHT, rect.width - portraitRect.width, FONTHEIGHT);
|
||||
Rect sexinfoRect2 = new Rect(rect.x + portraitRect.width, rect.y + (FONTHEIGHT * 2), rect.width - portraitRect.width, FONTHEIGHT);
|
||||
Rect bestsexRect = new Rect(rect.x + 2f, rect.y + (FONTHEIGHT * 3), rect.width - 4f, FONTHEIGHT - 2f);
|
||||
|
||||
if (history != null)
|
||||
{
|
||||
if (history.Incest) str += " - " + Keyed.Incest;
|
||||
Pawn partner = history.Partner;
|
||||
DrawPawn(portraitRect, history);
|
||||
Widgets.DrawHighlightIfMouseover(portraitRect);
|
||||
if (Widgets.ButtonInvisible(portraitRect))
|
||||
{
|
||||
SexHistoryComp pawnhistory = partner?.TryGetComp<SexHistoryComp>();
|
||||
if (pawnhistory != null)
|
||||
{
|
||||
ChangePawn(partner, pawnhistory);
|
||||
SoundDefOf.Click.PlayOneShotOnCamera();
|
||||
}
|
||||
else
|
||||
{
|
||||
SoundDefOf.ClickReject.PlayOneShotOnCamera();
|
||||
}
|
||||
}
|
||||
|
||||
string rapeInfo = "";
|
||||
if (history.Raped > 0) rapeInfo += Keyed.RS_Raped + history.Raped + " ";
|
||||
if (history.RapedMe > 0) rapeInfo += Keyed.RS_RapedMe + history.RapedMe;
|
||||
|
||||
GUI.Label(nameRect, partner?.Name?.ToStringFull ?? history.Label.CapitalizeFirst(), fontStyleLeft);
|
||||
GUI.Label(sexinfoRect, Keyed.RS_Sex_Count + history.TotalSexCount + " " + rapeInfo, fontStyleLeft);
|
||||
GUI.Label(sexinfoRect2, Keyed.RS_Orgasms + history.OrgasmCount, fontStyleLeft);
|
||||
GUI.Label(sexinfoRect2, pawn.GetRelationsString(partner) + " ", fontStyleRight);
|
||||
float p = history.BestSatisfaction / BASESAT;
|
||||
FillableBarLabeled(bestsexRect, String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)history.BestSextype]), p / 2, HistoryUtility.SextypeColor[(int)history.BestSextype], Texture2D.blackTexture, null, String.Format("{0:P2}", p));
|
||||
|
||||
if (history.IamFirst)
|
||||
str += "\n" + Keyed.RS_LostVirgin(history.Label, pawn.LabelShort);
|
||||
if (history.BestSexTickAbs != 0)
|
||||
str += "\n" + Keyed.RS_HadBestSexDaysAgo(history.BestSexElapsedTicks.ToStringTicksToDays() + " " + Keyed.RS_Ago);
|
||||
|
||||
TooltipHandler.TipRegion(rect, str);
|
||||
}
|
||||
else
|
||||
{
|
||||
Widgets.DrawTextureFitted(portraitRect, HistoryUtility.UnknownPawn, 1.0f);
|
||||
Widgets.Label(nameRect, Keyed.Unknown);
|
||||
Widgets.Label(sexinfoRect, Keyed.RS_Sex_Count + "?");
|
||||
Widgets.Label(sexinfoRect2, Keyed.RS_Orgasms + "?");
|
||||
FillableBarLabeled(bestsexRect, String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)xxx.rjwSextype.None]), 0, Texture2D.linearGrayTexture, Texture2D.blackTexture);
|
||||
}
|
||||
}
|
||||
|
||||
protected void DrawSexInfoCard(Rect rect, SexPartnerHistoryRecord history, string label, string tooltip, string rightlabel = "")
|
||||
{
|
||||
Rect labelRect = new Rect(rect.x, rect.y, rect.width, FONTHEIGHT);
|
||||
Rect infoRect = new Rect(rect.x, rect.y + FONTHEIGHT, rect.width, rect.height - FONTHEIGHT);
|
||||
GUI.Label(labelRect, label, fontStyleLeft);
|
||||
GUI.Label(labelRect, rightlabel, fontStyleRight);
|
||||
DrawInfoWithPortrait(infoRect, history, tooltip);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Right section
|
||||
/// </summary>
|
||||
protected void DrawBaseSexInfoRight(Rect rect)
|
||||
{
|
||||
Listing_Standard listmain = new Listing_Standard();
|
||||
listmain.Begin(rect.ContractedBy(4f));
|
||||
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), history.GetRecentPartnersHistory, Keyed.RS_Recent_Sex_Partner, Keyed.RS_Recent_Sex_Partner_ToolTip, RJWUIUtility.GetSexDays(history.RecentSexTickAbs));
|
||||
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), history.GetFirstPartnerHistory, Keyed.RS_First_Sex_Partner, Keyed.RS_First_Sex_Partner_ToolTip, RJWUIUtility.GetSexDays(history.FirstSexTickAbs));
|
||||
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), history.GetMostPartnerHistory, Keyed.RS_Most_Sex_Partner, Keyed.RS_Most_Sex_Partner_ToolTip, RJWUIUtility.GetSexDays(history.MostSexTickAbs));
|
||||
DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), history.GetBestSexPartnerHistory, Keyed.RS_Best_Sex_Partner, Keyed.RS_Best_Sex_Partner_ToolTip, RJWUIUtility.GetSexDays(history.BestSexTickAbs));
|
||||
GUI.Label(listmain.GetRect(FONTHEIGHT), Keyed.RS_PreferRace, fontStyleLeft);
|
||||
DrawPreferRace(listmain.GetRect(66f + 15f));
|
||||
listmain.GetRect(15f);
|
||||
listmain.End();
|
||||
}
|
||||
|
||||
protected void DrawPreferRace(Rect rect)
|
||||
{
|
||||
Widgets.DrawMenuSection(rect);
|
||||
Rect portraitRect = new Rect(rect.x, rect.y, rect.height - 15f, rect.height - 15f);
|
||||
Rect infoRect1 = new Rect(rect.x + portraitRect.width, rect.y, rect.width - portraitRect.width, FONTHEIGHT);
|
||||
Rect infoRect2 = new Rect(rect.x + portraitRect.width, rect.y + FONTHEIGHT, rect.width - portraitRect.width, FONTHEIGHT);
|
||||
Rect infoRect3 = new Rect(rect.x + portraitRect.width, rect.y + (FONTHEIGHT * 2), rect.width - portraitRect.width - 2f, FONTHEIGHT);
|
||||
|
||||
if (history.PreferRace != null)
|
||||
{
|
||||
Widgets.DrawTextureFitted(portraitRect, RJWUIUtility.GetRaceIcon(history.PreferRacePawn, portraitRect.size), 1.0f);
|
||||
GUI.Label(infoRect1, history.PreferRace?.label.CapitalizeFirst() ?? Keyed.None, fontStyleLeft);
|
||||
GUI.Label(infoRect2, Keyed.RS_Sex_Count + history.PreferRaceSexCount, fontStyleLeft);
|
||||
if (history.PreferRace != pawn.def)
|
||||
{
|
||||
if (history.PreferRace.race.Animal ^ pawn.def.race.Animal)
|
||||
{
|
||||
GUI.Label(infoRect1, Keyed.RS_Bestiality + " ", fontStyleRight);
|
||||
FillableBarLabeled(infoRect3, Keyed.RS_Sex_Info(Keyed.RS_Bestiality, history.BestialityCount.ToString()), history.BestialityCount / 100f, Texture2D.linearGrayTexture, Texture2D.blackTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
GUI.Label(infoRect1, Keyed.RS_Interspecies + " ", fontStyleRight);
|
||||
FillableBarLabeled(infoRect3, Keyed.RS_Sex_Info(Keyed.RS_Interspecies, history.InterspeciesCount.ToString()), history.InterspeciesCount / 100f, Texture2D.linearGrayTexture, Texture2D.blackTexture);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Widgets.DrawTextureFitted(portraitRect, HistoryUtility.UnknownPawn, 1.0f);
|
||||
GUI.Label(infoRect1, Keyed.None, fontStyleLeft);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Center section
|
||||
/// </summary>
|
||||
protected void DrawBaseSexInfoCenter(Rect rect, Pawn pawn)
|
||||
{
|
||||
Rect portraitRect = new Rect(rect.x + (rect.width / 4), rect.y, rect.width / 2, rect.width / 1.5f);
|
||||
Rect nameRect = new Rect(portraitRect.x, portraitRect.yMax - (FONTHEIGHT * 2), portraitRect.width, FONTHEIGHT * 2);
|
||||
Rect infoRect = new Rect(rect.x, rect.y + portraitRect.height, rect.width, rect.height - portraitRect.height);
|
||||
Rect lockRect = new Rect(portraitRect.xMax - ICONSIZE, portraitRect.y, ICONSIZE, ICONSIZE);
|
||||
Rect tmp;
|
||||
|
||||
if (Mouse.IsOver(portraitRect))
|
||||
{
|
||||
Configurations settings = SexperienceMod.Settings;
|
||||
Texture lockicon = settings.SelectionLocked ? HistoryUtility.Locked : HistoryUtility.Unlocked;
|
||||
Widgets.DrawTextureFitted(lockRect, lockicon, 1.0f);
|
||||
if (Widgets.ButtonInvisible(lockRect))
|
||||
{
|
||||
SoundDefOf.Click.PlayOneShotOnCamera();
|
||||
settings.SelectionLocked = !settings.SelectionLocked;
|
||||
}
|
||||
}
|
||||
|
||||
GUI.Box(portraitRect, "", boxStyle);
|
||||
Widgets.DrawTextureFitted(portraitRect, PortraitsCache.Get(pawn, portraitRect.size, Rot4.South, default, 1, true, true, false, false), 1.0f);
|
||||
Widgets.DrawHighlightIfMouseover(portraitRect);
|
||||
if (Widgets.ButtonInvisible(portraitRect))
|
||||
{
|
||||
SoundDefOf.Click.PlayOneShotOnCamera();
|
||||
selectedPawn = null;
|
||||
}
|
||||
|
||||
GUI.Box(nameRect, "", boxStyle);
|
||||
GUI.Label(nameRect.TopHalf(), pawn.Name?.ToStringFull ?? pawn.Label, fontStyleCenter);
|
||||
if (pawn.story != null) GUI.Label(nameRect.BottomHalf(), pawn.ageTracker.AgeBiologicalYears + ", " + pawn.story.Title, fontStyleCenter);
|
||||
else GUI.Label(nameRect.BottomHalf(), pawn.ageTracker.AgeBiologicalYears + ", " + pawn.def.label, fontStyleCenter);
|
||||
|
||||
Listing_Standard listmain = new Listing_Standard();
|
||||
listmain.Begin(infoRect);
|
||||
listmain.Gap(20f);
|
||||
float p;
|
||||
|
||||
Trait virginity = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin);
|
||||
if (virginity != null && virginity.Degree != Virginity.TraitDegree.FemaleAfterSurgery)
|
||||
{
|
||||
tmp = listmain.GetRect(FONTHEIGHT);
|
||||
GUI.color = Color.red;
|
||||
GUI.Box(tmp, "", boxStyle);
|
||||
GUI.color = Color.white;
|
||||
GUI.Label(tmp, virginity.Label, fontStyleCenter);
|
||||
}
|
||||
else
|
||||
{
|
||||
p = history.TotalSexHad;
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_TotalSexHad + ": {0:0} ({1:0})", p, pawn.records.GetValue(xxx.CountOfSex)), p / 100, HistoryUtility.TotalSex, Texture2D.blackTexture, null, Keyed.RS_SAT_AVG(String.Format("{0:P2}", history.AVGSat)));
|
||||
}
|
||||
listmain.Gap(1f);
|
||||
|
||||
tmp = listmain.GetRect(FONTHEIGHT);
|
||||
p = pawn.records.GetValue(VariousDefOf.Lust);
|
||||
FillableBarLabeled(tmp, String.Format(Keyed.Lust + ": {0:0.00}", p), Mathf.Clamp01(p.Normalization(-SexperienceMod.Settings.LustLimit * 3, SexperienceMod.Settings.LustLimit * 3)), HistoryUtility.Slaanesh, Texture2D.blackTexture, null, String.Format(xxx.sex_drive_stat.LabelCap.CapitalizeFirst() + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_drive_stat)));
|
||||
listmain.Gap(1f);
|
||||
if (Mouse.IsOver(tmp))
|
||||
{
|
||||
TooltipHandler.TipRegion(tmp, RJWUIUtility.GetStatExplanation(pawn, xxx.sex_drive_stat, pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_drive_stat)));
|
||||
}
|
||||
|
||||
p = history.GetBestSextype(out xxx.rjwSextype sextype) / BASESAT;
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Best_Sextype + ": {0}", Keyed.Sextype[(int)sextype]), p / 2, HistoryUtility.SextypeColor[(int)sextype], Texture2D.blackTexture, null, Keyed.RS_SAT_AVG(String.Format("{0:P2}", p)));
|
||||
listmain.Gap(1f);
|
||||
|
||||
p = history.GetRecentSextype(out sextype) / BASESAT;
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Recent_Sextype + ": {0}", Keyed.Sextype[(int)sextype]), p / 2, HistoryUtility.SextypeColor[(int)sextype], Texture2D.blackTexture, null, String.Format("{0:P2}", p));
|
||||
listmain.Gap(1f);
|
||||
|
||||
if (history.IncestuousCount < history.CorpseFuckCount)
|
||||
{
|
||||
p = history.CorpseFuckCount;
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Necrophile + ": {0}", p), p / 50, HistoryUtility.Nurgle, Texture2D.blackTexture);
|
||||
listmain.Gap(1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
p = history.IncestuousCount;
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.Incest + ": {0}", p), p / 50, HistoryUtility.Nurgle, Texture2D.blackTexture);
|
||||
listmain.Gap(1f);
|
||||
}
|
||||
|
||||
p = pawn.records.GetValue(VariousDefOf.AmountofEatenCum);
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Cum_Swallowed + ": {0} mL, {1} " + Keyed.RS_NumofTimes, p, pawn.records.GetValue(VariousDefOf.NumofEatenCum)), p / 1000, Texture2D.linearGrayTexture, Texture2D.blackTexture);
|
||||
listmain.Gap(1f);
|
||||
|
||||
Hediff addiction = pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.CumAddiction)
|
||||
?? pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.CumTolerance);
|
||||
if (addiction != null)
|
||||
{
|
||||
p = addiction.Severity;
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), $"{addiction.Label}: {p.ToStringPercent()}", p, Texture2D.linearGrayTexture, Texture2D.blackTexture, addiction.GetTooltip(pawn, false));
|
||||
}
|
||||
else
|
||||
{
|
||||
listmain.GetRect(FONTHEIGHT);
|
||||
}
|
||||
listmain.Gap(1f);
|
||||
|
||||
p = history.RapedCount;
|
||||
tmp = listmain.GetRect(FONTHEIGHT);
|
||||
if (p < history.BeenRapedCount)
|
||||
{
|
||||
p = history.BeenRapedCount;
|
||||
FillableBarLabeled(tmp, String.Format(Keyed.RS_BeenRaped + ": {0}", p), p / 50, Texture2D.grayTexture, Texture2D.blackTexture, null, String.Format(xxx.vulnerability_stat.LabelCap.CapitalizeFirst() + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.vulnerability_stat)));
|
||||
listmain.Gap(1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
FillableBarLabeled(tmp, String.Format(Keyed.RS_RapedSomeone + ": {0}", p), p / 50, HistoryUtility.Khorne, Texture2D.blackTexture, null, String.Format(xxx.vulnerability_stat.LabelCap.CapitalizeFirst() + ": {0:P2}", pawn.Dead ? 0 : pawn.GetStatValue(xxx.vulnerability_stat)));
|
||||
listmain.Gap(1f);
|
||||
}
|
||||
if (Mouse.IsOver(tmp))
|
||||
{
|
||||
TooltipHandler.TipRegion(tmp, RJWUIUtility.GetStatExplanation(pawn, xxx.vulnerability_stat, pawn.Dead ? 0 : pawn.GetStatValue(xxx.vulnerability_stat)));
|
||||
}
|
||||
|
||||
p = pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_satisfaction);
|
||||
tmp = listmain.GetRect(FONTHEIGHT);
|
||||
FillableBarLabeled(tmp, String.Format(xxx.sex_satisfaction.LabelCap.CapitalizeFirst() + ": {0:P2}", p), p / 2, HistoryUtility.Satisfaction, Texture2D.blackTexture);
|
||||
listmain.Gap(1f);
|
||||
if (Mouse.IsOver(tmp))
|
||||
{
|
||||
TooltipHandler.TipRegion(tmp, RJWUIUtility.GetStatExplanation(pawn, xxx.sex_satisfaction, pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_satisfaction)));
|
||||
}
|
||||
|
||||
SkillRecord skill = pawn.skills?.GetSkill(VariousDefOf.Sex);
|
||||
p = skill?.Level ?? 0;
|
||||
tmp = listmain.GetRect(FONTHEIGHT);
|
||||
FillableBarLabeled(tmp, $"{Keyed.RS_SexSkill}: {p}, {skill?.xpSinceLastLevel / skill?.XpRequiredForLevelUp:P2}", p / 20, HistoryUtility.Tzeentch, Texture2D.blackTexture, null, $"{VariousDefOf.SexAbility.LabelCap.CapitalizeFirst()}: {pawn.GetSexStat():P2}", HistoryUtility.PassionBG[(int)(skill?.passion ?? 0)]);
|
||||
if (Mouse.IsOver(tmp))
|
||||
{
|
||||
TooltipHandler.TipRegion(tmp, RJWUIUtility.GetStatExplanation(pawn, VariousDefOf.SexAbility, pawn.GetSexStat()));
|
||||
}
|
||||
|
||||
listmain.Gap(1f);
|
||||
|
||||
if (selectedPawn != null) DrawSexInfoCard(listmain.GetRect(CARDHEIGHT), selectedPawn, Keyed.RS_Selected_Partner, Keyed.RS_Selected_Partner, RJWUIUtility.GetSexDays(selectedPawn.RecentSexTickAbs));
|
||||
else DrawExtraInfo(listmain.GetRect(CARDHEIGHT));
|
||||
|
||||
listmain.End();
|
||||
}
|
||||
|
||||
protected void DrawExtraInfo(Rect rect)
|
||||
{
|
||||
Widgets.DrawMenuSection(rect);
|
||||
Rect inRect = rect.ContractedBy(4f);
|
||||
Listing_Standard listmain = new Listing_Standard();
|
||||
listmain.Begin(inRect);
|
||||
listmain.Gap(4f);
|
||||
listmain.GetRect(FONTHEIGHT).DrawSexuality(rjwcomp);
|
||||
listmain.Gap(1f);
|
||||
listmain.GetRect(FONTHEIGHT * 3f).DrawQuirk(pawn);
|
||||
listmain.End();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Left section
|
||||
/// </summary>
|
||||
protected void DrawBaseSexInfoLeft(Rect rect)
|
||||
{
|
||||
Listing_Standard listmain = new Listing_Standard();
|
||||
listmain.Begin(rect);
|
||||
float p;
|
||||
|
||||
//Sex statistics
|
||||
GUI.Label(listmain.GetRect(FONTHEIGHT), " " + Keyed.RS_Statistics, fontStyleLeft);
|
||||
listmain.Gap(1f);
|
||||
float maxSatisfaction = history.GetBestSextype(out _);
|
||||
if (maxSatisfaction == 0f) maxSatisfaction = BASESAT;
|
||||
for (int i = 0; i < Sextype.Length; i++)
|
||||
{
|
||||
int sexindex = Sextype[i];
|
||||
float relativeSat = history.GetAVGSat(sexindex) / maxSatisfaction;
|
||||
p = history.GetAVGSat(sexindex) / BASESAT;
|
||||
string label = Keyed.RS_Sex_Info(Keyed.Sextype[sexindex], history.GetSexCount(sexindex).ToString());
|
||||
Rect tmpRect = listmain.GetRect(FONTHEIGHT);
|
||||
FillableBarLabeled(tmpRect, label, relativeSat, HistoryUtility.SextypeColor[sexindex], Texture2D.blackTexture, null, Keyed.RS_SAT_AVG(String.Format("{0:P2}", p)));
|
||||
if (Mouse.IsOver(tmpRect))
|
||||
{
|
||||
TooltipHandler.TipRegion(tmpRect, Keyed.RS_LastSex.CapitalizeFirst() + ": " + RJWUIUtility.GetSexDays(history.GetSextypeRecentTickAbs(Sextype[i]), true));
|
||||
}
|
||||
|
||||
listmain.Gap(1f);
|
||||
}
|
||||
|
||||
p = history.PartnerCount;
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_Sex_Partners + ": {0} ({1})", p, pawn.records.GetValue(VariousDefOf.SexPartnerCount)), p / 50, HistoryUtility.Partners, Texture2D.blackTexture);
|
||||
listmain.Gap(1f);
|
||||
|
||||
p = history.VirginsTaken;
|
||||
FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(Keyed.RS_VirginsTaken + ": {0:0}", p), p / 100, HistoryUtility.Partners, Texture2D.blackTexture);
|
||||
listmain.Gap(1f);
|
||||
|
||||
//Partner list
|
||||
Rect listLabelRect = listmain.GetRect(FONTHEIGHT);
|
||||
Rect sortbtnRect = new Rect(listLabelRect.xMax - 80f, listLabelRect.y, 80f, listLabelRect.height);
|
||||
GUI.Label(listLabelRect, " " + Keyed.RS_PartnerList, fontStyleLeft);
|
||||
if (Widgets.ButtonText(sortbtnRect, orderMode.Translate()))
|
||||
{
|
||||
SoundDefOf.Click.PlayOneShotOnCamera();
|
||||
orderMode = orderMode.Next();
|
||||
SortPartnerList(orderMode);
|
||||
}
|
||||
|
||||
listmain.Gap(1f);
|
||||
|
||||
Rect scrollRect = listmain.GetRect(CARDHEIGHT + 1f);
|
||||
GUI.Box(scrollRect, "", buttonStyle);
|
||||
if (!partnerList.NullOrEmpty())
|
||||
{
|
||||
Rect listRect = new Rect(scrollRect.x, scrollRect.y, LISTPAWNSIZE * partnerList.Count, scrollRect.height - 30f);
|
||||
Widgets.ScrollHorizontal(scrollRect, ref scroll, listRect);
|
||||
Widgets.BeginScrollView(scrollRect, ref scroll, listRect);
|
||||
DrawPartnerList(listRect, partnerList);
|
||||
Widgets.EndScrollView();
|
||||
}
|
||||
|
||||
listmain.End();
|
||||
}
|
||||
|
||||
protected void DrawPartnerList(Rect rect, List<SexPartnerHistoryRecord> partnerList)
|
||||
{
|
||||
Rect pawnRect = new Rect(rect.x, rect.y, LISTPAWNSIZE, LISTPAWNSIZE);
|
||||
for (int i = 0; i < partnerList.Count; i++)
|
||||
{
|
||||
Rect labelRect = new Rect(pawnRect.x, pawnRect.yMax - FONTHEIGHT, pawnRect.width, FONTHEIGHT);
|
||||
|
||||
DrawPawn(pawnRect, partnerList[i]);
|
||||
Widgets.DrawHighlightIfMouseover(pawnRect);
|
||||
GUI.Label(labelRect, partnerList[i].Label, fontStyleCenter);
|
||||
if (Widgets.ButtonInvisible(pawnRect))
|
||||
{
|
||||
selectedPawn = partnerList[i];
|
||||
SoundDefOf.Click.PlayOneShotOnCamera();
|
||||
}
|
||||
if (partnerList[i] == selectedPawn)
|
||||
{
|
||||
Widgets.DrawHighlightSelected(pawnRect);
|
||||
}
|
||||
|
||||
pawnRect.x += LISTPAWNSIZE;
|
||||
}
|
||||
}
|
||||
|
||||
protected void DrawPawn(Rect rect, SexPartnerHistoryRecord history)
|
||||
{
|
||||
if (history != null)
|
||||
{
|
||||
bool drawheart = false;
|
||||
Rect iconRect = new Rect(rect.x + (rect.width * 3 / 4), rect.y, rect.width / 4, rect.height / 4);
|
||||
Texture img = HistoryUtility.UnknownPawn;
|
||||
|
||||
if (history.IamFirst)
|
||||
{
|
||||
GUI.color = HistoryUtility.HistoryColor;
|
||||
Widgets.DrawTextureFitted(rect, HistoryUtility.FirstOverlay, 1.0f);
|
||||
GUI.color = Color.white;
|
||||
}
|
||||
|
||||
if (history.Partner != null)
|
||||
{
|
||||
img = PortraitsCache.Get(history.Partner, rect.size, Rot4.South, default, 1, true, true, false, false);
|
||||
drawheart = LovePartnerRelationUtility.LovePartnerRelationExists(pawn, history.Partner);
|
||||
}
|
||||
else if (history.Race?.uiIcon != null)
|
||||
{
|
||||
img = history.Race.uiIcon;
|
||||
}
|
||||
|
||||
if (history.Incest)
|
||||
{
|
||||
Widgets.DrawTextureFitted(iconRect, HistoryUtility.Incest, 1.0f);
|
||||
iconRect.x -= iconRect.width;
|
||||
}
|
||||
Widgets.DrawTextureFitted(rect, img, 1.0f);
|
||||
if (drawheart)
|
||||
{
|
||||
Widgets.DrawTextureFitted(iconRect, HistoryUtility.Heart, 1.0f);
|
||||
iconRect.x -= iconRect.width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void FillableBarLabeled(Rect rect, string label, float fillPercent, Texture2D filltexture, Texture2D bgtexture, string tooltip = null, string rightlabel = "", Texture2D border = null)
|
||||
{
|
||||
Widgets.FillableBar(rect, Math.Min(fillPercent, 1.0f), filltexture, bgtexture, true);
|
||||
GUI.Label(rect, " " + label.CapitalizeFirst(), fontStyleLeft);
|
||||
GUI.Label(rect, rightlabel.CapitalizeFirst() + " ", fontStyleRight);
|
||||
Widgets.DrawHighlightIfMouseover(rect);
|
||||
if (tooltip != null) TooltipHandler.TipRegion(rect, tooltip);
|
||||
if (border != null)
|
||||
{
|
||||
rect.DrawBorder(border, 2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
58
Source/RJWSexperience/SexperienceMod.cs
Normal file
58
Source/RJWSexperience/SexperienceMod.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
using UnityEngine;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
using RJWSexperience.Settings;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public class SexperienceMod : Mod
|
||||
{
|
||||
private static Configurations settings;
|
||||
public static Configurations Settings { get => settings; }
|
||||
|
||||
public ITab CurrentTab { get; private set; }
|
||||
|
||||
private readonly List<TabRecord> tabRecords;
|
||||
|
||||
public SexperienceMod(ModContentPack content) : base(content)
|
||||
{
|
||||
settings = GetSettings<Configurations>();
|
||||
CurrentTab = settings;
|
||||
tabRecords = new List<TabRecord>();
|
||||
}
|
||||
|
||||
public override string SettingsCategory()
|
||||
{
|
||||
return Keyed.Mod_Title;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fills tabRecords list.
|
||||
/// This method cannot be called in constructor because at that stage language file is not loaded
|
||||
/// </summary>
|
||||
private void InitTabRecords()
|
||||
{
|
||||
List<ITab> tabs = new List<ITab>
|
||||
{
|
||||
settings,
|
||||
settings.History,
|
||||
settings.Debug
|
||||
};
|
||||
|
||||
foreach (ITab tab in tabs)
|
||||
tabRecords.Add(new TabRecord(tab.Label, delegate { this.CurrentTab = tab; }, delegate { return this?.CurrentTab == tab; }));
|
||||
}
|
||||
|
||||
public override void DoSettingsWindowContents(Rect inRect)
|
||||
{
|
||||
if (tabRecords.NullOrEmpty())
|
||||
InitTabRecords();
|
||||
|
||||
Rect contentRect = inRect.BottomPartPixels(inRect.height - TabDrawer.TabHeight);
|
||||
|
||||
_ = TabDrawer.DrawTabs(contentRect, tabRecords);
|
||||
|
||||
CurrentTab.DoTabContents(contentRect);
|
||||
}
|
||||
}
|
||||
}
|
55
Source/RJWSexperience/StatParts.cs
Normal file
55
Source/RJWSexperience/StatParts.cs
Normal file
|
@ -0,0 +1,55 @@
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
/// <summary>
|
||||
/// Lust changes SexFrequency stat
|
||||
/// </summary>
|
||||
public class StatPart_Lust : StatPart
|
||||
{
|
||||
public override string ExplanationPart(StatRequest req)
|
||||
{
|
||||
if (req.HasThing && (req.Thing is Pawn pawn))
|
||||
{
|
||||
return $"{Keyed.Lust.CapitalizeFirst()}: x{GetLustFactor(pawn).ToStringPercent()}";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void TransformValue(StatRequest req, ref float val)
|
||||
{
|
||||
if (req.HasThing && (req.Thing is Pawn pawn))
|
||||
val *= GetLustFactor(pawn);
|
||||
}
|
||||
|
||||
protected float GetLustFactor(Pawn pawn) => LustUtility.GetLustFactor(pawn.records.GetValue(VariousDefOf.Lust));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Make slaves more vulnurable
|
||||
/// </summary>
|
||||
public class StatPart_Slave : StatPart
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public float factor;
|
||||
|
||||
public override string ExplanationPart(StatRequest req)
|
||||
{
|
||||
if (req.HasThing && ((req.Thing as Pawn)?.IsSlave == true))
|
||||
{
|
||||
return $"{Keyed.Slave.CapitalizeFirst()}: x{factor.ToStringPercent()}";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public override void TransformValue(StatRequest req, ref float val)
|
||||
{
|
||||
if (req.HasThing && ((req.Thing as Pawn)?.IsSlave == true))
|
||||
{
|
||||
val *= factor;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public class ThoughtDefExtension_StageFromRecord : DefModExtension
|
||||
{
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public RecordDef recordDef;
|
||||
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
|
||||
public List<float> minimumValueforStage = new List<float>();
|
||||
}
|
||||
}
|
39
Source/RJWSexperience/Thoughts/Thought_Recordbased.cs
Normal file
39
Source/RJWSexperience/Thoughts/Thought_Recordbased.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
/// <summary>
|
||||
/// Thought class using record.
|
||||
/// </summary>
|
||||
public class Thought_Recordbased : Thought_Memory
|
||||
{
|
||||
private ThoughtDefExtension_StageFromRecord extension;
|
||||
|
||||
protected ThoughtDefExtension_StageFromRecord Extension
|
||||
{
|
||||
get
|
||||
{
|
||||
if (extension == null)
|
||||
extension = def.GetModExtension<ThoughtDefExtension_StageFromRecord>();
|
||||
return extension;
|
||||
}
|
||||
}
|
||||
|
||||
protected RecordDef RecordDef => Extension.recordDef;
|
||||
protected List<float> MinimumValueforStage => Extension.minimumValueforStage;
|
||||
|
||||
public override int CurStageIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
float value = pawn?.records?.GetValue(RecordDef) ?? 0f;
|
||||
for (int i = MinimumValueforStage.Count - 1; i > 0; i--)
|
||||
{
|
||||
if (MinimumValueforStage[i] < value) return i;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
38
Source/RJWSexperience/Utility.cs
Normal file
38
Source/RJWSexperience/Utility.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using RimWorld;
|
||||
using System;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
public static class Utility
|
||||
{
|
||||
private static readonly Random random = new Random(Environment.TickCount);
|
||||
|
||||
public static float RandGaussianLike(float min, float max, int iterations = 3)
|
||||
{
|
||||
double res = 0;
|
||||
for (int i = 0; i < iterations; i++)
|
||||
{
|
||||
res += random.NextDouble();
|
||||
}
|
||||
res /= iterations;
|
||||
|
||||
return ((float)res).Denormalization(min, max);
|
||||
}
|
||||
|
||||
public static void SetTo(this Pawn_RecordsTracker records, RecordDef record, float value)
|
||||
{
|
||||
float recordval = records.GetValue(record);
|
||||
records.AddTo(record, value - recordval);
|
||||
}
|
||||
|
||||
public static float Normalization(this float num, float min, float max)
|
||||
{
|
||||
return (num - min) / (max - min);
|
||||
}
|
||||
|
||||
public static float Denormalization(this float num, float min, float max)
|
||||
{
|
||||
return (num * (max - min)) + min;
|
||||
}
|
||||
}
|
||||
}
|
37
Source/RJWSexperience/VariousDefOf.cs
Normal file
37
Source/RJWSexperience/VariousDefOf.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience
|
||||
{
|
||||
[DefOf]
|
||||
public static class VariousDefOf
|
||||
{
|
||||
public static readonly RecordDef NumofEatenCum;
|
||||
public static readonly RecordDef AmountofEatenCum;
|
||||
public static readonly RecordDef Lust;
|
||||
public static readonly RecordDef VaginalSexCount;
|
||||
public static readonly RecordDef AnalSexCount;
|
||||
public static readonly RecordDef OralSexCount;
|
||||
public static readonly RecordDef BlowjobCount;
|
||||
public static readonly RecordDef CunnilingusCount;
|
||||
public static readonly RecordDef GenitalCaressCount;
|
||||
public static readonly RecordDef HandjobCount;
|
||||
public static readonly RecordDef FingeringCount;
|
||||
public static readonly RecordDef FootjobCount;
|
||||
public static readonly RecordDef MiscSexualBehaviorCount;
|
||||
public static readonly RecordDef SexPartnerCount;
|
||||
public static readonly RecordDef OrgasmCount;
|
||||
public static readonly SkillDef Sex;
|
||||
public static readonly ThingDef CumBucket;
|
||||
public static readonly ThingDef GatheredCum;
|
||||
public static readonly ThingDef FilthCum;
|
||||
public static readonly ChemicalDef Cum;
|
||||
public static readonly NeedDef Chemical_Cum;
|
||||
public static readonly TraitDef Virgin;
|
||||
public static readonly KeyBindingDef OpenSexStatistics;
|
||||
public static readonly StatDef SexAbility;
|
||||
|
||||
public static readonly HediffDef CumAddiction;
|
||||
public static readonly HediffDef CumTolerance;
|
||||
}
|
||||
}
|
39
Source/RJWSexperience/Virginity/Recipe_HymenSurgery.cs
Normal file
39
Source/RJWSexperience/Virginity/Recipe_HymenSurgery.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Virginity
|
||||
{
|
||||
public class Recipe_HymenSurgery : Recipe_Surgery
|
||||
{
|
||||
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
|
||||
{
|
||||
if (pawn.gender != Gender.Female)
|
||||
yield break;
|
||||
|
||||
BodyPartRecord part = Genital_Helper.get_genitalsBPR(pawn);
|
||||
if (part == null)
|
||||
yield break;
|
||||
|
||||
List<Hediff> hediffs = Genital_Helper.get_PartsHediffList(pawn, part);
|
||||
if (Genital_Helper.has_vagina(pawn, hediffs) && !HasHymen(pawn))
|
||||
yield return part;
|
||||
}
|
||||
|
||||
public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill)
|
||||
{
|
||||
if (billDoer == null)
|
||||
return;
|
||||
|
||||
TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[]
|
||||
{
|
||||
billDoer,
|
||||
pawn
|
||||
});
|
||||
TraitHandler.AddVirginTrait(pawn);
|
||||
}
|
||||
|
||||
private static bool HasHymen(Pawn pawn) => pawn.story?.traits?.GetTrait(VariousDefOf.Virgin)?.Degree > 0;
|
||||
}
|
||||
}
|
10
Source/RJWSexperience/Virginity/TraitDegree.cs
Normal file
10
Source/RJWSexperience/Virginity/TraitDegree.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
namespace RJWSexperience.Virginity
|
||||
{
|
||||
public static class TraitDegree
|
||||
{
|
||||
public const int FemaleDamagedVirgin = -1;
|
||||
public const int MaleVirgin = 0;
|
||||
public const int FemaleAfterSurgery = 1;
|
||||
public const int FemaleVirgin = 2;
|
||||
}
|
||||
}
|
64
Source/RJWSexperience/Virginity/TraitHandler.cs
Normal file
64
Source/RJWSexperience/Virginity/TraitHandler.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Virginity
|
||||
{
|
||||
public static class TraitHandler
|
||||
{
|
||||
private const float hymenSurgeryChance = 0.05f;
|
||||
|
||||
public static void GenerateVirginTrait(Pawn pawn)
|
||||
{
|
||||
if (pawn.story?.traits == null)
|
||||
return;
|
||||
|
||||
if (pawn.gender == Gender.Female && !pawn.IsVirgin())
|
||||
{
|
||||
if (Rand.Chance(hymenSurgeryChance))
|
||||
{
|
||||
Trait virgin = new Trait(VariousDefOf.Virgin, TraitDegree.FemaleAfterSurgery, true);
|
||||
pawn.story.traits.GainTrait(virgin);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
AddVirginTrait(pawn);
|
||||
}
|
||||
|
||||
public static void AddVirginTrait(Pawn pawn)
|
||||
{
|
||||
if (pawn.story?.traits == null)
|
||||
return;
|
||||
|
||||
if (pawn.IsVirgin())
|
||||
{
|
||||
int degree = TraitDegree.MaleVirgin;
|
||||
if (pawn.gender == Gender.Female)
|
||||
degree = TraitDegree.FemaleVirgin;
|
||||
Trait virgin = new Trait(VariousDefOf.Virgin, degree, true);
|
||||
pawn.story.traits.GainTrait(virgin);
|
||||
}
|
||||
else if (pawn.gender == Gender.Female)
|
||||
{
|
||||
Trait virgin = new Trait(VariousDefOf.Virgin, TraitDegree.FemaleAfterSurgery, true);
|
||||
pawn.story.traits.GainTrait(virgin);
|
||||
}
|
||||
}
|
||||
|
||||
public static int? RemoveVirginTrait(Pawn pawn)
|
||||
{
|
||||
Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin);
|
||||
if (virgin == null)
|
||||
return null;
|
||||
|
||||
int degree = virgin.Degree;
|
||||
if (pawn.gender == Gender.Female && degree > 0 && !pawn.Dead)
|
||||
{
|
||||
FilthMaker.TryMakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Blood, pawn.LabelShort, 1, FilthSourceFlags.Pawn);
|
||||
}
|
||||
pawn.story.traits.RemoveTrait(virgin);
|
||||
return degree;
|
||||
}
|
||||
}
|
||||
}
|
13
Source/RJWSexperienceCum/HediffDefOf.cs
Normal file
13
Source/RJWSexperienceCum/HediffDefOf.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperienceCum
|
||||
{
|
||||
[DefOf]
|
||||
public static class HediffDefOf
|
||||
{
|
||||
public static readonly HediffDef Hediff_CumController;
|
||||
public static readonly HediffDef Hediff_Cum;
|
||||
public static readonly HediffDef Hediff_InsectSpunk;
|
||||
}
|
||||
}
|
11
Source/RJWSexperienceCum/JobDefOf.cs
Normal file
11
Source/RJWSexperienceCum/JobDefOf.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperienceCum
|
||||
{
|
||||
[DefOf]
|
||||
public static class JobDefOf
|
||||
{
|
||||
public static readonly JobDef CleanSelfwithBucket;
|
||||
}
|
||||
}
|
93
Source/RJWSexperienceCum/JobDriver_CleanSelfWithBucket.cs
Normal file
93
Source/RJWSexperienceCum/JobDriver_CleanSelfWithBucket.cs
Normal file
|
@ -0,0 +1,93 @@
|
|||
using RJWSexperience;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
|
||||
namespace RJWSexperienceCum
|
||||
{
|
||||
public class JobDriver_CleanSelfWithBucket : JobDriver
|
||||
{
|
||||
protected const int UNITTIME = 240;//ticks - 120 = 2 real seconds, 3 in-game minutes
|
||||
protected float progress = 0;
|
||||
protected float severitycache = 1;
|
||||
protected Hediff hediffcache;
|
||||
protected float CleaningTime
|
||||
{
|
||||
get
|
||||
{
|
||||
return severitycache * UNITTIME;
|
||||
}
|
||||
}
|
||||
|
||||
protected Building_CumBucket Bucket => TargetB.Thing as Building_CumBucket;
|
||||
|
||||
public override bool TryMakePreToilReservations(bool errorOnFailed)
|
||||
{
|
||||
return pawn.Reserve(pawn, job, 1, -1, null, errorOnFailed);
|
||||
}
|
||||
|
||||
protected override IEnumerable<Toil> MakeNewToils()
|
||||
{
|
||||
this.FailOn(delegate
|
||||
{
|
||||
List<Hediff> hediffs = pawn.health.hediffSet.hediffs;
|
||||
return !hediffs.Exists(x => x.def == HediffDefOf.Hediff_CumController);
|
||||
});
|
||||
yield return Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch);
|
||||
Toil cleaning = new Toil
|
||||
{
|
||||
initAction = CleaningInit,
|
||||
tickAction = CleaningTick,
|
||||
defaultCompleteMode = ToilCompleteMode.Never
|
||||
};
|
||||
cleaning.AddFinishAction(Finish);
|
||||
cleaning.WithProgressBar(TargetIndex.A, () => progress / CleaningTime);
|
||||
|
||||
yield return cleaning;
|
||||
}
|
||||
|
||||
protected void CleaningInit()
|
||||
{
|
||||
hediffcache = pawn.health.hediffSet.hediffs.Find(x => x.def == HediffDefOf.Hediff_Cum || x.def == HediffDefOf.Hediff_InsectSpunk);
|
||||
if (hediffcache == null)
|
||||
{
|
||||
pawn.jobs.EndCurrentJob(JobCondition.Succeeded);
|
||||
}
|
||||
else
|
||||
{
|
||||
progress = 0f;
|
||||
severitycache = hediffcache.Severity;
|
||||
if (float.IsNaN(severitycache)) //TODO: Figure out WHY NaN is here
|
||||
severitycache = 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
protected void CleaningTick()
|
||||
{
|
||||
progress++;
|
||||
if (progress > CleaningTime)
|
||||
{
|
||||
Cleaned();
|
||||
}
|
||||
}
|
||||
|
||||
protected void Cleaned()
|
||||
{
|
||||
if (hediffcache != null)
|
||||
{
|
||||
float cumamount = hediffcache.Severity * 10f;
|
||||
hediffcache.Severity = 0f;
|
||||
Bucket.AddCum(cumamount);
|
||||
}
|
||||
CleaningInit();
|
||||
}
|
||||
|
||||
protected void Finish()
|
||||
{
|
||||
if (pawn.CurJobDef == RimWorld.JobDefOf.Wait_MaintainPosture)
|
||||
{
|
||||
pawn.jobs.EndCurrentJob(JobCondition.InterruptForced);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
Source/RJWSexperienceCum/Properties/AssemblyInfo.cs
Normal file
36
Source/RJWSexperienceCum/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("RJWSexperienceCum")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RJWSexperienceCum")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("73cb4597-22bd-4a3e-a3ce-6d65dd080f65")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
61
Source/RJWSexperienceCum/RJWSexperienceCum.csproj
Normal file
61
Source/RJWSexperienceCum/RJWSexperienceCum.csproj
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{73CB4597-22BD-4A3E-A3CE-6D65DD080F65}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>RJWSexperienceCum</RootNamespace>
|
||||
<AssemblyName>RJWSexperienceCum</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\..\Mod Compatibility\RJW Cum\Assemblies\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="JobDefOf.cs" />
|
||||
<Compile Include="ThingDefOf.cs" />
|
||||
<Compile Include="JobDriver_CleanSelfWithBucket.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="HediffDefOf.cs" />
|
||||
<Compile Include="WorkGiver_CleanSelfWithBucket.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Krafs.Rimworld.Ref">
|
||||
<Version>1.3.3389</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\RJWSexperience\RJWSexperience.csproj">
|
||||
<Project>{9c728e06-573b-4b04-a07f-acbf60cb424d}</Project>
|
||||
<Name>RJWSexperience</Name>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
12
Source/RJWSexperienceCum/ThingDefOf.cs
Normal file
12
Source/RJWSexperienceCum/ThingDefOf.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperienceCum
|
||||
{
|
||||
[DefOf]
|
||||
public static class ThingDefOf
|
||||
{
|
||||
public static readonly ThingDef GatheredCum;
|
||||
public static readonly ThingDef CumBucket;
|
||||
}
|
||||
}
|
30
Source/RJWSexperienceCum/WorkGiver_CleanSelfWithBucket.cs
Normal file
30
Source/RJWSexperienceCum/WorkGiver_CleanSelfWithBucket.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using RimWorld;
|
||||
using RJWSexperience;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
|
||||
namespace RJWSexperienceCum
|
||||
{
|
||||
public class WorkGiver_CleanSelfWithBucket : WorkGiver_Scanner
|
||||
{
|
||||
public override ThingRequest PotentialWorkThingRequest => ThingRequest.ForDef(ThingDefOf.CumBucket);
|
||||
public override PathEndMode PathEndMode => PathEndMode.ClosestTouch;
|
||||
public override bool ShouldSkip(Pawn pawn, bool forced = false)
|
||||
{
|
||||
return HediffDefOf.Hediff_CumController == null || !pawn.health.hediffSet.HasHediff(HediffDefOf.Hediff_CumController);
|
||||
}
|
||||
|
||||
public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false)
|
||||
{
|
||||
if (!(t is Building_CumBucket bucket))
|
||||
return false;
|
||||
|
||||
return bucket.StoredStackCount < ThingDefOf.GatheredCum.stackLimit;
|
||||
}
|
||||
|
||||
public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false)
|
||||
{
|
||||
return JobMaker.MakeJob(JobDefOf.CleanSelfwithBucket, pawn, t);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue