Removed some code warnings

This commit is contained in:
amevarashi 2022-03-24 22:31:07 +05:00
parent 82e4224bed
commit 60b268695c
22 changed files with 90 additions and 149 deletions

View 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")]

View File

@ -17,7 +17,6 @@ namespace RJWSexperience.Ideology
if (ModLister.HasActiveModWithName("RJW Sexperience")) if (ModLister.HasActiveModWithName("RJW Sexperience"))
{ {
//Log.Message("[RJWSexperience.Ideology] Found RJWSexperience, patching");
harmony.Patch(AccessTools.Method(typeof(PawnExtensions), nameof(PawnExtensions.IsIncest)), harmony.Patch(AccessTools.Method(typeof(PawnExtensions), nameof(PawnExtensions.IsIncest)),
prefix: new HarmonyMethod(typeof(Sexperience_Patch_IsIncest), nameof(Sexperience_Patch_IsIncest.Prefix)), prefix: new HarmonyMethod(typeof(Sexperience_Patch_IsIncest), nameof(Sexperience_Patch_IsIncest.Prefix)),
postfix: null postfix: null

View File

@ -30,8 +30,7 @@ namespace RJWSexperience.Ideology
{ {
if (mainideo.HasPrecept(VariousDefOf.BabyFaction_AlwaysFather)) if (mainideo.HasPrecept(VariousDefOf.BabyFaction_AlwaysFather))
{ {
Pawn parent = baby.GetFather(); Pawn parent = baby.GetFather() ?? baby.GetMother();
if (parent == null) baby.GetMother();
ideo = parent.Ideo; ideo = parent.Ideo;
return parent.Faction; return parent.Faction;
@ -162,7 +161,6 @@ namespace RJWSexperience.Ideology
bool isCoreLovin = props.isCoreLovin; bool isCoreLovin = props.isCoreLovin;
xxx.rjwSextype sextype = props.sexType; xxx.rjwSextype sextype = props.sexType;
//Log.Message("Aftersex " + pawn.Label + ": " + sextype);
if (partner != null) if (partner != null)
{ {
if (xxx.is_human(pawn)) AfterSexHuman(pawn, partner, usedCondom, rape, isCoreLovin, sextype); 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(human, tag + HETag.Gender(human), partner));
Find.HistoryEventsManager.RecordEvent(sexevent.TaggedEvent(partner, tag + HETag.Gender(partner), human)); 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) public static void Postfix(InteractionContext context, InteractionWithExtension interaction, IInteractionRule rule, ref float __result)
{ {
Ideo ideo = context.Inputs.Initiator.Ideo; Ideo ideo = context.Inputs.Initiator.Ideo;
if (ideo != null) PreceptSextype(ideo, context.Inputs.Initiator.GetStatValue(xxx.sex_drive_stat), ref __result, 0, interaction); 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<String> promiscuousSexTypes = new List<String> { private static readonly List<String> promiscuousSexTypes = new List<String> {
"DoublePenetration", "DoublePenetration",
"Scissoring", "Scissoring",
"Sixtynine", "Sixtynine",
@ -418,7 +409,6 @@ namespace RJWSexperience.Ideology
{ {
if (!mother.IsAnimal()) if (!mother.IsAnimal())
{ {
//baby.SetFactionDirect(baby.GetFactionUsingPrecept());
Faction faction = baby.GetFactionUsingPrecept(out Ideo ideo); Faction faction = baby.GetFactionUsingPrecept(out Ideo ideo);
if (baby.Faction != faction) baby.SetFaction(faction); if (baby.Faction != faction) baby.SetFaction(faction);
baby.ideo?.SetIdeo(ideo); baby.ideo?.SetIdeo(ideo);

View File

@ -64,7 +64,6 @@ namespace RJWSexperience.Ideology
protected override IEnumerable<Toil> MakeNewToils() protected override IEnumerable<Toil> MakeNewToils()
{ {
//ModLog.Message("" + this.GetType().ToString() + "::MakeNewToils() called");
setup_ticks(); setup_ticks();
var PartnerJob = VariousDefOf.GettinDrugSex; var PartnerJob = VariousDefOf.GettinDrugSex;
@ -74,19 +73,6 @@ namespace RJWSexperience.Ideology
this.FailOn(() => Partner == null); this.FailOn(() => Partner == null);
yield return Toils_Goto.GotoThing(iTarget, PathEndMode.OnCell); 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(); Toil WaitForPartner = new Toil();
WaitForPartner.defaultCompleteMode = ToilCompleteMode.Delay; WaitForPartner.defaultCompleteMode = ToilCompleteMode.Delay;
WaitForPartner.initAction = delegate WaitForPartner.initAction = delegate
@ -167,8 +153,6 @@ namespace RJWSexperience.Ideology
{ {
setup_ticks(); setup_ticks();
parteners.Add(Partner);// add job starter, so this wont fail, before Initiator starts his job 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. // More/less hearts based on opinion.
if (pawn.relations.OpinionOf(Partner) < 0) if (pawn.relations.OpinionOf(Partner) < 0)
@ -195,9 +179,6 @@ namespace RJWSexperience.Ideology
get_loved.defaultCompleteMode = ToilCompleteMode.Never; get_loved.defaultCompleteMode = ToilCompleteMode.Never;
get_loved.socialMode = RandomSocialMode.Off; get_loved.socialMode = RandomSocialMode.Off;
get_loved.handlingFacing = true; get_loved.handlingFacing = true;
//get_loved.initAction = delegate
//{
//};
get_loved.tickAction = delegate get_loved.tickAction = delegate
{ {
}; };
@ -229,15 +210,11 @@ namespace RJWSexperience.Ideology
{ {
setup_ticks(); setup_ticks();
//this.FailOn(() => PawnUtility.PlayerForcedJobNowOrSoon(pawn));
this.FailOn(() => pawn.health.Downed); this.FailOn(() => pawn.health.Downed);
this.FailOn(() => pawn.IsBurning()); this.FailOn(() => pawn.IsBurning());
this.FailOn(() => pawn.IsFighting()); this.FailOn(() => pawn.IsFighting());
this.FailOn(() => pawn.Drafted); this.FailOn(() => pawn.Drafted);
//ModLog.Message(" Making new toil for QuickFap.");
Toil SexToil = Toils_General.Wait(duration); Toil SexToil = Toils_General.Wait(duration);
SexToil.handlingFacing = true; SexToil.handlingFacing = true;
SexToil.initAction = delegate SexToil.initAction = delegate

View File

@ -48,7 +48,6 @@ namespace RJWSexperience.Ideology
protected override IEnumerable<Toil> MakeNewToils() protected override IEnumerable<Toil> MakeNewToils()
{ {
//ModLog.Message("" + this.GetType().ToString() + "::MakeNewToils() called");
setup_ticks(); setup_ticks();
this.FailOnDespawnedNullOrForbidden(iTarget); this.FailOnDespawnedNullOrForbidden(iTarget);
@ -148,7 +147,6 @@ namespace RJWSexperience.Ideology
Job tobed = JobMaker.MakeJob(JobDefOf.Rescue, pawn, Bed); Job tobed = JobMaker.MakeJob(JobDefOf.Rescue, pawn, Bed);
tobed.count = 1; tobed.count = 1;
Partner.jobs.jobQueue.EnqueueFirst(tobed); Partner.jobs.jobQueue.EnqueueFirst(tobed);
//Log.Message(xxx.get_pawnname(Initiator) + ": job tobed:" + tobed);
} }
else if (pawn.HostileTo(Partner)) else if (pawn.HostileTo(Partner))
pawn.health.AddHediff(xxx.submitting); pawn.health.AddHediff(xxx.submitting);

View File

@ -73,13 +73,8 @@ namespace RJWSexperience.Ideology
if (dri == null) if (dri == null)
{ {
Job gettin_raped = JobMaker.MakeJob(PartnerJob, pawn); 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); 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; yield return StartPartnerJob;
@ -93,17 +88,12 @@ namespace RJWSexperience.Ideology
{ {
Partner.pather.StopDead(); Partner.pather.StopDead();
Partner.jobs.curDriver.asleep = false; Partner.jobs.curDriver.asleep = false;
//CondomUtility.GetCondomFromRoom(Partner);
//Sexprops.usedCondom = CondomUtility.TryUseCondom(Partner);
if (RJWSettings.DebugRape) ModLog.Message("JobDriver_RapeComfortPawn::MakeNewToils() - reserving prisoner"); if (RJWSettings.DebugRape) ModLog.Message("JobDriver_RapeComfortPawn::MakeNewToils() - reserving prisoner");
//pawn.Reserve(Partner, xxx.max_rapists_per_prisoner, 0);
Start(); Start();
}; };
SexToil.tickAction = delegate SexToil.tickAction = delegate
{ {
//if (pawn.IsHashIntervalTick(ticks_between_hearts))
// ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Heart);
SexTick(pawn, Partner); SexTick(pawn, Partner);
SexUtility.reduce_rest(Partner, 1); SexUtility.reduce_rest(Partner, 1);
SexUtility.reduce_rest(pawn, 2); SexUtility.reduce_rest(pawn, 2);

View File

@ -32,8 +32,6 @@ namespace RJWSexperience.Ideology
{ {
if (pawn.IsPrisonerOfColony || pawn.IsSlaveOfColony) return true; if (pawn.IsPrisonerOfColony || pawn.IsSlaveOfColony) return true;
if (pawn.IsSubmissive()) 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; if (pawn.IsDesignatedComfort() || (pawn.guilt != null && pawn.guilt.IsGuilty) || (pawn.apparel != null && pawn.apparel.PsychologicallyNude)) return true;
return false; return false;
} }
@ -99,11 +97,11 @@ namespace RJWSexperience.Ideology
public static bool CanBeBreeder(Pawn animal, Precept_Ritual precept) public static bool CanBeBreeder(Pawn animal, Precept_Ritual precept)
{ {
if (precept != null) if (precept != null && precept.ideo.HasPrecept(VariousDefOf.Bestiality_OnlyVenerated) && !precept.ideo.IsVeneratedAnimal(animal))
{ {
if (precept.ideo.HasPrecept(VariousDefOf.Bestiality_OnlyVenerated) && !precept.ideo.IsVeneratedAnimal(animal)) return false; return false;
} }
if (!xxx.can_rape(animal)) return false; if (!xxx.can_rape(animal)) return false;
return true; return true;
} }

View File

@ -57,6 +57,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Ideology\GoodwillSituationWorker_MemeCompatibility.cs" /> <Compile Include="Ideology\GoodwillSituationWorker_MemeCompatibility.cs" />
<Compile Include="Harmony.cs" /> <Compile Include="Harmony.cs" />
<Compile Include="Ideology\Keyed.cs" /> <Compile Include="Ideology\Keyed.cs" />

View File

@ -44,12 +44,11 @@ namespace RJWSexperience
int num = (int)storedcum; int num = (int)storedcum;
cum.stackCount = num; cum.stackCount = num;
if (cum.stackCount > 0) if (cum.stackCount > 0 && !GenPlace.TryPlaceThing(cum, PositionHeld, Map, ThingPlaceMode.Direct, out Thing res))
{ {
if (!GenPlace.TryPlaceThing(cum, PositionHeld, Map, ThingPlaceMode.Direct, out Thing res)) FilthMaker.TryMakeFilth(PositionHeld, Map, VariousDefOf.FilthCum, num);
FilthMaker.TryMakeFilth(PositionHeld, Map, VariousDefOf.FilthCum, num); }
} storedcum -= num;
storedcum -= num;
} }
} }

View File

@ -2,9 +2,6 @@
using UnityEngine; using UnityEngine;
using Verse; using Verse;
namespace RJWSexperience namespace RJWSexperience
{ {
public class Configurations : ModSettings public class Configurations : ModSettings
@ -35,7 +32,7 @@ namespace RJWSexperience
public static bool SelectionLocked = false; public static bool SelectionLocked = false;
public static void ResettoDefault() public void ResetToDefault()
{ {
MaxLustDeviation = MaxInitialLustDefault; MaxLustDeviation = MaxInitialLustDefault;
AvgLust = AvgLustDefault; AvgLust = AvgLustDefault;
@ -52,7 +49,7 @@ namespace RJWSexperience
public override void ExposeData() 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 AvgLust, "AvgLust", AvgLust, true);
Scribe_Values.Look(ref MaxSexCountDeviation, "MaxSexCountDeviation", MaxSexCountDeviation, true); Scribe_Values.Look(ref MaxSexCountDeviation, "MaxSexCountDeviation", MaxSexCountDeviation, true);
Scribe_Values.Look(ref LustEffectPower, "LustEffectPower", LustEffectPower, true); Scribe_Values.Look(ref LustEffectPower, "LustEffectPower", LustEffectPower, true);
@ -70,12 +67,13 @@ namespace RJWSexperience
public class RjwSexperienceMod : Mod public class RjwSexperienceMod : Mod
{ {
private readonly Configurations config; private Vector2 scroll;
private static Vector2 scroll;
public RjwSexperienceMod(ModContentPack content) : base(content) public Configurations Settings { get; }
public RjwSexperienceMod(ModContentPack content) : base(content)
{ {
config = GetSettings<Configurations>(); Settings = GetSettings<Configurations>();
} }
public override string SettingsCategory() public override string SettingsCategory()
@ -97,7 +95,6 @@ namespace RJWSexperience
listmain.Begin(mainRect); listmain.Begin(mainRect);
listmain.Gap(20f); listmain.Gap(20f);
LabelwithTextfield(listmain.GetRect(lineHeight), Keyed.Option_2_Label + " x" + Configurations.LustEffectPower, Keyed.Option_2_Desc, ref Configurations.LustEffectPower, 0f, 100f); 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)(Configurations.LustEffectPower * 1000);
Adjuster = (int)listmain.Slider(Adjuster, 0, 2000); Adjuster = (int)listmain.Slider(Adjuster, 0, 2000);
@ -123,7 +120,6 @@ namespace RJWSexperience
Adjuster = (int)section.Slider(Adjuster, -1000, 1000); Adjuster = (int)section.Slider(Adjuster, -1000, 1000);
Configurations.AvgLust = Adjuster; Configurations.AvgLust = Adjuster;
LabelwithTextfield(section.GetRect(lineHeight), Keyed.Option_5_Label + " " + Configurations.MaxSexCountDeviation, Keyed.Option_5_Desc, ref Configurations.MaxSexCountDeviation, 0f, 2000f); 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)Configurations.MaxSexCountDeviation;
Adjuster = (int)section.Slider(Adjuster, 0, 2000); Adjuster = (int)section.Slider(Adjuster, 0, 2000);
@ -146,16 +142,14 @@ namespace RJWSexperience
listmain.EndSection(section); listmain.EndSection(section);
} }
if (listmain.ButtonText("reset to default")) if (listmain.ButtonText("reset to default"))
{ {
Configurations.ResettoDefault(); Settings.ResetToDefault();
} }
listmain.End(); listmain.End();
Widgets.EndScrollView(); Widgets.EndScrollView();
} }
public void LabelwithTextfield(Rect rect, string label, string tooltip, ref float value, float min, float max) 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); 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.TextFieldNumeric(textfieldRect,ref value, ref valuestr, min, max);
Widgets.DrawHighlightIfMouseover(rect); Widgets.DrawHighlightIfMouseover(rect);
TooltipHandler.TipRegion(rect, tooltip); TooltipHandler.TipRegion(rect, tooltip);
} }
public void SliderOption(Rect doublerect, string label, string tooltip, ref float value, float min, float max, float division) 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); Adjuster = (int)Widgets.HorizontalSlider(doublerect.BottomHalf(), Adjuster, 0, division);
value = (Adjuster / division).Denormalization(min,max); value = (Adjuster / division).Denormalization(min,max);
} }
} }
} }

View File

@ -90,11 +90,7 @@ namespace RJWSexperience
public static bool HasHymen(this Pawn pawn) public static bool HasHymen(this Pawn pawn)
{ {
Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin); Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin);
if (virgin != null) return virgin?.Degree > 0;
{
if (virgin.Degree > 0) return true;
}
return false;
} }
/// <summary> /// <summary>
@ -107,13 +103,10 @@ namespace RJWSexperience
if (pawn.IsVirgin()) if (pawn.IsVirgin())
{ {
SexPartnerHistory history = pawn.GetPartnerHistory(); SexPartnerHistory history = pawn.GetPartnerHistory();
if (history != null) history?.RecordFirst(partner, props);
{
history.RecordFirst(partner, props);
}
if (RJWUtility.RemoveVirginTrait(pawn, 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 else

View 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")]

View File

@ -59,7 +59,6 @@ namespace RJWSexperience
cleaning.WithProgressBar(TargetIndex.A, () => progress/CleaningTime); cleaning.WithProgressBar(TargetIndex.A, () => progress/CleaningTime);
yield return cleaning; yield return cleaning;
yield break;
} }
protected void CleaningInit() protected void CleaningInit()

View File

@ -7,7 +7,7 @@ using Verse;
namespace RJWSexperience namespace RJWSexperience
{ {
[HarmonyPatch(typeof(Pawn), "GetGizmos")] [HarmonyPatch(typeof(Pawn), "GetGizmos")]
public class Pawn_GetGizmos public static class Pawn_GetGizmos
{ {
public static void Postfix(ref IEnumerable<Gizmo> __result, Pawn __instance) public static void Postfix(ref IEnumerable<Gizmo> __result, Pawn __instance)
{ {

View File

@ -16,10 +16,11 @@ namespace RJWSexperience
{ {
if (__instance.Sexprops.sexType != xxx.rjwSextype.Masturbation && !(__instance is JobDriver_Masturbate)) 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); __instance.pawn?.skills?.Learn(VariousDefOf.SexSkill, 0.05f, true);
} }
else
{ {
__instance.pawn?.skills?.Learn(VariousDefOf.SexSkill, 0.35f, true); __instance.pawn?.skills?.Learn(VariousDefOf.SexSkill, 0.35f, true);
} }
@ -82,13 +83,16 @@ namespace RJWSexperience
if (props.sexType != xxx.rjwSextype.Masturbation || props.partner != null) 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 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<RjwSexperienceMod>().Message($"{props.pawn.NameShortColored}'s lust changed by {lustDelta} (from {lust})"); rjw.Modules.Shared.Logs.LogManager.GetLogger<RjwSexperienceMod>().Message($"{props.pawn.NameShortColored}'s lust changed by {lustDelta} (from {lust})");
props.pawn.records.AddTo(VariousDefOf.Lust, lustDelta); props.pawn.records.AddTo(VariousDefOf.Lust, lustDelta);
} }
@ -178,7 +182,6 @@ namespace RJWSexperience
} }
} }
[HarmonyPatch(typeof(WorkGiver_CleanSelf), "JobOnThing")] [HarmonyPatch(typeof(WorkGiver_CleanSelf), "JobOnThing")]
public static class RJW_Patch_CleanSelf_JobOnThing public static class RJW_Patch_CleanSelf_JobOnThing
{ {
@ -192,27 +195,44 @@ namespace RJWSexperience
return false; return false;
} }
return true; return true;
} }
} }
[HarmonyPatch(typeof(JobGiver_Masturbate), "TryGiveJob")] [HarmonyPatch(typeof(CasualSex_Helper), nameof(CasualSex_Helper.FindSexLocation))]
public static class RJW_Patch_Masturabte_TryGiveJob public static class RJW_Patch_CasualSex_Helper_FindSexLocation
{ {
public static void Postfix(Pawn pawn, ref Job __result) /// <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 (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(); Log.Message("Not player faction");
if (bucket != null) return true;
{
__result.Clear();
__result = JobMaker.MakeJob(xxx.Masturbate, null, null, bucket.RandomAdjacentCell8Way());
}
} }
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;
} }
} }
} }

