From 60b268695c57d2ee78e66e76581f46d1f2d0435e Mon Sep 17 00:00:00 2001 From: amevarashi Date: Thu, 24 Mar 2022 22:31:07 +0500 Subject: [PATCH] Removed some code warnings --- .../IdeologyAddon/GlobalSuppressions.cs | 8 +++ RJWSexperience/IdeologyAddon/Harmony.cs | 1 - .../IdeologyAddon/Ideology/RJW_Patch_Ideo.cs | 14 +---- .../Ideology/Rituals/JobGiver_DrugOrgy.cs | 23 -------- .../Rituals/JobGiver_GangbangConsensual.cs | 2 - .../Rituals/JobGiver_GangbangVictim.cs | 10 ---- .../Ideology/Rituals/RitualRoles.cs | 12 ++--- .../IdeologyAddon/IdeologyAddon.csproj | 1 + .../RJWSexperience/Building_Cumbucket.cs | 11 ++-- .../RJWSexperience/Configurations.cs | 27 ++++------ .../ExtensionMethods/PawnExtensions.cs | 13 ++--- .../RJWSexperience/GlobalSuppressions.cs | 8 +++ RJWSexperience/RJWSexperience/JobDrivers.cs | 1 - .../RJWSexperience/Patches/GetGizmos.cs | 2 +- .../RJWSexperience/Patches/RJW_Patch.cs | 52 +++++++++++++------ .../RJWSexperience/Patches/Rimworld_Patch.cs | 2 +- .../RJWSexperience/RJWSexperience.csproj | 1 + .../SexHistory/HistoryUtility.cs | 14 ++--- .../SexHistory/SexPartnerHistory.cs | 1 - .../RJWSexperience/Thought_Recordbased.cs | 19 +------ .../RJWSexperience/UI/RJWUIUtility.cs | 4 +- RJWSexperience/RJWSexperience/UI/SexStatus.cs | 13 ----- 22 files changed, 90 insertions(+), 149 deletions(-) create mode 100644 RJWSexperience/IdeologyAddon/GlobalSuppressions.cs create mode 100644 RJWSexperience/RJWSexperience/GlobalSuppressions.cs diff --git a/RJWSexperience/IdeologyAddon/GlobalSuppressions.cs b/RJWSexperience/IdeologyAddon/GlobalSuppressions.cs new file mode 100644 index 0000000..38d94e9 --- /dev/null +++ b/RJWSexperience/IdeologyAddon/GlobalSuppressions.cs @@ -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")] diff --git a/RJWSexperience/IdeologyAddon/Harmony.cs b/RJWSexperience/IdeologyAddon/Harmony.cs index 68b591c..32e5639 100644 --- a/RJWSexperience/IdeologyAddon/Harmony.cs +++ b/RJWSexperience/IdeologyAddon/Harmony.cs @@ -17,7 +17,6 @@ namespace RJWSexperience.Ideology if (ModLister.HasActiveModWithName("RJW Sexperience")) { - //Log.Message("[RJWSexperience.Ideology] Found RJWSexperience, patching"); harmony.Patch(AccessTools.Method(typeof(PawnExtensions), nameof(PawnExtensions.IsIncest)), prefix: new HarmonyMethod(typeof(Sexperience_Patch_IsIncest), nameof(Sexperience_Patch_IsIncest.Prefix)), postfix: null diff --git a/RJWSexperience/IdeologyAddon/Ideology/RJW_Patch_Ideo.cs b/RJWSexperience/IdeologyAddon/Ideology/RJW_Patch_Ideo.cs index 9ddb5f3..33e4011 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/RJW_Patch_Ideo.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/RJW_Patch_Ideo.cs @@ -30,8 +30,7 @@ namespace RJWSexperience.Ideology { if (mainideo.HasPrecept(VariousDefOf.BabyFaction_AlwaysFather)) { - Pawn parent = baby.GetFather(); - if (parent == null) baby.GetMother(); + Pawn parent = baby.GetFather() ?? baby.GetMother(); ideo = parent.Ideo; return parent.Faction; @@ -162,7 +161,6 @@ namespace RJWSexperience.Ideology bool isCoreLovin = props.isCoreLovin; xxx.rjwSextype sextype = props.sexType; - //Log.Message("Aftersex " + pawn.Label + ": " + sextype); if (partner != null) { if (xxx.is_human(pawn)) AfterSexHuman(pawn, partner, usedCondom, rape, isCoreLovin, sextype); @@ -227,12 +225,6 @@ namespace RJWSexperience.Ideology { Find.HistoryEventsManager.RecordEvent(sexevent.TaggedEvent(human, tag + HETag.Gender(human), partner)); Find.HistoryEventsManager.RecordEvent(sexevent.TaggedEvent(partner, tag + HETag.Gender(partner), human)); - //if (sexevent == VariousDefOf.PromiscuousSex) - //{ - // human.records.AddTo(SexperienceDefOf.Lust, 1.0f* RJWUtility.LustIncrementFactor(human.records.GetValue(SexperienceDefOf.Lust))); - // partner.records.AddTo(SexperienceDefOf.Lust, 1.0f * RJWUtility.LustIncrementFactor(partner.records.GetValue(SexperienceDefOf.Lust))); - //} - } } } @@ -302,7 +294,6 @@ namespace RJWSexperience.Ideology { public static void Postfix(InteractionContext context, InteractionWithExtension interaction, IInteractionRule rule, ref float __result) { - Ideo ideo = context.Inputs.Initiator.Ideo; if (ideo != null) PreceptSextype(ideo, context.Inputs.Initiator.GetStatValue(xxx.sex_drive_stat), ref __result, 0, interaction); @@ -312,7 +303,7 @@ namespace RJWSexperience.Ideology } - public static List promiscuousSexTypes = new List { + private static readonly List promiscuousSexTypes = new List { "DoublePenetration", "Scissoring", "Sixtynine", @@ -418,7 +409,6 @@ namespace RJWSexperience.Ideology { if (!mother.IsAnimal()) { - //baby.SetFactionDirect(baby.GetFactionUsingPrecept()); Faction faction = baby.GetFactionUsingPrecept(out Ideo ideo); if (baby.Faction != faction) baby.SetFaction(faction); baby.ideo?.SetIdeo(ideo); diff --git a/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_DrugOrgy.cs b/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_DrugOrgy.cs index a85ba70..a7eacb0 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_DrugOrgy.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_DrugOrgy.cs @@ -64,7 +64,6 @@ namespace RJWSexperience.Ideology protected override IEnumerable MakeNewToils() { - //ModLog.Message("" + this.GetType().ToString() + "::MakeNewToils() called"); setup_ticks(); var PartnerJob = VariousDefOf.GettinDrugSex; @@ -74,19 +73,6 @@ namespace RJWSexperience.Ideology this.FailOn(() => Partner == null); yield return Toils_Goto.GotoThing(iTarget, PathEndMode.OnCell); - - //Toil findQuickieSpot = new Toil(); - //findQuickieSpot.defaultCompleteMode = ToilCompleteMode.PatherArrival; - //findQuickieSpot.initAction = delegate - //{ - // var spot = Partner.Position.RandomAdjacentCell8Way(); - // pawn.pather.StartPath(spot, PathEndMode.OnCell); - // Partner.jobs.StopAll(); //sometimes errors with stuff like vomiting - // Job job = JobMaker.MakeJob(JobDefOf.GotoMindControlled, spot); - // Partner.jobs.StartJob(job, JobCondition.InterruptForced); - //}; - //yield return findQuickieSpot; - Toil WaitForPartner = new Toil(); WaitForPartner.defaultCompleteMode = ToilCompleteMode.Delay; WaitForPartner.initAction = delegate @@ -167,8 +153,6 @@ namespace RJWSexperience.Ideology { setup_ticks(); parteners.Add(Partner);// add job starter, so this wont fail, before Initiator starts his job - //--ModLog.Message("JobDriver_GettinLoved::MakeNewToils is called"); - //ModLog.Message("" + Partner.CurJob.def); // More/less hearts based on opinion. if (pawn.relations.OpinionOf(Partner) < 0) @@ -195,9 +179,6 @@ namespace RJWSexperience.Ideology get_loved.defaultCompleteMode = ToilCompleteMode.Never; get_loved.socialMode = RandomSocialMode.Off; get_loved.handlingFacing = true; - //get_loved.initAction = delegate - //{ - //}; get_loved.tickAction = delegate { }; @@ -229,15 +210,11 @@ namespace RJWSexperience.Ideology { setup_ticks(); - //this.FailOn(() => PawnUtility.PlayerForcedJobNowOrSoon(pawn)); this.FailOn(() => pawn.health.Downed); this.FailOn(() => pawn.IsBurning()); this.FailOn(() => pawn.IsFighting()); this.FailOn(() => pawn.Drafted); - - //ModLog.Message(" Making new toil for QuickFap."); - Toil SexToil = Toils_General.Wait(duration); SexToil.handlingFacing = true; SexToil.initAction = delegate diff --git a/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_GangbangConsensual.cs b/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_GangbangConsensual.cs index 0cc87c2..dfb8ec8 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_GangbangConsensual.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_GangbangConsensual.cs @@ -48,7 +48,6 @@ namespace RJWSexperience.Ideology protected override IEnumerable MakeNewToils() { - //ModLog.Message("" + this.GetType().ToString() + "::MakeNewToils() called"); setup_ticks(); this.FailOnDespawnedNullOrForbidden(iTarget); @@ -148,7 +147,6 @@ namespace RJWSexperience.Ideology Job tobed = JobMaker.MakeJob(JobDefOf.Rescue, pawn, Bed); tobed.count = 1; Partner.jobs.jobQueue.EnqueueFirst(tobed); - //Log.Message(xxx.get_pawnname(Initiator) + ": job tobed:" + tobed); } else if (pawn.HostileTo(Partner)) pawn.health.AddHediff(xxx.submitting); diff --git a/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_GangbangVictim.cs b/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_GangbangVictim.cs index 99ef640..ce2ec72 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_GangbangVictim.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/Rituals/JobGiver_GangbangVictim.cs @@ -73,13 +73,8 @@ namespace RJWSexperience.Ideology if (dri == null) { Job gettin_raped = JobMaker.MakeJob(PartnerJob, pawn); - //Building_Bed Bed = null; - //if (Partner.GetPosture() == PawnPosture.LayingInBed) - // Bed = Partner.CurrentBed(); Partner.jobs.StartJob(gettin_raped, JobCondition.InterruptForced, null, false, true, null); - //if (Bed != null) - // (Partner.jobs.curDriver as JobDriver_SexBaseRecieverRaped)?.Set_bed(Bed); } }; yield return StartPartnerJob; @@ -93,17 +88,12 @@ namespace RJWSexperience.Ideology { Partner.pather.StopDead(); Partner.jobs.curDriver.asleep = false; - //CondomUtility.GetCondomFromRoom(Partner); - //Sexprops.usedCondom = CondomUtility.TryUseCondom(Partner); if (RJWSettings.DebugRape) ModLog.Message("JobDriver_RapeComfortPawn::MakeNewToils() - reserving prisoner"); - //pawn.Reserve(Partner, xxx.max_rapists_per_prisoner, 0); Start(); }; SexToil.tickAction = delegate { - //if (pawn.IsHashIntervalTick(ticks_between_hearts)) - // ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Heart); SexTick(pawn, Partner); SexUtility.reduce_rest(Partner, 1); SexUtility.reduce_rest(pawn, 2); diff --git a/RJWSexperience/IdeologyAddon/Ideology/Rituals/RitualRoles.cs b/RJWSexperience/IdeologyAddon/Ideology/Rituals/RitualRoles.cs index ef047d6..eb9576a 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/Rituals/RitualRoles.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/Rituals/RitualRoles.cs @@ -32,8 +32,6 @@ namespace RJWSexperience.Ideology { if (pawn.IsPrisonerOfColony || pawn.IsSlaveOfColony) return true; if (pawn.IsSubmissive()) return true; - //if ((pawn.Ideo?.HasMeme(MemeDefOf.FemaleSupremacy) ?? false) && pawn.gender != Gender.Female) return true; - //else if ((pawn.Ideo?.HasMeme(MemeDefOf.MaleSupremacy) ?? false) && pawn.gender != Gender.Male) return true; if (pawn.IsDesignatedComfort() || (pawn.guilt != null && pawn.guilt.IsGuilty) || (pawn.apparel != null && pawn.apparel.PsychologicallyNude)) return true; return false; } @@ -99,11 +97,11 @@ namespace RJWSexperience.Ideology public static bool CanBeBreeder(Pawn animal, Precept_Ritual precept) { - if (precept != null) - { - if (precept.ideo.HasPrecept(VariousDefOf.Bestiality_OnlyVenerated) && !precept.ideo.IsVeneratedAnimal(animal)) return false; - } - if (!xxx.can_rape(animal)) return false; + if (precept != null && precept.ideo.HasPrecept(VariousDefOf.Bestiality_OnlyVenerated) && !precept.ideo.IsVeneratedAnimal(animal)) + { + return false; + } + if (!xxx.can_rape(animal)) return false; return true; } diff --git a/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj b/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj index a592920..620b567 100644 --- a/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj +++ b/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj @@ -57,6 +57,7 @@ + diff --git a/RJWSexperience/RJWSexperience/Building_Cumbucket.cs b/RJWSexperience/RJWSexperience/Building_Cumbucket.cs index a1f3586..9513ba9 100644 --- a/RJWSexperience/RJWSexperience/Building_Cumbucket.cs +++ b/RJWSexperience/RJWSexperience/Building_Cumbucket.cs @@ -44,12 +44,11 @@ namespace RJWSexperience int num = (int)storedcum; cum.stackCount = num; - if (cum.stackCount > 0) - { - if (!GenPlace.TryPlaceThing(cum, PositionHeld, Map, ThingPlaceMode.Direct, out Thing res)) - FilthMaker.TryMakeFilth(PositionHeld, Map, VariousDefOf.FilthCum, num); - } - storedcum -= num; + if (cum.stackCount > 0 && !GenPlace.TryPlaceThing(cum, PositionHeld, Map, ThingPlaceMode.Direct, out Thing res)) + { + FilthMaker.TryMakeFilth(PositionHeld, Map, VariousDefOf.FilthCum, num); + } + storedcum -= num; } } diff --git a/RJWSexperience/RJWSexperience/Configurations.cs b/RJWSexperience/RJWSexperience/Configurations.cs index 9a2a1f4..5e0ebc6 100644 --- a/RJWSexperience/RJWSexperience/Configurations.cs +++ b/RJWSexperience/RJWSexperience/Configurations.cs @@ -2,9 +2,6 @@ using UnityEngine; using Verse; - - - namespace RJWSexperience { public class Configurations : ModSettings @@ -35,7 +32,7 @@ namespace RJWSexperience public static bool SelectionLocked = false; - public static void ResettoDefault() + public void ResetToDefault() { MaxLustDeviation = MaxInitialLustDefault; AvgLust = AvgLustDefault; @@ -52,7 +49,7 @@ namespace RJWSexperience public override void ExposeData() { - Scribe_Values.Look(ref MaxLustDeviation, "MaxLustDeviation", MaxLustDeviation, true); + Scribe_Values.Look(ref MaxLustDeviation, "MaxLustDeviation", MaxInitialLustDefault, true); Scribe_Values.Look(ref AvgLust, "AvgLust", AvgLust, true); Scribe_Values.Look(ref MaxSexCountDeviation, "MaxSexCountDeviation", MaxSexCountDeviation, true); Scribe_Values.Look(ref LustEffectPower, "LustEffectPower", LustEffectPower, true); @@ -70,12 +67,13 @@ namespace RJWSexperience public class RjwSexperienceMod : Mod { - private readonly Configurations config; - private static Vector2 scroll; + private Vector2 scroll; - public RjwSexperienceMod(ModContentPack content) : base(content) + public Configurations Settings { get; } + + public RjwSexperienceMod(ModContentPack content) : base(content) { - config = GetSettings(); + Settings = GetSettings(); } public override string SettingsCategory() @@ -97,7 +95,6 @@ namespace RJWSexperience listmain.Begin(mainRect); listmain.Gap(20f); - LabelwithTextfield(listmain.GetRect(lineHeight), Keyed.Option_2_Label + " x" + Configurations.LustEffectPower, Keyed.Option_2_Desc, ref Configurations.LustEffectPower, 0f, 100f); Adjuster = (int)(Configurations.LustEffectPower * 1000); Adjuster = (int)listmain.Slider(Adjuster, 0, 2000); @@ -123,7 +120,6 @@ namespace RJWSexperience Adjuster = (int)section.Slider(Adjuster, -1000, 1000); Configurations.AvgLust = Adjuster; - LabelwithTextfield(section.GetRect(lineHeight), Keyed.Option_5_Label + " " + Configurations.MaxSexCountDeviation, Keyed.Option_5_Desc, ref Configurations.MaxSexCountDeviation, 0f, 2000f); Adjuster = (int)Configurations.MaxSexCountDeviation; Adjuster = (int)section.Slider(Adjuster, 0, 2000); @@ -146,16 +142,14 @@ namespace RJWSexperience listmain.EndSection(section); } - if (listmain.ButtonText("reset to default")) { - Configurations.ResettoDefault(); + Settings.ResetToDefault(); } listmain.End(); Widgets.EndScrollView(); - } - + public 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); @@ -164,7 +158,6 @@ namespace RJWSexperience Widgets.TextFieldNumeric(textfieldRect,ref value, ref valuestr, min, max); Widgets.DrawHighlightIfMouseover(rect); TooltipHandler.TipRegion(rect, tooltip); - } public void SliderOption(Rect doublerect, string label, string tooltip, ref float value, float min, float max, float division) @@ -175,7 +168,5 @@ namespace RJWSexperience Adjuster = (int)Widgets.HorizontalSlider(doublerect.BottomHalf(), Adjuster, 0, division); value = (Adjuster / division).Denormalization(min,max); } - } - } diff --git a/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs b/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs index a50a44e..8c0af91 100644 --- a/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs +++ b/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs @@ -90,11 +90,7 @@ namespace RJWSexperience public static bool HasHymen(this Pawn pawn) { Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin); - if (virgin != null) - { - if (virgin.Degree > 0) return true; - } - return false; + return virgin?.Degree > 0; } /// @@ -107,13 +103,10 @@ namespace RJWSexperience if (pawn.IsVirgin()) { SexPartnerHistory history = pawn.GetPartnerHistory(); - if (history != null) - { - history.RecordFirst(partner, props); - } + history?.RecordFirst(partner, props); if (RJWUtility.RemoveVirginTrait(pawn, partner, props)) { - if (Configurations.EnableRecordRandomizer) Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true); + Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true); } } else diff --git a/RJWSexperience/RJWSexperience/GlobalSuppressions.cs b/RJWSexperience/RJWSexperience/GlobalSuppressions.cs new file mode 100644 index 0000000..38d94e9 --- /dev/null +++ b/RJWSexperience/RJWSexperience/GlobalSuppressions.cs @@ -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")] diff --git a/RJWSexperience/RJWSexperience/JobDrivers.cs b/RJWSexperience/RJWSexperience/JobDrivers.cs index a0bcd5a..d424bfd 100644 --- a/RJWSexperience/RJWSexperience/JobDrivers.cs +++ b/RJWSexperience/RJWSexperience/JobDrivers.cs @@ -59,7 +59,6 @@ namespace RJWSexperience cleaning.WithProgressBar(TargetIndex.A, () => progress/CleaningTime); yield return cleaning; - yield break; } protected void CleaningInit() diff --git a/RJWSexperience/RJWSexperience/Patches/GetGizmos.cs b/RJWSexperience/RJWSexperience/Patches/GetGizmos.cs index d283e9d..0c3a483 100644 --- a/RJWSexperience/RJWSexperience/Patches/GetGizmos.cs +++ b/RJWSexperience/RJWSexperience/Patches/GetGizmos.cs @@ -7,7 +7,7 @@ using Verse; namespace RJWSexperience { [HarmonyPatch(typeof(Pawn), "GetGizmos")] - public class Pawn_GetGizmos + public static class Pawn_GetGizmos { public static void Postfix(ref IEnumerable __result, Pawn __instance) { diff --git a/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs b/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs index 00fca22..3d82535 100644 --- a/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs +++ b/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs @@ -16,10 +16,11 @@ namespace RJWSexperience { if (__instance.Sexprops.sexType != xxx.rjwSextype.Masturbation && !(__instance is JobDriver_Masturbate)) { - if (__instance.Sexprops.isRape) + if (__instance.Sexprops.isRape && __instance.Sexprops.isReceiver) { __instance.pawn?.skills?.Learn(VariousDefOf.SexSkill, 0.05f, true); } + else { __instance.pawn?.skills?.Learn(VariousDefOf.SexSkill, 0.35f, true); } @@ -82,13 +83,16 @@ namespace RJWSexperience if (props.sexType != xxx.rjwSextype.Masturbation || props.partner != null) { - lustDelta = Mathf.Clamp((satisfaction - base_sat_per_fuck) * RJWUtility.LustIncrementFactor(lust ?? 0), -0.5f, 0.5f); // If the sex is satisfactory, lust grows up. Declines at the opposite. + lustDelta = Mathf.Clamp((satisfaction - base_sat_per_fuck) * RJWUtility.LustIncrementFactor((float)lust), -0.5f, 0.5f); // If the sex is satisfactory, lust grows up. Declines at the opposite. } else { - lustDelta = Mathf.Clamp(satisfaction * satisfaction * RJWUtility.LustIncrementFactor(lust ?? 0), 0, 0.5f); // Masturbation always increases lust. + lustDelta = Mathf.Clamp(satisfaction * satisfaction * RJWUtility.LustIncrementFactor((float)lust), 0, 0.5f); // Masturbation always increases lust. } + if (lustDelta == 0) + return; + rjw.Modules.Shared.Logs.LogManager.GetLogger().Message($"{props.pawn.NameShortColored}'s lust changed by {lustDelta} (from {lust})"); props.pawn.records.AddTo(VariousDefOf.Lust, lustDelta); } @@ -178,7 +182,6 @@ namespace RJWSexperience } } - [HarmonyPatch(typeof(WorkGiver_CleanSelf), "JobOnThing")] public static class RJW_Patch_CleanSelf_JobOnThing { @@ -192,27 +195,44 @@ namespace RJWSexperience return false; } - return true; } } - [HarmonyPatch(typeof(JobGiver_Masturbate), "TryGiveJob")] - public static class RJW_Patch_Masturabte_TryGiveJob + [HarmonyPatch(typeof(CasualSex_Helper), nameof(CasualSex_Helper.FindSexLocation))] + public static class RJW_Patch_CasualSex_Helper_FindSexLocation { - public static void Postfix(Pawn pawn, ref Job __result) + /// + /// If masturbation and current map has a bucket, return location near the bucket + /// + /// + /// + /// + /// + public static bool Prefix(Pawn pawn, Pawn partner, ref IntVec3 __result) { - if (RJWPreferenceSettings.FapEverywhere && (pawn.Faction?.IsPlayer ?? false) && __result != null) + if (partner != null) + return true; // Not masturbation + + Log.Message($"CasualSex_Helper.FindSexLocation for {pawn.NameShortColored}"); + + if (!pawn.Faction?.IsPlayer ?? true) { - Building_CumBucket bucket = pawn.FindClosestBucket(); - if (bucket != null) - { - __result.Clear(); - __result = JobMaker.MakeJob(xxx.Masturbate, null, null, bucket.RandomAdjacentCell8Way()); - } + Log.Message("Not player faction"); + 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; } } - } diff --git a/RJWSexperience/RJWSexperience/Patches/Rimworld_Patch.cs b/RJWSexperience/RJWSexperience/Patches/Rimworld_Patch.cs index e414423..2c105bc 100644 --- a/RJWSexperience/RJWSexperience/Patches/Rimworld_Patch.cs +++ b/RJWSexperience/RJWSexperience/Patches/Rimworld_Patch.cs @@ -23,7 +23,7 @@ namespace RJWSexperience } [HarmonyPatch(typeof(FloatMenuMakerMap), "AddHumanlikeOrders")] - public class HumanlikeOrder_Patch + public static class HumanlikeOrder_Patch { public static void Postfix(Vector3 clickPos, Pawn pawn, List opts) { diff --git a/RJWSexperience/RJWSexperience/RJWSexperience.csproj b/RJWSexperience/RJWSexperience/RJWSexperience.csproj index 45a2126..6796d6c 100644 --- a/RJWSexperience/RJWSexperience/RJWSexperience.csproj +++ b/RJWSexperience/RJWSexperience/RJWSexperience.csproj @@ -70,6 +70,7 @@ + diff --git a/RJWSexperience/RJWSexperience/SexHistory/HistoryUtility.cs b/RJWSexperience/RJWSexperience/SexHistory/HistoryUtility.cs index dff903a..7167fcb 100644 --- a/RJWSexperience/RJWSexperience/SexHistory/HistoryUtility.cs +++ b/RJWSexperience/RJWSexperience/SexHistory/HistoryUtility.cs @@ -20,13 +20,13 @@ namespace RJWSexperience public static readonly Texture2D Incest = ContentFinder.Get("UI/Icon/Incest"); public static readonly Texture2D Locked = ContentFinder.Get("UI/Icon/RSLocked"); public static readonly Texture2D Unlocked = ContentFinder.Get("UI/Icon/RSUnlocked"); - public static Texture2D Slaanesh = SolidColorMaterials.NewSolidColorTexture(0.686f, 0.062f, 0.698f, 1.0f); - public static Texture2D Khorne = SolidColorMaterials.NewSolidColorTexture(0.415f, 0.0f, 0.003f, 1.0f); - public static Texture2D Tzeentch = SolidColorMaterials.NewSolidColorTexture(0.082f, 0.453f, 0.6f, 1.0f); - public static Texture2D Nurgle = SolidColorMaterials.NewSolidColorTexture(0.6f, 0.83f, 0.35f, 1.0f); - public static Texture2D Partners = SolidColorMaterials.NewSolidColorTexture(0.843f, 0.474f, 0.6f, 1.0f); - public static Texture2D TotalSex = SolidColorMaterials.NewSolidColorTexture(0.878f, 0.674f, 0.411f, 1.0f); - public static Texture2D Satisfaction = SolidColorMaterials.NewSolidColorTexture(0.325f, 0.815f, 0.729f,1.0f); + 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[] diff --git a/RJWSexperience/RJWSexperience/SexHistory/SexPartnerHistory.cs b/RJWSexperience/RJWSexperience/SexHistory/SexPartnerHistory.cs index bb60dd2..1f50eaf 100644 --- a/RJWSexperience/RJWSexperience/SexHistory/SexPartnerHistory.cs +++ b/RJWSexperience/RJWSexperience/SexHistory/SexPartnerHistory.cs @@ -425,7 +425,6 @@ namespace RJWSexperience preferracepawncache = allpartners.FirstOrDefault(x => x.def == preferracecache); } - max = 0; for (int i = 0; i < sextypecount.Length; i++) { float avgsat = sextypesat[i] / sextypecount[i]; diff --git a/RJWSexperience/RJWSexperience/Thought_Recordbased.cs b/RJWSexperience/RJWSexperience/Thought_Recordbased.cs index b99e623..6080e86 100644 --- a/RJWSexperience/RJWSexperience/Thought_Recordbased.cs +++ b/RJWSexperience/RJWSexperience/Thought_Recordbased.cs @@ -17,7 +17,7 @@ namespace RJWSexperience public RecordDef recordDef; public List minimumValueforStage = new List(); public float increment; - } + } /// /// Thought class using record. @@ -54,18 +54,6 @@ namespace RJWSexperience } } - public override void ExposeData() - { - base.ExposeData(); - } - - - - public override void ThoughtInterval() - { - base.ThoughtInterval(); - } - public override bool TryMergeWithExistingMemory(out bool showBubble) { ThoughtHandler thoughts = pawn.needs.mood.thoughts; @@ -83,11 +71,6 @@ namespace RJWSexperience return false; } - public override void Init() - { - base.Init(); - } - protected virtual void Merged() { age = 0; diff --git a/RJWSexperience/RJWSexperience/UI/RJWUIUtility.cs b/RJWSexperience/RJWSexperience/UI/RJWUIUtility.cs index 6cc63f3..94e219b 100644 --- a/RJWSexperience/RJWSexperience/UI/RJWUIUtility.cs +++ b/RJWSexperience/RJWSexperience/UI/RJWUIUtility.cs @@ -82,8 +82,8 @@ namespace RJWSexperience.UI 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 stat.description + "\n" + + stat.Worker.GetExplanationFull(StatRequest.For(pawn), ToStringNumberSense.Undefined, val); return "Dead".Translate(); } diff --git a/RJWSexperience/RJWSexperience/UI/SexStatus.cs b/RJWSexperience/RJWSexperience/UI/SexStatus.cs index e0e71d9..e03e323 100644 --- a/RJWSexperience/RJWSexperience/UI/SexStatus.cs +++ b/RJWSexperience/RJWSexperience/UI/SexStatus.cs @@ -180,7 +180,6 @@ namespace RJWSexperience.UI if (partnerList.NullOrEmpty()) return; switch (mode) { - case PartnerOrderMode.Normal: default: partnerList = history?.PartnerList; break; @@ -328,10 +327,6 @@ namespace RJWSexperience.UI FillableBarLabeled(infoRect3, Keyed.RS_Sex_Info(Keyed.RS_Interspecies, history.InterspeciesCount.ToString()), history.InterspeciesCount / 100f, Texture2D.linearGrayTexture, Texture2D.blackTexture); } } - else - { - //GUI.Label(infoRect1, Keyed.RS_Normal + " ", fontstyleright); - } } else { @@ -452,10 +447,6 @@ namespace RJWSexperience.UI listmain.Gap(1f); } - - //listmain.GetRect(FONTHEIGHT); - //listmain.Gap(1f); - p = history.RapedCount; tmp = listmain.GetRect(FONTHEIGHT); if (p < history.BeenRapedCount) @@ -484,10 +475,6 @@ namespace RJWSexperience.UI TooltipHandler.TipRegion(tmp, RJWUIUtility.GetStatExplanation(pawn, xxx.sex_satisfaction, pawn.Dead ? 0 : pawn.GetStatValue(xxx.sex_satisfaction))); } - //p = pawn.GetStatValue(xxx.vulnerability_stat); - //FillableBarLabeled(listmain.GetRect(FONTHEIGHT), String.Format(xxx.vulnerability_stat.LabelCap.CapitalizeFirst() + ": {0:P2}", p), p / 2, HistoryUtility.Khorne, Texture2D.blackTexture, xxx.vulnerability_stat.description); - //listmain.Gap(1f); - SkillRecord skill = pawn.skills?.GetSkill(VariousDefOf.SexSkill); p = skill?.Level ?? 0; tmp = listmain.GetRect(FONTHEIGHT);