From 67c2328ad6c41ad5b5cdd0535ab71f8a1175a514 Mon Sep 17 00:00:00 2001 From: amevarashi Date: Mon, 17 Apr 2023 16:34:35 +0500 Subject: [PATCH] Change VariousDefOf to RsDefOf Fix some IDE messages --- .../RJWSexperience/Cum/Building_Cumbucket.cs | 8 +- Source/RJWSexperience/Cum/CumUtility.cs | 2 +- .../SpecialThingFilterWorker_Cum.cs | 2 +- .../SpecialThingFilterWorker_CumBase.cs | 10 +-- .../SpecialThingFilterWorker_NoCum.cs | 2 +- .../IngestionOutcomeDoer_RecordEatenCum.cs | 4 +- .../CumAddictPartKindUsageRule.cs | 6 +- Source/RJWSexperience/Cum/Thought_AteCum.cs | 2 +- Source/RJWSexperience/DebugAction.cs | 55 +++++++------ .../ExtensionMethods/PawnExtensions.cs | 4 +- Source/RJWSexperience/LustUtility.cs | 4 +- Source/RJWSexperience/Patches/RJW_Patch.cs | 8 +- .../RJWSexperience/Patches/Rimworld_Patch.cs | 4 +- Source/RJWSexperience/RJWSexperience.csproj | 2 +- Source/RJWSexperience/RJWUtility.cs | 36 ++++----- Source/RJWSexperience/RsDefOf.cs | 78 +++++++++++++++++++ .../SexHistory/RecordRandomizer.cs | 52 ++++++------- .../SexHistory/SexHistoryComp.cs | 4 +- .../SexHistory/UI/SexStatusViewModel.cs | 20 ++--- Source/RJWSexperience/StatParts.cs | 2 +- Source/RJWSexperience/VariousDefOf.cs | 37 --------- .../Virginity/Recipe_HymenSurgery.cs | 8 +- .../RJWSexperience/Virginity/TraitHandler.cs | 8 +- 23 files changed, 196 insertions(+), 162 deletions(-) create mode 100644 Source/RJWSexperience/RsDefOf.cs delete mode 100644 Source/RJWSexperience/VariousDefOf.cs diff --git a/Source/RJWSexperience/Cum/Building_Cumbucket.cs b/Source/RJWSexperience/Cum/Building_Cumbucket.cs index 4598f5f..2cccea7 100644 --- a/Source/RJWSexperience/Cum/Building_Cumbucket.cs +++ b/Source/RJWSexperience/Cum/Building_Cumbucket.cs @@ -42,8 +42,8 @@ namespace RJWSexperience // Used in Menstruation with this namespace if (SexperienceMod.Settings.DevMode) { stringBuilder.AppendLine(); - stringBuilder.AppendLine($"[Debug] stored: {StoredStackCount}"); - stringBuilder.Append($"[Debug] storedDecimalRemainder: {storedDecimalRemainder}"); + stringBuilder.Append("[Debug] stored: ").Append(StoredStackCount).AppendLine(); + stringBuilder.Append("[Debug] storedDecimalRemainder: ").Append(storedDecimalRemainder); } return stringBuilder.ToString(); @@ -51,7 +51,7 @@ namespace RJWSexperience // Used in Menstruation with this namespace public void AddCum(float amount) { - AddCum(amount, VariousDefOf.GatheredCum); + AddCum(amount, RsDefOf.Thing.GatheredCum); } public void AddCum(float amount, ThingDef cumDef) @@ -69,7 +69,7 @@ namespace RJWSexperience // Used in Menstruation with this namespace cum.stackCount = num; if (cum.stackCount > 0 && !GenPlace.TryPlaceThing(cum, PositionHeld, Map, ThingPlaceMode.Direct, out Thing res)) { - FilthMaker.TryMakeFilth(PositionHeld, Map, VariousDefOf.FilthCum, num); + FilthMaker.TryMakeFilth(PositionHeld, Map, RsDefOf.Thing.FilthCum, num); } storedDecimalRemainder -= num; } diff --git a/Source/RJWSexperience/Cum/CumUtility.cs b/Source/RJWSexperience/Cum/CumUtility.cs index 988349d..e3be0e9 100644 --- a/Source/RJWSexperience/Cum/CumUtility.cs +++ b/Source/RJWSexperience/Cum/CumUtility.cs @@ -125,7 +125,7 @@ namespace RJWSexperience.Cum const float allOf = 1000f; log.Message($"FeedCum({pawn.NameShortColored}, {amount})"); - Thing cum = ThingMaker.MakeThing(VariousDefOf.GatheredCum); + Thing cum = ThingMaker.MakeThing(RsDefOf.Thing.GatheredCum); cum.stackCount = (int)Math.Ceiling(amount); log.Message($"Created a stack of {cum.stackCount} cum"); cum.Ingested(pawn, allOf); diff --git a/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_Cum.cs b/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_Cum.cs index 81ea225..2f89284 100644 --- a/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_Cum.cs +++ b/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_Cum.cs @@ -6,7 +6,7 @@ namespace RJWSexperience.Cum.FilterWorkers { public override bool Matches(Thing t) { - return IsCum(t) || IsFoodWithCum(t); + return IsCum(t.def) || IsFoodWithCum(t); } } } diff --git a/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_CumBase.cs b/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_CumBase.cs index d622aa0..ce9fb03 100644 --- a/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_CumBase.cs +++ b/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_CumBase.cs @@ -10,20 +10,18 @@ namespace RJWSexperience.Cum.FilterWorkers return def.IsIngestible && def.IsProcessedFood; } - protected bool IsCum(Thing t) => IsCum(t.def); - - protected bool IsCum(ThingDef t) => t == VariousDefOf.GatheredCum; + protected bool IsCum(ThingDef t) => t == RsDefOf.Thing.GatheredCum; protected bool IsFoodWithCum(Thing food) { CompIngredients compIngredients = food.TryGetComp(); - if (compIngredients == null) + if (compIngredients?.ingredients == null) return false; - foreach (ThingDef ingredient in compIngredients.ingredients) + for (int i = 0; i < compIngredients.ingredients.Count; i++) { - if (IsCum(ingredient)) + if (IsCum(compIngredients.ingredients[i])) return true; } diff --git a/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_NoCum.cs b/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_NoCum.cs index d288316..b9b32e3 100644 --- a/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_NoCum.cs +++ b/Source/RJWSexperience/Cum/FilterWorkers/SpecialThingFilterWorker_NoCum.cs @@ -6,7 +6,7 @@ namespace RJWSexperience.Cum.FilterWorkers { public override bool Matches(Thing t) { - return !IsCum(t) && !IsFoodWithCum(t); + return !IsCum(t.def) && !IsFoodWithCum(t); } } } diff --git a/Source/RJWSexperience/Cum/IngestionOutcomeDoer_RecordEatenCum.cs b/Source/RJWSexperience/Cum/IngestionOutcomeDoer_RecordEatenCum.cs index 29c9798..812abc5 100644 --- a/Source/RJWSexperience/Cum/IngestionOutcomeDoer_RecordEatenCum.cs +++ b/Source/RJWSexperience/Cum/IngestionOutcomeDoer_RecordEatenCum.cs @@ -12,8 +12,8 @@ namespace RJWSexperience.Cum { int amount = ingested.stackCount * (int)unitAmount; Logs.LogManager.GetLogger().Message($"Record {pawn.NameShortColored} eating {amount} ml of cum"); - pawn.records.Increment(VariousDefOf.NumofEatenCum); - pawn.records.AddTo(VariousDefOf.AmountofEatenCum, amount); + pawn.records.Increment(RsDefOf.Record.NumofEatenCum); + pawn.records.AddTo(RsDefOf.Record.AmountofEatenCum, amount); } } } diff --git a/Source/RJWSexperience/Cum/Interactions/CumAddictPartKindUsageRule.cs b/Source/RJWSexperience/Cum/Interactions/CumAddictPartKindUsageRule.cs index bdd4762..946dad7 100644 --- a/Source/RJWSexperience/Cum/Interactions/CumAddictPartKindUsageRule.cs +++ b/Source/RJWSexperience/Cum/Interactions/CumAddictPartKindUsageRule.cs @@ -17,7 +17,7 @@ namespace RJWSexperience.Cum.Interactions if (context.Internals.Submissive.Parts.Penises.Any()) return GetForCumAddict(context.Internals.Dominant.Pawn); - if (AddictionUtility.IsAddicted(context.Internals.Submissive.Pawn, VariousDefOf.Cum)) + if (AddictionUtility.IsAddicted(context.Internals.Submissive.Pawn, RsDefOf.Chemical.Cum)) return GetForPartner(); return Enumerable.Empty>(); @@ -28,7 +28,7 @@ namespace RJWSexperience.Cum.Interactions if (context.Internals.Dominant.Parts.Penises.Any()) return GetForCumAddict(context.Internals.Submissive.Pawn); - if (AddictionUtility.IsAddicted(context.Internals.Dominant.Pawn, VariousDefOf.Cum)) + if (AddictionUtility.IsAddicted(context.Internals.Dominant.Pawn, RsDefOf.Chemical.Cum)) return GetForPartner(); return Enumerable.Empty>(); @@ -42,7 +42,7 @@ namespace RJWSexperience.Cum.Interactions var log = LogManager.GetLogger(); log.Message($"Called for {pawn.NameShortColored}"); - if (!(pawn.needs?.TryGetNeed(VariousDefOf.Chemical_Cum) is Need_Chemical cumNeed)) + if (!(pawn.needs?.TryGetNeed(RsDefOf.Need.Chemical_Cum) is Need_Chemical cumNeed)) yield break; log.Message($"{pawn.NameShortColored} is cum addict, current desire level: {cumNeed.CurCategory}"); diff --git a/Source/RJWSexperience/Cum/Thought_AteCum.cs b/Source/RJWSexperience/Cum/Thought_AteCum.cs index 79fc834..fba55b2 100644 --- a/Source/RJWSexperience/Cum/Thought_AteCum.cs +++ b/Source/RJWSexperience/Cum/Thought_AteCum.cs @@ -4,7 +4,7 @@ { protected override void UpdateCurStage() { - if (pawn?.health?.hediffSet?.HasHediff(VariousDefOf.CumAddiction) ?? false) + if (pawn?.health?.hediffSet?.HasHediff(RsDefOf.Hediff.CumAddiction) ?? false) { SetForcedStage(def.stages.Count - 1); } diff --git a/Source/RJWSexperience/DebugAction.cs b/Source/RJWSexperience/DebugAction.cs index ca1b971..71a7a85 100644 --- a/Source/RJWSexperience/DebugAction.cs +++ b/Source/RJWSexperience/DebugAction.cs @@ -8,9 +8,9 @@ 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) + public static void ResetRecords(Pawn p) { - Trait virgin = p.story?.traits?.GetTrait(VariousDefOf.Virgin); + Trait virgin = p.story?.traits?.GetTrait(RsDefOf.Trait.Virgin); if (virgin != null) p.story.traits.RemoveTrait(virgin); ResetRecord(p, true); if (ResetRecord(p, false)) @@ -19,7 +19,7 @@ namespace RJWSexperience } [DebugAction("RJW Sexperience", "Reset pawn's record(virgin)", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] - private static void ResetRecordsZero(Pawn p) + public static void ResetRecordsZero(Pawn p) { ResetRecord(p, true); Virginity.TraitHandler.AddVirginTrait(p); @@ -27,32 +27,31 @@ namespace RJWSexperience } [DebugAction("RJW Sexperience", "Reset lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] - private static void ResetLust(Pawn p) + public 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) + public static void SetLust(Pawn p) { - p.records.SetTo(VariousDefOf.Lust, 0); + p.records.SetTo(RsDefOf.Record.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) + public static void AddLust(Pawn p) { - p.records.AddTo(VariousDefOf.Lust, 10); - MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust)); + p.records.AddTo(RsDefOf.Record.Lust, 10); + MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(RsDefOf.Record.Lust)); } [DebugAction("RJW Sexperience", "Subtract 10 to lust", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.PlayingOnMap)] - private static void SubtractLust(Pawn p) + public static void SubtractLust(Pawn p) { - p.records.AddTo(VariousDefOf.Lust, -10); - MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(VariousDefOf.Lust)); + p.records.AddTo(RsDefOf.Record.Lust, -10); + MoteMaker.ThrowText(p.TrueCenter(), p.Map, "Lust: " + p.records.GetValue(RsDefOf.Record.Lust)); } private static bool ResetRecord(Pawn pawn, bool allzero) @@ -66,21 +65,21 @@ namespace RJWSexperience } 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(RsDefOf.Record.Lust, 0); + pawn.records.SetTo(RsDefOf.Record.NumofEatenCum, 0); + pawn.records.SetTo(RsDefOf.Record.AmountofEatenCum, 0); + pawn.records.SetTo(RsDefOf.Record.VaginalSexCount, 0); + pawn.records.SetTo(RsDefOf.Record.AnalSexCount, 0); + pawn.records.SetTo(RsDefOf.Record.OralSexCount, 0); + pawn.records.SetTo(RsDefOf.Record.BlowjobCount, 0); + pawn.records.SetTo(RsDefOf.Record.CunnilingusCount, 0); + pawn.records.SetTo(RsDefOf.Record.GenitalCaressCount, 0); + pawn.records.SetTo(RsDefOf.Record.HandjobCount, 0); + pawn.records.SetTo(RsDefOf.Record.FingeringCount, 0); + pawn.records.SetTo(RsDefOf.Record.FootjobCount, 0); + pawn.records.SetTo(RsDefOf.Record.MiscSexualBehaviorCount, 0); + pawn.records.SetTo(RsDefOf.Record.SexPartnerCount, 0); + pawn.records.SetTo(RsDefOf.Record.OrgasmCount, 0); pawn.records.SetTo(xxx.CountOfBeenRapedByAnimals, 0); pawn.records.SetTo(xxx.CountOfBeenRapedByHumanlikes, 0); pawn.records.SetTo(xxx.CountOfBeenRapedByInsects, 0); diff --git a/Source/RJWSexperience/ExtensionMethods/PawnExtensions.cs b/Source/RJWSexperience/ExtensionMethods/PawnExtensions.cs index 9e3a7f9..2469c21 100644 --- a/Source/RJWSexperience/ExtensionMethods/PawnExtensions.cs +++ b/Source/RJWSexperience/ExtensionMethods/PawnExtensions.cs @@ -27,7 +27,7 @@ namespace RJWSexperience public static float GetSexStat(this Pawn pawn) { if (xxx.is_human(pawn) && !pawn.Dead) - return pawn.GetStatValue(VariousDefOf.SexAbility); + return pawn.GetStatValue(RsDefOf.Stat.SexAbility); return 1.0f; } @@ -70,7 +70,7 @@ namespace RJWSexperience /// public static bool IsVirgin(this Pawn pawn) { - return pawn.records.GetValue(VariousDefOf.VaginalSexCount) == 0; + return pawn.records.GetValue(RsDefOf.Record.VaginalSexCount) == 0; } /// diff --git a/Source/RJWSexperience/LustUtility.cs b/Source/RJWSexperience/LustUtility.cs index ba7aa8f..a89dd54 100644 --- a/Source/RJWSexperience/LustUtility.cs +++ b/Source/RJWSexperience/LustUtility.cs @@ -74,7 +74,7 @@ namespace RJWSexperience public static void UpdateLust(SexProps props, float satisfaction, float baseSatisfaction) { - float? lust = props.pawn.records?.GetValue(VariousDefOf.Lust); + float? lust = props.pawn.records?.GetValue(RsDefOf.Record.Lust); if (lust == null) return; @@ -97,7 +97,7 @@ namespace RJWSexperience return; LogManager.GetLogger("LustUtility").Message($"{props.pawn.NameShortColored}'s lust changed by {lustDelta} (from {lust})"); - props.pawn.records.AddTo(VariousDefOf.Lust, lustDelta); + props.pawn.records.AddTo(RsDefOf.Record.Lust, lustDelta); } private static float LustIncrementFactor(float lust) diff --git a/Source/RJWSexperience/Patches/RJW_Patch.cs b/Source/RJWSexperience/Patches/RJW_Patch.cs index b3ccd7c..d712827 100644 --- a/Source/RJWSexperience/Patches/RJW_Patch.cs +++ b/Source/RJWSexperience/Patches/RJW_Patch.cs @@ -20,11 +20,11 @@ namespace RJWSexperience { if (__instance.Sexprops.isRape && __instance.Sexprops.isReceiver) { - __instance.pawn?.skills?.Learn(VariousDefOf.Sex, 0.05f, true); + __instance.pawn?.skills?.Learn(RsDefOf.Skill.Sex, 0.05f, true); } else { - __instance.pawn?.skills?.Learn(VariousDefOf.Sex, 0.35f, true); + __instance.pawn?.skills?.Learn(RsDefOf.Skill.Sex, 0.35f, true); } } } @@ -44,7 +44,7 @@ namespace RJWSexperience { LustUtility.UpdateLust(props, satisfaction, base_sat_per_fuck); CumUtility.FillCumBuckets(props); - props.pawn.records?.Increment(VariousDefOf.OrgasmCount); + props.pawn.records?.Increment(RsDefOf.Record.OrgasmCount); if (SexperienceMod.Settings.EnableSexHistory && props.hasPartner()) props.pawn.TryGetComp()?.RecordSatisfaction(props.partner, props, satisfaction); } @@ -64,7 +64,7 @@ namespace RJWSexperience { public static void Postfix(Pawn pawn) { - SkillRecord sexskill = pawn.skills.GetSkill(VariousDefOf.Sex); + SkillRecord sexskill = pawn.skills.GetSkill(RsDefOf.Skill.Sex); if (sexskill != null) { sexskill.passion = Passion.Major; diff --git a/Source/RJWSexperience/Patches/Rimworld_Patch.cs b/Source/RJWSexperience/Patches/Rimworld_Patch.cs index 0db6038..d00a943 100644 --- a/Source/RJWSexperience/Patches/Rimworld_Patch.cs +++ b/Source/RJWSexperience/Patches/Rimworld_Patch.cs @@ -32,11 +32,11 @@ namespace RJWSexperience if (!pawn.relations.DirectRelationExists(PawnRelationDefOf.Parent, newMother)) return; - Trait virgin = newMother.story?.traits?.GetTrait(VariousDefOf.Virgin, Virginity.TraitDegree.FemaleVirgin); + Trait virgin = newMother.story?.traits?.GetTrait(RsDefOf.Trait.Virgin, Virginity.TraitDegree.FemaleVirgin); if (virgin != null) { newMother.story.traits.RemoveTrait(virgin); - newMother.story.traits.GainTrait(new Trait(VariousDefOf.Virgin, Virginity.TraitDegree.FemaleAfterSurgery)); + newMother.story.traits.GainTrait(new Trait(RsDefOf.Trait.Virgin, Virginity.TraitDegree.FemaleAfterSurgery)); } } } diff --git a/Source/RJWSexperience/RJWSexperience.csproj b/Source/RJWSexperience/RJWSexperience.csproj index ac5c39f..2aef4a8 100644 --- a/Source/RJWSexperience/RJWSexperience.csproj +++ b/Source/RJWSexperience/RJWSexperience.csproj @@ -98,7 +98,7 @@ - + diff --git a/Source/RJWSexperience/RJWUtility.cs b/Source/RJWSexperience/RJWUtility.cs index 19d4160..d980f0c 100644 --- a/Source/RJWSexperience/RJWUtility.cs +++ b/Source/RJWSexperience/RJWUtility.cs @@ -58,52 +58,52 @@ namespace RJWSexperience { case xxx.rjwSextype.Vaginal: case xxx.rjwSextype.Scissoring: - IncreaseSameRecords(pawn, partner, VariousDefOf.VaginalSexCount); + IncreaseSameRecords(pawn, partner, RsDefOf.Record.VaginalSexCount); break; case xxx.rjwSextype.Anal: - IncreaseSameRecords(pawn, partner, VariousDefOf.AnalSexCount); + IncreaseSameRecords(pawn, partner, RsDefOf.Record.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); + IncreaseRecords(giver, receiver, RsDefOf.Record.OralSexCount, RsDefOf.Record.BlowjobCount); } else if (Genital_Helper.has_penis_fertile(receiver) || Genital_Helper.has_penis_infertile(receiver)) { - IncreaseRecords(giver, receiver, VariousDefOf.BlowjobCount, VariousDefOf.OralSexCount); + IncreaseRecords(giver, receiver, RsDefOf.Record.BlowjobCount, RsDefOf.Record.OralSexCount); } break; case xxx.rjwSextype.Sixtynine: - IncreaseSameRecords(pawn, partner, VariousDefOf.OralSexCount); + IncreaseSameRecords(pawn, partner, RsDefOf.Record.OralSexCount); RecordDef recordpawn, recordpartner; if (Genital_Helper.has_penis_fertile(pawn) || Genital_Helper.has_penis_infertile(pawn)) { - recordpartner = VariousDefOf.BlowjobCount; + recordpartner = RsDefOf.Record.BlowjobCount; } else { - recordpartner = VariousDefOf.CunnilingusCount; + recordpartner = RsDefOf.Record.CunnilingusCount; } if (Genital_Helper.has_penis_fertile(partner) || Genital_Helper.has_penis_infertile(partner)) { - recordpawn = VariousDefOf.BlowjobCount; + recordpawn = RsDefOf.Record.BlowjobCount; } else { - recordpawn = VariousDefOf.CunnilingusCount; + recordpawn = RsDefOf.Record.CunnilingusCount; } IncreaseRecords(pawn, partner, recordpawn, recordpartner); break; case xxx.rjwSextype.Cunnilingus: if (Genital_Helper.has_vagina(giver)) { - IncreaseRecords(giver, receiver, VariousDefOf.OralSexCount, VariousDefOf.CunnilingusCount); + IncreaseRecords(giver, receiver, RsDefOf.Record.OralSexCount, RsDefOf.Record.CunnilingusCount); } else if (Genital_Helper.has_vagina(receiver)) { - IncreaseRecords(giver, receiver, VariousDefOf.CunnilingusCount, VariousDefOf.OralSexCount); + IncreaseRecords(giver, receiver, RsDefOf.Record.CunnilingusCount, RsDefOf.Record.OralSexCount); } break; case xxx.rjwSextype.Masturbation: @@ -111,29 +111,29 @@ namespace RJWSexperience case xxx.rjwSextype.Handjob: if (Genital_Helper.has_penis_fertile(giver) || Genital_Helper.has_penis_infertile(giver)) { - IncreaseRecords(giver, receiver, VariousDefOf.GenitalCaressCount, VariousDefOf.HandjobCount); + IncreaseRecords(giver, receiver, RsDefOf.Record.GenitalCaressCount, RsDefOf.Record.HandjobCount); } else { - IncreaseRecords(giver, receiver, VariousDefOf.HandjobCount, VariousDefOf.GenitalCaressCount); + IncreaseRecords(giver, receiver, RsDefOf.Record.HandjobCount, RsDefOf.Record.GenitalCaressCount); } break; case xxx.rjwSextype.Fingering: case xxx.rjwSextype.Fisting: if (Genital_Helper.has_vagina(giver)) { - IncreaseRecords(giver, receiver, VariousDefOf.GenitalCaressCount, VariousDefOf.FingeringCount); + IncreaseRecords(giver, receiver, RsDefOf.Record.GenitalCaressCount, RsDefOf.Record.FingeringCount); } else { - IncreaseRecords(giver, receiver, VariousDefOf.FingeringCount, VariousDefOf.GenitalCaressCount); + IncreaseRecords(giver, receiver, RsDefOf.Record.FingeringCount, RsDefOf.Record.GenitalCaressCount); } break; case xxx.rjwSextype.Footjob: - IncreaseSameRecords(pawn, partner, VariousDefOf.FootjobCount); + IncreaseSameRecords(pawn, partner, RsDefOf.Record.FootjobCount); break; default: - IncreaseSameRecords(pawn, partner, VariousDefOf.MiscSexualBehaviorCount); + IncreaseSameRecords(pawn, partner, RsDefOf.Record.MiscSexualBehaviorCount); break; } } @@ -154,7 +154,7 @@ namespace RJWSexperience // Moved this method back because of Menstruation public static Building_CumBucket FindClosestBucket(this Pawn pawn) { - List buckets = pawn.Map.listerBuildings.allBuildingsColonist.FindAll(x => x is Building_CumBucket bucket && bucket.StoredStackCount < VariousDefOf.GatheredCum.stackLimit); + List buckets = pawn.Map.listerBuildings.allBuildingsColonist.FindAll(x => x is Building_CumBucket bucket && bucket.StoredStackCount < RsDefOf.Thing.GatheredCum.stackLimit); if (buckets.NullOrEmpty()) return null; diff --git a/Source/RJWSexperience/RsDefOf.cs b/Source/RJWSexperience/RsDefOf.cs new file mode 100644 index 0000000..d617947 --- /dev/null +++ b/Source/RJWSexperience/RsDefOf.cs @@ -0,0 +1,78 @@ +using RimWorld; +using Verse; + +namespace RJWSexperience +{ + public static class RsDefOf + { + [DefOf] + public static class Record + { + 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; + } + + [DefOf] + public static class Skill + { + public static readonly SkillDef Sex; + } + + [DefOf] + public static class Thing + { + public static readonly ThingDef GatheredCum; + public static readonly ThingDef FilthCum; + } + + [DefOf] + public static class Chemical + { + public static readonly ChemicalDef Cum; + } + + [DefOf] + public static class Need + { + public static readonly NeedDef Chemical_Cum; + } + + [DefOf] + public static class Trait + { + public static readonly TraitDef Virgin; + } + + [DefOf] + public static class KeyBinding + { + public static readonly KeyBindingDef OpenSexStatistics; + } + + [DefOf] + public static class Stat + { + public static readonly StatDef SexAbility; + } + + [DefOf] + public static class Hediff + { + public static readonly HediffDef CumAddiction; + public static readonly HediffDef CumTolerance; + } + } +} diff --git a/Source/RJWSexperience/SexHistory/RecordRandomizer.cs b/Source/RJWSexperience/SexHistory/RecordRandomizer.cs index 98d807b..b1c61f9 100644 --- a/Source/RJWSexperience/SexHistory/RecordRandomizer.cs +++ b/Source/RJWSexperience/SexHistory/RecordRandomizer.cs @@ -95,8 +95,8 @@ namespace RJWSexperience.SexHistory minValue = float.MinValue; value = Mathf.Clamp(value, minValue, float.MaxValue); - float recordvalue = pawn.records.GetValue(VariousDefOf.Lust); - pawn.records.AddTo(VariousDefOf.Lust, value - recordvalue); + float recordvalue = pawn.records.GetValue(RsDefOf.Record.Lust); + pawn.records.AddTo(RsDefOf.Record.Lust, value - recordvalue); return value; } @@ -145,7 +145,7 @@ namespace RJWSexperience.SexHistory totalSexCount += RandomizeRecord(pawn, xxx.CountOfSexWithHumanlikes, avgsex, deviation); if (totalSexCount > 0) - pawn.records.AddTo(VariousDefOf.SexPartnerCount, Math.Max(1, Rand.Range(0, totalSexCount / 7))); + pawn.records.AddTo(RsDefOf.Record.SexPartnerCount, Math.Max(1, Rand.Range(0, totalSexCount / 7))); return totalSexCount; } @@ -170,67 +170,67 @@ namespace RJWSexperience.SexHistory Gender prefer = PreferredGender(pawn); int sex = (int)(totalsex * RJWPreferenceSettings.vaginal / totalweight); totalsex -= sex; - pawn.records.AddTo(VariousDefOf.VaginalSexCount, sex); + pawn.records.AddTo(RsDefOf.Record.VaginalSexCount, sex); sex = (int)(totalsex * RJWPreferenceSettings.anal / totalweight); totalsex -= sex; - pawn.records.AddTo(VariousDefOf.AnalSexCount, sex); + pawn.records.AddTo(RsDefOf.Record.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); + if (prefer == Gender.Male) pawn.records.AddTo(RsDefOf.Record.BlowjobCount, sex); + else pawn.records.AddTo(RsDefOf.Record.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); + if (prefer == Gender.Male) pawn.records.AddTo(RsDefOf.Record.OralSexCount, sex); + else pawn.records.AddTo(RsDefOf.Record.CunnilingusCount, sex); sex = (int)(totalsex * RJWPreferenceSettings.rimming / totalweight); totalsex -= sex; - pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex); + pawn.records.AddTo(RsDefOf.Record.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); + pawn.records.AddTo(RsDefOf.Record.VaginalSexCount, sex); + pawn.records.AddTo(RsDefOf.Record.AnalSexCount, sex); sex = (int)(totalsex * RJWPreferenceSettings.breastjob / totalweight); totalsex -= sex; - pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex); + pawn.records.AddTo(RsDefOf.Record.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); + if (prefer == Gender.Male) pawn.records.AddTo(RsDefOf.Record.HandjobCount, sex); + else pawn.records.AddTo(RsDefOf.Record.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); + if (prefer == Gender.Female) pawn.records.AddTo(RsDefOf.Record.FingeringCount, sex); + else pawn.records.AddTo(RsDefOf.Record.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); + if (prefer == Gender.Male) pawn.records.AddTo(RsDefOf.Record.HandjobCount, sex); + else pawn.records.AddTo(RsDefOf.Record.FingeringCount, sex); + pawn.records.AddTo(RsDefOf.Record.GenitalCaressCount, sex); sex = (int)(totalsex * RJWPreferenceSettings.footjob / totalweight); totalsex -= sex; - pawn.records.AddTo(VariousDefOf.FootjobCount, sex); + pawn.records.AddTo(RsDefOf.Record.FootjobCount, sex); sex = (int)(totalsex * RJWPreferenceSettings.scissoring / totalweight); totalsex -= sex; - pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex); + pawn.records.AddTo(RsDefOf.Record.MiscSexualBehaviorCount, sex); sex = (int)(totalsex * RJWPreferenceSettings.fisting / totalweight); totalsex -= sex; - pawn.records.AddTo(VariousDefOf.MiscSexualBehaviorCount, sex); + pawn.records.AddTo(RsDefOf.Record.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); + pawn.records.AddTo(RsDefOf.Record.OralSexCount, totalsex); + if (prefer == Gender.Male) pawn.records.AddTo(RsDefOf.Record.BlowjobCount, totalsex); + else pawn.records.AddTo(RsDefOf.Record.CunnilingusCount, totalsex); } private static Gender PreferredGender(Pawn pawn) diff --git a/Source/RJWSexperience/SexHistory/SexHistoryComp.cs b/Source/RJWSexperience/SexHistory/SexHistoryComp.cs index dcd25e1..8c103a3 100644 --- a/Source/RJWSexperience/SexHistory/SexHistoryComp.cs +++ b/Source/RJWSexperience/SexHistory/SexHistoryComp.cs @@ -291,7 +291,7 @@ namespace RJWSexperience.SexHistory SexPartnerHistoryRecord newRecord = new SexPartnerHistoryRecord(partner, partner.IsIncest(ParentPawn)); histories.Add(partnerId, newRecord); - ParentPawn.records.Increment(VariousDefOf.SexPartnerCount); + ParentPawn.records.Increment(RsDefOf.Record.SexPartnerCount); return newRecord; } @@ -442,7 +442,7 @@ namespace RJWSexperience.SexHistory defaultLabel = Keyed.RS_Sex_History, icon = HistoryUtility.HistoryIcon, defaultIconColor = HistoryUtility.HistoryColor, - hotKey = VariousDefOf.OpenSexStatistics, + hotKey = RsDefOf.KeyBinding.OpenSexStatistics, action = () => UI.SexStatusWindow.ToggleWindow(this) }; } diff --git a/Source/RJWSexperience/SexHistory/UI/SexStatusViewModel.cs b/Source/RJWSexperience/SexHistory/UI/SexStatusViewModel.cs index 556e0ba..2a80835 100644 --- a/Source/RJWSexperience/SexHistory/UI/SexStatusViewModel.cs +++ b/Source/RJWSexperience/SexHistory/UI/SexStatusViewModel.cs @@ -163,7 +163,7 @@ namespace RJWSexperience.SexHistory.UI } SexTypes.Add(new BarInfo( - label: String.Format(Keyed.RS_Sex_Partners + ": {0} ({1})", _history.PartnerCount, Pawn.records.GetValue(VariousDefOf.SexPartnerCount)), + label: String.Format(Keyed.RS_Sex_Partners + ": {0} ({1})", _history.PartnerCount, Pawn.records.GetValue(RsDefOf.Record.SexPartnerCount)), fillPercent: _history.PartnerCount / 50, fillTexture: HistoryUtility.Partners)); @@ -178,7 +178,7 @@ namespace RJWSexperience.SexHistory.UI fillTexture: HistoryUtility.TotalSex, labelRight: Keyed.RS_SatAVG(_history.AVGSat)); - float lust = Pawn.records.GetValue(VariousDefOf.Lust); + float lust = Pawn.records.GetValue(RsDefOf.Record.Lust); float sexDrive = GetStatValue(xxx.sex_drive_stat); float lustLimit = SexperienceMod.Settings.LustLimit * 3f; Lust = new BarInfo( @@ -212,14 +212,14 @@ namespace RJWSexperience.SexHistory.UI fillPercent: _history.IncestuousCount / 50, fillTexture: HistoryUtility.Nurgle); - float amountofEatenCum = Pawn.records.GetValue(VariousDefOf.AmountofEatenCum); + float amountofEatenCum = Pawn.records.GetValue(RsDefOf.Record.AmountofEatenCum); ConsumedCum = new BarInfo( - label: String.Format(Keyed.RS_Cum_Swallowed + ": {0} mL, {1} " + Keyed.RS_NumofTimes, amountofEatenCum, Pawn.records.GetValue(VariousDefOf.NumofEatenCum)), + label: String.Format(Keyed.RS_Cum_Swallowed + ": {0} mL, {1} " + Keyed.RS_NumofTimes, amountofEatenCum, Pawn.records.GetValue(RsDefOf.Record.NumofEatenCum)), fillPercent: amountofEatenCum / 1000, fillTexture: Texture2D.linearGrayTexture); - Hediff cumHediff = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.CumAddiction) - ?? Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.CumTolerance); + Hediff cumHediff = Pawn.health.hediffSet.GetFirstHediffOfDef(RsDefOf.Hediff.CumAddiction) + ?? Pawn.health.hediffSet.GetFirstHediffOfDef(RsDefOf.Hediff.CumTolerance); if (cumHediff != null) { CumHediff = new BarInfo( @@ -254,15 +254,15 @@ namespace RJWSexperience.SexHistory.UI fillTexture: HistoryUtility.Satisfaction, tooltip: GetStatTooltip(xxx.sex_satisfaction, sexSatisfaction)); - SkillRecord skill = Pawn.skills?.GetSkill(VariousDefOf.Sex); + SkillRecord skill = Pawn.skills?.GetSkill(RsDefOf.Skill.Sex); float sexSkillLevel = skill?.Level ?? 0f; float sexStat = Pawn.GetSexStat(); SexSkill = new BarInfo( label: $"{Keyed.RS_SexSkill}: {sexSkillLevel}, {skill?.xpSinceLastLevel / skill?.XpRequiredForLevelUp:P2}", fillPercent: sexSkillLevel / 20, fillTexture: HistoryUtility.Tzeentch, - tooltip: GetStatTooltip(VariousDefOf.SexAbility, sexStat), - labelRight: VariousDefOf.SexAbility.LabelCap + ": " + sexStat.ToStringPercent(), + tooltip: GetStatTooltip(RsDefOf.Stat.SexAbility, sexStat), + labelRight: RsDefOf.Stat.SexAbility.LabelCap + ": " + sexStat.ToStringPercent(), border: HistoryUtility.GetPassionBG(skill?.passion)); } @@ -294,7 +294,7 @@ namespace RJWSexperience.SexHistory.UI private void UpdateVirginAndSexuality() { - Trait virginity = Pawn.story?.traits?.GetTrait(VariousDefOf.Virgin); + Trait virginity = Pawn.story?.traits?.GetTrait(RsDefOf.Trait.Virgin); if (virginity != null && virginity.Degree != Virginity.TraitDegree.FemaleAfterSurgery) { VirginLabel = virginity.Label; diff --git a/Source/RJWSexperience/StatParts.cs b/Source/RJWSexperience/StatParts.cs index eafdc43..206a296 100644 --- a/Source/RJWSexperience/StatParts.cs +++ b/Source/RJWSexperience/StatParts.cs @@ -24,7 +24,7 @@ namespace RJWSexperience val *= GetLustFactor(pawn); } - protected float GetLustFactor(Pawn pawn) => LustUtility.GetLustFactor(pawn.records.GetValue(VariousDefOf.Lust)); + protected float GetLustFactor(Pawn pawn) => LustUtility.GetLustFactor(pawn.records.GetValue(RsDefOf.Record.Lust)); } /// diff --git a/Source/RJWSexperience/VariousDefOf.cs b/Source/RJWSexperience/VariousDefOf.cs deleted file mode 100644 index 3f03d67..0000000 --- a/Source/RJWSexperience/VariousDefOf.cs +++ /dev/null @@ -1,37 +0,0 @@ -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; - } -} diff --git a/Source/RJWSexperience/Virginity/Recipe_HymenSurgery.cs b/Source/RJWSexperience/Virginity/Recipe_HymenSurgery.cs index f859e46..c215696 100644 --- a/Source/RJWSexperience/Virginity/Recipe_HymenSurgery.cs +++ b/Source/RJWSexperience/Virginity/Recipe_HymenSurgery.cs @@ -26,14 +26,10 @@ namespace RJWSexperience.Virginity if (billDoer == null) return; - TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[] - { - billDoer, - pawn - }); + TaleRecorder.RecordTale(TaleDefOf.DidSurgery, billDoer, pawn); TraitHandler.AddVirginTrait(pawn); } - private static bool HasHymen(Pawn pawn) => pawn.story?.traits?.GetTrait(VariousDefOf.Virgin)?.Degree > 0; + private static bool HasHymen(Pawn pawn) => pawn.story?.traits?.GetTrait(RsDefOf.Trait.Virgin)?.Degree > 0; } } diff --git a/Source/RJWSexperience/Virginity/TraitHandler.cs b/Source/RJWSexperience/Virginity/TraitHandler.cs index 40261d6..31e6a5e 100644 --- a/Source/RJWSexperience/Virginity/TraitHandler.cs +++ b/Source/RJWSexperience/Virginity/TraitHandler.cs @@ -17,7 +17,7 @@ namespace RJWSexperience.Virginity { if (Rand.Chance(hymenSurgeryChance)) { - Trait virgin = new Trait(VariousDefOf.Virgin, TraitDegree.FemaleAfterSurgery, true); + Trait virgin = new Trait(RsDefOf.Trait.Virgin, TraitDegree.FemaleAfterSurgery, true); pawn.story.traits.GainTrait(virgin); } return; @@ -36,19 +36,19 @@ namespace RJWSexperience.Virginity int degree = TraitDegree.MaleVirgin; if (pawn.gender == Gender.Female) degree = TraitDegree.FemaleVirgin; - Trait virgin = new Trait(VariousDefOf.Virgin, degree, true); + Trait virgin = new Trait(RsDefOf.Trait.Virgin, degree, true); pawn.story.traits.GainTrait(virgin); } else if (pawn.gender == Gender.Female) { - Trait virgin = new Trait(VariousDefOf.Virgin, TraitDegree.FemaleAfterSurgery, true); + Trait virgin = new Trait(RsDefOf.Trait.Virgin, TraitDegree.FemaleAfterSurgery, true); pawn.story.traits.GainTrait(virgin); } } public static int? RemoveVirginTrait(Pawn pawn) { - Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin); + Trait virgin = pawn.story?.traits?.GetTrait(RsDefOf.Trait.Virgin); if (virgin == null) return null;