View File

@ -23,7 +23,7 @@ namespace RJWSexperience
} }
[HarmonyPatch(typeof(FloatMenuMakerMap), "AddHumanlikeOrders")] [HarmonyPatch(typeof(FloatMenuMakerMap), "AddHumanlikeOrders")]
public class HumanlikeOrder_Patch public static class HumanlikeOrder_Patch
{ {
public static void Postfix(Vector3 clickPos, Pawn pawn, List<FloatMenuOption> opts) public static void Postfix(Vector3 clickPos, Pawn pawn, List<FloatMenuOption> opts)
{ {

View File

@ -70,6 +70,7 @@
<Compile Include="DebugAction.cs" /> <Compile Include="DebugAction.cs" />
<Compile Include="ExtensionMethods\PawnExtensions.cs" /> <Compile Include="ExtensionMethods\PawnExtensions.cs" />
<Compile Include="ExtensionMethods\SexPropsExtensions.cs" /> <Compile Include="ExtensionMethods\SexPropsExtensions.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Harmony.cs" /> <Compile Include="Harmony.cs" />
<Compile Include="IngestionOutcomeDoers.cs" /> <Compile Include="IngestionOutcomeDoers.cs" />
<Compile Include="JobDrivers.cs" /> <Compile Include="JobDrivers.cs" />

View File

@ -20,13 +20,13 @@ namespace RJWSexperience
public static readonly Texture2D Incest = ContentFinder<Texture2D>.Get("UI/Icon/Incest"); 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 Locked = ContentFinder<Texture2D>.Get("UI/Icon/RSLocked");
public static readonly Texture2D Unlocked = ContentFinder<Texture2D>.Get("UI/Icon/RSUnlocked"); public static readonly Texture2D Unlocked = ContentFinder<Texture2D>.Get("UI/Icon/RSUnlocked");
public static Texture2D Slaanesh = SolidColorMaterials.NewSolidColorTexture(0.686f, 0.062f, 0.698f, 1.0f); public static readonly 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 readonly 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 readonly 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 readonly 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 readonly 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 readonly 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 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 Color HistoryColor = new Color(0.9f,0.5f,0.5f);
public static readonly Texture2D[] SextypeColor = new Texture2D[] public static readonly Texture2D[] SextypeColor = new Texture2D[]

View File

@ -425,7 +425,6 @@ namespace RJWSexperience
preferracepawncache = allpartners.FirstOrDefault(x => x.def == preferracecache); preferracepawncache = allpartners.FirstOrDefault(x => x.def == preferracecache);
} }
max = 0;
for (int i = 0; i < sextypecount.Length; i++) for (int i = 0; i < sextypecount.Length; i++)
{ {
float avgsat = sextypesat[i] / sextypecount[i]; float avgsat = sextypesat[i] / sextypecount[i];

View File

@ -17,7 +17,7 @@ namespace RJWSexperience
public RecordDef recordDef; public RecordDef recordDef;
public List<float> minimumValueforStage = new List<float>(); public List<float> minimumValueforStage = new List<float>();
public float increment; public float increment;
} }
/// <summary> /// <summary>
/// Thought class using record. /// 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) public override bool TryMergeWithExistingMemory(out bool showBubble)
{ {
ThoughtHandler thoughts = pawn.needs.mood.thoughts; ThoughtHandler thoughts = pawn.needs.mood.thoughts;
@ -83,11 +71,6 @@ namespace RJWSexperience
return false; return false;
} }
public override void Init()
{
base.Init();
}
protected virtual void Merged() protected virtual void Merged()
{ {
age = 0; age = 0;

View File

@ -82,8 +82,8 @@ namespace RJWSexperience.UI
public static string GetStatExplanation(Pawn pawn, StatDef stat, float val) public static string GetStatExplanation(Pawn pawn, StatDef stat, float val)
{ {
if (!pawn.Dead) if (!pawn.Dead)
return stat.description + "\n" + return stat.description + "\n" +
stat.Worker.GetExplanationFull(StatRequest.For(pawn), ToStringNumberSense.Undefined, val); stat.Worker.GetExplanationFull(StatRequest.For(pawn), ToStringNumberSense.Undefined, val);
return "Dead".Translate(); return "Dead".Translate();
} }

View File

@ -180,7 +180,6 @@ namespace RJWSexperience.UI
if (partnerList.NullOrEmpty()) return; if (partnerList.NullOrEmpty()) return;
switch (mode) switch (mode)
{ {
case PartnerOrderMode.Normal:
default: default:
partnerList = history?.PartnerList; partnerList = history?.PartnerList;
break; 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); 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 else
{ {
@ -452,10 +447,6 @@ namespace RJWSexperience.UI
listmain.Gap(1f); listmain.Gap(1f);
} }
//listmain.GetRect(FONTHEIGHT);
//listmain.Gap(1f);
p = history.RapedCount; p = history.RapedCount;
tmp = listmain.GetRect(FONTHEIGHT); tmp = listmain.GetRect(FONTHEIGHT);
if (p < history.BeenRapedCount) 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))); 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); SkillRecord skill = pawn.skills?.GetSkill(VariousDefOf.SexSkill);
p = skill?.Level ?? 0; p = skill?.Level ?? 0;
tmp = listmain.GetRect(FONTHEIGHT); tmp = listmain.GetRect(FONTHEIGHT);