code
stringlengths
0
56.1M
repo_name
stringlengths
3
57
path
stringlengths
2
176
language
stringclasses
672 values
license
stringclasses
8 values
size
int64
0
56.8M
using RimWorld; using RimWorld.Planet; using UnityEngine; using Verse; using Multiplayer.API; namespace rjw { internal class Hediff_Parasite : Hediff_Pregnant { [SyncMethod] new public static void DoBirthSpawn(Pawn mother, Pawn father) { //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); int num = (mother.RaceProps.litterSizeCurve == null) ? 1 : Mathf.RoundToInt(Rand.ByCurve(mother.RaceProps.litterSizeCurve)); if (num < 1) { num = 1; } PawnGenerationRequest request = new PawnGenerationRequest( kind: father.kindDef, faction: father.Faction, forceGenerateNewPawn: true, developmentalStages: DevelopmentalStage.Newborn, allowDowned: true, canGeneratePawnRelations: false, mustBeCapableOfViolence: true, colonistRelationChanceFactor: 0, allowFood: false, allowAddictions: false, relationWithExtraPawnChanceFactor: 0 ); Pawn pawn = null; for (int i = 0; i < num; i++) { pawn = PawnGenerator.GeneratePawn(request); if (PawnUtility.TrySpawnHatchedOrBornPawn(pawn, mother)) { if (pawn.playerSettings != null && mother.playerSettings != null) { pawn.playerSettings.AreaRestriction = father.playerSettings.AreaRestriction; } if (pawn.RaceProps.IsFlesh) { pawn.relations.AddDirectRelation(PawnRelationDefOf.Parent, mother); if (father != null) { pawn.relations.AddDirectRelation(PawnRelationDefOf.Parent, father); } } } else { Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard); } } if (mother.Spawned) { FilthMaker.TryMakeFilth(mother.Position, mother.Map, ThingDefOf.Filth_AmnioticFluid, mother.LabelIndefinite(), 5); if (mother.caller != null) { mother.caller.DoCall(); } if (pawn.caller != null) { pawn.caller.DoCall(); } } } } }
Korth95/rjw
1.4/Source/Modules/Pregnancy/Hediffs/Hediff_ParasitePregnancy.cs
C#
mit
1,922
using System; using System.Collections.Generic; using System.Text; using RimWorld; using Verse; using Multiplayer.API; namespace rjw { public static class AgeStage { public const int Baby = 0; public const int Toddler = 1; public const int Child = 2; public const int Teenager = 3; public const int Adult = 4; } public class Hediff_SimpleBaby : HediffWithComps { // Keeps track of what stage the pawn has grown to private int grown_to = 0; private int stage_completed = 0; public float lastTick = 0; public float dayTick = 0; //Properties public int Grown_To { get { return grown_to; } } public override string DebugString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(base.DebugString()); stringBuilder.Append("Current CurLifeStageIndex: " + pawn.ageTracker.CurLifeStageIndex + ", grown_to: " + grown_to); return stringBuilder.ToString(); } public override void PostMake() { Severity = Math.Max(0.01f, Severity); if (grown_to == 0 && !pawn.health.hediffSet.HasHediff(HediffDef.Named("RJW_NoManipulationFlag"))) { pawn.health.AddHediff(HediffDef.Named("RJW_NoManipulationFlag"), null, null); } base.PostMake(); if (!pawn.RaceProps.lifeStageAges.Any(x => x.def.reproductive)) { if (pawn.health.hediffSet.HasHediff(xxx.RJW_NoManipulationFlag)) { pawn.health.hediffSet.hediffs.Remove(pawn.health.hediffSet.GetFirstHediffOfDef(xxx.RJW_NoManipulationFlag)); } pawn.health.RemoveHediff(this); } } public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref grown_to, "grown_to", 0); Scribe_Values.Look(ref lastTick, "lastTick", 0); Scribe_Values.Look(ref dayTick, "dayTick", 0); } internal void GrowUpTo(int stage) { GrowUpTo(stage, true); } [SyncMethod] internal void GrowUpTo(int stage, bool generated) { //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); if (grown_to < stage) grown_to = stage; // Update the Colonist Bar PortraitsCache.SetDirty(pawn); pawn.Drawer.renderer.graphics.ResolveAllGraphics(); // At the toddler stage. Now we can move and talk. if ((stage >= 1 || pawn.ageTracker.CurLifeStage.reproductive) && stage_completed < 1) { Severity = Math.Max(0.5f, Severity); stage_completed++; } // Re-enable skills that were locked out from toddlers if ((stage >= 2 || pawn.ageTracker.CurLifeStage.reproductive) && stage_completed < 2) { if (!generated) { if (xxx.RimWorldChildrenIsActive) { pawn.story.Childhood = DefDatabase<BackstoryDef>.GetNamed("CustomBackstory_Rimchild"); } // Remove the hidden hediff stopping pawns from manipulating } if (pawn.health.hediffSet.HasHediff(xxx.RJW_NoManipulationFlag)) { pawn.health.hediffSet.hediffs.Remove(pawn.health.hediffSet.GetFirstHediffOfDef(xxx.RJW_NoManipulationFlag)); } Severity = Math.Max(0.75f, Severity); stage_completed++; } // The child has grown to a teenager so we no longer need this effect if ((stage >= 3 || pawn.ageTracker.CurLifeStage.reproductive) && stage_completed < 3) { if (!generated && pawn.story.Childhood != null && pawn.story.Childhood.title == "Child") { if (xxx.RimWorldChildrenIsActive) { pawn.story.Childhood = DefDatabase<BackstoryDef>.GetNamed("CustomBackstory_Rimchild"); } } // Gain traits from life experiences if (pawn.story.traits.allTraits.Count < 3) { List<Trait> life_traitpool = new List<Trait>(); // Try get cannibalism if (pawn.needs.mood.thoughts.memories.Memories.Find(x => x.def == ThoughtDefOf.AteHumanlikeMeatAsIngredient) != null) { life_traitpool.Add(new Trait(TraitDefOf.Cannibal, 0, false)); } // Try to get bloodlust if (pawn.records.GetValue(RecordDefOf.KillsHumanlikes) > 0 || pawn.records.GetValue(RecordDefOf.AnimalsSlaughtered) >= 2) { life_traitpool.Add(new Trait(TraitDefOf.Bloodlust, 0, false)); } // Try to get shooting accuracy if (pawn.records.GetValue(RecordDefOf.ShotsFired) > 100 && (int)pawn.records.GetValue(RecordDefOf.PawnsDowned) > 0) { life_traitpool.Add(new Trait(TraitDef.Named("ShootingAccuracy"), 1, false)); } else if (pawn.records.GetValue(RecordDefOf.ShotsFired) > 100 && (int)pawn.records.GetValue(RecordDefOf.PawnsDowned) == 0) { life_traitpool.Add(new Trait(TraitDef.Named("ShootingAccuracy"), -1, false)); } // Try to get brawler else if (pawn.records.GetValue(RecordDefOf.ShotsFired) < 15 && pawn.records.GetValue(RecordDefOf.PawnsDowned) > 1) { life_traitpool.Add(new Trait(TraitDefOf.Brawler, 0, false)); } // Try to get necrophiliac if (pawn.records.GetValue(RecordDefOf.CorpsesBuried) > 50) { life_traitpool.Add(new Trait(xxx.necrophiliac, 0, false)); } // Try to get nymphomaniac if (pawn.records.GetValue(RecordDefOf.BodiesStripped) > 50) { life_traitpool.Add(new Trait(xxx.nymphomaniac, 0, false)); } // Try to get rapist if (pawn.records.GetValue(RecordDefOf.TimeAsPrisoner) > 300) { life_traitpool.Add(new Trait(xxx.rapist, 0, false)); } // Try to get Dislikes Men/Women int male_rivals = 0; int female_rivals = 0; foreach (Pawn colinist in Find.AnyPlayerHomeMap.mapPawns.AllPawnsSpawned) { if (pawn.relations.OpinionOf(colinist) <= -20) { if (colinist.gender == Gender.Male) male_rivals++; else female_rivals++; } } // Find which gender we hate if (male_rivals > 3 || female_rivals > 3) { if (male_rivals > female_rivals) life_traitpool.Add(new Trait(TraitDefOf.DislikesMen, 0, false)); else if (female_rivals > male_rivals) life_traitpool.Add(new Trait(TraitDefOf.DislikesWomen, 0, false)); } // Pyromaniac never put out any fires. Seems kinda stupid /*if ((int)pawn.records.GetValue (RecordDefOf.FiresExtinguished) == 0) { life_traitpool.Add (new Trait (TraitDefOf.Pyromaniac, 0, false)); }*/ // Neurotic if (pawn.records.GetValue(RecordDefOf.TimesInMentalState) > 6) { life_traitpool.Add(new Trait(TraitDef.Named("Neurotic"), 2, false)); } else if (pawn.records.GetValue(RecordDefOf.TimesInMentalState) > 3) { life_traitpool.Add(new Trait(TraitDef.Named("Neurotic"), 1, false)); } // People(male or female) can turn gay during puberty //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); if (Rand.Value <= 0.03f && pawn.story.traits.allTraits.Count <= 3) { pawn.story.traits.GainTrait(new Trait(TraitDefOf.Gay, 0, true)); } // Now let's try to add some life experience traits if (life_traitpool.Count > 0) { int i = 3; while (pawn.story.traits.allTraits.Count < 3 && i > 0) { Trait newtrait = life_traitpool.RandomElement(); if (pawn.story.traits.HasTrait(newtrait.def) == false) pawn.story.traits.GainTrait(newtrait); i--; } } } stage_completed++; pawn.health.RemoveHediff(this); } } //everyday grow 1 year until reproductive public void GrowFast() { if (RJWPregnancySettings.phantasy_pregnancy) { if (!pawn.ageTracker.CurLifeStage.reproductive || pawn.ageTracker.Growth >= 1) { pawn.ageTracker.AgeBiologicalTicks = (pawn.ageTracker.AgeBiologicalYears + 1) * GenDate.TicksPerYear + 1; pawn.ageTracker.DebugForceBirthdayBiological(); GrowUpTo(pawn.ageTracker.CurLifeStageIndex, false); } } } public void TickRare() { //--ModLog.Message("Hediff_SimpleBaby::TickRare is called"); if (pawn.ageTracker.CurLifeStageIndex > Grown_To) { GrowUpTo(pawn.ageTracker.CurLifeStageIndex, false); } // Update the graphics set //if (pawn.ageTracker.CurLifeStageIndex >= AgeStage.Toddler) // pawn.Drawer.renderer.graphics.ResolveAllGraphics(); if (xxx.RimWorldChildrenIsActive) { //if (Prefs.DevMode) // Log.Message("RJW child tick - CnP active"); //we do not disable our hediff anymore // if (pawn.health.hediffSet.HasHediff(HediffDef.Named("RJW_NoManipulationFlag"))) //{ // pawn.health.hediffSet.hediffs.Remove(pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("RJW_NoManipulationFlag"))); // pawn.health.AddHediff(HediffDef.Named("NoManipulationFlag"), null, null); //} //if (pawn.health.hediffSet.HasHediff(HediffDef.Named("RJW_BabyState"))) //{ // pawn.health.hediffSet.hediffs.Remove(pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("RJW_BabyState"))); // pawn.health.AddHediff(HediffDef.Named("BabyState"), null, null); // if (Prefs.DevMode) Log.Message("RJW_Babystate self-removing"); // } if (pawn.ageTracker.CurLifeStageIndex <= 1) { //The UnhappBaby feature is not included in RJW, but will // Check if the baby is hungry, and if so, add the whiny baby hediff var hunger = pawn.needs.food; var joy = pawn.needs.joy; if ((joy != null)&&(hunger!=null)) { //There's no way to patch out the CnP adressing nill fields if (hunger.CurLevelPercentage<hunger.PercentageThreshHungry || joy.CurLevelPercentage <0.1) { if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("UnhappyBaby"))){ //--Log.Message("Adding unhappy baby hediff"); pawn.health.AddHediff(HediffDef.Named("UnhappyBaby"), null, null); } } } } } } public override void Tick() { /* if (xxx.RimWorldChildrenIsActive) { if (pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("RJW_BabyState"))!=null) { pawn.health.RemoveHediff(this); } return; } */ //This void call every frame. should not logmes no reason //--ModLog.Message("Hediff_SimpleBaby::PostTick is called"); base.Tick(); if (pawn.Spawned) { var thisTick = Find.TickManager.TicksGame; if ((thisTick - dayTick) >= GenDate.TicksPerDay) { GrowFast(); dayTick = thisTick; } if ((thisTick - lastTick) >= 250) { TickRare(); lastTick = thisTick; } } } public override bool Visible { get { return false; } } } }
Korth95/rjw
1.4/Source/Modules/Pregnancy/Hediffs/Hediff_SimpleBaby.cs
C#
mit
10,395
using System; namespace rjw { public class RJWAssociatedHediffAttribute : Attribute { public string defName { get; private set; } public RJWAssociatedHediffAttribute(string defName) { this.defName = defName; } } }
Korth95/rjw
1.4/Source/Modules/Pregnancy/Hediffs/RJWAssociatedHediffAttribute.cs
C#
mit
232
using RimWorld; using Verse; using System; using System.Linq; using System.Collections.Generic; using Multiplayer.API; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Extensions; using static rjw.Hediff_BasePregnancy; ///RimWorldChildren pregnancy: //using RimWorldChildren; namespace rjw { /// <summary> /// This handles pregnancy chosing between different types of pregnancy awailable to it /// 1a:RimWorldChildren pregnancy for humanlikes /// 1b:RJW pregnancy for humanlikes /// 2:RJW pregnancy for bestiality /// 3:RJW pregnancy for insects /// 4:RJW pregnancy for mechanoids /// </summary> public static class PregnancyHelper { // TODO: Move this and all HediifDef.Named calls to a proper DefOf class private static HediffDef RJW_IUD = HediffDef.Named("RJW_IUD"); //called by aftersex (including rape, breed, etc) //called by mcevent //pawn - "father"; partner = mother //TODO: this needs rewrite to account receiver group sex (props?) public static void impregnate(SexProps props) { if (RJWSettings.DevMode) ModLog.Message("Rimjobworld::impregnate(" + props.sexType + "):: " + xxx.get_pawnname(props.pawn) + " + " + xxx.get_pawnname(props.partner) + ":"); //"mech" pregnancy if (props.sexType == xxx.rjwSextype.MechImplant) { if (RJWPregnancySettings.mechanoid_pregnancy_enabled && xxx.is_mechanoid(props.pawn)) { // removing old pregnancies var p = GetPregnancies(props.partner); if (!p.NullOrEmpty()) { var i = p.Count; while (i > 0) { i -= 1; var h = GetPregnancies(props.partner); if (h[i] is Hediff_MechanoidPregnancy) { if (RJWSettings.DevMode) ModLog.Message(" already pregnant by mechanoid"); } else if (h[i] is Hediff_BasePregnancy) { if (RJWSettings.DevMode) ModLog.Message(" removing rjw normal pregnancy"); (h[i] as Hediff_BasePregnancy).Kill(); } else { if (RJWSettings.DevMode) ModLog.Message(" removing vanilla or other mod pregnancy"); props.partner.health.RemoveHediff(h[i]); } } } // new pregnancy if (RJWSettings.DevMode) ModLog.Message(" mechanoid pregnancy started"); Hediff_MechanoidPregnancy hediff = Hediff_BasePregnancy.Create<Hediff_MechanoidPregnancy>(props.partner, props.pawn); return; /* // Not an actual pregnancy. This implants mechanoid tech into the target. //may lead to pregnancy //old "chip pregnancies", maybe integrate them somehow? //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); HediffDef_MechImplants egg = (from x in DefDatabase<HediffDef_MechImplants>.AllDefs select x).RandomElement(); if (egg != null) { if (RJWSettings.DevMode) Log.Message(" planting MechImplants:" + egg.ToString()); PlantSomething(egg, partner, !Genital_Helper.has_vagina(partner), 1); return; } else { if (RJWSettings.DevMode) Log.Message(" no mech implant found"); }*/ } return; } //"ovi" pregnancy/egglaying var AnalOk = props.sexType == xxx.rjwSextype.Anal && RJWPregnancySettings.insect_anal_pregnancy_enabled; var OralOk = props.sexType == xxx.rjwSextype.Oral && RJWPregnancySettings.insect_oral_pregnancy_enabled; // Sextype can result in pregnancy. if (!(props.sexType == xxx.rjwSextype.Vaginal || props.sexType == xxx.rjwSextype.DoublePenetration || AnalOk || OralOk)) return; Pawn giver = props.pawn; // orgasmer Pawn receiver = props.partner; List<Hediff> pawnparts = giver.GetGenitalsList(); List<Hediff> partnerparts = receiver.GetGenitalsList(); var interaction = Modules.Interactions.Helpers.InteractionHelper.GetWithExtension(props.dictionaryKey); //ModLog.Message(" RaceImplantEggs()" + pawn.RaceImplantEggs()); //"insect" pregnancy if (CouldBeEgging(props, giver, receiver, pawnparts, partnerparts)) { //TODO: add widget toggle for bind all/neutral/hostile pawns //Initiator/rapist puts victim in cocoon, maybe move it to aftersex? if (!props.isReceiver) if (CanCocoon(giver)) if (giver.HostileTo(receiver) || receiver.IsPrisonerOfColony || receiver.health.hediffSet.HasHediff(xxx.submitting)) if (!receiver.health.hediffSet.HasHediff(HediffDef.Named("RJW_Cocoon"))) { receiver.health.AddHediff(HediffDef.Named("RJW_Cocoon")); } if (RJWSettings.DevMode) ModLog.Message(" 'egg' pregnancy checks"); //see who penetrates who in interaction if (!props.isReceiver && interaction.DominantHasTag(GenitalTag.CanPenetrate)) { if (RJWSettings.DevMode) ModLog.Message(" impregnate(egg) - by initiator"); } else if (props.isReceiver && props.isRevese && interaction.SubmissiveHasTag(GenitalTag.CanPenetrate)) { if (RJWSettings.DevMode) ModLog.Message(" impregnate(egg) - by receiver (reverse)"); } else { if (RJWSettings.DevMode) ModLog.Message(" no valid interaction tags/family"); return; } //implant/fertilise eggs DoEgg(props); return; } if (!(props.sexType == xxx.rjwSextype.Vaginal || props.sexType == xxx.rjwSextype.DoublePenetration)) return; //"normal" and "beastial" pregnancy if (RJWSettings.DevMode) ModLog.Message(" 'normal' pregnancy checks"); //interaction stuff if for handling futa/see who penetrates who in interaction if (!props.isReceiver && interaction.DominantHasTag(GenitalTag.CanPenetrate) && interaction.SubmissiveHasFamily(GenitalFamily.Vagina)) { if (RJWSettings.DevMode) ModLog.Message(" impregnate - by initiator"); } else if (props.isReceiver && props.isRevese && interaction.DominantHasFamily(GenitalFamily.Vagina) && interaction.SubmissiveHasTag(GenitalTag.CanPenetrate)) { if (RJWSettings.DevMode) ModLog.Message(" impregnate - by receiver (reverse)"); } else { if (RJWSettings.DevMode) ModLog.Message(" no valid interaction tags/family"); return; } if (!Modules.Interactions.Helpers.PartHelper.FindParts(giver, GenitalTag.CanFertilize).Any()) { if (RJWSettings.DevMode) ModLog.Message(xxx.get_pawnname(giver) + " has no parts to Fertilize with"); return; } if (!Modules.Interactions.Helpers.PartHelper.FindParts(receiver, GenitalTag.CanBeFertilized).Any()) { if (RJWSettings.DevMode) ModLog.Message(xxx.get_pawnname(receiver) + " has no parts to be Fertilized"); return; } if (CanImpregnate(giver, receiver, props.sexType)) { DoImpregnate(giver, receiver); } } private static bool CouldBeEgging(SexProps props, Pawn giver, Pawn reciever, List<Hediff> pawnparts, List<Hediff> partnerparts) { List<Hediff_InsectEgg> eggs = new(); reciever.health.hediffSet.GetHediffs(ref eggs); //no ovipositor or fertilization possible if ((Genital_Helper.has_ovipositorF(giver, pawnparts) || Genital_Helper.has_ovipositorM(giver, pawnparts) || (Genital_Helper.has_penis_fertile(giver, pawnparts) && (giver.RaceImplantEggs() || eggs.Any())) ) == false) { return false; } if ((props.sexType == xxx.rjwSextype.Vaginal || props.sexType == xxx.rjwSextype.DoublePenetration) && Genital_Helper.has_vagina(reciever, partnerparts)) { return true; } if ((props.sexType == xxx.rjwSextype.Anal || props.sexType == xxx.rjwSextype.DoublePenetration) && Genital_Helper.has_anus(reciever) && RJWPregnancySettings.insect_anal_pregnancy_enabled) { return true; } if (props.sexType == xxx.rjwSextype.Oral && RJWPregnancySettings.insect_oral_pregnancy_enabled) { return true; } return false; } private static bool CanCocoon(Pawn pawn) { return xxx.is_insect(pawn); } /// <summary> /// Gets the pregnancy that is likely to complete first, when there are multiple /// pregnancies, such as from egg implants. /// </summary> /// <param name="pawn">The pawn to inspect.</param> /// <returns>The pregnancy likely to complete first.</returns> public static Hediff GetPregnancy(Pawn pawn) { var allPregnancies = GetPregnancies(pawn); if (allPregnancies.Count == 0) return null; allPregnancies.SortBy((preg) => { (var ticksCompleted, var ticksToBirth) = GetProgressTicks(preg); return ticksToBirth - ticksCompleted; }); return allPregnancies[0]; } /// <summary> /// Gets the gestation progress of a pregnancy. /// </summary> /// <param name="hediff">The pregnancy hediff.</param> /// <returns>The current progress, a value between 0 and 1.</returns> public static float GetProgress(Hediff hediff) => hediff switch { Hediff_BasePregnancy rjwPreg => rjwPreg.GestationProgress, Hediff_Pregnant vanillaPreg => vanillaPreg.GestationProgress, _ => 0f }; /// <summary> /// <para>Gets gestation ticks completed and the total needed for birth. Both /// of these values are approximate, as things like malnutrition can affect /// the gestation rate.</para> /// </summary> /// <param name="hediff">The pregnancy hediff.</param> /// <returns>A tuple of ticks.</returns> public static (int ticksCompleted, int ticksToBirth) GetProgressTicks(Hediff hediff) { if (hediff is Hediff_BasePregnancy rjwPreg) { // RJW pregnancies maintain these numbers internally, so they don't // need to be inferred. var ticksToBirth = rjwPreg.p_end_tick - rjwPreg.p_start_tick; return (rjwPreg.ageTicks, Convert.ToInt32(ticksToBirth)); } else { var progress = GetProgress(hediff); var raceProps = GetGestatingRace(hediff); var ticksToBirth = (int)(raceProps.gestationPeriodDays * GenDate.TicksPerDay); var ticksCompleted = (int)(progress * ticksToBirth); return (ticksCompleted, ticksToBirth); } } /// <summary> /// <para>Gets the race-props that are providing the gestation rate of a pregnancy.</para> /// <para>This may or may not be accurate, depending on how the pregnancy is ultimately /// implemented.</para> /// </summary> /// <param name="hediff">The pregnancy hediff.</param> /// <returns>The properties of the assumed gestating race.</returns> public static RaceProperties GetGestatingRace(Hediff hediff) => hediff switch { // Insect eggs use the implanter, if it is set. Otherwise, the egg is probably // still inside the genetic mother, so we can use the carrier instead. Hediff_InsectEgg eggPreg when eggPreg.implanter is { } implanter => implanter.RaceProps, // Some RJW pregnancies will store the gestating babies; the first pawn in // the list is treated as the gestation source. Hediff_BasePregnancy rjwPreg when rjwPreg.babies is { } babies && babies.Count > 0 => babies[0].RaceProps, // For anything else, assume the carrying pawn is the source. _ => hediff.pawn.RaceProps }; /// <summary> /// Gets all pregnancies of the pawn as a list. This may include both RJW /// and vanilla pregnancies. /// </summary> /// <param name="pawn">The pawn to inspect.</param> /// <returns>A list of pregnancy hediffs.</returns> public static List<Hediff> GetPregnancies(Pawn pawn) => pawn.health.hediffSet.hediffs .Where(x => x is Hediff_BasePregnancy or Hediff_Pregnant) .ToList(); ///<summary>Can get preg with above conditions, do impregnation.</summary> [SyncMethod] public static void DoEgg(SexProps props) { if (RJWPregnancySettings.insect_pregnancy_enabled) { if (RJWSettings.DevMode) ModLog.Message(" insect pregnancy"); //female "insect" plant eggs //futa "insect" 50% plant eggs, 50% fertilize eggs if ((Genital_Helper.has_ovipositorF(props.pawn) && !Genital_Helper.has_penis_fertile(props.pawn)) || (Rand.Value > 0.5f && Genital_Helper.has_ovipositorF(props.pawn))) //penis eggs someday? //(Rand.Value > 0.5f && (Genital_Helper.has_ovipositorF(pawn) || Genital_Helper.has_penis_fertile(pawn) && pawn.RaceImplantEggs()))) { float maxeggssize = (props.partner.BodySize / 5) * (xxx.has_quirk(props.partner, "Incubator") ? 2f : 1f) * (Genital_Helper.has_ovipositorF(props.partner) ? 2f * RJWPregnancySettings.egg_pregnancy_ovipositor_capacity_factor : 1f); float eggedsize = 0; // get implanter eggs List<Hediff_InsectEgg> eggs = new(); props.partner.health.hediffSet.GetHediffs(ref eggs); // check if fertilised eggs/ non generic eggs foreach (Hediff_InsectEgg egg in eggs) { if (egg.father != null) eggedsize += egg.father.RaceProps.baseBodySize / 5 * (egg.def as HediffDef_InsectEgg).eggsize * RJWPregnancySettings.egg_pregnancy_eggs_size; else eggedsize += egg.implanter.RaceProps.baseBodySize / 5 * (egg.def as HediffDef_InsectEgg).eggsize * RJWPregnancySettings.egg_pregnancy_eggs_size; } if (RJWSettings.DevMode) ModLog.Message(" determine " + xxx.get_pawnname(props.partner) + " size of eggs inside: " + eggedsize + ", max: " + maxeggssize); BodyPartRecord targetBodyPart = Genital_Helper.get_genitalsBPR(props.pawn); //Get our genitals Predicate<Hediff> filterByGenitalia = hediff => hediff.Part == targetBodyPart; //make filter props.pawn.health.hediffSet.GetHediffs(ref eggs, filterByGenitalia); //pick only eggs from our genitals (not from anus or stomach) BodyPartRecord partnerGenitals = null; if (props.sexType == xxx.rjwSextype.Anal) partnerGenitals = Genital_Helper.get_anusBPR(props.partner); else if (props.sexType == xxx.rjwSextype.Oral) partnerGenitals = Genital_Helper.get_stomachBPR(props.partner); else if (props.sexType == xxx.rjwSextype.DoublePenetration && Rand.Value > 0.5f && RJWPregnancySettings.insect_anal_pregnancy_enabled) partnerGenitals = Genital_Helper.get_anusBPR(props.partner); else partnerGenitals = Genital_Helper.get_genitalsBPR(props.partner); while (eggs.Any() && eggedsize < maxeggssize) { if (props.sexType == xxx.rjwSextype.Vaginal) { // removing old pregnancies var p = GetPregnancies(props.partner); if (!p.NullOrEmpty()) { var i = p.Count; while (i > 0) { i -= 1; var h = GetPregnancies(props.partner); if (h[i] is Hediff_MechanoidPregnancy) { if (RJWSettings.DevMode) ModLog.Message(" egging - pregnant by mechanoid, skip"); } else if (h[i] is Hediff_BasePregnancy) { if (RJWSettings.DevMode) ModLog.Message(" egging - removing rjw normal pregnancy"); (h[i] as Hediff_BasePregnancy).Kill(); } else { if (RJWSettings.DevMode) ModLog.Message(" egging - removing vanilla or other mod pregnancy"); props.partner.health.RemoveHediff(h[i]); } } } } var egg = eggs.First(); eggs.Remove(egg); props.pawn.health.RemoveHediff(egg); props.partner.health.AddHediff(egg, partnerGenitals); egg.Implanter(props.pawn); eggedsize += egg.eggssize * (egg.def as HediffDef_InsectEgg).eggsize * RJWPregnancySettings.egg_pregnancy_eggs_size; } } //male or futa fertilize eggs else if (!props.pawn.health.hediffSet.HasHediff(xxx.sterilized)) { if (Genital_Helper.has_penis_fertile(props.pawn)) if ((Genital_Helper.has_ovipositorF(props.pawn) || Genital_Helper.has_ovipositorM(props.pawn)) || (props.pawn.health.capacities.GetLevel(xxx.reproduction) > 0)) { List<Hediff_InsectEgg> eggs = new(); props.partner.health.hediffSet.GetHediffs(ref eggs); if (!RJWPregnancySettings.egg_pregnancy_fertOrificeCheck_enabled) { foreach (var egg in eggs) egg.Fertilize(props.pawn); } else { //Gargulecode BodyPartRecord targetBodyPart; if (props.sexType == xxx.rjwSextype.Anal || props.sexType == xxx.rjwSextype.DoublePenetration) targetBodyPart = Genital_Helper.get_anusBPR(props.partner); //Anal? get anus else if (props.sexType == xxx.rjwSextype.Oral) targetBodyPart = Genital_Helper.get_stomachBPR(props.partner); //Oral? get stomach else targetBodyPart = Genital_Helper.get_genitalsBPR(props.partner); //nothing above? get genitals //End Gargulecode foreach (var egg in eggs.Where(x=> x.Part == targetBodyPart)) egg.Fertilize(props.pawn); if (props.sexType == xxx.rjwSextype.DoublePenetration) { targetBodyPart = Genital_Helper.get_genitalsBPR(props.partner); foreach (var egg in eggs.Where(x => x.Part == targetBodyPart)) egg.Fertilize(props.pawn); } } } } return; } } [SyncMethod] public static void DoImpregnate(Pawn pawn, Pawn partner) { if (RJWSettings.DevMode) ModLog.Message(" Doimpregnate " + xxx.get_pawnname(pawn) + " is a father, " + xxx.get_pawnname(partner) + " is a mother"); if (AndroidsCompatibility.IsAndroid(pawn) && !AndroidsCompatibility.AndroidPenisFertility(pawn)) { if (RJWSettings.DevMode) ModLog.Message(" Father is android with no arcotech penis, abort"); return; } if (AndroidsCompatibility.IsAndroid(partner) && !AndroidsCompatibility.AndroidVaginaFertility(partner)) { if (RJWSettings.DevMode) ModLog.Message(" Mother is android with no arcotech vagina, abort"); return; } // fertility check float basePregnancyChance = RJWPregnancySettings.humanlike_impregnation_chance / 100f; if (xxx.is_animal(partner)) basePregnancyChance = RJWPregnancySettings.animal_impregnation_chance / 100f; // Interspecies modifier if (pawn.def.defName != partner.def.defName) { if (RJWPregnancySettings.complex_interspecies) basePregnancyChance *= SexUtility.BodySimilarity(pawn, partner); else basePregnancyChance *= RJWPregnancySettings.interspecies_impregnation_modifier; } else { //Egg fertility check CompEggLayer compEggLayer = partner.TryGetComp<CompEggLayer>(); if (compEggLayer != null) basePregnancyChance = 1.0f; } //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); float fertility = Math.Min(pawn.health.capacities.GetLevel(xxx.reproduction), partner.health.capacities.GetLevel(xxx.reproduction)); if (partner.health.hediffSet.HasHediff(RJW_IUD)) { fertility /= 99f; } float pregnancyChance = basePregnancyChance * fertility; if (!Rand.Chance(pregnancyChance)) { if (RJWSettings.DevMode) ModLog.Message(" Impregnation failed. Chance: " + pregnancyChance.ToStringPercent()); return; } if (RJWSettings.DevMode) ModLog.Message(" Impregnation succeeded. Chance: " + pregnancyChance.ToStringPercent()); AddPregnancyHediff(partner, pawn); } ///<summary>For checking normal pregnancy, should not for egg implantion or such.</summary> public static bool CanImpregnate(Pawn fucker, Pawn fucked, xxx.rjwSextype sexType = xxx.rjwSextype.Vaginal) { if (fucker == null || fucked == null) return false; if (RJWSettings.DevMode) ModLog.Message("Rimjobworld::CanImpregnate checks (" + sexType + "):: " + xxx.get_pawnname(fucker) + " + " + xxx.get_pawnname(fucked) + ":"); if (sexType == xxx.rjwSextype.MechImplant && !RJWPregnancySettings.mechanoid_pregnancy_enabled) { if (RJWSettings.DevMode) ModLog.Message(" mechanoid 'pregnancy' disabled"); return false; } if (!(sexType == xxx.rjwSextype.Vaginal || sexType == xxx.rjwSextype.DoublePenetration)) { if (RJWSettings.DevMode) ModLog.Message(" sextype cannot result in pregnancy"); return false; } if (AndroidsCompatibility.IsAndroid(fucker) && AndroidsCompatibility.IsAndroid(fucked)) { if (RJWSettings.DevMode) ModLog.Message(xxx.get_pawnname(fucked) + " androids cant breed/reproduce androids"); return false; } if ((fucker.IsUnsexyRobot() || fucked.IsUnsexyRobot()) && !(sexType == xxx.rjwSextype.MechImplant)) { if (RJWSettings.DevMode) ModLog.Message(" unsexy robot cant be pregnant"); return false; } if (!fucker.RaceHasPregnancy()) { if (RJWSettings.DevMode) ModLog.Message(xxx.get_pawnname(fucked) + " filtered race that cant be pregnant"); return false; } if (!fucked.RaceHasPregnancy()) { if (RJWSettings.DevMode) ModLog.Message(xxx.get_pawnname(fucker) + " filtered race that cant impregnate"); return false; } if (fucked.IsPregnant()) { if (RJWSettings.DevMode) ModLog.Message(" already pregnant."); return false; } List<Hediff_InsectEgg> eggs = new(); fucked.health.hediffSet.GetHediffs(ref eggs); if ((from x in eggs where x.def == DefDatabase<HediffDef_InsectEgg>.GetNamed(x.def.defName) select x).Any()) { if (RJWSettings.DevMode) ModLog.Message(xxx.get_pawnname(fucked) + " cant get pregnant while eggs inside"); return false; } var pawnparts = fucker.GetGenitalsList(); var partnerparts = fucked.GetGenitalsList(); if (!(Genital_Helper.has_penis_fertile(fucker, pawnparts) && Genital_Helper.has_vagina(fucked, partnerparts)) && !(Genital_Helper.has_penis_fertile(fucked, partnerparts) && Genital_Helper.has_vagina(fucker, pawnparts))) { if (RJWSettings.DevMode) ModLog.Message(" missing genitals for impregnation"); return false; } if (fucker.health.capacities.GetLevel(xxx.reproduction) <= 0 || fucked.health.capacities.GetLevel(xxx.reproduction) <= 0) { if (RJWSettings.DevMode) ModLog.Message(" one (or both) pawn(s) infertile"); return false; } if (xxx.is_human(fucked) && xxx.is_human(fucker) && (RJWPregnancySettings.humanlike_impregnation_chance == 0 || !RJWPregnancySettings.humanlike_pregnancy_enabled)) { if (RJWSettings.DevMode) ModLog.Message(" human pregnancy chance set to 0% or pregnancy disabled."); return false; } else if (((xxx.is_animal(fucker) && xxx.is_human(fucked)) || (xxx.is_human(fucker) && xxx.is_animal(fucked))) && !RJWPregnancySettings.bestial_pregnancy_enabled) { if (RJWSettings.DevMode) ModLog.Message(" bestiality pregnancy chance set to 0% or pregnancy disabled."); return false; } else if (xxx.is_animal(fucked) && xxx.is_animal(fucker) && (RJWPregnancySettings.animal_impregnation_chance == 0 || !RJWPregnancySettings.animal_pregnancy_enabled)) { if (RJWSettings.DevMode) ModLog.Message(" animal-animal pregnancy chance set to 0% or pregnancy disabled."); return false; } else if (fucker.def.defName != fucked.def.defName && (RJWPregnancySettings.interspecies_impregnation_modifier <= 0.0f && !RJWPregnancySettings.complex_interspecies)) { if (RJWSettings.DevMode) ModLog.Message(" interspecies pregnancy disabled."); return false; } if (!(fucked.RaceProps.gestationPeriodDays > 0)) { CompEggLayer compEggLayer = fucked.TryGetComp<CompEggLayer>(); if (compEggLayer == null) { if (RJWSettings.DevMode) ModLog.Message(xxx.get_pawnname(fucked) + " mother.RaceProps.gestationPeriodDays is " + fucked.RaceProps.gestationPeriodDays + " cant impregnate"); return false; } } return true; } //Plant babies for human/bestiality pregnancy public static void AddPregnancyHediff(Pawn mother, Pawn father) { //human-human if (RJWPregnancySettings.humanlike_pregnancy_enabled && xxx.is_human(mother) && xxx.is_human(father)) { CompEggLayer compEggLayer = mother.TryGetComp<CompEggLayer>(); if (compEggLayer != null) { // fertilize eggs of humanlikes ?! if (!compEggLayer.FullyFertilized) { compEggLayer.Fertilize(father); //if (!mother.kindDef.defName.Contains("Chicken")) // if (compEggLayer.Props.eggFertilizedDef.defName.Contains("RJW")) } } else { if (RJWPregnancySettings.UseVanillaPregnancy) { // vanilla 1.4 human pregnancy hediff ModLog.Message("preg hediffdefof PregnantHuman " + HediffDefOf.PregnantHuman); StartVanillaPregnancy(mother, father); } else { // use RJW hediff Hediff_BasePregnancy.Create<Hediff_HumanlikePregnancy>(mother, father); } } } //human-animal //maybe make separate option for human males vs female animals??? else if (RJWPregnancySettings.bestial_pregnancy_enabled && (xxx.is_human(mother) ^ xxx.is_human(father))) { CompEggLayer compEggLayer = mother.TryGetComp<CompEggLayer>(); if (compEggLayer != null) { if (!compEggLayer.FullyFertilized) compEggLayer.Fertilize(father); } else { DnaGivingParent dnaGivingParent = Hediff_BasePregnancy.SelectDnaGivingParent(mother, father); if (RJWPregnancySettings.UseVanillaPregnancy && xxx.is_human(mother) && dnaGivingParent == DnaGivingParent.Mother) { // vanilla 1.4 human pregnancy hediff ModLog.Message("preg hediffdefof PregnantHuman " + HediffDefOf.PregnantHuman); StartVanillaPregnancy(mother, father); } else { Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father, dnaGivingParent); } } } //animal-animal else if (xxx.is_animal(mother) && xxx.is_animal(father)) { CompEggLayer compEggLayer = mother.TryGetComp<CompEggLayer>(); if (compEggLayer != null) { // fertilize eggs of same species if (!compEggLayer.FullyFertilized) if (mother.kindDef == father.kindDef) compEggLayer.Fertilize(father); } else if (RJWPregnancySettings.animal_pregnancy_enabled) { Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father); } } } public static void StartVanillaPregnancy(Pawn mother, Pawn father, Pawn geneticMother = null, HediffDef def = null) { def ??= HediffDefOf.PregnantHuman; Hediff_Pregnant pregnancy = (Hediff_Pregnant) HediffMaker.MakeHediff(def, mother); pregnancy.SetParents(geneticMother, father, PregnancyUtility.GetInheritedGeneSet(father, mother)); mother.health.AddHediff(pregnancy); } //Plant Insect eggs/mech chips/other preg mod hediff? public static bool PlantSomething(HediffDef def, Pawn target, bool isToAnal = false, int amount = 1) { if (def == null) return false; if (!isToAnal && !Genital_Helper.has_vagina(target)) return false; if (isToAnal && !Genital_Helper.has_anus(target)) return false; BodyPartRecord Part = (isToAnal) ? Genital_Helper.get_anusBPR(target) : Genital_Helper.get_genitalsBPR(target); if (Part != null || Part.parts.Count != 0) { //killoff normal preg if (!isToAnal) { if (RJWSettings.DevMode) ModLog.Message(" removing other pregnancies"); var p = GetPregnancies(target); if (!p.NullOrEmpty()) { foreach (var x in p) { if (x is Hediff_BasePregnancy) { var preg = x as Hediff_BasePregnancy; preg.Kill(); } else { target.health.RemoveHediff(x); } } } } for (int i = 0; i < amount; i++) { if (RJWSettings.DevMode) ModLog.Message(" planting something weird"); target.health.AddHediff(def, Part); } return true; } return false; } /// <summary> /// Remove CnP Pregnancy, that is added without passing rjw checks /// </summary> public static void cleanup_CnP(Pawn pawn) { //They do subpar probability checks and disrespect our settings, but I fail to just prevent their doloving override. //probably needs harmonypatch //So I remove the hediff if it is created and recreate it if needed in our handler later if (RJWSettings.DevMode) ModLog.Message(" cleanup_CnP after love check"); var h = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("HumanPregnancy")); if (h != null && h.ageTicks < 100) { pawn.health.RemoveHediff(h); if (RJWSettings.DevMode) ModLog.Message(" removed hediff from " + xxx.get_pawnname(pawn)); } } /// <summary> /// Remove Vanilla Pregnancy /// </summary> public static void cleanup_vanilla(Pawn pawn) { if (RJWSettings.DevMode) ModLog.Message(" cleanup_vanilla after love check"); var h = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Pregnant); if (h != null && h.ageTicks < 100) { pawn.health.RemoveHediff(h); if (RJWSettings.DevMode) ModLog.Message(" removed hediff from " + xxx.get_pawnname(pawn)); } } /// <summary> /// Below is stuff for RimWorldChildren /// its not used, we rely only on our own pregnancies /// </summary> /// <summary> /// This function tries to call Children and pregnancy utilities to see if that mod could handle the pregnancy /// </summary> /// <returns>true if cnp pregnancy will work, false if rjw one should be used instead</returns> public static bool CnP_WillAccept(Pawn mother) { //if (!xxx.RimWorldChildrenIsActive) return false; //return RimWorldChildren.ChildrenUtility.RaceUsesChildren(mother); } /// <summary> /// This funtcion tries to call Children and Pregnancy to create humanlike pregnancy implemented by the said mod. /// </summary> public static void CnP_DoPreg(Pawn mother, Pawn father) { if (!xxx.RimWorldChildrenIsActive) return; //RimWorldChildren.Hediff_HumanPregnancy.Create(mother, father); } } }
Korth95/rjw
1.4/Source/Modules/Pregnancy/Pregnancy_Helper.cs
C#
mit
29,372
using RimWorld; using System; using System.Linq; using Verse; using System.Collections.Generic; namespace rjw { public class Recipe_Abortion : Recipe_RemoveHediff { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) { BodyPartRecord part = pawn.RaceProps.body.corePart; if (recipe.appliedOnFixedBodyParts[0] != null) part = pawn.RaceProps.body.AllParts.Find(x => x.def == recipe.appliedOnFixedBodyParts[0]); if (part != null) { bool isMatch = Hediff_BasePregnancy.KnownPregnancies() // For every known pregnancy .Where(x => pawn.health.hediffSet.HasHediff(HediffDef.Named(x), true) && recipe.removesHediff == HediffDef.Named(x)) // Find matching bodyparts .Select(x => (Hediff_BasePregnancy)pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named(x))) // get pregnancy hediff .Where(pregnancy => pregnancy.is_discovered && (!pregnancy.is_checked || !(pregnancy is Hediff_MechanoidPregnancy))) // Find visible pregnancies or unchecked mech .Any(); // return true if found something if (isMatch) { yield return part; } } } public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill) { foreach (Hediff x in pawn.health.hediffSet.hediffs.Where(x => x is Hediff_MechanoidPregnancy)) { (x as Hediff_MechanoidPregnancy).GiveBirth(); return; } base.ApplyOnPawn(pawn, part, billDoer, ingredients, bill); } } public class Recipe_PregnancyAbortMech : Recipe_Abortion { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) { BodyPartRecord part = pawn.RaceProps.body.corePart; if (recipe.appliedOnFixedBodyParts[0] != null) part = pawn.RaceProps.body.AllParts.Find(x => x.def == recipe.appliedOnFixedBodyParts[0]); if (part != null) { bool isMatch = Hediff_BasePregnancy.KnownPregnancies() // For every known pregnancy .Where(x => pawn.health.hediffSet.HasHediff(HediffDef.Named(x), true) && recipe.removesHediff == HediffDef.Named(x)) // Find matching bodyparts .Select(x => (Hediff_BasePregnancy)pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named(x))) // get pregnancy hediff .Where(pregnancy => pregnancy.is_checked && pregnancy is Hediff_MechanoidPregnancy) // Find checked/visible pregnancies .Any(); // return true if found something if (isMatch) { yield return part; } } } } }
Korth95/rjw
1.4/Source/Modules/Pregnancy/Recipes/Recipe_Abortion.cs
C#
mit
2,492
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_ClaimChild : RecipeWorker { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) { if (pawn != null)//I have no idea how it works but Recipe_ShutDown : RecipeWorker does not return values when not applicable { //Log.Message("RJW Claim child check on " + pawn); if (xxx.is_human(pawn) && !pawn.IsColonist) { if ( (pawn.ageTracker.CurLifeStageIndex < 2))//Guess it is hardcoded for now to `baby` and `toddler` of standard 4 stages of human life { BodyPartRecord brain = pawn.health.hediffSet.GetBrain(); if (brain != null) { //Log.Message("RJW Claim child is applicable"); yield return brain; } } } } } public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill) { if (pawn == null) { ModLog.Error("Error applying medical recipe, pawn is null"); return; } pawn.SetFaction(Faction.OfPlayer); //we could do //pawn.SetFaction(billDoer.Faction); //but that is useless because GetPartsToApplyOn does not support factions anyway and all recipes are hardcoded to player. } } }
Korth95/rjw
1.4/Source/Modules/Pregnancy/Recipes/Recipe_ClaimChild.cs
C#
mit
1,289
using RimWorld; using System; using System.Linq; using Verse; using System.Collections.Generic; namespace rjw { public class Recipe_DeterminePregnancy : RecipeWorker { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) { /* Males can be impregnated by mechanoids, probably if (!xxx.is_female(pawn)) { yield break; } */ BodyPartRecord part = pawn.RaceProps.body.corePart; if (recipe.appliedOnFixedBodyParts[0] != null) part = pawn.RaceProps.body.AllParts.Find(x => x.def == recipe.appliedOnFixedBodyParts[0]); if (part != null && (pawn.ageTracker.CurLifeStage.reproductive) || pawn.IsPregnant(true)) { yield return part; } } public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill) { var p = PregnancyHelper.GetPregnancies(pawn); if (p.NullOrEmpty()) { Messages.Message(xxx.get_pawnname(billDoer) + " has determined " + xxx.get_pawnname(pawn) + " is not pregnant.", MessageTypeDefOf.NeutralEvent); return; } foreach (var x in p) { if (x is Hediff_BasePregnancy) { var preg = x as Hediff_BasePregnancy; preg.CheckPregnancy(); } } } } public class Recipe_DeterminePaternity : RecipeWorker { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) { BodyPartRecord part = pawn.RaceProps.body.corePart; if (recipe.appliedOnFixedBodyParts[0] != null) part = pawn.RaceProps.body.AllParts.Find(x => x.def == recipe.appliedOnFixedBodyParts[0]); if (part != null && pawn.IsPregnant(true)) { yield return part; } } public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill) { var p = PregnancyHelper.GetPregnancies(pawn); if (p.NullOrEmpty()) { Messages.Message(xxx.get_pawnname(billDoer) + " has determined " + xxx.get_pawnname(pawn) + " is not pregnant.", MessageTypeDefOf.NeutralEvent); return; } foreach (var x in p) { if (x is Hediff_BasePregnancy) { var preg = x as Hediff_BasePregnancy; Messages.Message(xxx.get_pawnname(billDoer) + " has determined " + xxx.get_pawnname(pawn) + " is pregnant and " + preg.father + " is the father.", MessageTypeDefOf.NeutralEvent); preg.CheckPregnancy(); preg.is_parent_known = true; } } } } }
Korth95/rjw
1.4/Source/Modules/Pregnancy/Recipes/Recipe_DeterminePregnancy.cs
C#
mit
2,435
using System.Collections.Generic; using System.Linq; using Verse; namespace rjw { /// <summary> /// IUD - prevent pregnancy /// </summary> public class Recipe_InstallIUD : Recipe_InstallImplantToExistParts { public override bool AvailableOnNow(Thing thing, BodyPartRecord part = null) { if (RJWPregnancySettings.UseVanillaPregnancy) { return false; } return base.AvailableOnNow(thing, part); } // Let's comment it out. What's the worst that could happen? // public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) // { // if (!xxx.is_female(pawn)) // { // return Enumerable.Empty<BodyPartRecord>(); // } // return base.GetPartsToApplyOn(pawn, recipe); // } } }
Korth95/rjw
1.4/Source/Modules/Pregnancy/Recipes/Recipe_InstallIUD.cs
C#
mit
753
using RimWorld; using System; using Verse; using System.Collections.Generic; namespace rjw { public class Recipe_PregnancyHackMech : RecipeWorker { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) { BodyPartRecord part = pawn.RaceProps.body.corePart; if (recipe.appliedOnFixedBodyParts[0] != null) part = pawn.RaceProps.body.AllParts.Find(x => x.def == recipe.appliedOnFixedBodyParts[0]); if (part != null && pawn.health.hediffSet.HasHediff(HediffDef.Named("RJW_pregnancy_mech"), part, true)) { Hediff_MechanoidPregnancy pregnancy = (Hediff_MechanoidPregnancy)pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("RJW_pregnancy_mech")); //Log.Message("RJW_pregnancy_mech hack check: " + pregnancy.is_checked); if (pregnancy.is_checked && !pregnancy.is_hacked) yield return part; } } public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill) { if (pawn.health.hediffSet.HasHediff(HediffDef.Named("RJW_pregnancy_mech"))) { Hediff_MechanoidPregnancy pregnancy = (Hediff_MechanoidPregnancy)pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("RJW_pregnancy_mech")); pregnancy.Hack(); } } } }
Korth95/rjw
1.4/Source/Modules/Pregnancy/Recipes/Recipe_PregnancyHackMech.cs
C#
mit
1,273
using RimWorld; using System.Collections.Generic; using System.Linq; using Verse; namespace rjw { /// <summary> /// Sterilization /// </summary> public class Recipe_InstallImplantToExistParts : Recipe_InstallImplant { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) { bool blocked = Genital_Helper.genitals_blocked(pawn) || xxx.is_slime(pawn); if (!blocked) foreach (BodyPartRecord record in pawn.RaceProps.body.AllParts.Where(x => recipe.appliedOnFixedBodyParts.Contains(x.def))) { if (!pawn.health.hediffSet.hediffs.Any((Hediff x) => x.def == recipe.addsHediff)) { yield return record; } } } } }
Korth95/rjw
1.4/Source/Modules/Pregnancy/Recipes/Recipe_Sterilize.cs
C#
mit
697
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Quirks { public interface IQuirkService { bool HasQuirk(Pawn pawn, string quirk); } }
Korth95/rjw
1.4/Source/Modules/Quirks/IQuirkService.cs
C#
mit
246
using rjw.Modules.Quirks; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Quirks.Implementation { public class QuirkService : IQuirkService { public static IQuirkService Instance { get; private set; } static QuirkService() { Instance = new QuirkService(); } private QuirkService() { } public bool HasQuirk(Pawn pawn, string quirk) { //No paw ! hum ... I meant pawn ! if (pawn == null) { return false; } //No quirk ! if (string.IsNullOrWhiteSpace(quirk)) { return false; } string loweredQuirk = quirk.ToLower(); string pawnQuirks = CompRJW.Comp(pawn).quirks .ToString() .ToLower(); return pawnQuirks.Contains(loweredQuirk); } } }
Korth95/rjw
1.4/Source/Modules/Quirks/Implementation/QuirkService.cs
C#
mit
814
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Quirks { public static class Quirks { public const string Podophile = "Podophile"; public const string Impregnation = "Impregnation fetish"; } }
Korth95/rjw
1.4/Source/Modules/Quirks/Quirks.cs
C#
mit
294
using Verse; namespace rjw.Modules.Rand { /// <summary> /// <para>When used with a `using` statement, creates a seeded RNG context.</para> /// <para>Once the block is exited, the original RNG state is restored.</para> /// <example> /// <para>How to create a seeded context:</para> /// <code> /// // Pull in the `Seeded` type at the top of the C# file. /// using Seeded = rjw.Modules.Rand.Seeded; /// /// string RandomYepNah(Pawn pawn) /// { /// // Put it in a `using` with a new seed or a good seed source (like this /// // pawn here), and then do your random stuff inside. There's no need to /// // bind it to a variable. /// using (Seeded.With(pawn)) /// { /// var someChance = Verse.Rand.Chance(0.5f); /// return someChance ? "Yep!" : "Nah..."; /// } /// } /// </code> /// <para>When the block is exited, the ref-struct is disposed, which pops the /// RNG state for you. It even does this if there's an exception thrown in the /// using block, so the RNG state won't be borked.</para> /// <para>It should be safe to layer multiple RNG contexts. They should pop /// in the correct order.</para> /// </example> /// </summary> public readonly ref struct Seeded { public readonly int seed; private Seeded(int replacementSeed) { seed = replacementSeed; Verse.Rand.PushState(replacementSeed); } public void Dispose() { Verse.Rand.PopState(); } /// <summary> /// <para>When used with a `using` statement, creates an isolated RNG context.</para> /// <para>Once the block is exited, the original RNG state is restored.</para> /// <para>This version will use the given seed.</para> /// </summary> /// <param name="replacementSeed">The seed to use.</param> /// <returns>An RNG context.</returns> public static Seeded With(int replacementSeed) => new(replacementSeed); /// <summary> /// <para>When used with a `using` statement, creates an isolated RNG context.</para> /// <para>Once the block is exited, the original RNG state is restored.</para> /// <para>This version will use a seed based on the thing's ID and so the /// randomness will be reproducible for that thing each time the block is /// entered. As long as you always do the same operations, it will always /// produce the same RNG.</para> /// </summary> /// <param name="thing">The thing to use as a seed source.</param> /// <returns>An RNG context.</returns> public static Seeded With(Thing thing) => new(thing.HashOffset()); /// <summary> /// <para>When used with a `using` statement, creates an isolated RNG context.</para> /// <para>Once the block is exited, the original RNG state is restored.</para> /// <para>This is similar to <see cref="With"/>, but it will use a special seed /// associated with the given thing that will be stable for the current in-game /// hour.</para> /// <para>You can get the seed from the context's struct, if needed. Just /// assign the context to a variable.</para> /// </summary> /// <param name="thing">The thing to use as a seed source.</param> /// <param name="salt">Salt that can be added to munge the seed further.</param> /// <returns>An RNG context.</returns> public static Seeded ForHour(Thing thing, int salt = 42) => new(Verse.Rand.RandSeedForHour(thing, salt)); /// <summary> /// <para>When used with a `using` statement, creates an isolated RNG context.</para> /// <para>Once the block is exited, the original RNG state is restored.</para> /// <para>This is similar to <see cref="With"/>, but it will use a random seed /// based on the last RNG state. This should be stable for multiplayer.</para> /// <para>You can get the seed from the context's struct, if needed. Just /// assign the context to a variable.</para> /// </summary> /// <returns>An RNG context.</returns> public static Seeded Randomly() => new(Verse.Rand.Int); } }
Korth95/rjw
1.4/Source/Modules/Rand/SeededContext.cs
C#
mit
3,923
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Shared.Comparers { public class StringComparer_IgnoreCase : IEqualityComparer<string> { public bool Equals(string x, string y) { return String.Equals(x, y, StringComparison.InvariantCultureIgnoreCase); } public int GetHashCode(string obj) { if (obj == null) { return 0; } return obj.GetHashCode(); } } }
Korth95/rjw
1.4/Source/Modules/Shared/Comparers/StringComparer_IgnoreCase.cs
C#
mit
482
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Shared.Enums { public enum PawnState { Healthy, Downed, Unconscious, Dead } }
Korth95/rjw
1.4/Source/Modules/Shared/Enums/PawnState.cs
C#
mit
231
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Shared.Extensions { public static class BodyPartRecordExtension { public static bool IsMissingForPawn(this BodyPartRecord self, Pawn pawn) { if (pawn == null) { throw new ArgumentNullException(nameof(pawn)); } if (self == null) { throw new ArgumentNullException(nameof(self)); } return pawn.health.hediffSet.hediffs .Where(hediff => hediff.Part == self) .Where(hediff => hediff is Hediff_MissingPart) .Any(); } } }
Korth95/rjw
1.4/Source/Modules/Shared/Extensions/BodyPartRecordExtension.cs
C#
mit
621
using System; using Verse; namespace rjw.Modules.Shared.Extensions { public static class PawnExtensions { public static string GetName(this Pawn pawn) { if (pawn == null) { return "null"; } if (String.IsNullOrWhiteSpace(pawn.Name?.ToStringFull) == false) { return pawn.Name.ToStringFull; } return pawn.def.defName; } } }
Korth95/rjw
1.4/Source/Modules/Shared/Extensions/PawnExtensions.cs
C#
mit
365
using System; using UnityEngine; using Verse; namespace rjw.Modules.Shared.Helpers { public static class AgeHelper { public const int ImmortalRaceAgeClamp = 25; public const int NonHumanRaceAgeClamp = 25; public static int ScaleToHumanAge(Pawn pawn, int humanLifespan = 80) { float pawnAge = pawn.ageTracker.AgeBiologicalYearsFloat; if (pawn.def.defName == "Human") return (int)pawnAge; // Human, no need to scale anything. float lifeExpectancy = pawn.RaceProps.lifeExpectancy; if (RJWSettings.UseAdvancedAgeScaling == true) { //pseudo-immortal & immortal races if (lifeExpectancy >= 500) { return CalculateForImmortals(pawn, humanLifespan); } if (lifeExpectancy != humanLifespan) { //other races return CalculateForNonHuman(pawn, humanLifespan); } } float ageScaling = humanLifespan / lifeExpectancy; float scaledAge = pawnAge * ageScaling; return (int)Mathf.Max(scaledAge, 1); } private static int CalculateForImmortals(Pawn pawn, int humanLifespan) { float age = pawn.ageTracker.AgeBiologicalYearsFloat; float lifeExpectancy = pawn.RaceProps.lifeExpectancy; float growth = pawn.ageTracker.Growth; //Growth and hacks { growth = ImmortalGrowthHacks(pawn, age, growth); if (growth < 1) { return (int)Mathf.Lerp(0, ImmortalRaceAgeClamp, growth); } } //curve { float life = age / lifeExpectancy; //Hypothesis : very long living races looks "young" until the end of their lifespan if (life < 0.9f) { return ImmortalRaceAgeClamp; } return (int)Mathf.LerpUnclamped(ImmortalRaceAgeClamp, humanLifespan, Mathf.InverseLerp(0.9f, 1, life)); } } private static float ImmortalGrowthHacks(Pawn pawn, float age, float originalGrowth) { if (pawn.ageTracker.CurLifeStage.reproductive == false) { //Hopefully, reproductive life stage will mean that we're dealing with an adult return Math.Min(1, age / ImmortalRaceAgeClamp); } return 1; } private static int CalculateForNonHuman(Pawn pawn, int humanLifespan) { float age = pawn.ageTracker.AgeBiologicalYearsFloat; float lifeExpectancy = pawn.RaceProps.lifeExpectancy; float growth = pawn.ageTracker.Growth; //Growth and hacks { growth = NonHumanGrowthHacks(pawn, age, growth); if (growth < 1) { return (int)Mathf.Lerp(0, NonHumanRaceAgeClamp, growth); } } //curve { float life = age / lifeExpectancy; return (int)Mathf.LerpUnclamped(NonHumanRaceAgeClamp, humanLifespan, life); } } private static float NonHumanGrowthHacks(Pawn pawn, float age, float originalGrowth) { if (pawn.ageTracker.CurLifeStage.reproductive == false) { //Hopefully, reproductive life stage will mean that we're dealing with an adult return Math.Min(1, age / NonHumanRaceAgeClamp); } return 1; } } }
Korth95/rjw
1.4/Source/Modules/Shared/Helpers/AgeHelper.cs
C#
mit
2,914
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Shared.Helpers { public static class RandomHelper { private static Random _random; static RandomHelper() { _random = new Random(); } /// <remarks>this is not foolproof</remarks> public static TType WeightedRandom<TType>(IList<Weighted<TType>> weights) { if (weights == null || weights.Any() == false || weights.Where(e => e.Weight < 0).Any()) { return default(TType); } Weighted<TType> result; if (weights.TryRandomElementByWeight(e => e.Weight, out result) == true) { return result.Element; } return weights.RandomElement().Element; } } }
Korth95/rjw
1.4/Source/Modules/Shared/Helpers/RandomHelper.cs
C#
mit
754
using rjw.Modules.Shared.Enums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Shared { public interface IPawnStateService { PawnState Detect(Pawn pawn); } }
Korth95/rjw
1.4/Source/Modules/Shared/IPawnStateService.cs
C#
mit
271
using rjw.Modules.Shared.Enums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Shared.Implementation { public class PawnStateService : IPawnStateService { public static IPawnStateService Instance { get; private set; } static PawnStateService() { Instance = new PawnStateService(); } public PawnState Detect(Pawn pawn) { if (pawn.Dead) { return PawnState.Dead; } if (pawn.Downed) { if (pawn.health.capacities.CanBeAwake == false) { return PawnState.Unconscious; } return PawnState.Downed; } return PawnState.Healthy; } } }
Korth95/rjw
1.4/Source/Modules/Shared/Implementation/PawnStateService.cs
C#
mit
701
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Shared.Logs { public interface ILog { void Debug(string message); void Debug(string message, Exception e); void Message(string message); void Message(string message, Exception e); void Warning(string message); void Warning(string message, Exception e); void Error(string message); void Error(string message, Exception e); } }
Korth95/rjw
1.4/Source/Modules/Shared/Logs/ILog.cs
C#
mit
487
namespace rjw.Modules.Shared.Logs { public interface ILogProvider { bool IsActive { get; } } }
Korth95/rjw
1.4/Source/Modules/Shared/Logs/ILogProvider.cs
C#
mit
103
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Shared.Logs { public static class LogManager { private class Logger : ILog { private readonly string _loggerTypeName; private readonly ILogProvider _logProvider; public Logger(string typeName) { _loggerTypeName = typeName; } public Logger(string typeName, ILogProvider logProvider) { _loggerTypeName = typeName; _logProvider = logProvider; } public void Debug(string message) { LogDebug(CreateLogMessage(message)); } public void Debug(string message, Exception exception) { LogDebug(CreateLogMessage(message, exception)); } public void Message(string message) { LogMessage(CreateLogMessage(message)); } public void Message(string message, Exception exception) { LogMessage(CreateLogMessage(message, exception)); } public void Warning(string message) { LogWarning(CreateLogMessage(message)); } public void Warning(string message, Exception exception) { LogWarning(CreateLogMessage(message, exception)); } public void Error(string message) { LogError(CreateLogMessage(message)); } public void Error(string message, Exception exception) { LogError(CreateLogMessage(message, exception)); } private string CreateLogMessage(string message) { return $"[{_loggerTypeName}] {message}"; } private string CreateLogMessage(string message, Exception exception) { return $"{CreateLogMessage(message)}{Environment.NewLine}{exception}"; } private void LogDebug(string message) { if (_logProvider?.IsActive != false && RJWSettings.DevMode == true) { ModLog.Message(message); } } private void LogMessage(string message) { if (_logProvider?.IsActive != false) { ModLog.Message(message); } } private void LogWarning(string message) { if (_logProvider?.IsActive != false) { ModLog.Warning(message); } } private void LogError(string message) { if (_logProvider?.IsActive != false) { ModLog.Error(message); } } } public static ILog GetLogger<TType, TLogProvider>() where TLogProvider : ILogProvider, new() { return new Logger(typeof(TType).Name, new TLogProvider()); } public static ILog GetLogger<TType>() { return new Logger(typeof(TType).Name); } public static ILog GetLogger(string staticTypeName) { return new Logger(staticTypeName); } } }
Korth95/rjw
1.4/Source/Modules/Shared/Logs/LogManager.cs
C#
mit
2,582
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Shared { public static class Multipliers { public const float Never = 0f; public const float AlmostNever = 0.1f; public const float VeryRare = 0.2f; public const float Rare = 0.5f; public const float Uncommon = 0.8f; public const float Average = 1.0f; public const float Common = 1.2f; public const float Frequent = 1.5f; public const float VeryFrequent = 1.8f; public const float Doubled = 2.0f; public const float DoubledPlus = 2.5f; } }
Korth95/rjw
1.4/Source/Modules/Shared/Multipliers.cs
C#
mit
612
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Shared { public class Weighted<TType> { public TType Element { get; set; } public float Weight { get; set; } public Weighted(float weight, TType element) { Weight = weight; Element = element; } } }
Korth95/rjw
1.4/Source/Modules/Shared/Weighted.cs
C#
mit
360
#nullable enable using System.Linq; using Verse; using rjw.Modules.Shared.Logs; using rjw.Modules.Interactions.DefModExtensions; using static rjw.Genital_Helper; using Sex = rjw.GenderHelper.Sex; using Seeded = rjw.Modules.Rand.Seeded; namespace rjw.Modules.Testing { static class TestHelper { static readonly ILog Log = LogManager.GetLogger("TestHelper"); /// <summary> /// Adds some default options to this request that are desireable for testing. /// </summary> /// <param name="request">The request to modify.</param> /// <returns>The modified request.</returns> public static PawnGenerationRequest RequestDefaults(this PawnGenerationRequest request) => request with { CanGeneratePawnRelations = false, ForceNoIdeo = true, ForceGenerateNewPawn = true }; /// <summary> /// <para>Generates a natural pawn using the given request and a fixed seed.</para> /// <para>If there was an issue generating the pawn, it will return null.</para> /// </summary> /// <param name="request">The pawn request.</param> /// <returns>The generated pawn or null.</returns> public static Pawn? GenerateSeededPawn(PawnGenerationRequest request) { using (Seeded.With(42)) { var tries = 5; while (tries >= 0) { var pawn = PawnGenerator.GeneratePawn(request); // Keep generating until we get a "natural" pawn. We want to // control when futas and traps happen. switch (GenderHelper.GetSex(pawn)) { case Sex.male when pawn.gender == Gender.Male: case Sex.female when pawn.gender == Gender.Female: case Sex.none when pawn.gender == Gender.None: return pawn; } tries -= 1; } Log.Error($"Could not generate test pawn for: {request.KindDef.defName}"); return null; } } /// <summary> /// Tries to replace a sex-part of the given pawn using a recipe. /// </summary> /// <param name="pawn">The pawn to change.</param> /// <param name="recipe">The recipe to apply.</param> /// <returns>Whether the part was applied successfully.</returns> public static bool ApplyPartToPawn(Pawn pawn, RecipeDef recipe) { var worker = recipe.Worker; var hediffDef = recipe.addsHediff; if (!GenitalPartExtension.TryGet(hediffDef, out var ext)) return false; // They must have the correct body part for this sex part. var bpr = worker.GetPartsToApplyOn(pawn, recipe).FirstOrDefault(); if (bpr is null) return false; var curParts = get_AllPartsHediffList(pawn) .Where((hed) => GenitalPartExtension.TryGet(hed, out var e) && e.family == ext.family) .ToArray(); // We're replacing natural with artifical. if (curParts.Length == 0) return false; foreach (var part in curParts) pawn.health.RemoveHediff(part); var hediff = SexPartAdder.MakePart(hediffDef, pawn, bpr); pawn.health.AddHediff(hediff, bpr); return true; } /// <summary> /// Replaces the genitals of a pawn with artificial ones. /// </summary> /// <param name="pawn">The pawn to change.</param> /// <returns>Whether the part was swapped successfully.</returns> public static bool GiveArtificialGenitals(Pawn pawn) { var changed = false; if (get_genitalsBPR(pawn) is not { } bpr) return changed; if (has_penis_fertile(pawn)) { foreach (var part in pawn.GetGenitalsList()) if (is_fertile_penis(part)) pawn.health.RemoveHediff(part); var hediff = SexPartAdder.MakePart(hydraulic_penis, pawn, bpr); pawn.health.AddHediff(hediff, bpr); changed = true; } if (has_vagina(pawn)) { foreach (var part in pawn.GetGenitalsList()) if (is_vagina(part)) pawn.health.RemoveHediff(part); var hediff = SexPartAdder.MakePart(hydraulic_vagina, pawn, bpr); pawn.health.AddHediff(hediff, bpr); changed = true; } return changed; } /// <summary> /// <para>Adds parts to a pawn to make them into a trap.</para> /// <para>The pawn must be a natural male to be changed. If the pawn is /// already a trap, it will return `true`. Otherwise, it will return `false` /// if it failed to change the pawn.</para> /// <para>Note since Feb-2023: this is currently bugged, since the /// `SexPartAdder.add_breasts` does not respect the request to use female /// breasts.</para> /// </summary> /// <param name="pawn">The pawn to change.</param> /// <returns>Whether the pawn was modified.</returns> public static bool MakeIntoTrap(Pawn pawn) { if (GenderHelper.GetSex(pawn) is var sex and not Sex.male) return sex is Sex.trap; var parts = pawn.GetBreastList(); foreach (var part in parts) pawn.health.RemoveHediff(part); SexPartAdder.add_breasts(pawn, gender: Gender.Female); return GenderHelper.GetSex(pawn) is Sex.trap; } /// <summary> /// <para>Adds a part to a pawn to make them into a futa.</para> /// <para>The pawn must be a natural male or female and will return `false` /// if it failed to change the pawn into a futa.</para> /// </summary> /// <param name="pawn">The pawn to change.</param> /// <param name="infertile">Whether the part should be infertile.</param> /// <returns>Whether the pawn was modified.</returns> public static bool MakeIntoFuta(Pawn pawn, bool infertile = false) { Hediff hediff; switch ((GenderHelper.GetSex(pawn), infertile)) { case (Sex.male or Sex.trap, false): SexPartAdder.add_genitals(pawn, gender: Gender.Female); return GenderHelper.GetSex(pawn) is Sex.futa; case (Sex.male or Sex.trap, true) when get_genitalsBPR(pawn) is { } bpr: hediff = SexPartAdder.MakePart(hydraulic_vagina, pawn, bpr); pawn.health.AddHediff(hediff, bpr); return GenderHelper.GetSex(pawn) is Sex.futa; case (Sex.female, false): SexPartAdder.add_genitals(pawn, gender: Gender.Male); return GenderHelper.GetSex(pawn) is Sex.futa; case (Sex.female, true) when get_genitalsBPR(pawn) is { } bpr: hediff = SexPartAdder.MakePart(hydraulic_penis, pawn, bpr); pawn.health.AddHediff(hediff, bpr); return GenderHelper.GetSex(pawn) is Sex.futa; default: return false; } } } }
Korth95/rjw
1.4/Source/Modules/Testing/TestHelper.cs
C#
mit
6,140
using System; using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Need_Sex : Need_Seeker { public bool isInvisible => pawn.Map == null; private static float decay_per_day = 0.3f; // TODO: make these threshold values constants or at least static // readonly properties, if they're meant for patching. public float thresh_frustrated() => 0.05f; public float thresh_horny() => 0.25f; public float thresh_neutral() => 0.50f; public float thresh_satisfied() => 0.75f; public float thresh_ahegao() => 0.95f; public Need_Sex(Pawn pawn) : base(pawn) { //if (xxx.is_mechanoid(pawn)) return; //Added by nizhuan-jjr:Misc.Robots are not allowed to have sex, so they don't need sex actually. threshPercents = new List<float> { thresh_frustrated(), thresh_horny(), thresh_neutral(), thresh_satisfied(), thresh_ahegao() }; } // These are overridden just for other mods to patch and alter their behavior. // Without it, they would need to patch `Need` itself, adding a type check to // every single need IN THE GAME before executing the new behavior. public override float CurInstantLevel { get { return base.CurInstantLevel; } } public override float CurLevel { get { return base.CurLevel; } set { base.CurLevel = value; } } //public override bool ShowOnNeedList //{ // get // { // if (Genital_Helper.has_genitals(pawn)) // return true; // ModLog.Message("curLevelInt " + curLevelInt); // return false; // } //} //public override string GetTipString() //{ // return string.Concat(new string[] // { // this.LabelCap, // ": ", // this.CurLevelPercentage.ToStringPercent(), // "\n", // this.def.description, // "\n", // }); //} public static float brokenbodyfactor(Pawn pawn) { //This adds in the broken body system float broken_body_factor = 1f; if (pawn.health.hediffSet.HasHediff(xxx.feelingBroken)) { switch (pawn.health.hediffSet.GetFirstHediffOfDef(xxx.feelingBroken).CurStageIndex) { case 0: return 0.75f; case 1: return 1.4f; case 2: return 2f; } } return broken_body_factor; } public static float druggedfactor(Pawn pawn) { if (pawn.health.hediffSet.HasHediff(RJWHediffDefOf.HumpShroomEffect)) { //ModLog.Message("Need_Sex::druggedfactor 3 pawn is " + xxx.get_pawnname(pawn)); return 3f; } // No humpshroom effect but addicted? if (pawn.health.hediffSet.HasHediff(RJWHediffDefOf.HumpShroomAddiction)) { //ModLog.Message("Need_Sex::druggedfactor 0.5 pawn is " + xxx.get_pawnname(pawn)); return 0.5f; } //ModLog.Message("Need_Sex::druggedfactor 1 pawn is " + xxx.get_pawnname(pawn)); return 1f; } static float diseasefactor(Pawn pawn) { return 1f; } static float futafactor(Pawn pawn) { // Checks for doubly-fertile futa. // Presumably, they got twice the hormones coursing through their brain. return Genital_Helper.is_futa(pawn) ? 2.0f : 1.0f; } static float agefactor(Pawn pawn) { // Age check was moved to start of `NeedInterval` and this factor // is no longer useful in base RJW. It is left here in case any // mod patches this factor. return 1f; } /// <summary> /// Gets the cumulative factors affecting decay for a given pawn. /// </summary> public static float GetFallFactorFor(Pawn pawn) { return brokenbodyfactor(pawn) * druggedfactor(pawn) * diseasefactor(pawn) * agefactor(pawn) * futafactor(pawn); } static float fall_per_tick(Pawn pawn) { var fall_per_tick = decay_per_day / GenDate.TicksPerDay * GetFallFactorFor(pawn); //--ModLog.Message("Need_Sex::NeedInterval is called - pawn is " + xxx.get_pawnname(pawn) + " is has both genders " + (Genital_Helper.has_penis(pawn) && Genital_Helper.has_vagina(pawn))); //ModLog.Message(" " + xxx.get_pawnname(pawn) + "'s sex need stats:: fall_per_tick: " + fall_per_tick + ", sex_need_factor_from_lifestage: " + sex_need_factor_from_lifestage(pawn) ); return fall_per_tick; } public override void NeedInterval() { if (isInvisible) return; // no caravans // Asexual or too young. if (xxx.is_asexual(pawn) || !xxx.can_do_loving(pawn)) { CurLevel = 0.5f; return; } //--ModLog.Message("Need_Sex::NeedInterval is called0 - pawn is "+xxx.get_pawnname(pawn)); if (!def.freezeWhileSleeping || pawn.Awake()) { // `NeedInterval` is called by `Pawn_NeedsTracker` once every 150 ticks, which is around .06 game hours. var fallPerCall = 150 * fall_per_tick(pawn); var sexDriveModifier = xxx.get_sex_drive(pawn); var decayRateModifier = RJWSettings.sexneed_decay_rate; var decayThisCall = fallPerCall * sexDriveModifier * decayRateModifier; CurLevel -= decayThisCall; // ModLog.Message($" {xxx.get_pawnname(pawn)}'s sex need stats:: Decay/call: {decayThisCall}, Dec. rate: {decayRateModifier}, Cur.lvl: {CurLevel}, Sex drive: {sexDriveModifier}"); } //--ModLog.Message("Need_Sex::NeedInterval is called1"); } } }
Korth95/rjw
1.4/Source/Needs/Need_Sex.cs
C#
mit
5,134
using Verse; namespace rjw { /// <summary> /// Looks up and returns a BodyPartTagDef defined in the XML /// </summary> public static class BodyPartTagDefOf { public static BodyPartTagDef RJW_Fertility { get { if (a == null) a = (BodyPartTagDef)GenDefDatabase.GetDef(typeof(BodyPartTagDef), "RJW_Fertility"); return a; } } private static BodyPartTagDef a; } }
Korth95/rjw
1.4/Source/PawnCapacities/BodyPartTagDefOf.cs
C#
mit
395
using RimWorld; using System; using System.Collections.Generic; using UnityEngine; using Verse; namespace rjw { /// <summary> /// Calculates a pawn's fertility based on its age and fertility sources /// </summary> public class PawnCapacityWorker_Fertility : PawnCapacityWorker { public override float CalculateCapacityLevel(HediffSet diffSet, List<PawnCapacityUtility.CapacityImpactor> impactors = null) { Pawn pawn = diffSet.pawn; var parts = pawn.GetGenitalsList(); if (!Genital_Helper.has_penis_fertile(pawn, parts) && !Genital_Helper.has_vagina(pawn, parts)) return 0; if (Genital_Helper.has_ovipositorF(pawn, parts) || Genital_Helper.has_ovipositorM(pawn, parts)) return 0; //ModLog.Message("PawnCapacityWorker_Fertility::CalculateCapacityLevel is called for: " + xxx.get_pawnname(pawn)); if (!pawn.RaceHasFertility()) { //Log.Message(" Fertility_filter, no fertility for : " + pawn.kindDef.defName); return 0f; } //androids only fertile with archotech parts if (AndroidsCompatibility.IsAndroid(pawn) && !(AndroidsCompatibility.AndroidPenisFertility(pawn) || AndroidsCompatibility.AndroidVaginaFertility(pawn))) { //Log.Message(" Android has no archotech genitals set fertility to 0 for: " + pawn.kindDef.defName); return 0f; } float result = 1; if (RJWPregnancySettings.UseVanillaPregnancy && pawn.RaceProps.Humanlike) { float fertilityStat = pawn.GetStatValue(StatDefOf.Fertility); if (fertilityStat != 1) { result *= fertilityStat; impactors?.Add(new CapacityImpactorVanillaFertility()); } } else { float ageFactor = CalculateAgeImpact(pawn); if (ageFactor != 1) { result *= ageFactor; impactors?.Add(new CapacityImpactorAge()); } } result *= PawnCapacityUtility.CalculateTagEfficiency(diffSet, BodyPartTagDefOf.RJW_Fertility, 1f, FloatRange.ZeroToOne, impactors); //ModLog.Message("PawnCapacityWorker_Fertility::CalculateCapacityLevel result is: " + result); return result; } public override bool CanHaveCapacity(BodyDef body) { return body.HasPartWithTag(BodyPartTagDefOf.RJW_Fertility); } private float CalculateAgeImpact(Pawn pawn) { RaceProperties race = pawn.RaceProps; float startAge = 0f; //raise fertility float startMaxAge = 0f; //max fertility float endAge = race.lifeExpectancy * (RJWPregnancySettings.fertility_endage_male * 0.7f); // Age when males start to lose potency. float zeroFertility = race.lifeExpectancy * RJWPregnancySettings.fertility_endage_male; // Age when fertility hits 0%. if (xxx.is_female(pawn)) { if (xxx.is_animal(pawn)) { endAge = race.lifeExpectancy * (RJWPregnancySettings.fertility_endage_female_animal * 0.6f); zeroFertility = race.lifeExpectancy * RJWPregnancySettings.fertility_endage_female_animal; } else { endAge = race.lifeExpectancy * (RJWPregnancySettings.fertility_endage_female_humanlike * 0.6f); // Age when fertility begins to drop. zeroFertility = race.lifeExpectancy * RJWPregnancySettings.fertility_endage_female_humanlike; // Age when fertility hits 0%. } } //If pawn is an animal, first reproductive lifestage is (usually) adult, so set startMaxAge at first reproductive stage, and startAge at stage before that. int adult; if (xxx.is_animal(pawn) && (adult = race.lifeStageAges.FirstIndexOf((ls) => ls.def.reproductive)) > 0) { startAge = race.lifeStageAges[adult - 1].minAge; startMaxAge = race.lifeStageAges[adult].minAge; } else { foreach (LifeStageAge lifestage in race.lifeStageAges) { if (lifestage.def.reproductive) //presumably teen stage if (startAge == 0f && startMaxAge == 0f) { startAge = lifestage.minAge; startMaxAge = (Mathf.Max(startAge + (startAge + endAge) * 0.08f, startAge)); } //presumably adult stage else { if (startMaxAge > lifestage.minAge) // ensure peak fertility stays at start or a bit before adult stage startMaxAge = lifestage.minAge; } } } //Log.Message(" Fertility ages for " + pawn.Name + " are: " + startAge + ", " + startMaxAge + ", " + endAge + ", " + endMaxAge); return GenMath.FlatHill(startAge, startMaxAge, endAge, zeroFertility, pawn.ageTracker.AgeBiologicalYearsFloat); } // Tooltips are hardcoded to only use concrete vanilla CapacityImpactors(?!), so we need to subclass one // in order to show anything without gratuitous patching (and possibly stepping on the toes of any mod that // happens to mess with these tooltips). CapacityImpactorPain doesn't have any fields or specialised methods, // so that's what we'll use. public class CapacityImpactorAge : PawnCapacityUtility.CapacityImpactorPain { public override string Readable(Pawn pawn) { return "AgeImpactor".Translate() + pawn.ageTracker.AgeBiologicalYearsFloat.ToStringApproxAge(); } } public class CapacityImpactorVanillaFertility : PawnCapacityUtility.CapacityImpactorPain { public override string Readable(Pawn pawn) { return "VanillaFertilityImpactor".Translate( ((int) (pawn.GetStatValue(StatDefOf.Fertility) * 100)).Named("VALUE") ); } } } }
Korth95/rjw
1.4/Source/PawnCapacities/PawnCapacityWorker_Fertility.cs
C#
mit
5,265
using System; using System.Collections.Generic; using System.Linq; using Verse; using UnityEngine; using RimWorld; using Verse.Sound; namespace rjw.MainTab { [StaticConstructorOnStartup] public static class DesignatorCheckbox { public static readonly Texture2D CheckboxOnTex = ContentFinder<Texture2D>.Get("UI/Commands/Service_on"); public static readonly Texture2D CheckboxOffTex = ContentFinder<Texture2D>.Get("UI/Commands/Service_off"); public static readonly Texture2D CheckboxDisabledTex = ContentFinder<Texture2D>.Get("UI/Commands/Service_Refuse"); private static bool checkboxPainting; private static bool checkboxPaintingState; public static void Checkbox(Vector2 topLeft, ref bool checkOn, float size = 24f, bool disabled = false, Texture2D texChecked = null, Texture2D texUnchecked = null, Texture2D texDisabled = null) { Checkbox(topLeft.x, topLeft.y, ref checkOn, size, disabled, texChecked, texUnchecked); } public static void Checkbox(float x, float y, ref bool checkOn, float size = 24f, bool disabled = false, Texture2D texChecked = null, Texture2D texUnchecked = null, Texture2D texDisabled = null) { Rect rect = new Rect(x, y, size, size); CheckboxDraw(x, y, checkOn, disabled, size, texChecked, texUnchecked,texDisabled); if (!disabled) { MouseoverSounds.DoRegion(rect); bool flag = false; Widgets.DraggableResult draggableResult = Widgets.ButtonInvisibleDraggable(rect, false); if (draggableResult == Widgets.DraggableResult.Pressed) { checkOn = !checkOn; flag = true; } else if (draggableResult == Widgets.DraggableResult.Dragged) { checkOn = !checkOn; flag = true; checkboxPainting = true; checkboxPaintingState = checkOn; } if (Mouse.IsOver(rect) && checkboxPainting && Input.GetMouseButton(0) && checkOn != checkboxPaintingState) { checkOn = checkboxPaintingState; flag = true; } if (flag) { if (checkOn) { SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera(null); } else { SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera(null); } } } } private static void CheckboxDraw(float x, float y, bool active, bool disabled, float size = 24f, Texture2D texChecked = null, Texture2D texUnchecked = null, Texture2D texDisabled = null) { Texture2D image; if (disabled) { image = ((!(texDisabled != null)) ? CheckboxDisabledTex : texDisabled); } else if (active) { image = ((!(texChecked != null)) ? CheckboxOnTex : texChecked); } else { image = ((!(texUnchecked != null)) ? CheckboxOffTex : texUnchecked); } Rect position = new Rect(x, y, size, size); GUI.DrawTexture(position, image); } } }
Korth95/rjw
1.4/Source/RJWTab/Checkboxes/DesignatorCheckbox.cs
C#
mit
2,754
using System; using System.Collections.Generic; using System.Linq; using Verse; using UnityEngine; using RimWorld; using Verse.Sound; namespace rjw.MainTab.Checkbox { [StaticConstructorOnStartup] public abstract class PawnColumnCheckbox : PawnColumnWorker { public static readonly Texture2D CheckboxOnTex; public static readonly Texture2D CheckboxOffTex; public static readonly Texture2D CheckboxDisabledTex; public const int HorizontalPadding = 2; public override void DoCell(Rect rect, Pawn pawn, RimWorld.PawnTable table) { if (!this.HasCheckbox(pawn)) { return; } if (Find.TickManager.TicksGame % 60 == 0) { pawn.UpdatePermissions(); //Log.Message("GetDisabled UpdateCanDesignateService for " + xxx.get_pawnname(pawn)); //Log.Message("UpdateCanDesignateService " + pawn.UpdateCanDesignateService()); //Log.Message("CanDesignateService " + pawn.CanDesignateService()); //Log.Message("GetDisabled " + GetDisabled(pawn)); } int num = (int)((rect.width - 24f) / 2f); int num2 = Mathf.Max(3, 0); Vector2 vector = new Vector2(rect.x + (float)num, rect.y + (float)num2); Rect rect2 = new Rect(vector.x, vector.y, 24f, 24f); bool disabled = this.GetDisabled(pawn); bool value; if (disabled) { value = false; } else { value = this.GetValue(pawn); } bool flag = value; Vector2 topLeft = vector; //Widgets.Checkbox(topLeft, ref value, 24f, disabled, CheckboxOnTex, CheckboxOffTex, CheckboxDisabledTex); MakeCheckbox(topLeft, ref value, 24f, disabled, CheckboxOnTex, CheckboxOffTex, CheckboxDisabledTex); if (Mouse.IsOver(rect2)) { string tip = this.GetTip(pawn); if (!tip.NullOrEmpty()) { TooltipHandler.TipRegion(rect2, tip); } } if (value != flag) { this.SetValue(pawn, value); } } protected void MakeCheckbox(Vector2 topLeft, ref bool value, float v = 24f, bool disabled = false, Texture2D checkboxOnTex = null, Texture2D checkboxOffTex = null, Texture2D checkboxDisabledTex = null) { Widgets.Checkbox(topLeft, ref value, v, disabled, checkboxOnTex, checkboxOffTex, checkboxDisabledTex); } protected virtual string GetTip(Pawn pawn) { return null; } protected virtual bool HasCheckbox(Pawn pawn) { return false; } protected abstract bool GetValue(Pawn pawn); protected abstract void SetValue(Pawn pawn, bool value); protected virtual bool GetDisabled(Pawn pawn) { return false; } } }
Korth95/rjw
1.4/Source/RJWTab/Checkboxes/PawnColumnCheckbox.cs
C#
mit
2,494
using RimWorld; using UnityEngine; using Verse; namespace rjw.MainTab.Checkbox { [StaticConstructorOnStartup] public class PawnColumnWorker_BreedAnimal : PawnColumnWorker_Checkbox { public static readonly Texture2D CheckboxOnTex = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_on"); public static readonly Texture2D CheckboxOffTex = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_off"); public static readonly Texture2D CheckboxDisabledTex = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_Refuse"); protected override bool HasCheckbox(Pawn pawn) { return pawn.CanDesignateBreeding(); } protected bool GetDisabled(Pawn pawn) { return !pawn.CanDesignateBreeding(); } protected override bool GetValue(Pawn pawn) { return pawn.IsDesignatedBreeding() && xxx.is_animal(pawn); } protected override void SetValue(Pawn pawn, bool value, PawnTable table) { if (value == this.GetValue(pawn)) return; pawn.ToggleBreeding(); } } }
Korth95/rjw
1.4/Source/RJWTab/Checkboxes/PawnColumnWorker_BreedAnimal.cs
C#
mit
1,000
using RimWorld; using UnityEngine; using Verse; namespace rjw.MainTab.Checkbox { [StaticConstructorOnStartup] public class PawnColumnWorker_BreedHumanlike : PawnColumnWorker_Checkbox { public static readonly Texture2D CheckboxOnTex = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_on"); public static readonly Texture2D CheckboxOffTex = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_off"); public static readonly Texture2D CheckboxDisabledTex = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_Refuse"); protected override bool HasCheckbox(Pawn pawn) { return pawn.CanDesignateBreeding(); } protected bool GetDisabled(Pawn pawn) { return !pawn.CanDesignateBreeding(); } protected override bool GetValue(Pawn pawn) { return pawn.IsDesignatedBreeding() && xxx.is_human(pawn); } protected override void SetValue(Pawn pawn, bool value, PawnTable table) { if (value == this.GetValue(pawn)) return; pawn.ToggleBreeding(); } } }
Korth95/rjw
1.4/Source/RJWTab/Checkboxes/PawnColumnWorker_BreedHumanlike.cs
C#
mit
1,002
using RimWorld; using UnityEngine; using Verse; namespace rjw.MainTab.Checkbox { [StaticConstructorOnStartup] public class PawnColumnWorker_BreederAnimal : PawnColumnWorker_Checkbox { public static readonly Texture2D CheckboxOnTex = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_on"); public static readonly Texture2D CheckboxOffTex = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_off"); public static readonly Texture2D CheckboxDisabledTex = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_Refuse"); protected override bool HasCheckbox(Pawn pawn) { return pawn.CanDesignateBreedingAnimal(); } protected bool GetDisabled(Pawn pawn) { return !pawn.CanDesignateBreedingAnimal(); } protected override bool GetValue(Pawn pawn) { return pawn.IsDesignatedBreedingAnimal() && xxx.is_animal(pawn); } protected override void SetValue(Pawn pawn, bool value, PawnTable table) { if (value == this.GetValue(pawn)) return; pawn.ToggleBreedingAnimal(); } } }
Korth95/rjw
1.4/Source/RJWTab/Checkboxes/PawnColumnWorker_BreederAnimal.cs
C#
mit
1,026
using RimWorld; using UnityEngine; using Verse; namespace rjw.MainTab.Checkbox { [StaticConstructorOnStartup] public class PawnColumnWorker_Comfort : PawnColumnWorker_Checkbox { public static readonly Texture2D CheckboxOnTex = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_on"); public static readonly Texture2D CheckboxOffTex = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_off"); public static readonly Texture2D CheckboxDisabledTex = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_Refuse"); protected override bool HasCheckbox(Pawn pawn) { return pawn.CanDesignateComfort(); } protected bool GetDisabled(Pawn pawn) { return !pawn.CanDesignateComfort(); } protected override bool GetValue(Pawn pawn) { return pawn.IsDesignatedComfort(); } protected override void SetValue(Pawn pawn, bool value, PawnTable table) { pawn.ToggleComfort(); } } }
Korth95/rjw
1.4/Source/RJWTab/Checkboxes/PawnColumnWorker_Comfort.cs
C#
mit
931
using RimWorld; using UnityEngine; using Verse; namespace rjw.MainTab.Checkbox { [StaticConstructorOnStartup] public class PawnColumnWorker_Hero : PawnColumnCheckbox { //public static readonly Texture2D CheckboxOnTex = ContentFinder<Texture2D>.Get("UI/Commands/Hero_on"); //public static readonly Texture2D CheckboxOffTex = ContentFinder<Texture2D>.Get("UI/Commands/Hero_off"); //public static readonly Texture2D CheckboxDisabledTex = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_Refuse"); //public static readonly Texture2D iconAccept = ContentFinder<Texture2D>.Get("UI/Commands/Hero_off"); //static readonly Texture2D iconCancel = ContentFinder<Texture2D>.Get("UI/Commands/Hero_on"); //protected override Texture2D GetIconFor(Pawn pawn) //{ // return pawn.CanDesignateHero() ? pawn.IsDesignatedHero() ? iconAccept : iconCancel : null; //} //protected override string GetIconTip(Pawn pawn) //{ // return "PawnColumnWorker_IsHero".Translate(); // ; //} //public static Texture2D CheckboxOnTex = ContentFinder<Texture2D>.Get("UI/Commands/Hero_on"); //public static Texture2D CheckboxOffTex = ContentFinder<Texture2D>.Get("UI/Commands/Hero_off"); protected override bool HasCheckbox(Pawn pawn) { return pawn.CanDesignateHero() || pawn.IsDesignatedHero(); } protected override bool GetValue(Pawn pawn) { return pawn.IsDesignatedHero(); } protected override void SetValue(Pawn pawn, bool value) { if (pawn.IsDesignatedHero()) return; pawn.ToggleHero(); //reload/update tab var rjwtab = DefDatabase<MainButtonDef>.GetNamed("RJW_MainButton"); Find.MainTabsRoot.ToggleTab(rjwtab, false);//off Find.MainTabsRoot.ToggleTab(rjwtab, false);//on } } }
Korth95/rjw
1.4/Source/RJWTab/Checkboxes/PawnColumnWorker_Hero.cs
C#
mit
1,740
using RimWorld; using UnityEngine; using Verse; namespace rjw.MainTab.Checkbox { [StaticConstructorOnStartup] public class PawnColumnWorker_Whore : PawnColumnWorker_Checkbox { public static readonly Texture2D CheckboxOnTex = ContentFinder<Texture2D>.Get("UI/Commands/Service_on"); public static readonly Texture2D CheckboxOffTex = ContentFinder<Texture2D>.Get("UI/Commands/Service_off"); public static readonly Texture2D CheckboxDisabledTex = ContentFinder<Texture2D>.Get("UI/Commands/Service_Refuse"); protected override bool HasCheckbox(Pawn pawn) { return pawn.CanDesignateService(); } protected bool GetDisabled(Pawn pawn) { return !pawn.CanDesignateService(); } protected override bool GetValue(Pawn pawn) { return pawn.IsDesignatedService(); } protected override void SetValue(Pawn pawn, bool value, PawnTable table) { pawn.ToggleService(); } } }
Korth95/rjw
1.4/Source/RJWTab/Checkboxes/PawnColumnWorker_Whore.cs
C#
mit
905
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.MainTab.DefModExtensions { public class RJW_PawnTable : DefModExtension { public string label; } }
Korth95/rjw
1.4/Source/RJWTab/DefModExtensions/RJW_PawnTable.cs
C#
mit
251
using System.Collections.Generic; using System.Linq; using System.Text; using RimWorld; using RimWorld.Planet; using UnityEngine; using Verse; namespace rjw.MainTab.Icon { [StaticConstructorOnStartup] public class PawnColumnWorker_IsBreeder : PawnColumnWorker_Icon { private static readonly Texture2D comfortOn = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_on"); private readonly Texture2D comfortOff = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_off"); private readonly Texture2D comfortOff_nobg = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_off_nobg"); protected override Texture2D GetIconFor(Pawn pawn) { return pawn.CanDesignateBreeding() ? pawn.IsDesignatedBreeding() ? comfortOn : comfortOff : comfortOff_nobg; //return xxx.is_slave(pawn) ? comfortOff : null; } protected override string GetIconTip(Pawn pawn) { return "PawnColumnWorker_IsBreeder".Translate(); ; } } }
Korth95/rjw
1.4/Source/RJWTab/Icons/PawnColumnWorker_IsBreeder.cs
C#
mit
954
using System.Collections.Generic; using System.Linq; using System.Text; using RimWorld; using RimWorld.Planet; using UnityEngine; using Verse; namespace rjw.MainTab.Icon { [StaticConstructorOnStartup] public class PawnColumnWorker_IsComfort : PawnColumnWorker_Icon { private readonly Texture2D comfortOn = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_on"); private readonly Texture2D comfortOff = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_off"); private readonly Texture2D comfortOff_nobg = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_off_nobg"); protected override Texture2D GetIconFor(Pawn pawn) { return pawn.CanDesignateComfort() ? pawn.IsDesignatedComfort() ? comfortOn : comfortOff : comfortOff_nobg; } protected override string GetIconTip(Pawn pawn) { return "PawnColumnWorker_IsComfort".Translate(); ; } } }
Korth95/rjw
1.4/Source/RJWTab/Icons/PawnColumnWorker_IsComfort.cs
C#
mit
893
using System.Collections.Generic; using System.Linq; using System.Text; using RimWorld; using RimWorld.Planet; using UnityEngine; using Verse; namespace rjw.MainTab.Icon { [StaticConstructorOnStartup] public class PawnColumnWorker_IsPrisoner : PawnColumnWorker_Icon { private static readonly Texture2D comfortOn = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_on"); private readonly Texture2D comfortOff = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_off"); private readonly Texture2D comfortOff_nobg = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_off_nobg"); protected override Texture2D GetIconFor(Pawn pawn) { return pawn.IsPrisonerOfColony ? comfortOff_nobg : null; } protected override string GetIconTip(Pawn pawn) { return "PawnColumnWorker_IsPrisoner".Translate(); } } }
Korth95/rjw
1.4/Source/RJWTab/Icons/PawnColumnWorker_IsPrisoner.cs
C#
mit
848
using System.Collections.Generic; using System.Linq; using System.Text; using RimWorld; using RimWorld.Planet; using UnityEngine; using Verse; namespace rjw.MainTab.Icon { [StaticConstructorOnStartup] public class PawnColumnWorker_IsSlave : PawnColumnWorker_Icon { private readonly Texture2D comfortOn = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_on"); private readonly Texture2D comfortOff = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_off"); private readonly Texture2D comfortOff_nobg = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_off_nobg"); protected override Texture2D GetIconFor(Pawn pawn) { return xxx.is_slave(pawn) ? ModsConfig.IdeologyActive ? GuestUtility.SlaveIcon : comfortOff_nobg : null; } protected override string GetIconTip(Pawn pawn) { return "PawnColumnWorker_IsSlave".Translate(); ; } } }
Korth95/rjw
1.4/Source/RJWTab/Icons/PawnColumnWorker_IsSlave.cs
C#
mit
887
using RimWorld; using UnityEngine; using Verse; using static rjw.GenderHelper; namespace rjw.MainTab.Icon { [StaticConstructorOnStartup] public class PawnColumnWorker_RJWGender : PawnColumnWorker_Gender { public static readonly Texture2D hermIcon = ContentFinder<Texture2D>.Get("UI/Icons/Gender/Genders", true); protected override Texture2D GetIconFor(Pawn pawn) => GetSex(pawn) switch { Sex.futa => hermIcon, _ => pawn.gender.GetIcon() }; protected override string GetIconTip(Pawn pawn) => GetSex(pawn) switch { Sex.futa => "PawnColumnWorker_RJWGender_IsHerm".Translate(), _ => pawn.GetGenderLabel().CapitalizeFirst() }; } }
Korth95/rjw
1.4/Source/RJWTab/Icons/PawnColumnWorker_RJWGender.cs
C#
mit
661
using System.Collections.Generic; using System.Linq; using Verse; using RimWorld; using RimWorld.Planet; using UnityEngine; using rjw.MainTab.DefModExtensions; namespace rjw.MainTab { [StaticConstructorOnStartup] public class RJW_PawnTableList { public List<PawnTableDef> getdefs() { var defs = new List<PawnTableDef>(); defs.AddRange(DefDatabase<PawnTableDef>.AllDefs.Where(x => x.HasModExtension<RJW_PawnTable>())); return defs; } } public class MainTabWindow : MainTabWindow_PawnTable { protected override float ExtraBottomSpace { get { return 53f; //default 53 } } protected override float ExtraTopSpace { get { return 40f; //default 0 } } protected override PawnTableDef PawnTableDef => pawnTableDef; protected override IEnumerable<Pawn> Pawns => pawns; public IEnumerable<Pawn> pawns = Find.CurrentMap.mapPawns.AllPawns.Where(p => p.RaceProps.Humanlike && p.IsColonist && !xxx.is_slave(p)); public PawnTableDef pawnTableDef = DefDatabase<PawnTableDef>.GetNamed("RJW_PawnTable_Colonists"); /// <summary> /// draw table /// </summary> /// <param name="rect"></param> public override void DoWindowContents(Rect rect) { base.DoWindowContents(rect); if (Widgets.ButtonText(new Rect(rect.x + 5f, rect.y + 5f, Mathf.Min(rect.width, 260f), 32f), "MainTabWindow_Designators".Translate(), true, true, true)) { MakeMenu(); } } public override void PostOpen() { base.PostOpen(); Find.World.renderer.wantedMode = WorldRenderMode.None; } /// <summary> /// reload/update tab /// </summary> public static void Reloadtab() { var rjwtab = DefDatabase<MainButtonDef>.GetNamed("RJW_MainButton"); Find.MainTabsRoot.ToggleTab(rjwtab, false);//off Find.MainTabsRoot.ToggleTab(rjwtab, false);//on } public void MakeMenu() { Find.WindowStack.Add(new FloatMenu(MakeOptions())); } /// <summary> /// switch pawnTable's /// patch this /// </summary> public List<FloatMenuOption> MakeOptions() { List<FloatMenuOption> opts = new List<FloatMenuOption>(); PawnTableDef tabC = DefDatabase<PawnTableDef>.GetNamed("RJW_PawnTable_Colonists"); PawnTableDef tabA = DefDatabase<PawnTableDef>.GetNamed("RJW_PawnTable_Animals"); PawnTableDef tabP = DefDatabase<PawnTableDef>.GetNamed("RJW_PawnTable_Property"); opts.Add(new FloatMenuOption(tabC.GetModExtension<RJW_PawnTable>().label, () => { pawnTableDef = tabC; pawns = Find.CurrentMap.mapPawns.AllPawns.Where(p => p.RaceProps.Humanlike && p.IsColonist && !xxx.is_slave(p)); Notify_ResolutionChanged(); Reloadtab(); }, MenuOptionPriority.Default)); opts.Add(new FloatMenuOption(tabA.GetModExtension<RJW_PawnTable>().label, () => { pawnTableDef = tabA; pawns = Find.CurrentMap.mapPawns.PawnsInFaction(Faction.OfPlayer).Where(p => xxx.is_animal(p)); Notify_ResolutionChanged(); Reloadtab(); }, MenuOptionPriority.Default)); opts.Add(new FloatMenuOption(tabP.GetModExtension<RJW_PawnTable>().label, () => { pawnTableDef = tabP; pawns = Find.CurrentMap.mapPawns.AllPawns.Where(p => p.RaceProps.Humanlike && (p.IsColonist && xxx.is_slave(p) || p.IsPrisonerOfColony)); Notify_ResolutionChanged(); Reloadtab(); }, MenuOptionPriority.Default)); return opts; } } }
Korth95/rjw
1.4/Source/RJWTab/MainTabWindow.cs
C#
mit
3,335
using System; using UnityEngine; using Verse; using Verse.Sound; namespace RimWorld { // Token: 0x020013F0 RID: 5104 public class PawnColumnWorker_Master : PawnColumnWorker { // Token: 0x17001618 RID: 5656 // (get) Token: 0x06007D97 RID: 32151 RVA: 0x00012AE6 File Offset: 0x00010CE6 protected override GameFont DefaultHeaderFont { get { return GameFont.Tiny; } } // Token: 0x06007D98 RID: 32152 RVA: 0x002CCC79 File Offset: 0x002CAE79 public override int GetMinWidth(PawnTable table) { return Mathf.Max(base.GetMinWidth(table), 100); } // Token: 0x06007D99 RID: 32153 RVA: 0x002CCC89 File Offset: 0x002CAE89 public override int GetOptimalWidth(PawnTable table) { return Mathf.Clamp(170, this.GetMinWidth(table), this.GetMaxWidth(table)); } // Token: 0x06007D9A RID: 32154 RVA: 0x002CB126 File Offset: 0x002C9326 public override void DoHeader(Rect rect, PawnTable table) { base.DoHeader(rect, table); MouseoverSounds.DoRegion(rect); } // Token: 0x06007D9B RID: 32155 RVA: 0x002CCCA3 File Offset: 0x002CAEA3 public override void DoCell(Rect rect, Pawn pawn, PawnTable table) { if (!this.CanAssignMaster(pawn)) { return; } TrainableUtility.MasterSelectButton(rect.ContractedBy(2f), pawn, true); } // Token: 0x06007D9C RID: 32156 RVA: 0x002CCCC4 File Offset: 0x002CAEC4 public override int Compare(Pawn a, Pawn b) { int valueToCompare = this.GetValueToCompare1(a); int valueToCompare2 = this.GetValueToCompare1(b); if (valueToCompare != valueToCompare2) { return valueToCompare.CompareTo(valueToCompare2); } return this.GetValueToCompare2(a).CompareTo(this.GetValueToCompare2(b)); } // Token: 0x06007D9D RID: 32157 RVA: 0x002CCD01 File Offset: 0x002CAF01 private bool CanAssignMaster(Pawn pawn) { return pawn.RaceProps.Animal && pawn.Faction == Faction.OfPlayer && pawn.training.HasLearned(TrainableDefOf.Obedience); } // Token: 0x06007D9E RID: 32158 RVA: 0x002CCD34 File Offset: 0x002CAF34 private int GetValueToCompare1(Pawn pawn) { if (!this.CanAssignMaster(pawn)) { return 0; } if (pawn.playerSettings.Master == null) { return 1; } return 2; } // Token: 0x06007D9F RID: 32159 RVA: 0x002CCD51 File Offset: 0x002CAF51 private string GetValueToCompare2(Pawn pawn) { if (pawn.playerSettings != null && pawn.playerSettings.Master != null) { return pawn.playerSettings.Master.Label; } return ""; } } }
Korth95/rjw
1.4/Source/RJWTab/PawnColumnWorker_Master.cs
C#
mit
2,498
using System.Collections.Generic; using System.Linq; using System.Text; using RimWorld; using RimWorld.Planet; using UnityEngine; using Verse; namespace rjw.MainTab { public abstract class PawnColumnWorker_TextCenter : PawnColumnWorker_Text { public override void DoCell(Rect rect, Pawn pawn, PawnTable table) { Rect rect2 = new Rect(rect.x, rect.y, rect.width, Mathf.Min(rect.height, 30f)); string textFor = GetTextFor(pawn); if (textFor != null) { Text.Font = GameFont.Small; Text.Anchor = TextAnchor.MiddleCenter; Text.WordWrap = false; Widgets.Label(rect2, textFor); Text.WordWrap = true; Text.Anchor = TextAnchor.UpperLeft; string tip = GetTip(pawn); if (!tip.NullOrEmpty()) { TooltipHandler.TipRegion(rect2, tip); } } } } }
Korth95/rjw
1.4/Source/RJWTab/PawnColumnWorker_TextCenter.cs
C#
mit
803
using System; using System.Collections.Generic; using System.Linq; using RimWorld; using rjw; using Verse; namespace rjw.MainTab { public class RJW_PawnTable_Animals : PawnTable_Animals { public RJW_PawnTable_Animals(PawnTableDef def, Func<IEnumerable<Pawn>> pawnsGetter, int uiWidth, int uiHeight) : base(def, pawnsGetter, uiWidth, uiHeight) { } //default sorting protected override IEnumerable<Pawn> LabelSortFunction(IEnumerable<Pawn> input) { //return input.OrderBy(p => p.Name); foreach (Pawn p in input) p.UpdatePermissions(); return input.OrderByDescending(p => xxx.get_pawnname(p)); //return input.OrderByDescending(p => (p.IsPrisonerOfColony || p.IsSlaveOfColony) != false).ThenBy(p => (p.Name.ToStringShort.Colorize(Color.yellow))); //return input.OrderBy(p => xxx.get_pawnname(p)); } protected override IEnumerable<Pawn> PrimarySortFunction(IEnumerable<Pawn> input) { foreach (Pawn p in input) p.UpdatePermissions(); return input; //return base.PrimarySortFunction(input); } //public IEnumerable<Pawn> FilterPawns //{ // get // { // ModLog.Message("FilterPawnsGet"); // var x = Find.CurrentMap.mapPawns.PawnsInFaction(Faction.OfPlayer).Where(p => xxx.is_animal(p)); // ModLog.Message("x: " + x); // return x; // } //} } }
Korth95/rjw
1.4/Source/RJWTab/PawnTable_Animals.cs
C#
mit
1,314
using System; using System.Collections.Generic; using System.Linq; using RimWorld; using rjw; using Verse; namespace rjw.MainTab { public class RJW_PawnTable_Humanlikes : PawnTable_PlayerPawns { public RJW_PawnTable_Humanlikes(PawnTableDef def, Func<IEnumerable<Pawn>> pawnsGetter, int uiWidth, int uiHeight) : base(def, pawnsGetter, uiWidth, uiHeight) { } //default sorting protected override IEnumerable<Pawn> LabelSortFunction(IEnumerable<Pawn> input) { //return input.OrderBy(p => p.Name); foreach (Pawn p in input) p.UpdatePermissions(); return input.OrderByDescending(p => (p.IsPrisonerOfColony || p.IsSlaveOfColony) != false).ThenBy(p => xxx.get_pawnname(p)); //return input.OrderByDescending(p => (p.IsPrisonerOfColony || p.IsSlaveOfColony) != false).ThenBy(p => (p.Name.ToStringShort.Colorize(Color.yellow))); //return input.OrderBy(p => xxx.get_pawnname(p)); } protected override IEnumerable<Pawn> PrimarySortFunction(IEnumerable<Pawn> input) { foreach (Pawn p in input) p.UpdatePermissions(); return input; //return base.PrimarySortFunction(input); } //public static IEnumerable<Pawn> FilterPawns() //{ // return Find.CurrentMap.mapPawns.PawnsInFaction(Faction.OfPlayer).Where(p => xxx.is_animal(p)); //} } }
Korth95/rjw
1.4/Source/RJWTab/PawnTable_Humanlikes.cs
C#
mit
1,285
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_InstallAnus : Recipe_InstallPrivates { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { var gen_blo = Genital_Helper.anus_blocked(p); foreach (BodyPartRecord part in base.GetPartsToApplyOn(p, r)) if ((!gen_blo) || (part != xxx.anus)) yield return part; } } }
Korth95/rjw
1.4/Source/Recipes/Install_Part/Recipe_InstallAnus.cs
C#
mit
421
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_InstallBreasts : Recipe_InstallPrivates { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { var gen_blo = Genital_Helper.breasts_blocked(p); foreach (BodyPartRecord part in base.GetPartsToApplyOn(p, r)) if ((!gen_blo) || (part != xxx.breasts)) yield return part; } } }
Korth95/rjw
1.4/Source/Recipes/Install_Part/Recipe_InstallBreasts.cs
C#
mit
430
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_InstallGenitals : Recipe_InstallPrivates { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { var gen_blo = Genital_Helper.genitals_blocked(p); foreach (BodyPartRecord part in base.GetPartsToApplyOn(p, r)) if ((!gen_blo) || (part != xxx.genitals)) yield return part; } } }
Korth95/rjw
1.4/Source/Recipes/Install_Part/Recipe_InstallGenitals.cs
C#
mit
437
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_InstallPart : rjw_CORE_EXPOSED.Recipe_InstallOrReplaceBodyPart { public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill) { GenderHelper.Sex before = GenderHelper.GetSex(pawn); base.ApplyOnPawn(pawn, part, billDoer, ingredients, bill); GenderHelper.Sex after = GenderHelper.GetSex(pawn); GenderHelper.ChangeSex(pawn, before, after); } } public class Recipe_InstallGenitals : Recipe_InstallPart { public override bool blocked(Pawn p) { return (Genital_Helper.genitals_blocked(p) || xxx.is_slime(p));//|| xxx.is_demon(p) } } public class Recipe_InstallBreasts : Recipe_InstallPart { public override bool blocked(Pawn p) { return (Genital_Helper.breasts_blocked(p) || xxx.is_slime(p));//|| xxx.is_demon(p) } } public class Recipe_InstallAnus : Recipe_InstallPart { public override bool blocked(Pawn p) { return (Genital_Helper.anus_blocked(p) || xxx.is_slime(p));//|| xxx.is_demon(p) } } }
Korth95/rjw
1.4/Source/Recipes/Install_Part/Recipe_InstallPart.cs
C#
mit
1,111
using System.Collections.Generic; using RimWorld; using Verse; using System.Linq; using System; namespace rjw { public class Recipe_GrowBreasts : Recipe_Surgery { public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill) { if (billDoer != null) { if (CheckSurgeryFail(billDoer, pawn, ingredients, part, bill)) { return; } TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[] { billDoer, pawn }); } var oldBoobs = pawn.health.hediffSet.hediffs.FirstOrDefault(hediff => hediff.def == bill.recipe.removesHediff); var newBoobs = bill.recipe.addsHediff; var newSize = BreastSize_Helper.GetSize(newBoobs); GenderHelper.ChangeSex(pawn, () => { BreastSize_Helper.HurtBreasts(pawn, part, 3 * (newSize - 1)); if (pawn.health.hediffSet.PartIsMissing(part)) { return; } if (oldBoobs != null) { pawn.health.RemoveHediff(oldBoobs); } pawn.health.AddHediff(newBoobs, part); }); } public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipeDef) { yield break; var chest = Genital_Helper.get_breastsBPR(pawn); if (pawn.health.hediffSet.PartIsMissing(chest) || Genital_Helper.breasts_blocked(pawn)) { yield break; } var old = recipeDef.removesHediff; if (old == null ? BreastSize_Helper.HasNipplesOnly(pawn, chest) : pawn.health.hediffSet.HasHediff(old, chest)) { yield return chest; } } } }
Korth95/rjw
1.4/Source/Recipes/Recipe_GrowBreasts.cs
C#
mit
1,538
using RimWorld; using System.Collections.Generic; using Verse; namespace rjw { /// <summary> /// Removes heddifs (restraints/cocoon) /// </summary> public class Recipe_RemoveRestraints : Recipe_RemoveHediff { public override bool AvailableOnNow(Thing pawn, BodyPartRecord part = null) { return true; } public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) { List<Hediff> allHediffs = pawn.health.hediffSet.hediffs; int i = 0; while (true) { if (i >= allHediffs.Count) { yield break; } if (allHediffs[i].def == recipe.removesHediff && allHediffs[i].Visible) { break; } i++; } yield return allHediffs[i].Part; } } }
Korth95/rjw
1.4/Source/Recipes/Recipe_Restraints.cs
C#
mit
734
using System.Collections.Generic; using RimWorld; using Verse; using System.Linq; using System; namespace rjw { public class Recipe_ShrinkBreasts : Recipe_Surgery { public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill) { if (billDoer != null) { if (CheckSurgeryFail(billDoer, pawn, ingredients, part, bill)) { return; } TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[] { billDoer, pawn }); } if (!BreastSize_Helper.TryGetBreastSize(pawn, out var oldSize)) { throw new ApplicationException("Recipe_ShrinkBreasts could not find any breasts to shrink."); } var oldBoobs = pawn.health.hediffSet.GetFirstHediffOfDef(BreastSize_Helper.GetHediffDef(oldSize)); var newSize = oldSize - 1; var newBoobs = BreastSize_Helper.GetHediffDef(newSize); // I can't figure out how to spawn a stack of 2 meat. for (var i = 0; i < 2; i++) { GenSpawn.Spawn(pawn.RaceProps.meatDef, billDoer.Position, billDoer.Map); } GenderHelper.ChangeSex(pawn, () => { BreastSize_Helper.HurtBreasts(pawn, part, 5); if (pawn.health.hediffSet.PartIsMissing(part)) { return; } pawn.health.RemoveHediff(oldBoobs); pawn.health.AddHediff(newBoobs, part); }); } public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipeDef) { yield break; var chest = Genital_Helper.get_breastsBPR(pawn); if (Genital_Helper.breasts_blocked(pawn)) { yield break; } if (BreastSize_Helper.TryGetBreastSize(pawn, out var size) //&& size > BreastSize_Helper.GetSize(Genital_Helper.flat_breasts)) ) { yield return chest; } } } }
Korth95/rjw
1.4/Source/Recipes/Recipe_ShrinkBreasts.cs
C#
mit
1,755
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_RemoveAnus : Recipe_RemovePart { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { if (Genital_Helper.has_anus(p)) { bool blocked = Genital_Helper.anus_blocked(p) || xxx.is_slime(p);//|| xxx.is_demon(p) foreach (BodyPartRecord part in p.health.hediffSet.GetNotMissingParts()) if (r.appliedOnFixedBodyParts.Contains(part.def) && (!blocked)) yield return part; } } } }
Korth95/rjw
1.4/Source/Recipes/Remove_Part/Recipe_RemoveAnus.cs
C#
mit
542
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_RemoveBreasts : Recipe_RemovePart { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { if (Genital_Helper.has_breasts(p)) { bool blocked = Genital_Helper.breasts_blocked(p) || xxx.is_slime(p);//|| xxx.is_demon(p) foreach (BodyPartRecord part in p.health.hediffSet.GetNotMissingParts()) if (r.appliedOnFixedBodyParts.Contains(part.def) && (!blocked)) yield return part; } } } }
Korth95/rjw
1.4/Source/Recipes/Remove_Part/Recipe_RemoveBreasts.cs
C#
mit
551
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_RemoveGenitals : Recipe_RemovePart { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { if (Genital_Helper.has_genitals(p)) { bool blocked = Genital_Helper.genitals_blocked(p) || xxx.is_slime(p);//|| xxx.is_demon(p) foreach (BodyPartRecord part in p.health.hediffSet.GetNotMissingParts()) if (r.appliedOnFixedBodyParts.Contains(part.def) && (!blocked)) yield return part; } } } }
Korth95/rjw
1.4/Source/Recipes/Remove_Part/Recipe_RemoveGenitals.cs
C#
mit
554
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_RemovePart : rjw_CORE_EXPOSED.Recipe_RemoveBodyPart { // Quick and dirty method to guess whether the player is harvesting the genitals or amputating them // due to infection. The core code can't do this properly because it considers the private part // hediffs as "unclean". public override bool blocked(Pawn p) { return xxx.is_slime(p);//|| xxx.is_demon(p) } public bool is_harvest(Pawn p, BodyPartRecord part) { foreach (Hediff hed in p.health.hediffSet.hediffs) { if ((hed.Part?.def == part.def) && hed.def.isBad && (hed.Severity >= 0.70f)) return false; } return true; } public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { foreach (BodyPartRecord part in base.GetPartsToApplyOn(p, r)) { if (r.appliedOnFixedBodyParts.Contains(part.def) && !blocked(p)) yield return part; } } public override void ApplyOnPawn(Pawn p, BodyPartRecord part, Pawn doer, List<Thing> ingredients, Bill bill) { var har = is_harvest(p, part); base.ApplyOnPawn(p, part, doer, ingredients, bill); if (har) { if (!p.Dead) { //Log.Message("alive harvest " + part); ThoughtUtility.GiveThoughtsForPawnOrganHarvested(p, doer); } else { //Log.Message("dead harvest " + part); ThoughtUtility.GiveThoughtsForPawnExecuted(p, doer, PawnExecutionKind.OrganHarvesting); } } } public override string GetLabelWhenUsedOn(Pawn p, BodyPartRecord part) { return recipe.label.CapitalizeFirst(); } } /* public class Recipe_RemovePenis : Recipe_RemovePart { public override bool blocked(Pawn p) { return (Genital_Helper.genitals_blocked(p) || !(Genital_Helper.has_penis(p) && Genital_Helper.has_penis_infertile(p) && Genital_Helper.has_ovipositorF(p))); } } public class Recipe_RemoveVagina : Recipe_RemovePart { public override bool blocked(Pawn p) { return (Genital_Helper.genitals_blocked(p) || !Genital_Helper.has_vagina(p)); } } public class Recipe_RemoveGenitals : Recipe_RemovePart { public override bool blocked(Pawn p) { return (Genital_Helper.genitals_blocked(p) || !Genital_Helper.has_genitals(p)); } } public class Recipe_RemoveBreasts : Recipe_RemovePart { public override bool blocked(Pawn p) { return (Genital_Helper.breasts_blocked(p) || !Genital_Helper.has_breasts(p)); } } public class Recipe_RemoveAnus : Recipe_RemovePart { public override bool blocked(Pawn p) { return (Genital_Helper.anus_blocked(p) || !Genital_Helper.has_anus(p)); } } */ }
Korth95/rjw
1.4/Source/Recipes/Remove_Part/Recipe_RemovePart.cs
C#
mit
2,701
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_RemovePenis : Recipe_RemovePart { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { if (Genital_Helper.has_penis(p) || Genital_Helper.has_penis_infertile(p) || Genital_Helper.has_ovipositorF(p)) { bool blocked = Genital_Helper.genitals_blocked(p) || xxx.is_slime(p); foreach (var part in p.health.hediffSet.GetNotMissingParts()) if (r.appliedOnFixedBodyParts.Contains(part.def) && (!blocked)) yield return part; } } } }
Korth95/rjw
1.4/Source/Recipes/Remove_Part/Recipe_RemovePenis.cs
C#
mit
595
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_RemoveUdder : Recipe_RemovePart { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { if (Genital_Helper.has_udder(p)) { bool blocked = Genital_Helper.udder_blocked(p) || xxx.is_slime(p);//|| xxx.is_demon(p) foreach (BodyPartRecord part in p.health.hediffSet.GetNotMissingParts()) if (r.appliedOnFixedBodyParts.Contains(part.def) && (!blocked)) yield return part; } } } }
Korth95/rjw
1.4/Source/Recipes/Remove_Part/Recipe_RemoveUdder.cs
C#
mit
546
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_RemoveVagina : Recipe_RemovePart { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { if (Genital_Helper.has_vagina(p) ) { bool blocked = Genital_Helper.genitals_blocked(p) || xxx.is_slime(p); foreach (var part in p.health.hediffSet.GetNotMissingParts()) if (r.appliedOnFixedBodyParts.Contains(part.def) && (!blocked)) yield return part; } } } }
Korth95/rjw
1.4/Source/Recipes/Remove_Part/Recipe_RemoveVagina.cs
C#
mit
520
using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Recipe_MakeFuta : rjw_CORE_EXPOSED.Recipe_AddBodyPart { public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill) { GenderHelper.Sex before = GenderHelper.GetSex(pawn); base.ApplyOnPawn(pawn, part, billDoer, ingredients, bill); GenderHelper.Sex after = GenderHelper.GetSex(pawn); GenderHelper.ChangeSex(pawn, before, after); } } //Female to futa public class Recipe_MakeFutaF : Recipe_MakeFuta { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { var parts = p.GetGenitalsList(); bool blocked = Genital_Helper.genitals_blocked(p) || xxx.is_slime(p); //|| xxx.is_demon(p); bool has_vag = Genital_Helper.has_vagina(p, parts); bool has_cock = Genital_Helper.has_male_bits(p, parts); foreach (BodyPartRecord part in base.GetPartsToApplyOn(p, r)) if (r.appliedOnFixedBodyParts.Contains(part.def) && !blocked && (has_vag && !has_cock)) yield return part; } } //Male to futa public class Recipe_MakeFutaM : Recipe_MakeFuta { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { var parts = p.GetGenitalsList(); bool blocked = Genital_Helper.genitals_blocked(p) || xxx.is_slime(p); //|| xxx.is_demon(p); bool has_vag = Genital_Helper.has_vagina(p, parts); bool has_cock = Genital_Helper.has_male_bits(p, parts); foreach (BodyPartRecord part in base.GetPartsToApplyOn(p, r)) if (r.appliedOnFixedBodyParts.Contains(part.def) && !blocked && (!has_vag && has_cock)) yield return part; } } //TODO: maybe merge with above to make single recipe, but meh for now just copy-paste recipes or some filter to disable multiparts if normal part doesn't exist yet //add multi parts public class Recipe_AddMultiPart : Recipe_MakeFuta { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { //don't add artificial - peg, hydraulics, bionics, archo, ovi if (r.addsHediff.addedPartProps?.solid ?? false) yield break; //don't add if artificial parts present if (p.health.hediffSet.hediffs.Any((Hediff hed) => (hed.Part != null) && r.appliedOnFixedBodyParts.Contains(hed.Part.def) && (hed.def.addedPartProps?.solid ?? false))) yield break; var parts = p.GetGenitalsList(); //don't add if no ovi //if (Genital_Helper.has_ovipositorF(p, parts) || Genital_Helper.has_ovipositorM(p, parts)) // yield break; //don't add if same part type not present yet if (!Genital_Helper.has_vagina(p, parts) && r.defName.ToLower().Contains("vagina")) yield break; if (!Genital_Helper.has_penis_fertile(p, parts) && r.defName.ToLower().Contains("penis")) yield break; //cant install parts when part blocked, on slimes, on demons bool blocked = (xxx.is_slime(p) //|| xxx.is_demon(p) || (Genital_Helper.genitals_blocked(p) && r.appliedOnFixedBodyParts.Contains(xxx.genitalsDef)) || (Genital_Helper.anus_blocked(p) && r.appliedOnFixedBodyParts.Contains(xxx.anusDef)) || (Genital_Helper.breasts_blocked(p) && r.appliedOnFixedBodyParts.Contains(xxx.breastsDef))); foreach (BodyPartRecord part in base.GetPartsToApplyOn(p, r)) if (r.appliedOnFixedBodyParts.Contains(part.def) && !blocked) yield return part; } } public class Recipe_AddSinglePart : Recipe_MakeFuta { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { //cant install parts when part blocked, on slimes, or when already has one bool blocked = xxx.is_slime(p) || p.health.hediffSet.HasHediff(r.addsHediff); foreach (BodyPartRecord part in base.GetPartsToApplyOn(p, r)) if (r.appliedOnFixedBodyParts.Contains(part.def) && !blocked) yield return part; } } public class Recipe_RemoveSinglePart : Recipe_MakeFuta { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { //cant install parts when part blocked, on slimes, or when already has one bool blocked = xxx.is_slime(p) || !p.health.hediffSet.HasHediff(r.removesHediff); foreach (BodyPartRecord part in base.GetPartsToApplyOn(p, r)) if (r.appliedOnFixedBodyParts.Contains(part.def) && !blocked) yield return part; } } }
Korth95/rjw
1.4/Source/Recipes/Transgender/Recipe_MakeFuta.cs
C#
mit
4,364
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using RimWorld; using Verse; namespace rjw { public class PawnRelationWorker_Child_Beast : PawnRelationWorker_Child { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isChildOf(other, me); } } public class PawnRelationWorker_Sibling_Beast : PawnRelationWorker_Sibling { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isSiblingOf(other, me); } } public class PawnRelationWorker_HalfSibling_Beast : PawnRelationWorker_HalfSibling { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isHalfSiblingOf(other, me); } } public class PawnRelationWorker_Grandparent_Beast : PawnRelationWorker_Grandparent { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGrandchildOf(me, other); } } public class PawnRelationWorker_Grandchild_Beast : PawnRelationWorker_Grandchild { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGrandparentOf(me, other); //if other isGrandchildOf of me, me is their grandparent } } public class PawnRelationWorker_NephewOrNiece_Beast : PawnRelationWorker_NephewOrNiece { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isUncleOrAuntOf(me, other); } } public class PawnRelationWorker_UncleOrAunt_Beast : PawnRelationWorker_UncleOrAunt { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isNephewOrNieceOf(me, other); } } public class PawnRelationWorker_Cousin_Beast : PawnRelationWorker_Cousin { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isCousinOf(me, other); } } public class PawnRelationWorker_GreatGrandparent_Beast : PawnRelationWorker_GreatGrandparent { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGreatGrandChildOf(me, other); } } public class PawnRelationWorker_GreatGrandchild_Beast : PawnRelationWorker_GreatGrandchild { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGreatGrandparentOf(me, other); } } public class PawnRelationWorker_GranduncleOrGrandaunt_Beast : PawnRelationWorker_GranduncleOrGrandaunt { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGrandnephewOrGrandnieceOf(me, other); } } public class PawnRelationWorker_GrandnephewOrGrandniece_Beast : PawnRelationWorker_GrandnephewOrGrandniece { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGreatUncleOrAuntOf(me, other); } } public class PawnRelationWorker_CousinOnceRemoved_Beast : PawnRelationWorker_CousinOnceRemoved { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isCousinOnceRemovedOf(me, other); } } public class PawnRelationWorker_SecondCousin_Beast : PawnRelationWorker_SecondCousin { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isSecondCousinOf(me, other); } } /* public class PawnRelationWorker_Kin_Beast : PawnRelationWorker_Kin { public override bool InRelation(Pawn me, Pawn other) { if (!xxx.is_animal(other) || me == other) { return false; } if (base.InRelation(me, other) == true) { return true; } return false; } } */ }
Korth95/rjw
1.4/Source/Relations/BeastPawnRelationWorkers.cs
C#
mit
4,540
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using RimWorld; using Verse; namespace rjw { public class PawnRelationWorker_Child_Humanlike : PawnRelationWorker_Child { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } if (base.InRelation(me, other) == true) { return true; } return false; } } public class PawnRelationWorker_Sibling_Humanlike : PawnRelationWorker_Sibling { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } if (base.InRelation(me, other) == true) { return true; } return false; } } public class PawnRelationWorker_HalfSibling_Humanlike : PawnRelationWorker_HalfSibling { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isHalfSiblingOf(other, me); } } public class PawnRelationWorker_Grandparent_Humanlike : PawnRelationWorker_Grandparent { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGrandchildOf(me, other); } } public class PawnRelationWorker_Grandchild_Humanlike : PawnRelationWorker_Grandchild { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGrandparentOf(me, other); } } public class PawnRelationWorker_NephewOrNiece_Humanlike : PawnRelationWorker_NephewOrNiece { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isUncleOrAuntOf(me, other); } } public class PawnRelationWorker_UncleOrAunt_Humanlike : PawnRelationWorker_UncleOrAunt { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isNephewOrNieceOf(me, other); } } public class PawnRelationWorker_Cousin_Humanlike : PawnRelationWorker_Cousin { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isCousinOf(me, other); } } public class PawnRelationWorker_GreatGrandparent_Humanlike : PawnRelationWorker_GreatGrandparent { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGreatGrandChildOf(me, other); } } public class PawnRelationWorker_GreatGrandchild_Humanlike : PawnRelationWorker_GreatGrandchild { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGreatGrandparentOf(me, other); } } public class PawnRelationWorker_GranduncleOrGrandaunt_Humanlike : PawnRelationWorker_GranduncleOrGrandaunt { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGrandnephewOrGrandnieceOf(me, other); } } public class PawnRelationWorker_GrandnephewOrGrandniece_Humanlike : PawnRelationWorker_GrandnephewOrGrandniece { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isGreatUncleOrAuntOf(me, other); } } public class PawnRelationWorker_CousinOnceRemoved_Humanlike : PawnRelationWorker_CousinOnceRemoved { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isCousinOnceRemovedOf(me, other); } } public class PawnRelationWorker_SecondCousin_Humanlike : PawnRelationWorker_SecondCousin { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } return RelationChecker.isSecondCousinOf(me, other); } } public class PawnRelationWorker_Kin_Humanlike : PawnRelationWorker_Kin { public override bool InRelation(Pawn me, Pawn other) { if (xxx.is_animal(other) || me == other) { return false; } if (base.InRelation(me, other) == true) { return true; } return false; } } }
Korth95/rjw
1.4/Source/Relations/HumanlikeBloodRelationWorkers.cs
C#
mit
4,596
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using RimWorld; using Verse; namespace rjw { /// <summary> /// Checks for relations, workaround for relation checks that rely on other relation checks, since the vanilla inRelation checks have been prefixed. /// /// Return true if first pawn is specified relation of the second pawn /// /// If "me" isRelationOf "other" return true /// </summary> /// public static class RelationChecker { public static bool isChildOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if (me.GetMother() != other) { return me.GetFather() == other; } //else "other" is mother return true; } public static bool isSiblingOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if (me.GetMother() != null && me.GetFather() != null && me.GetMother() == other.GetMother() && me.GetFather() == other.GetFather()) { return true; } return false; } public static bool isHalfSiblingOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if (isSiblingOf(me, other)) { return false; } return ((me.GetMother() != null && me.GetMother() == other.GetMother()) || (me.GetFather() != null && me.GetFather() == other.GetFather())); } public static bool isAnySiblingOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if ((me.GetMother() != null && me.GetMother() == other.GetMother()) || (me.GetFather() != null && me.GetFather() == other.GetFather())) { return true; } return false; } public static bool isGrandchildOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if ((me.GetMother() != null && isChildOf(me.GetMother(), other)) || (me.GetFather() != null && isChildOf(me.GetFather(), other))) { return true; } return false; } public static bool isGrandparentOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if (isGrandchildOf(other, me)) { return true; } return false; } public static bool isNephewOrNieceOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if ((me.GetMother() != null && (isAnySiblingOf(other, me.GetMother()))) || (me.GetFather() != null && (isAnySiblingOf(other, me.GetFather())))) { return true; } return false; } public static bool isUncleOrAuntOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if (isNephewOrNieceOf(other, me)) { return true; } return false; } public static bool isCousinOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if ((other.GetMother() != null && isNephewOrNieceOf(me, other.GetMother())) || (other.GetFather() != null && isNephewOrNieceOf(me, other.GetFather()))) { return true; } return false; } public static bool isGreatGrandparentOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } return isGreatGrandChildOf(other, me); } public static bool isGreatGrandChildOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if ((me.GetMother() != null && isGrandchildOf(me.GetMother(), other)) || (me.GetFather() != null && isGrandchildOf(me.GetFather(), other))) { return true; } return false; } public static bool isGreatUncleOrAuntOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } return isGrandnephewOrGrandnieceOf(other, me); } public static bool isGrandnephewOrGrandnieceOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if ((me.GetMother() != null && isUncleOrAuntOf(other, me.GetMother())) || (me.GetFather() != null && isUncleOrAuntOf(other, me.GetFather()))) { return true; } return false; } public static bool isCousinOnceRemovedOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } if ((other.GetMother() != null && isCousinOf(me, other.GetMother())) || (other.GetFather() != null && isCousinOf(me, other.GetFather()))) { return true; } if ((other.GetMother() != null && isGrandnephewOrGrandnieceOf(me, other.GetMother())) || (other.GetFather() != null && isGrandnephewOrGrandnieceOf(me, other.GetFather()))) { return true; } return false; } public static bool isSecondCousinOf(Pawn me, Pawn other) { if (me == null || me == other) { return false; } PawnRelationWorker worker = PawnRelationDefOf.GranduncleOrGrandaunt.Worker; Pawn mother = other.GetMother(); if (mother != null && ((mother.GetMother() != null && isGrandnephewOrGrandnieceOf(me, mother.GetMother())) || (mother.GetFather() != null && isGrandnephewOrGrandnieceOf(me, mother.GetFather())))) { return true; } Pawn father = other.GetFather(); if (father != null && ((father.GetMother() != null && isGrandnephewOrGrandnieceOf(me, father.GetMother())) || (father.GetFather() != null && isGrandnephewOrGrandnieceOf(me, father.GetFather())))) { return true; } return false; } } }
Korth95/rjw
1.4/Source/Relations/RelationChecker.cs
C#
mit
5,373
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <ProjectGuid>{22F82FFF-8BD4-4CEE-9F22-C7DA71281E72}</ProjectGuid> <OutputType>Library</OutputType> <NoStandardLibraries>false</NoStandardLibraries> <AssemblyName>RJW</AssemblyName> <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <TargetFrameworkProfile /> <ShouldCreateLogs>True</ShouldCreateLogs> <AdvancedSettingsExpanded>True</AdvancedSettingsExpanded> <UpdateAssemblyVersion>True</UpdateAssemblyVersion> <UpdateAssemblyFileVersion>True</UpdateAssemblyFileVersion> <UpdateAssemblyInfoVersion>True</UpdateAssemblyInfoVersion> <AssemblyVersionSettings>None.None.IncrementOnDemand.Increment</AssemblyVersionSettings> <AssemblyFileVersionSettings>None.None.IncrementOnDemand.None</AssemblyFileVersionSettings> <AssemblyInfoVersionSettings>None.None.IncrementOnDemand.None</AssemblyInfoVersionSettings> <PrimaryVersionType>AssemblyVersionAttribute</PrimaryVersionType> <AssemblyVersion>1.6.0.493</AssemblyVersion> <LangVersion>10</LangVersion> <NuGetPackageImportStamp> </NuGetPackageImportStamp> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <DebugSymbols>true</DebugSymbols> <DebugType>full</DebugType> <Optimize>false</Optimize> <OutputPath>..\Assemblies\</OutputPath> <DefineConstants>TRACE;DEBUG</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <FileAlignment>4096</FileAlignment> <Prefer32Bit>false</Prefer32Bit> </PropertyGroup> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <DebugType>none</DebugType> <Optimize>true</Optimize> <OutputPath>..\Assemblies\</OutputPath> <DefineConstants>TRACE</DefineConstants> <ErrorReport>prompt</ErrorReport> <WarningLevel>4</WarningLevel> <LangVersion>latest</LangVersion> <Prefer32Bit>false</Prefer32Bit> </PropertyGroup> <!-- Set the `BENCHMARK` environment variable to "1" to enable benchmarking. --> <PropertyGroup Condition="'$(BENCHMARK)' == '1'"> <DefineConstants>$(DefineConstants);BENCHMARK</DefineConstants> </PropertyGroup> <PropertyGroup> <RootNamespace>rjw</RootNamespace> </PropertyGroup> <Choose> <!-- Mod-folder Relative --> <When Condition="Exists('..\..\..\..\Mods')"> <PropertyGroup> <RWPath>..\..\..\..</RWPath> </PropertyGroup> </When> <!-- Windows x86 --> <When Condition="Exists('C:\Program Files (x86)\Steam\steamapps\common\RimWorld')"> <PropertyGroup> <RWPath>C:\Program Files (x86)\Steam\steamapps\common\RimWorld</RWPath> </PropertyGroup> </When> <!-- Windows x64 --> <When Condition="Exists('C:\Program Files\Steam\steamapps\common\RimWorld')"> <PropertyGroup> <RWPath>C:\Program Files\Steam\steamapps\common\RimWorld</RWPath> </PropertyGroup> </When> <!-- Linux --> <When Condition="Exists('$(HOME)\.steam\steam')"> <PropertyGroup> <RWPath>$(HOME)\.steam\steam\steamapps\common\RimWorld</RWPath> </PropertyGroup> </When> <!-- MacOS --> <When Condition="Exists('$(HOME)\Library\Application Support\Steam')"> <PropertyGroup> <RWPath>$(HOME)\Library\Application Support\Steam\steamapps\common\RimWorld</RWPath> </PropertyGroup> </When> <!-- Fallback option: define the RIMWORLD environment variable, pointing to RimWorld's install folder --> <When Condition="Exists('$(RIMWORLD)')"> <PropertyGroup> <RWPath>$(RIMWORLD)</RWPath> </PropertyGroup> </When> </Choose> <PropertyGroup> <ReferencePath> $(RWPath)\RimWorldWin_Data\Managed; $(RWPath)\RimWorldWin64_Data\Managed; $(RWPath)\RimWorldLinux_Data\Managed; $(RWPath)\RimWorldMac.app\Contents\Resources\Data\Managed; $(ReferencePath) </ReferencePath> </PropertyGroup> <!-- Prevents copying DLLs on build. --> <!-- If you do still get copies, wipe out the `obj` folder and re-run the `restore` task. --> <!-- You can do this on the command line with: `msbuild /t:restore` --> <ItemDefinitionGroup> <Reference><Private>False</Private></Reference> <ProjectReference><Private>False</Private></ProjectReference> <PackageReference><ExcludeAssets>runtime</ExcludeAssets></PackageReference> </ItemDefinitionGroup> <ItemGroup> <Compile Include=".\**\*.cs" /> <!-- Ignore files in `obj`; they'll be included else where, as needed. --> <Compile Remove=".\obj\**\*.cs" /> <!-- Things in trash are in trash for a reason, I presume. Maybe delete them? --> <Compile Remove=".\0trash\**\*.cs" /> <!-- Exclude files not currently in use here. --> <!-- Better yet, clean up your garbage. If we need it again, Git keeps a copy for us. --> <Compile Remove=".\Common\ExpandedPawnCharacterCard.cs" /> <Compile Remove=".\Common\Verb_Fuck.cs" /> <Compile Remove=".\Common\CORE_EXPOSED\HealthCardUtility.cs" /> <Compile Remove=".\JobDrivers\JobRJWSex.cs" /> <Compile Remove=".\JobDrivers\JobDriver_AbortMechPregnancy.cs" /> <Compile Remove=".\RJWTab\PawnColumnWorker_Master.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_BestialityForFemale.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_Quickie.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_ViolateCorpse.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_BestialityForMale.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_Masturbate_Quick.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_RapeEnemy.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_BestialityF.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_Rape.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_Sex.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_CleanSexStuff.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_RapeCP.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_Masturbate_Bed.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_BestialityM.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_Solicit.cs" /> <Compile Remove=".\WorkGivers\WorkGiver_Masturbate_Chair.cs" /> <Compile Remove=".\Harmony\patch_PartIsMissing.cs" /> <Compile Remove=".\Harmony\d.cs" /> <Compile Remove=".\Harmony\patch_need.cs" /> <Compile Remove=".\Harmony\test.cs" /> <Compile Remove=".\Harmony\patch_CnPBnC.cs" /> <Compile Remove=".\Harmony\Building_Bed_Patch.cs" /> <Compile Remove=".\Harmony\CnPcompatibility.cs" /> <Compile Remove=".\Harmony\patch_AnimalTab.cs" /> <Compile Remove=".\DefOf\RJW_RecipeDefOf.cs" /> <Compile Remove=".\DefOf\JobDriver_AdjustParts.cs" /> <Compile Remove=".\DefOf\JobDefOf.cs" /> <Compile Remove=".\Modules\Bondage\Comps\CompCryptoStamped.cs" /> <Compile Remove=".\Modules\Genitals\Enums\LewdablePartKind.cs" /> <Compile Remove=".\Recipes\Install_Part\Recipe_InstallGenitals.cs" /> <Compile Remove=".\Recipes\Install_Part\Recipe_InstallBreasts.cs" /> <Compile Remove=".\Recipes\Install_Part\Recipe_InstallAnus.cs" /> <Compile Remove=".\Recipes\Recipe_ShrinkBreasts.cs" /> <Compile Remove=".\Recipes\Recipe_GrowBreasts.cs" /> <Compile Remove=".\Recipes\Remove_Part\Recipe_RemovePenis.cs" /> <Compile Remove=".\Recipes\Remove_Part\Recipe_RemoveVagina.cs" /> </ItemGroup> <ItemGroup> <Reference Include="0MultiplayerAPI, Version=0.3.0.0, Culture=neutral, processorArchitecture=MSIL"> <HintPath>0trash\packages\RimWorld.MultiplayerAPI.0.3.0\lib\net472\0MultiplayerAPI.dll</HintPath> </Reference> <Reference Include="Psychology"> <HintPath>0trash\modpackages\Psychology.2018-11-18\Assemblies\Psychology.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="RimWorldChildren"> <HintPath>0trash\modpackages\ChildrenAndPregnancy.0.4e\Assemblies\RimWorldChildren.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="SyrTraits"> <HintPath>0trash\modpackages\SYR.Individuality.1.1.7\1.1\Assemblies\SyrTraits.dll</HintPath> <Private>False</Private> </Reference> <Reference Include="System" /> <Reference Include="System.Runtime.InteropServices.RuntimeInformation" /> <!-- RimWorld references --> <Reference Include="Assembly-CSharp" /> <Reference Include="ISharpZipLib" /> <Reference Include="Unity.TextMeshPro" /> <Reference Include="UnityEngine.AIModule" /> <Reference Include="UnityEngine.AccessibilityModule" /> <Reference Include="UnityEngine.AndroidJNIModule" /> <Reference Include="UnityEngine.AnimationModule" /> <Reference Include="UnityEngine.AssetBundleModule" /> <Reference Include="UnityEngine.AudioModule" /> <Reference Include="UnityEngine.ClothModule" /> <Reference Include="UnityEngine.ClusterInputModule" /> <Reference Include="UnityEngine.ClusterRendererModule" /> <Reference Include="UnityEngine.CoreModule" /> <Reference Include="UnityEngine.CrashReportingModule" /> <Reference Include="UnityEngine.DSPGraphModule" /> <Reference Include="UnityEngine.DirectorModule" /> <Reference Include="UnityEngine.GameCenterModule" /> <Reference Include="UnityEngine.GridModule" /> <Reference Include="UnityEngine.HotReloadModule" /> <Reference Include="UnityEngine.IMGUIModule" /> <Reference Include="UnityEngine.ImageConversionModule" /> <Reference Include="UnityEngine.InputLegacyModule" /> <Reference Include="UnityEngine.InputModule" /> <Reference Include="UnityEngine.JSONSerializeModule" /> <Reference Include="UnityEngine.LocalizationModule" /> <Reference Include="UnityEngine.ParticleSystemModule" /> <Reference Include="UnityEngine.PerformanceReportingModule" /> <Reference Include="UnityEngine.Physics2DModule" /> <Reference Include="UnityEngine.PhysicsModule" /> <Reference Include="UnityEngine.ProfilerModule" /> <Reference Include="UnityEngine.ScreenCaptureModule" /> <Reference Include="UnityEngine.SharedInternalsModule" /> <Reference Include="UnityEngine.SpriteMaskModule" /> <Reference Include="UnityEngine.SpriteShapeModule" /> <Reference Include="UnityEngine.StreamingModule" /> <Reference Include="UnityEngine.SubstanceModule" /> <Reference Include="UnityEngine.TLSModule" /> <Reference Include="UnityEngine.TerrainModule" /> <Reference Include="UnityEngine.TerrainPhysicsModule" /> <Reference Include="UnityEngine.TextCoreModule" /> <Reference Include="UnityEngine.TextRenderingModule" /> <Reference Include="UnityEngine.TilemapModule" /> <Reference Include="UnityEngine.UI" /> <Reference Include="UnityEngine.UIElementsModule" /> <Reference Include="UnityEngine.UIModule" /> <Reference Include="UnityEngine.UNETModule" /> <Reference Include="UnityEngine.UmbraModule" /> <Reference Include="UnityEngine.UnityAnalyticsModule" /> <Reference Include="UnityEngine.UnityConnectModule" /> <Reference Include="UnityEngine.UnityTestProtocolModule" /> <Reference Include="UnityEngine.UnityWebRequestAssetBundleModule" /> <Reference Include="UnityEngine.UnityWebRequestAudioModule" /> <Reference Include="UnityEngine.UnityWebRequestModule" /> <Reference Include="UnityEngine.UnityWebRequestTextureModule" /> <Reference Include="UnityEngine.UnityWebRequestWWWModule" /> <Reference Include="UnityEngine.VFXModule" /> <Reference Include="UnityEngine.VRModule" /> <Reference Include="UnityEngine.VehiclesModule" /> <Reference Include="UnityEngine.VideoModule" /> <Reference Include="UnityEngine.WindModule" /> <Reference Include="UnityEngine.XRModule" /> <Reference Include="UnityEngine" /> <!-- The following are not available on all platforms, IE Linux. --> <!-- <Reference Include="UnityEngine.ARModule" /> --> <!-- <Reference Include="NAudio" /> --> <!-- <Reference Include="NVorbis" /> --> <!-- end RimWorld references --> </ItemGroup> <ItemGroup> <PackageReference Include="Lib.Harmony" Version="2.2.2" /> <PackageReference Include="UnlimitedHugs.Rimworld.HugsLib" Version="10.0.1" /> </ItemGroup> <ItemGroup /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio AllowExistingFolder="true" /> </ProjectExtensions> </Project>
Korth95/rjw
1.4/Source/RimJobWorld.Main.csproj
csproj
mit
12,680
Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.27130.2024 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RimJobWorld.Main", "RimJobWorld.Main.csproj", "{22F82FFF-8BD4-4CEE-9F22-C7DA71281E72}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {22F82FFF-8BD4-4CEE-9F22-C7DA71281E72}.Debug|Any CPU.ActiveCfg = Release|Any CPU {22F82FFF-8BD4-4CEE-9F22-C7DA71281E72}.Debug|Any CPU.Build.0 = Release|Any CPU {22F82FFF-8BD4-4CEE-9F22-C7DA71281E72}.Release|Any CPU.ActiveCfg = Release|Any CPU {22F82FFF-8BD4-4CEE-9F22-C7DA71281E72}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {16BA61E5-4C97-4E73-926D-6718DE8E4776} EndGlobalSection EndGlobal
Korth95/rjw
1.4/Source/RimJobWorld.Main.sln
sln
mit
1,105
using System; using UnityEngine; using Verse; using System.Collections.Generic; namespace rjw { public class RJWDebugSettings : ModSettings { private static Vector2 scrollPosition; private static float height_modifier = 0f; public static void DoWindowContents(Rect inRect) { Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f); Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + height_modifier); Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect); // scroll Listing_Standard listingStandard = new Listing_Standard(); listingStandard.maxOneColumn = true; listingStandard.ColumnWidth = viewRect.width / 2.05f; listingStandard.Begin(viewRect); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("submit_button_enabled".Translate(), ref RJWSettings.submit_button_enabled, "submit_button_enabled_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("RJW_designation_box".Translate(), ref RJWSettings.show_RJW_designation_box, "RJW_designation_box_desc".Translate()); listingStandard.Gap(5f); if (listingStandard.ButtonText("Rjw Parts " + RJWSettings.ShowRjwParts)) { Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>() { new FloatMenuOption("Extended", (() => RJWSettings.ShowRjwParts = RJWSettings.ShowParts.Extended)), new FloatMenuOption("Show", (() => RJWSettings.ShowRjwParts = RJWSettings.ShowParts.Show)), //new FloatMenuOption("Known".Translate(), (() => RJWSettings.ShowRjwParts = RJWSettings.ShowParts.Known)), new FloatMenuOption("Hide", (() => RJWSettings.ShowRjwParts = RJWSettings.ShowParts.Hide)) })); } listingStandard.Gap(30f); GUI.contentColor = Color.yellow; listingStandard.Label("YOU PATHETIC CHEATER "); GUI.contentColor = Color.white; listingStandard.CheckboxLabeled("override_RJW_designation_checks_name".Translate(), ref RJWSettings.override_RJW_designation_checks, "override_RJW_designation_checks_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("override_control".Translate(), ref RJWSettings.override_control, "override_control_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("AddTrait_Rapist".Translate(), ref RJWSettings.AddTrait_Rapist, "AddTrait_Rapist_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("AddTrait_Masocist".Translate(), ref RJWSettings.AddTrait_Masocist, "AddTrait_Masocist_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("AddTrait_Nymphomaniac".Translate(), ref RJWSettings.AddTrait_Nymphomaniac, "AddTrait_Nymphomaniac_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("AddTrait_Necrophiliac".Translate(), ref RJWSettings.AddTrait_Necrophiliac, "AddTrait_Necrophiliac_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("AddTrait_Nerves".Translate(), ref RJWSettings.AddTrait_Nerves, "AddTrait_Nerves_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("AddTrait_Zoophiliac".Translate(), ref RJWSettings.AddTrait_Zoophiliac, "AddTrait_Zoophiliac_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("AddTrait_FootSlut".Translate(), ref RJWSettings.AddTrait_FootSlut, "AddTrait_FootSlut_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("AddTrait_CumSlut".Translate(), ref RJWSettings.AddTrait_CumSlut, "AddTrait_CumSlut_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("AddTrait_ButtSlut".Translate(), ref RJWSettings.AddTrait_ButtSlut, "AddTrait_ButtSlut_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("Allow_RMB_DeepTalk".Translate(), ref RJWSettings.Allow_RMB_DeepTalk, "Allow_RMB_DeepTalk_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("Disable_bestiality_pregnancy_relations".Translate(), ref RJWSettings.Disable_bestiality_pregnancy_relations, "Disable_bestiality_pregnancy_relations_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("Disable_egg_pregnancy_relations".Translate(), ref RJWSettings.Disable_egg_pregnancy_relations, "Disable_egg_pregnancy_relations_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("Disable_MeditationFocusDrain".Translate(), ref RJWSettings.Disable_MeditationFocusDrain, "Disable_MeditationFocusDrain_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("Disable_RecreationDrain".Translate(), ref RJWSettings.Disable_RecreationDrain, "Disable_RecreationDrain_desc".Translate()); listingStandard.Gap(5f); listingStandard.NewColumn(); listingStandard.Gap(4f); GUI.contentColor = Color.yellow; listingStandard.CheckboxLabeled("designated_freewill".Translate(), ref RJWSettings.designated_freewill, "designated_freewill_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("override_lovin".Translate(), ref RJWSettings.override_lovin, "override_lovin_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("override_matin".Translate(), ref RJWSettings.override_matin, "override_matin_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("matin_crossbreed".Translate(), ref RJWSettings.matin_crossbreed, "matin_crossbreed_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("DevMode_name".Translate(), ref RJWSettings.DevMode, "DevMode_desc".Translate()); listingStandard.Gap(5f); if (RJWSettings.DevMode) { listingStandard.CheckboxLabeled("WildMode_name".Translate(), ref RJWSettings.WildMode, "WildMode_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("HippieMode_name".Translate(), ref RJWSettings.HippieMode, "HippieMode_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("DebugLogJoinInBed".Translate(), ref RJWSettings.DebugLogJoinInBed, "DebugLogJoinInBed_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("DebugRape".Translate(), ref RJWSettings.DebugRape, "DebugRape_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("DebugInteraction".Translate(), ref RJWSettings.DebugInteraction, "DebugInteraction_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("DebugNymph".Translate(), ref RJWSettings.DebugNymph, "DebugNymph_desc".Translate()); listingStandard.Gap(5f); } else { RJWSettings.DebugLogJoinInBed = false; RJWSettings.DebugRape = false; } listingStandard.CheckboxLabeled("GenderlessAsFuta_name".Translate(), ref RJWSettings.GenderlessAsFuta, "GenderlessAsFuta_desc".Translate()); listingStandard.Gap(5f); GUI.contentColor = Color.white; listingStandard.Gap(30f); listingStandard.Label("maxDistanceCellsCasual_name".Translate() + ": " + (RJWSettings.maxDistanceCellsCasual), -1f, "maxDistanceCellsCasual_desc".Translate()); RJWSettings.maxDistanceCellsCasual = listingStandard.Slider((int)RJWSettings.maxDistanceCellsCasual, 0, 10000); listingStandard.Label("maxDistanceCellsRape_name".Translate() + ": " + (RJWSettings.maxDistanceCellsRape), -1f, "maxDistanceCellsRape_desc".Translate()); RJWSettings.maxDistanceCellsRape = listingStandard.Slider((int)RJWSettings.maxDistanceCellsRape, 0, 10000); listingStandard.Label("maxDistancePathCost_name".Translate() + ": " + (RJWSettings.maxDistancePathCost), -1f, "maxDistancePathCost_desc".Translate()); RJWSettings.maxDistancePathCost = listingStandard.Slider((int)RJWSettings.maxDistancePathCost, 0, 5000); listingStandard.End(); height_modifier = listingStandard.CurHeight; Widgets.EndScrollView(); } public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref RJWSettings.submit_button_enabled, "submit_button_enabled", RJWSettings.submit_button_enabled, true); Scribe_Values.Look(ref RJWSettings.show_RJW_designation_box, "show_RJW_designation_box", RJWSettings.show_RJW_designation_box, true); Scribe_Values.Look(ref RJWSettings.ShowRjwParts, "ShowRjwParts", RJWSettings.ShowRjwParts, true); Scribe_Values.Look(ref RJWSettings.maxDistanceCellsCasual, "maxDistanceCellsCasual", RJWSettings.maxDistanceCellsCasual, true); Scribe_Values.Look(ref RJWSettings.maxDistanceCellsRape, "maxDistanceCellsRape", RJWSettings.maxDistanceCellsRape, true); Scribe_Values.Look(ref RJWSettings.maxDistancePathCost, "maxDistancePathCost", RJWSettings.maxDistancePathCost, true); Scribe_Values.Look(ref RJWSettings.AddTrait_Rapist, "AddTrait_Rapist", RJWSettings.AddTrait_Rapist, true); Scribe_Values.Look(ref RJWSettings.AddTrait_Masocist, "AddTrait_Masocist", RJWSettings.AddTrait_Masocist, true); Scribe_Values.Look(ref RJWSettings.AddTrait_Nymphomaniac, "AddTrait_Nymphomaniac", RJWSettings.AddTrait_Nymphomaniac, true); Scribe_Values.Look(ref RJWSettings.AddTrait_Necrophiliac, "AddTrait_Necrophiliac", RJWSettings.AddTrait_Necrophiliac, true); Scribe_Values.Look(ref RJWSettings.AddTrait_Nerves, "AddTrait_Nerves", RJWSettings.AddTrait_Nerves, true); Scribe_Values.Look(ref RJWSettings.AddTrait_Zoophiliac, "AddTrait_Zoophiliac", RJWSettings.AddTrait_Zoophiliac, true); Scribe_Values.Look(ref RJWSettings.AddTrait_FootSlut, "AddTrait_FootSlut", RJWSettings.AddTrait_FootSlut, true); Scribe_Values.Look(ref RJWSettings.AddTrait_CumSlut, "AddTrait_CumSlut", RJWSettings.AddTrait_CumSlut, true); Scribe_Values.Look(ref RJWSettings.AddTrait_ButtSlut, "AddTrait_ButtSlut", RJWSettings.AddTrait_ButtSlut, true); Scribe_Values.Look(ref RJWSettings.Allow_RMB_DeepTalk, "Allow_RMB_DeepTalk", RJWSettings.Allow_RMB_DeepTalk, true); Scribe_Values.Look(ref RJWSettings.Allow_RMB_DeepTalk, "Allow_RMB_DeepTalk", RJWSettings.Allow_RMB_DeepTalk, true); Scribe_Values.Look(ref RJWSettings.Disable_bestiality_pregnancy_relations, "Disable_bestiality_pregnancy_relations", RJWSettings.Disable_bestiality_pregnancy_relations, true); Scribe_Values.Look(ref RJWSettings.Disable_egg_pregnancy_relations, "Disable_egg_pregnancy_relations", RJWSettings.Disable_egg_pregnancy_relations, true); Scribe_Values.Look(ref RJWSettings.Disable_MeditationFocusDrain, "Disable_MeditationFocusDrain", RJWSettings.Disable_MeditationFocusDrain, true); Scribe_Values.Look(ref RJWSettings.Disable_RecreationDrain, "Disable_RecreationDrain", RJWSettings.Disable_RecreationDrain, true); Scribe_Values.Look(ref RJWSettings.GenderlessAsFuta, "GenderlessAsFuta", RJWSettings.GenderlessAsFuta, true); Scribe_Values.Look(ref RJWSettings.override_lovin, "override_lovin", RJWSettings.override_lovin, true); Scribe_Values.Look(ref RJWSettings.override_matin, "override_matin", RJWSettings.override_matin, true); Scribe_Values.Look(ref RJWSettings.matin_crossbreed, "matin_crossbreed", RJWSettings.matin_crossbreed, true); Scribe_Values.Look(ref RJWSettings.WildMode, "Wildmode", RJWSettings.WildMode, true); Scribe_Values.Look(ref RJWSettings.HippieMode, "Hippiemode", RJWSettings.HippieMode, true); Scribe_Values.Look(ref RJWSettings.override_RJW_designation_checks, "override_RJW_designation_checks", RJWSettings.override_RJW_designation_checks, true); Scribe_Values.Look(ref RJWSettings.override_control, "override_control", RJWSettings.override_control, true); Scribe_Values.Look(ref RJWSettings.DevMode, "DevMode", RJWSettings.DevMode, true); Scribe_Values.Look(ref RJWSettings.DebugLogJoinInBed, "DebugLogJoinInBed", RJWSettings.DebugLogJoinInBed, true); Scribe_Values.Look(ref RJWSettings.DebugRape, "DebugRape", RJWSettings.DebugRape, true); Scribe_Values.Look(ref RJWSettings.DebugInteraction, "DebugInteraction", RJWSettings.DebugInteraction, true); Scribe_Values.Look(ref RJWSettings.DebugNymph, "DebugNymph", RJWSettings.DebugNymph, true); } } }
Korth95/rjw
1.4/Source/Settings/RJWDebugSettings.cs
C#
mit
12,065
using System; using UnityEngine; using Verse; namespace rjw { public class RJWHookupSettings : ModSettings { public static bool HookupsEnabled = true; public static bool QuickHookupsEnabled = true; public static bool NoHookupsDuringWorkHours = true; public static bool ColonistsCanHookup = true; public static bool ColonistsCanHookupWithVisitor = false; public static bool CanHookupWithPrisoner = false; public static bool VisitorsCanHookupWithColonists = false; public static bool VisitorsCanHookupWithVisitors = true; public static bool PrisonersCanHookupWithNonPrisoner = false; public static bool PrisonersCanHookupWithPrisoner = true; public static float HookupChanceForNonNymphos = 0.3f; public static float MinimumFuckabilityToHookup = 0.1f; public static float MinimumAttractivenessToHookup = 0.5f; public static float MinimumRelationshipToHookup = 20f; //public static bool NymphosCanPickAnyone = true; public static bool NymphosCanCheat = true; public static bool NymphosCanHomewreck = true; public static bool NymphosCanHomewreckReverse = true; private static Vector2 scrollPosition; private static float height_modifier = 0f; public static void DoWindowContents(Rect inRect) { MinimumFuckabilityToHookup = Mathf.Clamp(MinimumFuckabilityToHookup, 0.1f, 1f); MinimumAttractivenessToHookup = Mathf.Clamp(MinimumAttractivenessToHookup, 0.0f, 1f); MinimumRelationshipToHookup = Mathf.Clamp(MinimumRelationshipToHookup, -100, 100); Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f); Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + height_modifier); Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect); // scroll Listing_Standard listingStandard = new Listing_Standard(); listingStandard.maxOneColumn = true; listingStandard.ColumnWidth = viewRect.width / 2.05f; listingStandard.Begin(viewRect); listingStandard.Gap(4f); // Casual sex settings listingStandard.CheckboxLabeled("SettingHookupsEnabled".Translate(), ref HookupsEnabled, "SettingHookupsEnabled_desc".Translate()); if(HookupsEnabled) listingStandard.CheckboxLabeled("SettingQuickHookupsEnabled".Translate(), ref QuickHookupsEnabled, "SettingQuickHookupsEnabled_desc".Translate()); listingStandard.CheckboxLabeled("SettingNoHookupsDuringWorkHours".Translate(), ref NoHookupsDuringWorkHours, "SettingNoHookupsDuringWorkHours_desc".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("SettingColonistsCanHookup".Translate(), ref ColonistsCanHookup, "SettingColonistsCanHookup_desc".Translate()); listingStandard.CheckboxLabeled("SettingColonistsCanHookupWithVisitor".Translate(), ref ColonistsCanHookupWithVisitor, "SettingColonistsCanHookupWithVisitor_desc".Translate()); listingStandard.CheckboxLabeled("SettingVisitorsCanHookupWithColonists".Translate(), ref VisitorsCanHookupWithColonists, "SettingVisitorsCanHookupWithColonists_desc".Translate()); listingStandard.CheckboxLabeled("SettingVisitorsCanHookupWithVisitors".Translate(), ref VisitorsCanHookupWithVisitors, "SettingVisitorsCanHookupWithVisitors_desc".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("SettingPrisonersCanHookupWithNonPrisoner".Translate(), ref PrisonersCanHookupWithNonPrisoner, "SettingPrisonersCanHookupWithNonPrisoner_desc".Translate()); listingStandard.CheckboxLabeled("SettingPrisonersCanHookupWithPrisoner".Translate(), ref PrisonersCanHookupWithPrisoner, "SettingPrisonersCanHookupWithPrisoner_desc".Translate()); listingStandard.CheckboxLabeled("SettingCanHookupWithPrisoner".Translate(), ref CanHookupWithPrisoner, "SettingCanHookupWithPrisoner_desc".Translate()); listingStandard.Gap(10f); //listingStandard.CheckboxLabeled("SettingNymphosCanPickAnyone".Translate(), ref NymphosCanPickAnyone, "SettingNymphosCanPickAnyone_desc".Translate()); listingStandard.CheckboxLabeled("SettingNymphosCanCheat".Translate(), ref NymphosCanCheat, "SettingNymphosCanCheat_desc".Translate()); listingStandard.CheckboxLabeled("SettingNymphosCanHomewreck".Translate(), ref NymphosCanHomewreck, "SettingNymphosCanHomewreck_desc".Translate()); listingStandard.CheckboxLabeled("SettingNymphosCanHomewreckReverse".Translate(), ref NymphosCanHomewreckReverse, "SettingNymphosCanHomewreckReverse_desc".Translate()); listingStandard.Gap(10f); listingStandard.Label("SettingHookupChanceForNonNymphos".Translate() + ": " + (int)(HookupChanceForNonNymphos * 100) + "%", -1f, "SettingHookupChanceForNonNymphos_desc".Translate()); HookupChanceForNonNymphos = listingStandard.Slider(HookupChanceForNonNymphos, 0.0f, 1.0f); listingStandard.Label("SettingMinimumFuckabilityToHookup".Translate() + ": " + (int)(MinimumFuckabilityToHookup * 100) + "%", -1f, "SettingMinimumFuckabilityToHookup_desc".Translate()); MinimumFuckabilityToHookup = listingStandard.Slider(MinimumFuckabilityToHookup, 0.1f, 1.0f); // Minimum must be above 0.0 to avoid breaking SexAppraiser.would_fuck()'s hard-failure cases that return 0f listingStandard.Label("SettingMinimumAttractivenessToHookup".Translate() + ": " + (int)(MinimumAttractivenessToHookup * 100) + "%", -1f, "SettingMinimumAttractivenessToHookup_desc".Translate()); MinimumAttractivenessToHookup = listingStandard.Slider(MinimumAttractivenessToHookup, 0.0f, 1.0f); listingStandard.Label("SettingMinimumRelationshipToHookup".Translate() + ": " + (MinimumRelationshipToHookup), -1f, "SettingMinimumRelationshipToHookup_desc".Translate()); MinimumRelationshipToHookup = listingStandard.Slider((int)MinimumRelationshipToHookup, -100f, 100f); listingStandard.NewColumn(); listingStandard.Gap(4f); listingStandard.End(); height_modifier = listingStandard.CurHeight; Widgets.EndScrollView(); } public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref HookupsEnabled, "SettingHookupsEnabled"); Scribe_Values.Look(ref QuickHookupsEnabled, "SettingQuickHookupsEnabled"); Scribe_Values.Look(ref NoHookupsDuringWorkHours, "NoHookupsDuringWorkHours"); Scribe_Values.Look(ref ColonistsCanHookup, "SettingColonistsCanHookup"); Scribe_Values.Look(ref ColonistsCanHookupWithVisitor, "SettingColonistsCanHookupWithVisitor"); Scribe_Values.Look(ref VisitorsCanHookupWithColonists, "SettingVisitorsCanHookupWithColonists"); Scribe_Values.Look(ref VisitorsCanHookupWithVisitors, "SettingVisitorsCanHookupWithVisitors"); // Prisoner settings Scribe_Values.Look(ref CanHookupWithPrisoner, "SettingCanHookupWithPrisoner"); Scribe_Values.Look(ref PrisonersCanHookupWithNonPrisoner, "SettingPrisonersCanHookupWithNonPrisoner"); Scribe_Values.Look(ref PrisonersCanHookupWithPrisoner, "SettingPrisonersCanHookupWithPrisoner"); // Nympho settings //Scribe_Values.Look(ref NymphosCanPickAnyone, "SettingNymphosCanPickAnyone"); Scribe_Values.Look(ref NymphosCanCheat, "SettingNymphosCanCheat"); Scribe_Values.Look(ref NymphosCanHomewreck, "SettingNymphosCanHomewreck"); Scribe_Values.Look(ref NymphosCanHomewreckReverse, "SettingNymphosCanHomewreckReverse"); Scribe_Values.Look(ref HookupChanceForNonNymphos, "SettingHookupChanceForNonNymphos"); Scribe_Values.Look(ref MinimumFuckabilityToHookup, "SettingMinimumFuckabilityToHookup"); Scribe_Values.Look(ref MinimumAttractivenessToHookup, "SettingMinimumAttractivenessToHookup"); Scribe_Values.Look(ref MinimumRelationshipToHookup, "SettingMinimumRelationshipToHookup"); } } }
Korth95/rjw
1.4/Source/Settings/RJWHookupSettings.cs
C#
mit
7,542
using System; using UnityEngine; using Verse; namespace rjw { public class RJWPregnancySettings : ModSettings { public static bool humanlike_pregnancy_enabled = true; public static bool animal_pregnancy_enabled = true; public static bool animal_pregnancy_notifications_enabled = true; public static bool bestial_pregnancy_enabled = true; public static bool insect_pregnancy_enabled = true; public static bool insect_anal_pregnancy_enabled = false; public static bool insect_oral_pregnancy_enabled = false; public static bool egg_pregnancy_implant_anyone = true; public static bool egg_pregnancy_fertilize_anyone = false; public static bool egg_pregnancy_genes = true; public static bool egg_pregnancy_fertOrificeCheck_enabled = true; public static float egg_pregnancy_eggs_size = 1.0f; public static float egg_pregnancy_ovipositor_capacity_factor = 1f; public static bool safer_mechanoid_pregnancy = false; public static bool mechanoid_pregnancy_enabled = true; public static bool use_parent_method = true; public static float humanlike_DNA_from_mother = 0.5f; public static float bestiality_DNA_inheritance = 0.5f; // human/beast slider public static float bestial_DNA_from_mother = 1.0f; // mother/father slider public static bool complex_interspecies = false; public static int animal_impregnation_chance = 25; public static int humanlike_impregnation_chance = 25; public static float interspecies_impregnation_modifier = 0.2f; public static float fertility_endage_male = 1.2f; public static float fertility_endage_female_humanlike = 0.58f; public static float fertility_endage_female_animal = 0.96f; public static bool phantasy_pregnancy = false; public static float normal_pregnancy_duration = 1.0f; public static float egg_pregnancy_duration = 1.0f; public static float max_num_momtraits_inherited = 3.0f; public static float max_num_poptraits_inherited = 3.0f; private static bool useVanillaPregnancy = true; public static bool UseVanillaPregnancy => useVanillaPregnancy && ModsConfig.BiotechActive; private static Vector2 scrollPosition; private static float height_modifier = 0f; public static void DoWindowContents(Rect inRect) { Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f); Rect viewRect = new Rect(0f, 30f, inRect.width - 16f, inRect.height + height_modifier); Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect); Listing_Standard listingStandard = new Listing_Standard(); listingStandard.maxOneColumn = true; listingStandard.ColumnWidth = viewRect.width / 2.05f; listingStandard.Begin(viewRect); listingStandard.Gap(4f); listingStandard.CheckboxLabeled("RJWH_pregnancy".Translate(), ref humanlike_pregnancy_enabled, "RJWH_pregnancy_desc".Translate()); listingStandard.Gap(5f); if (ModsConfig.BiotechActive) { listingStandard.CheckboxLabeled("UseVanillaPregnancy".Translate(), ref useVanillaPregnancy, "UseVanillaPregnancy_desc".Translate()); listingStandard.Gap(5f); } listingStandard.CheckboxLabeled("RJWA_pregnancy".Translate(), ref animal_pregnancy_enabled, "RJWA_pregnancy_desc".Translate()); if (animal_pregnancy_enabled) { listingStandard.Gap(3f); listingStandard.CheckboxLabeled(" " + "RJWA_pregnancy_notifications".Translate(), ref animal_pregnancy_notifications_enabled, "RJWA_pregnancy_notifications_desc".Translate()); } listingStandard.Gap(5f); listingStandard.CheckboxLabeled("RJWB_pregnancy".Translate(), ref bestial_pregnancy_enabled, "RJWB_pregnancy_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("RJWI_pregnancy".Translate(), ref insect_pregnancy_enabled, "RJWI_pregnancy_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("egg_pregnancy_implant_anyone".Translate(), ref egg_pregnancy_implant_anyone, "egg_pregnancy_implant_anyone_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("egg_pregnancy_fertilize_anyone".Translate(), ref egg_pregnancy_fertilize_anyone, "egg_pregnancy_fertilize_anyone_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("egg_pregnancy_genes".Translate(), ref egg_pregnancy_genes, "egg_pregnancy_genes_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("RJWI_analPregnancy".Translate(), ref insect_anal_pregnancy_enabled, "RJWI_analPregnancy_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("RJWI_oralPregnancy".Translate(), ref insect_oral_pregnancy_enabled, "RJWI_oralPregnancy_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("RJWI_FertilizationCheck".Translate(), ref egg_pregnancy_fertOrificeCheck_enabled, "RJWI_FertilizationCheck_desc".Translate()); listingStandard.Gap(5f); listingStandard.Gap(5f); int eggs_size = (int)(egg_pregnancy_eggs_size * 100); listingStandard.Label("egg_pregnancy_eggs_size".Translate() + ": " + eggs_size + "%", -1f, "egg_pregnancy_eggs_size_desc".Translate()); egg_pregnancy_eggs_size = listingStandard.Slider(egg_pregnancy_eggs_size, 0.0f, 1.0f); int ovipositor_capacity_factor_percentage = (int)(egg_pregnancy_ovipositor_capacity_factor * 100); listingStandard.Label("egg_pregnancy_ovipositor_capacity_factor".Translate() + ": " + ovipositor_capacity_factor_percentage + "%", -1, "egg_pregnancy_ovipositor_capacity_factor_desc".Translate()); // Note: Choose the domain any wider and a different input method has to be used or the slider width has to be increased! egg_pregnancy_ovipositor_capacity_factor = listingStandard.Slider(egg_pregnancy_ovipositor_capacity_factor, .1f, 5f); listingStandard.Gap(12f); listingStandard.CheckboxLabeled("UseParentMethod".Translate(), ref use_parent_method, "UseParentMethod_desc".Translate()); listingStandard.Gap(5f); if (use_parent_method) { if (humanlike_DNA_from_mother == 0.0f) { listingStandard.Label(" " + "OffspringLookLikeTheirMother".Translate() + ": " + "AlwaysFather".Translate(), -1f, "OffspringLookLikeTheirMother_desc".Translate()); humanlike_DNA_from_mother = listingStandard.Slider(humanlike_DNA_from_mother, 0.0f, 1.0f); } else if (humanlike_DNA_from_mother == 1.0f) { listingStandard.Label(" " + "OffspringLookLikeTheirMother".Translate() + ": " + "AlwaysMother".Translate(), -1f, "OffspringLookLikeTheirMother_desc".Translate()); humanlike_DNA_from_mother = listingStandard.Slider(humanlike_DNA_from_mother, 0.0f, 1.0f); } else { int value = (int)(humanlike_DNA_from_mother * 100); listingStandard.Label(" " + "OffspringLookLikeTheirMother".Translate() + ": " + value + "%", -1f, "OffspringLookLikeTheirMother_desc".Translate()); humanlike_DNA_from_mother = listingStandard.Slider(humanlike_DNA_from_mother, 0.0f, 1.0f); } if (bestial_DNA_from_mother == 0.0f) { listingStandard.Label(" " + "OffspringIsHuman".Translate() + ": " + "AlwaysFather".Translate(), -1f, "OffspringIsHuman_desc".Translate()); bestial_DNA_from_mother = listingStandard.Slider(bestial_DNA_from_mother, 0.0f, 1.0f); } else if (bestial_DNA_from_mother == 1.0f) { listingStandard.Label(" " + "OffspringIsHuman".Translate() + ": " + "AlwaysMother".Translate(), -1f, "OffspringIsHuman_desc".Translate()); bestial_DNA_from_mother = listingStandard.Slider(bestial_DNA_from_mother, 0.0f, 1.0f); } else { int value = (int)(bestial_DNA_from_mother * 100); listingStandard.Label(" " + "OffspringIsHuman".Translate() + ": " + value + "%", -1f, "OffspringIsHuman_desc".Translate()); bestial_DNA_from_mother = listingStandard.Slider(bestial_DNA_from_mother, 0.0f, 1.0f); } if (bestiality_DNA_inheritance == 0.0f) { listingStandard.Label(" " + "OffspringIsHuman2".Translate() + ": " + "AlwaysBeast".Translate(), -1f, "OffspringIsHuman2_desc".Translate()); bestiality_DNA_inheritance = listingStandard.Slider(bestiality_DNA_inheritance, 0.0f, 1.0f); } else if (bestiality_DNA_inheritance == 1.0f) { listingStandard.Label(" " + "OffspringIsHuman2".Translate() + ": " + "AlwaysHumanlike".Translate(), -1f, "OffspringIsHuman2_desc".Translate()); bestiality_DNA_inheritance = listingStandard.Slider(bestiality_DNA_inheritance, 0.0f, 1.0f); } else { listingStandard.Label(" " + "OffspringIsHuman2".Translate() + ": " + "UsesOffspringIsHuman".Translate(), -1f, "OffspringIsHuman2_desc".Translate()); bestiality_DNA_inheritance = listingStandard.Slider(bestiality_DNA_inheritance, 0.0f, 1.0f); } } else humanlike_DNA_from_mother = 100; listingStandard.Gap(5f); listingStandard.Label("max_num_momtraits_inherited".Translate() + ": " + (int)(max_num_momtraits_inherited)); max_num_momtraits_inherited = listingStandard.Slider(max_num_momtraits_inherited, 0.0f, 9.0f); listingStandard.Gap(5f); listingStandard.Label("max_num_poptraits_inherited".Translate() + ": " + (int)(max_num_poptraits_inherited)); max_num_poptraits_inherited = listingStandard.Slider(max_num_poptraits_inherited, 0.0f, 9.0f); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("MechanoidImplanting".Translate(), ref mechanoid_pregnancy_enabled, "MechanoidImplanting_desc".Translate()); listingStandard.Gap(5f); if (mechanoid_pregnancy_enabled) { listingStandard.CheckboxLabeled("SaferMechanoidImplanting".Translate(), ref safer_mechanoid_pregnancy, "SaferMechanoidImplanting_desc".Translate()); listingStandard.Gap(5f); } listingStandard.CheckboxLabeled("ComplexImpregnation".Translate(), ref complex_interspecies, "ComplexImpregnation_desc".Translate()); listingStandard.Gap(10f); GUI.contentColor = Color.cyan; listingStandard.Label("Base pregnancy chances:"); listingStandard.Gap(5f); if (humanlike_pregnancy_enabled) listingStandard.Label(" Humanlike/Humanlike (same race): " + humanlike_impregnation_chance + "%"); else listingStandard.Label(" Humanlike/Humanlike (same race): -DISABLED-"); if (humanlike_pregnancy_enabled && !(humanlike_impregnation_chance * interspecies_impregnation_modifier <= 0.0f) && !complex_interspecies) listingStandard.Label(" Humanlike/Humanlike (different race): " + Math.Round(humanlike_impregnation_chance * interspecies_impregnation_modifier, 1) + "%"); else if (complex_interspecies) listingStandard.Label(" Humanlike/Humanlike (different race): -DEPENDS ON SPECIES-"); else listingStandard.Label(" Humanlike/Humanlike (different race): -DISABLED-"); if (animal_pregnancy_enabled) listingStandard.Label(" Animal/Animal (same race): " + animal_impregnation_chance + "%"); else listingStandard.Label(" Animal/Animal (same race): -DISABLED-"); if (animal_pregnancy_enabled && !(animal_impregnation_chance * interspecies_impregnation_modifier <= 0.0f) && !complex_interspecies) listingStandard.Label(" Animal/Animal (different race): " + Math.Round(animal_impregnation_chance * interspecies_impregnation_modifier, 1) + "%"); else if (complex_interspecies) listingStandard.Label(" Animal/Animal (different race): -DEPENDS ON SPECIES-"); else listingStandard.Label(" Animal/Animal (different race): -DISABLED-"); if (RJWSettings.bestiality_enabled && bestial_pregnancy_enabled && !(animal_impregnation_chance * interspecies_impregnation_modifier <= 0.0f) && !complex_interspecies) listingStandard.Label(" Humanlike/Animal: " + Math.Round(animal_impregnation_chance * interspecies_impregnation_modifier, 1) + "%"); else if (complex_interspecies) listingStandard.Label(" Humanlike/Animal: -DEPENDS ON SPECIES-"); else listingStandard.Label(" Humanlike/Animal: -DISABLED-"); if (RJWSettings.bestiality_enabled && bestial_pregnancy_enabled && !(animal_impregnation_chance * interspecies_impregnation_modifier <= 0.0f) && !complex_interspecies) listingStandard.Label(" Animal/Humanlike: " + Math.Round(humanlike_impregnation_chance * interspecies_impregnation_modifier, 1) + "%"); else if (complex_interspecies) listingStandard.Label(" Animal/Humanlike: -DEPENDS ON SPECIES-"); else listingStandard.Label(" Animal/Humanlike: -DISABLED-"); GUI.contentColor = Color.white; listingStandard.NewColumn(); listingStandard.Gap(4f); listingStandard.Label("PregnantCoeffecientForHuman".Translate() + ": " + humanlike_impregnation_chance + "%", -1f, "PregnantCoeffecientForHuman_desc".Translate()); humanlike_impregnation_chance = (int)listingStandard.Slider(humanlike_impregnation_chance, 0.0f, 100f); listingStandard.Label("PregnantCoeffecientForAnimals".Translate() + ": " + animal_impregnation_chance + "%", -1f, "PregnantCoeffecientForAnimals_desc".Translate()); animal_impregnation_chance = (int)listingStandard.Slider(animal_impregnation_chance, 0.0f, 100f); if (!complex_interspecies) { switch (interspecies_impregnation_modifier) { case 0.0f: GUI.contentColor = Color.grey; listingStandard.Label("InterspeciesImpregnantionModifier".Translate() + ": " + "InterspeciesDisabled".Translate(), -1f, "InterspeciesImpregnantionModifier_desc".Translate()); GUI.contentColor = Color.white; break; case 1.0f: GUI.contentColor = Color.cyan; listingStandard.Label("InterspeciesImpregnantionModifier".Translate() + ": " + "InterspeciesMaximum".Translate(), -1f, "InterspeciesImpregnantionModifier_desc".Translate()); GUI.contentColor = Color.white; break; default: listingStandard.Label("InterspeciesImpregnantionModifier".Translate() + ": " + Math.Round(interspecies_impregnation_modifier * 100, 1) + "%", -1f, "InterspeciesImpregnantionModifier_desc".Translate()); break; } interspecies_impregnation_modifier = listingStandard.Slider(interspecies_impregnation_modifier, 0.0f, 1.0f); } listingStandard.Label("RJW_fertility_endAge_male".Translate() + ": " + (int)(fertility_endage_male * 80) + "In_human_years".Translate(), -1f, "RJW_fertility_endAge_male_desc".Translate()); fertility_endage_male = listingStandard.Slider(fertility_endage_male, 0.1f, 3.0f); listingStandard.Label("RJW_fertility_endAge_female_humanlike".Translate() + ": " + (int)(fertility_endage_female_humanlike * 80) + "In_human_years".Translate(), -1f, "RJW_fertility_endAge_female_humanlike_desc".Translate()); fertility_endage_female_humanlike = listingStandard.Slider(fertility_endage_female_humanlike, 0.1f, 3.0f); listingStandard.Label("RJW_fertility_endAge_female_animal".Translate() + ": " + (int)(fertility_endage_female_animal * 100) + "XofLifeExpectancy".Translate(), -1f, "RJW_fertility_endAge_female_animal_desc".Translate()); fertility_endage_female_animal = listingStandard.Slider(fertility_endage_female_animal, 0.1f, 3.0f); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("phantasy_pregnancy".Translate(), ref phantasy_pregnancy, "phantasy_pregnancy_desc".Translate()); listingStandard.Gap(5f); listingStandard.Label("normal_pregnancy_duration".Translate() + ": " + (int)(normal_pregnancy_duration * 100) + "%", -1f, "normal_pregnancy_duration_desc".Translate()); normal_pregnancy_duration = listingStandard.Slider(normal_pregnancy_duration, 0.05f, 2.0f); listingStandard.Gap(5f); listingStandard.Label("egg_pregnancy_duration".Translate() + ": " + (int)(egg_pregnancy_duration * 100) + "%", -1f, "egg_pregnancy_duration_desc".Translate()); egg_pregnancy_duration = listingStandard.Slider(egg_pregnancy_duration, 0.05f, 2.0f); listingStandard.Gap(5f); listingStandard.End(); height_modifier = listingStandard.CurHeight; Widgets.EndScrollView(); } public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref humanlike_pregnancy_enabled, "humanlike_pregnancy_enabled", humanlike_pregnancy_enabled, true); Scribe_Values.Look(ref useVanillaPregnancy, "useVanillaPregnancy", useVanillaPregnancy, true); Scribe_Values.Look(ref animal_pregnancy_enabled, "animal_enabled", animal_pregnancy_enabled, true); Scribe_Values.Look(ref animal_pregnancy_notifications_enabled, "animal_notifications_enabled", animal_pregnancy_notifications_enabled, true); Scribe_Values.Look(ref bestial_pregnancy_enabled, "bestial_pregnancy_enabled", bestial_pregnancy_enabled, true); Scribe_Values.Look(ref insect_pregnancy_enabled, "insect_pregnancy_enabled", insect_pregnancy_enabled, true); Scribe_Values.Look(ref insect_anal_pregnancy_enabled, "insect_anal_pregnancy_enabled", insect_anal_pregnancy_enabled, true); Scribe_Values.Look(ref insect_oral_pregnancy_enabled, "insect_oral_pregnancy_enabled", insect_oral_pregnancy_enabled, true); Scribe_Values.Look(ref egg_pregnancy_implant_anyone, "egg_pregnancy_implant_anyone", egg_pregnancy_implant_anyone, true); Scribe_Values.Look(ref egg_pregnancy_fertilize_anyone, "egg_pregnancy_fertilize_anyone", egg_pregnancy_fertilize_anyone, true); Scribe_Values.Look(ref egg_pregnancy_genes, "egg_pregnancy_genes", egg_pregnancy_genes, true); Scribe_Values.Look(ref egg_pregnancy_fertOrificeCheck_enabled, "egg_pregnancy_fertOrificeCheck_enabled", egg_pregnancy_fertOrificeCheck_enabled, true); Scribe_Values.Look(ref egg_pregnancy_eggs_size, "egg_pregnancy_eggs_size", egg_pregnancy_eggs_size, true); Scribe_Values.Look(ref egg_pregnancy_ovipositor_capacity_factor, "egg_pregnancy_ovipositor_capacity_factor", egg_pregnancy_ovipositor_capacity_factor, true); Scribe_Values.Look(ref mechanoid_pregnancy_enabled, "mechanoid_enabled", mechanoid_pregnancy_enabled, true); Scribe_Values.Look(ref safer_mechanoid_pregnancy, "safer_mechanoid_pregnancy", safer_mechanoid_pregnancy, true); Scribe_Values.Look(ref use_parent_method, "use_parent_method", use_parent_method, true); Scribe_Values.Look(ref humanlike_DNA_from_mother, "humanlike_DNA_from_mother", humanlike_DNA_from_mother, true); Scribe_Values.Look(ref bestial_DNA_from_mother, "bestial_DNA_from_mother", bestial_DNA_from_mother, true); Scribe_Values.Look(ref bestiality_DNA_inheritance, "bestiality_DNA_inheritance", bestiality_DNA_inheritance, true); Scribe_Values.Look(ref humanlike_impregnation_chance, "humanlike_impregnation_chance", humanlike_impregnation_chance, true); Scribe_Values.Look(ref animal_impregnation_chance, "animal_impregnation_chance", animal_impregnation_chance, true); Scribe_Values.Look(ref interspecies_impregnation_modifier, "interspecies_impregnation_chance", interspecies_impregnation_modifier, true); Scribe_Values.Look(ref complex_interspecies, "complex_interspecies", complex_interspecies, true); Scribe_Values.Look(ref fertility_endage_male, "RJW_fertility_endAge_male", fertility_endage_male, true); Scribe_Values.Look(ref fertility_endage_female_humanlike, "fertility_endage_female_humanlike", fertility_endage_female_humanlike, true); Scribe_Values.Look(ref fertility_endage_female_animal, "fertility_endage_female_animal", fertility_endage_female_animal, true); Scribe_Values.Look(ref phantasy_pregnancy, "phantasy_pregnancy", phantasy_pregnancy, true); Scribe_Values.Look(ref normal_pregnancy_duration, "normal_pregnancy_duration", normal_pregnancy_duration, true); Scribe_Values.Look(ref egg_pregnancy_duration, "egg_pregnancy_duration", egg_pregnancy_duration, true); Scribe_Values.Look(ref max_num_momtraits_inherited, "max_num_momtraits_inherited", max_num_momtraits_inherited, true); Scribe_Values.Look(ref max_num_poptraits_inherited, "max_num_poptraits_inherited", max_num_poptraits_inherited, true); } } }
Korth95/rjw
1.4/Source/Settings/RJWPregnancySettings.cs
C#
mit
19,708
using System; using UnityEngine; using Verse; namespace rjw { public class RJWSettings : ModSettings { public static bool animal_on_animal_enabled = false; public static bool bestiality_enabled = false; public static bool necrophilia_enabled = false; private static bool overdrive = false; public static bool rape_enabled = false; public static bool designated_freewill = true; public static bool animal_CP_rape = false; public static bool visitor_CP_rape = false; public static bool colonist_CP_rape = false; public static bool rape_beating = false; public static bool gentle_rape_beating = false; public static bool rape_stripping = false; public static bool cum_filth = true; public static bool sounds_enabled = true; public static float sounds_sex_volume = 1.0f; public static float sounds_cum_volume = 1.0f; public static float sounds_voice_volume = 1.0f; public static float sounds_orgasm_volume = 1.0f; public static float sounds_animal_on_animal_volume = 0.5f; public static bool NymphTamed = false; public static bool NymphWild = true; public static bool NymphRaidEasy = false; public static bool NymphRaidHard = false; public static bool NymphRaidRP = false; public static bool NymphPermanentManhunter = false; public static bool NymphSappers = true; public static bool NymphFrustratedRape = true; public static bool FemaleFuta = false; public static bool MaleTrap = false; public static float male_nymph_chance = 0.0f; public static float futa_nymph_chance = 0.0f; public static float futa_natives_chance = 0.0f; public static float futa_spacers_chance = 0.5f; public static bool sexneed_fix = true; public static float sexneed_decay_rate = 1.0f; public static int Animal_mating_cooldown = 0; public static float nonFutaWomenRaping_MaxVulnerability = 0.8f; public static float rapee_MinVulnerability_human = 1.2f; public static bool RPG_hero_control = false; public static bool RPG_hero_control_HC = false; public static bool RPG_hero_control_Ironman = false; public static bool submit_button_enabled = true; public static bool show_RJW_designation_box = false; public static ShowParts ShowRjwParts = ShowParts.Show; public static float maxDistanceCellsCasual = 100; public static float maxDistanceCellsRape = 100; public static float maxDistancePathCost = 1000; public static bool WildMode = false; public static bool HippieMode = false; public static bool override_RJW_designation_checks = false; public static bool override_control = false; public static bool override_lovin = true; public static bool override_matin = true; public static bool matin_crossbreed = false; public static bool GenderlessAsFuta = false; public static bool DevMode = false; public static bool DebugLogJoinInBed = false; public static bool DebugRape = false; public static bool DebugInteraction = false; public static bool DebugNymph = false; public static bool AddTrait_Rapist = true; public static bool AddTrait_Masocist = true; public static bool AddTrait_Nymphomaniac = true; public static bool AddTrait_Necrophiliac = true; public static bool AddTrait_Nerves = true; public static bool AddTrait_Zoophiliac = true; public static bool AddTrait_FootSlut = true; public static bool AddTrait_CumSlut = true; public static bool AddTrait_ButtSlut = true; public static bool Allow_RMB_DeepTalk = false; public static bool Disable_bestiality_pregnancy_relations = false; public static bool Disable_egg_pregnancy_relations = false; public static bool Disable_MeditationFocusDrain = false; public static bool Disable_RecreationDrain = false; public static bool UseAdvancedAgeScaling = true; public static bool AllowYouthSex = true; public static bool sendTraitGainLetters = true; private static Vector2 scrollPosition; private static float height_modifier = 300f; public enum ShowParts { Extended, Show, Known, Hide }; public static void DoWindowContents(Rect inRect) { sexneed_decay_rate = Mathf.Clamp(sexneed_decay_rate, 0.0f, 10000.0f); nonFutaWomenRaping_MaxVulnerability = Mathf.Clamp(nonFutaWomenRaping_MaxVulnerability, 0.0f, 3.0f); rapee_MinVulnerability_human = Mathf.Clamp(rapee_MinVulnerability_human, 0.0f, 3.0f); Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f); Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + height_modifier); Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect); // scroll Listing_Standard listingStandard = new Listing_Standard(); listingStandard.maxOneColumn = true; listingStandard.ColumnWidth = viewRect.width / 2.05f; listingStandard.Begin(viewRect); listingStandard.Gap(4f); listingStandard.CheckboxLabeled("animal_on_animal_enabled".Translate(), ref animal_on_animal_enabled, "animal_on_animal_enabled_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("bestiality_enabled".Translate(), ref bestiality_enabled, "bestiality_enabled_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("necrophilia_enabled".Translate(), ref necrophilia_enabled, "necrophilia_enabled_desc".Translate()); listingStandard.Gap(10f); listingStandard.CheckboxLabeled("rape_enabled".Translate(), ref rape_enabled, "rape_enabled_desc".Translate()); if (rape_enabled) { listingStandard.Gap(3f); listingStandard.CheckboxLabeled(" " + "rape_stripping".Translate(), ref rape_stripping, "rape_stripping_desc".Translate()); listingStandard.Gap(3f); listingStandard.CheckboxLabeled(" " + "ColonistCanCP".Translate(), ref colonist_CP_rape, "ColonistCanCP_desc".Translate()); listingStandard.Gap(3f); listingStandard.CheckboxLabeled(" " + "VisitorsCanCP".Translate(), ref visitor_CP_rape, "VisitorsCanCP_desc".Translate()); listingStandard.Gap(3f); //if (!bestiality_enabled) //{ // GUI.contentColor = Color.grey; // animal_CP_rape = false; //} //listingStandard.CheckboxLabeled(" " + "AnimalsCanCP".Translate(), ref animal_CP_rape, "AnimalsCanCP_desc".Translate()); //if (!bestiality_enabled) // GUI.contentColor = Color.white; listingStandard.Gap(3f); listingStandard.CheckboxLabeled(" " + "PrisonersBeating".Translate(), ref rape_beating, "PrisonersBeating_desc".Translate()); listingStandard.Gap(3f); listingStandard.CheckboxLabeled(" " + "GentlePrisonersBeating".Translate(), ref gentle_rape_beating, "GentlePrisonersBeating_desc".Translate()); } else { colonist_CP_rape = false; visitor_CP_rape = false; animal_CP_rape = false; rape_beating = false; } listingStandard.Gap(10f); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("cum_filth".Translate(), ref cum_filth, "cum_filth_desc".Translate()); listingStandard.Gap(5f); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("sounds_enabled".Translate(), ref sounds_enabled, "sounds_enabled_desc".Translate()); if (sounds_enabled) { listingStandard.Label("sounds_sex_volume".Translate() + ": " + Math.Round(sounds_sex_volume * 100f, 0) + "%", -1f, "sounds_sex_volume_desc".Translate()); sounds_sex_volume = listingStandard.Slider(sounds_sex_volume, 0f, 2f); listingStandard.Label("sounds_cum_volume".Translate() + ": " + Math.Round(sounds_cum_volume * 100f, 0) + "%", -1f, "sounds_cum_volume_desc".Translate()); sounds_cum_volume = listingStandard.Slider(sounds_cum_volume, 0f, 2f); listingStandard.Label("sounds_voice_volume".Translate() + ": " + Math.Round(sounds_voice_volume * 100f, 0) + "%", -1f, "sounds_voice_volume_desc".Translate()); sounds_voice_volume = listingStandard.Slider(sounds_voice_volume, 0f, 2f); listingStandard.Label("sounds_orgasm_volume".Translate() + ": " + Math.Round(sounds_orgasm_volume * 100f, 0) + "%", -1f, "sounds_orgasm_volume_desc".Translate()); sounds_orgasm_volume = listingStandard.Slider(sounds_orgasm_volume, 0f, 2f); listingStandard.Label("sounds_animal_on_animal_volume".Translate() + ": " + Math.Round(sounds_animal_on_animal_volume * 100f, 0) + "%", -1f, "sounds_animal_on_animal_volume_desc".Translate()); sounds_animal_on_animal_volume = listingStandard.Slider(sounds_animal_on_animal_volume, 0f, 2f); } listingStandard.Gap(10f); listingStandard.CheckboxLabeled("RPG_hero_control_name".Translate(), ref RPG_hero_control, "RPG_hero_control_desc".Translate()); listingStandard.Gap(5f); if (RPG_hero_control) { listingStandard.CheckboxLabeled("RPG_hero_control_HC_name".Translate(), ref RPG_hero_control_HC, "RPG_hero_control_HC_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("RPG_hero_control_Ironman_name".Translate(), ref RPG_hero_control_Ironman, "RPG_hero_control_Ironman_desc".Translate()); listingStandard.Gap(5f); } else { RPG_hero_control_HC = false; RPG_hero_control_Ironman = false; } listingStandard.Gap(10f); listingStandard.CheckboxLabeled("UseAdvancedAgeScaling".Translate(), ref UseAdvancedAgeScaling, "UseAdvancedAgeScaling_desc".Translate()); listingStandard.CheckboxLabeled("AllowYouthSex".Translate(), ref AllowYouthSex, "AllowYouthSex_desc".Translate()); listingStandard.NewColumn(); listingStandard.Gap(4f); GUI.contentColor = Color.white; if (sexneed_decay_rate < 2.5f) { overdrive = false; listingStandard.Label("sexneed_decay_rate_name".Translate() + ": " + Math.Round(sexneed_decay_rate * 100f, 0) + "%", -1f, "sexneed_decay_rate_desc".Translate()); sexneed_decay_rate = listingStandard.Slider(sexneed_decay_rate, 0.0f, 5.0f); } else if (sexneed_decay_rate <= 5.0f && !overdrive) { GUI.contentColor = Color.yellow; listingStandard.Label("sexneed_decay_rate_name".Translate() + ": " + Math.Round(sexneed_decay_rate * 100f, 0) + "% [Not recommended]", -1f, "sexneed_decay_rate_desc".Translate()); sexneed_decay_rate = listingStandard.Slider(sexneed_decay_rate, 0.0f, 5.0f); if (sexneed_decay_rate == 5.0f) { GUI.contentColor = Color.red; if (listingStandard.ButtonText("OVERDRIVE")) overdrive = true; } GUI.contentColor = Color.white; } else { GUI.contentColor = Color.red; listingStandard.Label("sexneed_decay_rate_name".Translate() + ": " + Math.Round(sexneed_decay_rate * 100f, 0) + "% [WARNING: UNSAFE]", -1f, "sexneed_decay_rate_desc".Translate()); GUI.contentColor = Color.white; sexneed_decay_rate = listingStandard.Slider(sexneed_decay_rate, 0.0f, 10000.0f); } listingStandard.Gap(5f); listingStandard.CheckboxLabeled("sexneed_fix_name".Translate(), ref sexneed_fix, "sexneed_fix_desc".Translate()); listingStandard.Gap(5f); listingStandard.Label("Animal_mating_cooldown".Translate() + ": " + Animal_mating_cooldown + "h", -1f, "Animal_mating_cooldown_desc".Translate()); Animal_mating_cooldown = (int)listingStandard.Slider(Animal_mating_cooldown, 0, 100); listingStandard.Gap(5f); if (rape_enabled) { listingStandard.Label("NonFutaWomenRaping_MaxVulnerability".Translate() + ": " + (int)(nonFutaWomenRaping_MaxVulnerability * 100), -1f, "NonFutaWomenRaping_MaxVulnerability_desc".Translate()); nonFutaWomenRaping_MaxVulnerability = listingStandard.Slider(nonFutaWomenRaping_MaxVulnerability, 0.0f, 3.0f); listingStandard.Label("Rapee_MinVulnerability_human".Translate() + ": " + (int)(rapee_MinVulnerability_human * 100), -1f, "Rapee_MinVulnerability_human_desc".Translate()); rapee_MinVulnerability_human = listingStandard.Slider(rapee_MinVulnerability_human, 0.0f, 3.0f); } listingStandard.Gap(20f); listingStandard.CheckboxLabeled("NymphTamed".Translate(), ref NymphTamed, "NymphTamed_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("NymphWild".Translate(), ref NymphWild, "NymphWild_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("NymphRaidEasy".Translate(), ref NymphRaidEasy, "NymphRaidEasy_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("NymphRaidHard".Translate(), ref NymphRaidHard, "NymphRaidHard_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("NymphRaidRP".Translate(), ref NymphRaidRP, "NymphRaidRP_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("NymphPermanentManhunter".Translate(), ref NymphPermanentManhunter, "NymphPermanentManhunter_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("NymphSappers".Translate(), ref NymphSappers, "NymphSappers_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("NymphFrustratedRape".Translate(), ref NymphFrustratedRape, "NymphFrustratedRape_desc".Translate()); listingStandard.Gap(5f); // Save compatibility check for 1.9.7 // This can probably be safely removed at a later date, I doubt many players use old saves for long. if (male_nymph_chance > 1.0f || futa_nymph_chance > 1.0f || futa_natives_chance > 1.0f || futa_spacers_chance > 1.0f) { male_nymph_chance = 0.0f; futa_nymph_chance = 0.0f; futa_natives_chance = 0.0f; futa_spacers_chance = 0.0f; } listingStandard.CheckboxLabeled("FemaleFuta".Translate(), ref FemaleFuta, "FemaleFuta_desc".Translate()); listingStandard.CheckboxLabeled("MaleTrap".Translate(), ref MaleTrap, "MaleTrap_desc".Translate()); listingStandard.Label("male_nymph_chance".Translate() + ": " + (int)(male_nymph_chance * 100) + "%", -1f, "male_nymph_chance_desc".Translate()); male_nymph_chance = listingStandard.Slider(male_nymph_chance, 0.0f, 1.0f); if (FemaleFuta || MaleTrap) { listingStandard.Label("futa_nymph_chance".Translate() + ": " + (int)(futa_nymph_chance * 100) + "%", -1f, "futa_nymph_chance_desc".Translate()); futa_nymph_chance = listingStandard.Slider(futa_nymph_chance, 0.0f, 1.0f); } if (FemaleFuta || MaleTrap) { listingStandard.Label("futa_natives_chance".Translate() + ": " + (int)(futa_natives_chance * 100) + "%", -1f, "futa_natives_chance_desc".Translate()); futa_natives_chance = listingStandard.Slider(futa_natives_chance, 0.0f, 1.0f); listingStandard.Label("futa_spacers_chance".Translate() + ": " + (int)(futa_spacers_chance * 100) + "%", -1f, "futa_spacers_chance_desc".Translate()); futa_spacers_chance = listingStandard.Slider(futa_spacers_chance, 0.0f, 1.0f); } listingStandard.Gap(5f); listingStandard.CheckboxLabeled("SendTraitGainLetters".Translate(), ref RJWSettings.sendTraitGainLetters, "SendTraitGainLetters_desc".Translate()); listingStandard.End(); height_modifier = listingStandard.CurHeight; Widgets.EndScrollView(); } public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref animal_on_animal_enabled, "animal_on_animal_enabled", animal_on_animal_enabled, true); Scribe_Values.Look(ref bestiality_enabled, "bestiality_enabled", bestiality_enabled, true); Scribe_Values.Look(ref necrophilia_enabled, "necrophilia_enabled", necrophilia_enabled, true); Scribe_Values.Look(ref designated_freewill, "designated_freewill", designated_freewill, true); Scribe_Values.Look(ref rape_enabled, "rape_enabled", rape_enabled, true); Scribe_Values.Look(ref colonist_CP_rape, "colonist_CP_rape", colonist_CP_rape, true); Scribe_Values.Look(ref visitor_CP_rape, "visitor_CP_rape", visitor_CP_rape, true); Scribe_Values.Look(ref animal_CP_rape, "animal_CP_rape", animal_CP_rape, true); Scribe_Values.Look(ref rape_beating, "rape_beating", rape_beating, true); Scribe_Values.Look(ref gentle_rape_beating, "gentle_rape_beating", gentle_rape_beating, true); Scribe_Values.Look(ref rape_stripping, "rape_stripping", rape_stripping, true); Scribe_Values.Look(ref NymphTamed, "NymphTamed", NymphTamed, true); Scribe_Values.Look(ref NymphWild, "NymphWild", NymphWild, true); Scribe_Values.Look(ref NymphRaidEasy, "NymphRaidEasy", NymphRaidEasy, true); Scribe_Values.Look(ref NymphRaidHard, "NymphRaidHard", NymphRaidHard, true); Scribe_Values.Look(ref NymphRaidRP, "NymphRaidRP", NymphRaidRP, true); Scribe_Values.Look(ref NymphPermanentManhunter, "NymphPermanentManhunter", NymphPermanentManhunter, true); Scribe_Values.Look(ref NymphSappers, "NymphSappers", NymphSappers, true); Scribe_Values.Look(ref NymphFrustratedRape, "NymphFrustratedRape", NymphFrustratedRape, true); Scribe_Values.Look(ref FemaleFuta, "FemaleFuta", FemaleFuta, true); Scribe_Values.Look(ref MaleTrap, "MaleTrap", MaleTrap, true); Scribe_Values.Look(ref sounds_enabled, "sounds_enabled", sounds_enabled, true); Scribe_Values.Look(ref sounds_sex_volume, "sounds_sexvolume", sounds_sex_volume, true); Scribe_Values.Look(ref sounds_cum_volume, "sounds_cumvolume", sounds_cum_volume, true); Scribe_Values.Look(ref sounds_voice_volume, "sounds_voicevolume", sounds_voice_volume, true); Scribe_Values.Look(ref sounds_orgasm_volume, "sounds_orgasmvolume", sounds_orgasm_volume, true); Scribe_Values.Look(ref sounds_animal_on_animal_volume, "sounds_animal_on_animalvolume", sounds_animal_on_animal_volume, true); Scribe_Values.Look(ref cum_filth, "cum_filth", cum_filth, true); Scribe_Values.Look(ref sexneed_fix, "sexneed_fix", sexneed_fix, true); Scribe_Values.Look(ref sexneed_decay_rate, "sexneed_decay_rate", sexneed_decay_rate, true); Scribe_Values.Look(ref Animal_mating_cooldown, "Animal_mating_cooldown", Animal_mating_cooldown, true); Scribe_Values.Look(ref nonFutaWomenRaping_MaxVulnerability, "nonFutaWomenRaping_MaxVulnerability", nonFutaWomenRaping_MaxVulnerability, true); Scribe_Values.Look(ref rapee_MinVulnerability_human, "rapee_MinVulnerability_human", rapee_MinVulnerability_human, true); Scribe_Values.Look(ref male_nymph_chance, "male_nymph_chance", male_nymph_chance, true); Scribe_Values.Look(ref futa_nymph_chance, "futa_nymph_chance", futa_nymph_chance, true); Scribe_Values.Look(ref futa_natives_chance, "futa_natives_chance", futa_natives_chance, true); Scribe_Values.Look(ref futa_spacers_chance, "futa_spacers_chance", futa_spacers_chance, true); Scribe_Values.Look(ref RPG_hero_control, "RPG_hero_control", RPG_hero_control, true); Scribe_Values.Look(ref RPG_hero_control_HC, "RPG_hero_control_HC", RPG_hero_control_HC, true); Scribe_Values.Look(ref RPG_hero_control_Ironman, "RPG_hero_control_Ironman", RPG_hero_control_Ironman, true); Scribe_Values.Look(ref UseAdvancedAgeScaling, "UseAdvancedAgeScaling", UseAdvancedAgeScaling, true); Scribe_Values.Look(ref AllowYouthSex, "AllowTeenSex", AllowYouthSex, true); Scribe_Values.Look(ref sendTraitGainLetters, "sendTraitGainLetters", sendTraitGainLetters, true); } } }
Korth95/rjw
1.4/Source/Settings/RJWSettings.cs
C#
mit
18,853
using UnityEngine; using Verse; using Multiplayer.API; namespace rjw.Settings { public class RJWSettingsController : Mod { public RJWSettingsController(ModContentPack content) : base(content) { GetSettings<RJWSettings>(); } public override string SettingsCategory() { return "RJWSettingsOne".Translate(); } public override void DoSettingsWindowContents(Rect inRect) { if (MP.IsInMultiplayer) return; RJWSettings.DoWindowContents(inRect); } } public class RJWDebugController : Mod { public RJWDebugController(ModContentPack content) : base(content) { GetSettings<RJWDebugSettings>(); } public override string SettingsCategory() { return "RJWDebugSettings".Translate(); } public override void DoSettingsWindowContents(Rect inRect) { if (MP.IsInMultiplayer) return; RJWDebugSettings.DoWindowContents(inRect); } } public class RJWPregnancySettingsController : Mod { public RJWPregnancySettingsController(ModContentPack content) : base(content) { GetSettings<RJWPregnancySettings>(); } public override string SettingsCategory() { return "RJWSettingsTwo".Translate(); } public override void DoSettingsWindowContents(Rect inRect) { if (MP.IsInMultiplayer) return; //GUI.BeginGroup(inRect); //Rect outRect = new Rect(0f, 0f, inRect.width, inRect.height - 30f); //Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + 10f); //Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect); RJWPregnancySettings.DoWindowContents(inRect); //Widgets.EndScrollView(); //GUI.EndGroup(); } } public class RJWPreferenceSettingsController : Mod { public RJWPreferenceSettingsController(ModContentPack content) : base(content) { GetSettings<RJWPreferenceSettings>(); } public override string SettingsCategory() { return "RJWSettingsThree".Translate(); } public override void DoSettingsWindowContents(Rect inRect) { if (MP.IsInMultiplayer) return; RJWPreferenceSettings.DoWindowContents(inRect); } } public class RJWHookupSettingsController : Mod { public RJWHookupSettingsController(ModContentPack content) : base(content) { GetSettings<RJWHookupSettings>(); } public override string SettingsCategory() { return "RJWSettingsFour".Translate(); } public override void DoSettingsWindowContents(Rect inRect) { if (MP.IsInMultiplayer) return; RJWHookupSettings.DoWindowContents(inRect); } } }
Korth95/rjw
1.4/Source/Settings/RJWSettingsController.cs
C#
mit
2,509
using System; using System.Collections.Generic; using UnityEngine; using Verse; namespace rjw { // TODO: Add option for logging pregnancy chance after sex (dev mode only?) // TODO: Add an alernate more complex system for pregnancy calculations, by using bodyparts, genitalia, and size (similar species -> higher chance, different -> lower chance) // TODO: Old settings that are not in use - evalute if they're needed and either convert these to settings, or delete them. /* public float significant_pain_threshold; // Updated public float extreme_pain_threshold; // Updated public float base_chance_to_hit_prisoner; // Updated public int min_ticks_between_hits; // Updated public int max_ticks_between_hits; // Updated public float max_nymph_fraction; // Updated public float comfort_prisoner_rape_mtbh_mul; // Updated public float whore_mtbh_mul; // Updated public static bool comfort_prisoners_enabled; // Updated //this one is in config.cs as well! public static bool ComfortColonist; // New public static bool ComfortAnimal; // New public static bool rape_me_sticky_enabled; // Updated public static bool bondage_gear_enabled; // Updated public static bool nymph_joiners_enabled; // Updated public static bool always_accept_whores; // Updated public static bool nymphs_always_JoinInBed; // Updated public static bool zoophis_always_rape; // Updated public static bool rapists_always_rape; // Updated public static bool pawns_always_do_fapping; // Updated public static bool whores_always_findjob; // Updated public bool show_regular_dick_and_vag; // Updated */ public class RJWPreferenceSettings : ModSettings { public static float vaginal = 1.20f; public static float anal = 0.80f; public static float fellatio = 0.80f; public static float cunnilingus = 0.80f; public static float rimming = 0.40f; public static float double_penetration = 0.60f; public static float breastjob = 0.50f; public static float handjob = 0.80f; public static float mutual_masturbation = 0.70f; public static float fingering = 0.50f; public static float footjob = 0.30f; public static float scissoring = 0.50f; public static float fisting = 0.30f; public static float sixtynine = 0.69f; public static float asexual_ratio = 0.02f; public static float pansexual_ratio = 0.03f; public static float heterosexual_ratio = 0.7f; public static float bisexual_ratio = 0.15f; public static float homosexual_ratio = 0.1f; public static bool FapEverywhere = false; public static bool FapInBed = true; public static bool FapInBelts = true; public static bool FapInArmbinders = false; public static bool ShowForCP = true; public static bool ShowForBreeding = true; public static Clothing sex_wear = Clothing.Nude; public static RapeAlert rape_attempt_alert = RapeAlert.Humanlikes; public static RapeAlert rape_alert = RapeAlert.Humanlikes; public static Rjw_sexuality sexuality_distribution = Rjw_sexuality.Vanilla; public static AllowedSex Malesex = AllowedSex.All; public static AllowedSex FeMalesex = AllowedSex.All; private static Vector2 scrollPosition; private static float height_modifier = 0f; // For checking whether the player has tried to pseudo-disable a particular sex type public static bool PlayerIsButtSlut => !(anal == 0.01f && rimming == 0.01f && fisting == 0.01f); // Omitting DP since that could also just be two tabs in one slot public static bool PlayerIsFootSlut => footjob != 0.01f; public static bool PlayerIsCumSlut => fellatio != 0.01f; // Not happy with this nomenclature but it matches the trait so is probably more "readable" public static int MaxQuirks = 1; public enum AllowedSex { All, Homo, Nohomo }; public enum Clothing { Nude, Headgear, Clothed }; public enum RapeAlert { Enabled, Colonists, Humanlikes, Silent, Disabled }; public enum Rjw_sexuality { Vanilla, RimJobWorld, Psychology, SYRIndividuality }; public static void DoWindowContents(Rect inRect) { Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f); Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + height_modifier); Widgets.BeginScrollView(outRect, ref scrollPosition, viewRect); // scroll Listing_Standard listingStandard = new Listing_Standard(); listingStandard.maxOneColumn = true; listingStandard.ColumnWidth = viewRect.width / 3.15f; listingStandard.Begin(viewRect); listingStandard.Gap(4f); listingStandard.Label("SexTypeFrequency".Translate()); listingStandard.Gap(6f); listingStandard.Label(" " + "vaginal".Translate() + ": " + Math.Round(vaginal * 100, 0), -1, "vaginal_desc".Translate()); vaginal = listingStandard.Slider(vaginal, 0.01f, 3.0f); listingStandard.Label(" " + "anal".Translate() + ": " + Math.Round(anal * 100, 0), -1, "anal_desc".Translate()); anal = listingStandard.Slider(anal, 0.01f, 3.0f); listingStandard.Label(" " + "double_penetration".Translate() + ": " + Math.Round(double_penetration * 100, 0), -1, "double_penetration_desc".Translate()); double_penetration = listingStandard.Slider(double_penetration, 0.01f, 3.0f); listingStandard.Label(" " + "fellatio".Translate() + ": " + Math.Round(fellatio * 100, 0), -1, "fellatio_desc".Translate()); fellatio = listingStandard.Slider(fellatio, 0.01f, 3.0f); listingStandard.Label(" " + "cunnilingus".Translate() + ": " + Math.Round(cunnilingus * 100, 0), -1, "cunnilingus_desc".Translate()); cunnilingus = listingStandard.Slider(cunnilingus, 0.01f, 3.0f); listingStandard.Label(" " + "rimming".Translate() + ": " + Math.Round(rimming * 100, 0), -1, "rimming_desc".Translate()); rimming = listingStandard.Slider(rimming, 0.01f, 3.0f); listingStandard.Label(" " + "sixtynine".Translate() + ": " + Math.Round(sixtynine * 100, 0), -1, "sixtynine_desc".Translate()); sixtynine = listingStandard.Slider(sixtynine, 0.01f, 3.0f); listingStandard.CheckboxLabeled("FapEverywhere".Translate(), ref FapEverywhere, "FapEverywhere_desc".Translate()); listingStandard.CheckboxLabeled("FapInBed".Translate(), ref FapInBed, "FapInBed_desc".Translate()); listingStandard.CheckboxLabeled("FapInBelts".Translate(), ref FapInBelts, "FapInBelts_desc".Translate()); listingStandard.CheckboxLabeled("FapInArmbinders".Translate(), ref FapInArmbinders, "FapInArmbinders_desc".Translate()); listingStandard.NewColumn(); listingStandard.Gap(4f); if (listingStandard.ButtonText("Reset".Translate())) { vaginal = 1.20f; anal = 0.80f; fellatio = 0.80f; cunnilingus = 0.80f; rimming = 0.40f; double_penetration = 0.60f; breastjob = 0.50f; handjob = 0.80f; mutual_masturbation = 0.70f; fingering = 0.50f; footjob = 0.30f; scissoring = 0.50f; fisting = 0.30f; sixtynine = 0.69f; } listingStandard.Gap(6f); listingStandard.Label(" " + "breastjob".Translate() + ": " + Math.Round(breastjob * 100, 0), -1, "breastjob_desc".Translate()); breastjob = listingStandard.Slider(breastjob, 0.01f, 3.0f); listingStandard.Label(" " + "handjob".Translate() + ": " + Math.Round(handjob * 100, 0), -1, "handjob_desc".Translate()); handjob = listingStandard.Slider(handjob, 0.01f, 3.0f); listingStandard.Label(" " + "fingering".Translate() + ": " + Math.Round(fingering * 100, 0), -1, "fingering_desc".Translate()); fingering = listingStandard.Slider(fingering, 0.01f, 3.0f); listingStandard.Label(" " + "fisting".Translate() + ": " + Math.Round(fisting * 100, 0), -1, "fisting_desc".Translate()); fisting = listingStandard.Slider(fisting, 0.01f, 3.0f); listingStandard.Label(" " + "mutual_masturbation".Translate() + ": " + Math.Round(mutual_masturbation * 100, 0), -1, "mutual_masturbation_desc".Translate()); mutual_masturbation = listingStandard.Slider(mutual_masturbation, 0.01f, 3.0f); listingStandard.Label(" " + "footjob".Translate() + ": " + Math.Round(footjob * 100, 0), -1, "footjob_desc".Translate()); footjob = listingStandard.Slider(footjob, 0.01f, 3.0f); listingStandard.Label(" " + "scissoring".Translate() + ": " + Math.Round(scissoring * 100, 0), -1, "scissoring_desc".Translate()); scissoring = listingStandard.Slider(scissoring, 0.01f, 3.0f); if (listingStandard.ButtonText("Malesex".Translate() + Malesex.ToString())) { Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>() { new FloatMenuOption("AllowedSex.All".Translate(), (() => Malesex = AllowedSex.All)), new FloatMenuOption("AllowedSex.Homo".Translate(), (() => Malesex = AllowedSex.Homo)), new FloatMenuOption("AllowedSex.Nohomo".Translate(), (() => Malesex = AllowedSex.Nohomo)) })); } if (listingStandard.ButtonText("FeMalesex".Translate() + FeMalesex.ToString())) { Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>() { new FloatMenuOption("AllowedSex.All".Translate(), (() => FeMalesex = AllowedSex.All)), new FloatMenuOption("AllowedSex.Homo".Translate(), (() => FeMalesex = AllowedSex.Homo)), new FloatMenuOption("AllowedSex.Nohomo".Translate(), (() => FeMalesex = AllowedSex.Nohomo)) })); } listingStandard.NewColumn(); listingStandard.Gap(4f); // TODO: Add translation if (listingStandard.ButtonText("SexClothing".Translate() + sex_wear.ToString())) { Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>() { new FloatMenuOption("SexClothingNude".Translate(), (() => sex_wear = Clothing.Nude)), new FloatMenuOption("SexClothingHeadwear".Translate(), (() => sex_wear = Clothing.Headgear)), new FloatMenuOption("SexClothingFull".Translate(), (() => sex_wear = Clothing.Clothed)) })); } listingStandard.Gap(4f); if (listingStandard.ButtonText("RapeAttemptAlert".Translate() + rape_attempt_alert.ToString())) { Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>() { new FloatMenuOption("RapeAttemptAlertAlways".Translate(), (() => rape_attempt_alert = RapeAlert.Enabled)), new FloatMenuOption("RapeAttemptAlertHumanlike".Translate(), (() => rape_attempt_alert = RapeAlert.Humanlikes)), new FloatMenuOption("RapeAttemptAlertColonist".Translate(), (() => rape_attempt_alert = RapeAlert.Colonists)), new FloatMenuOption("RapeAttemptAlertSilent".Translate(), (() => rape_attempt_alert = RapeAlert.Silent)), new FloatMenuOption("RapeAttemptAlertDisabled".Translate(), (() => rape_attempt_alert = RapeAlert.Disabled)) })); } if (listingStandard.ButtonText("RapeAlert".Translate() + rape_alert.ToString())) { Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>() { new FloatMenuOption("RapeAlertAlways".Translate(), (() => rape_alert = RapeAlert.Enabled)), new FloatMenuOption("RapeAlertHumanlike".Translate(), (() => rape_alert = RapeAlert.Humanlikes)), new FloatMenuOption("RapeAlertColonist".Translate(), (() => rape_alert = RapeAlert.Colonists)), new FloatMenuOption("RapeAlertSilent".Translate(), (() => rape_alert = RapeAlert.Silent)), new FloatMenuOption("RapeAlertDisabled".Translate(), (() => rape_alert = RapeAlert.Disabled)) })); } listingStandard.CheckboxLabeled("RapeAlertCP".Translate(), ref ShowForCP, "RapeAlertCP_desc".Translate()); listingStandard.CheckboxLabeled("RapeAlertBreeding".Translate(), ref ShowForBreeding, "RapeAlertBreeding_desc".Translate()); listingStandard.Gap(26f); listingStandard.Label("SexualitySpread1".Translate(), -1, "SexualitySpread2".Translate()); if (listingStandard.ButtonText(sexuality_distribution.ToString())) { Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>() { new FloatMenuOption("Vanilla", () => sexuality_distribution = Rjw_sexuality.Vanilla), //new FloatMenuOption("RimJobWorld", () => sexuality_distribution = Rjw_sexuality.RimJobWorld), new FloatMenuOption("SYRIndividuality", () => sexuality_distribution = Rjw_sexuality.SYRIndividuality), new FloatMenuOption("Psychology", () => sexuality_distribution = Rjw_sexuality.Psychology) })); } if (sexuality_distribution == Rjw_sexuality.RimJobWorld) { listingStandard.Label("SexualityAsexual".Translate() + Math.Round((asexual_ratio / GetTotal()) * 100, 1) + "%", -1, "SexualityAsexual_desc".Translate()); asexual_ratio = listingStandard.Slider(asexual_ratio, 0.0f, 1.0f); listingStandard.Label("SexualityPansexual".Translate() + Math.Round((pansexual_ratio / GetTotal()) * 100, 1) + "%", -1, "SexualityPansexual_desc".Translate()); pansexual_ratio = listingStandard.Slider(pansexual_ratio, 0.0f, 1.0f); listingStandard.Label("SexualityHeterosexual".Translate() + Math.Round((heterosexual_ratio / GetTotal()) * 100, 1) + "%", -1, "SexualityHeterosexual_desc".Translate()); heterosexual_ratio = listingStandard.Slider(heterosexual_ratio, 0.0f, 1.0f); listingStandard.Label("SexualityBisexual".Translate() + Math.Round((bisexual_ratio / GetTotal()) * 100, 1) + "%", -1, "SexualityBisexual_desc".Translate()); bisexual_ratio = listingStandard.Slider(bisexual_ratio, 0.0f, 1.0f); listingStandard.Label("SexualityGay".Translate() + Math.Round((homosexual_ratio / GetTotal()) * 100, 1) + "%", -1, "SexualityGay_desc".Translate()); homosexual_ratio = listingStandard.Slider(homosexual_ratio, 0.0f, 1.0f); } else { if (!xxx.IndividualityIsActive && sexuality_distribution == Rjw_sexuality.SYRIndividuality) sexuality_distribution = Rjw_sexuality.Vanilla; else if (sexuality_distribution == Rjw_sexuality.SYRIndividuality) listingStandard.Label("SexualitySpreadIndividuality".Translate()); else if (!xxx.PsychologyIsActive && sexuality_distribution == Rjw_sexuality.Psychology) sexuality_distribution = Rjw_sexuality.Vanilla; else if (sexuality_distribution == Rjw_sexuality.Psychology) listingStandard.Label("SexualitySpreadPsychology".Translate()); else listingStandard.Label("SexualitySpreadVanilla".Translate()); } listingStandard.Label("MaxQuirks".Translate() + ": " + MaxQuirks, -1f, "MaxQuirks_desc".Translate()); MaxQuirks = (int)listingStandard.Slider(MaxQuirks, 0, 10); listingStandard.End(); height_modifier = listingStandard.CurHeight; Widgets.EndScrollView(); } public static float GetTotal() { return asexual_ratio + pansexual_ratio + heterosexual_ratio + bisexual_ratio + homosexual_ratio; } public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref vaginal, "vaginal_frequency", vaginal, true); Scribe_Values.Look(ref anal, "anal_frequency", anal, true); Scribe_Values.Look(ref fellatio, "fellatio_frequency", fellatio, true); Scribe_Values.Look(ref cunnilingus, "cunnilingus_frequency", cunnilingus, true); Scribe_Values.Look(ref rimming, "rimming_frequency", rimming, true); Scribe_Values.Look(ref double_penetration, "double_penetration_frequency", double_penetration, true); Scribe_Values.Look(ref sixtynine, "sixtynine_frequency", sixtynine, true); Scribe_Values.Look(ref breastjob, "breastjob_frequency", breastjob, true); Scribe_Values.Look(ref handjob, "handjob_frequency", handjob, true); Scribe_Values.Look(ref footjob, "footjob_frequency", footjob, true); Scribe_Values.Look(ref fingering, "fingering_frequency", fingering, true); Scribe_Values.Look(ref fisting, "fisting_frequency", fisting, true); Scribe_Values.Look(ref mutual_masturbation, "mutual_masturbation_frequency", mutual_masturbation, true); Scribe_Values.Look(ref scissoring, "scissoring_frequency", scissoring, true); Scribe_Values.Look(ref asexual_ratio, "asexual_ratio", asexual_ratio, true); Scribe_Values.Look(ref pansexual_ratio, "pansexual_ratio", pansexual_ratio, true); Scribe_Values.Look(ref heterosexual_ratio, "heterosexual_ratio", heterosexual_ratio, true); Scribe_Values.Look(ref bisexual_ratio, "bisexual_ratio", bisexual_ratio, true); Scribe_Values.Look(ref homosexual_ratio, "homosexual_ratio", homosexual_ratio, true); Scribe_Values.Look(ref FapEverywhere, "FapEverywhere", FapEverywhere, true); Scribe_Values.Look(ref FapInBed, "FapInBed", FapInBed, true); Scribe_Values.Look(ref FapInBelts, "FapInBelts", FapInBelts, true); Scribe_Values.Look(ref FapInArmbinders, "FapInArmbinders", FapInArmbinders, true); Scribe_Values.Look(ref sex_wear, "sex_wear", sex_wear, true); Scribe_Values.Look(ref rape_attempt_alert, "rape_attempt_alert", rape_attempt_alert, true); Scribe_Values.Look(ref rape_alert, "rape_alert", rape_alert, true); Scribe_Values.Look(ref ShowForCP, "ShowForCP", ShowForCP, true); Scribe_Values.Look(ref ShowForBreeding, "ShowForBreeding", ShowForBreeding, true); Scribe_Values.Look(ref sexuality_distribution, "sexuality_distribution", sexuality_distribution, true); Scribe_Values.Look(ref Malesex, "Malesex", Malesex, true); Scribe_Values.Look(ref FeMalesex, "FeMalesex", FeMalesex, true); Scribe_Values.Look(ref MaxQuirks, "MaxQuirks", MaxQuirks, true); } } }
Korth95/rjw
1.4/Source/Settings/RJWSexSettings.cs
C#
mit
17,104
using HugsLib.Settings; using UnityEngine; using Verse; namespace rjw.Properties { // This class allows you to handle specific events on the settings class: // The SettingChanging event is raised before a setting's value is changed. // The PropertyChanged event is raised after a setting's value is changed. // The SettingsLoaded event is raised after the setting values are loaded. // The SettingsSaving event is raised before the setting values are saved. internal sealed partial class Settings { public Settings() { // // To add event handlers for saving and changing settings, uncomment the lines below: // // this.SettingChanging += this.SettingChangingEventHandler; // // this.SettingsSaving += this.SettingsSavingEventHandler; // } private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { // Add code to handle the SettingChangingEvent event here. } private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { // Add code to handle the SettingsSaving event here. } private static readonly Color SelectedOptionColor = new Color(0.5f, 1f, 0.5f, 1f); public static bool CustomDrawer_Tabs(Rect rect, SettingHandle<string> selected, string defaultValues) { int labelWidth = 140; //int offset = -287; int offset = 0; bool change = false; Rect buttonRect = new Rect(rect) { width = labelWidth }; buttonRect.position = new Vector2(buttonRect.position.x + offset, buttonRect.position.y); Color activeColor = GUI.color; bool isSelected = defaultValues == selected.Value; if (isSelected) GUI.color = SelectedOptionColor; bool clicked = Widgets.ButtonText(buttonRect, defaultValues); if (isSelected) GUI.color = activeColor; if (clicked) { selected.Value = selected.Value != defaultValues ? defaultValues : "none"; change = true; } offset += labelWidth; return change; } } }
Korth95/rjw
1.4/Source/Settings/Settings.cs
C#
mit
2,007
using Verse; namespace rjw { public class config : Def { // TODO: Clean these. public float minor_pain_threshold; // 0.3 public float significant_pain_threshold; // 0.6 public float extreme_pain_threshold; // 0.95 public float base_chance_to_hit_prisoner; // 50 public int min_ticks_between_hits; // 500 public int max_ticks_between_hits; // 700 public float max_nymph_fraction; public float comfort_prisoner_rape_mtbh_mul; } }
Korth95/rjw
1.4/Source/Settings/config.cs
C#
mit
464
using System; using UnityEngine; using Verse; using Verse.AI; using RimWorld; namespace rjw { public class ThinkNode_ChancePerHour_Bestiality : ThinkNode_ChancePerHour { protected override float MtbHours(Pawn pawn) { float base_mtb = xxx.config.comfort_prisoner_rape_mtbh_mul; // Default is 4.0 float desire_factor; { Need_Sex need_sex = pawn.needs.TryGetNeed<Need_Sex>(); if (need_sex != null) { if (need_sex.CurLevel <= need_sex.thresh_frustrated()) desire_factor = 0.40f; else if (need_sex.CurLevel <= need_sex.thresh_horny()) desire_factor = 0.80f; else desire_factor = 1.00f; } else desire_factor = 1.00f; } float personality_factor; { personality_factor = 1.0f; if (xxx.is_nympho(pawn)) personality_factor *= 0.5f; else if (xxx.is_prude(pawn) || pawn.story.traits.HasTrait(TraitDefOf.BodyPurist)) personality_factor *= 2f; if (pawn.story.traits.HasTrait(TraitDefOf.Nudist)) personality_factor *= 0.9f; // Pawns with no zoophile trait should first try to find other outlets. if (!xxx.is_zoophile(pawn)) personality_factor *= 8f; // Less likely to engage in bestiality if the pawn has a lover... unless the lover is an animal (there's mods for that, so need to check). if (!xxx.IsSingleOrPartnersNotHere(pawn) && !xxx.is_animal(LovePartnerRelationUtility.ExistingMostLikedLovePartner(pawn, false)) && !xxx.is_lecher(pawn) && !xxx.is_nympho(pawn)) personality_factor *= 2.5f; // Pawns with few or no prior animal encounters are more reluctant to engage in bestiality. if (pawn.records.GetValue(xxx.CountOfSexWithAnimals) < 3) personality_factor *= 3f; else if (pawn.records.GetValue(xxx.CountOfSexWithAnimals) > 10) personality_factor *= 0.8f; } float fun_factor; { if ((pawn.needs.joy != null) && (xxx.is_bloodlust(pawn))) fun_factor = Mathf.Clamp01(0.50f + pawn.needs.joy.CurLevel); else fun_factor = 1.00f; } return base_mtb * desire_factor * personality_factor * fun_factor; } public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobParams) { try { return base.TryIssueJobPackage(pawn, jobParams); } catch (NullReferenceException) { //--ModLog.Message("ThinkNode_ChancePerHour_Bestiality:TryIssueJobPackage - error message" + e.Message); //--ModLog.Message("ThinkNode_ChancePerHour_Bestiality:TryIssueJobPackage - error stacktrace" + e.StackTrace); return ThinkResult.NoJob; ; } } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ChancePerHour_Bestiality.cs
C#
mit
2,560
using System; using Verse; using Verse.AI; namespace rjw { /// <summary> /// Cooldown for breeding /// something like 4.0*0.2 = 0.8 hours /// </summary> public class ThinkNode_ChancePerHour_Breed : ThinkNode_ChancePerHour { protected override float MtbHours(Pawn pawn) { return xxx.config.comfort_prisoner_rape_mtbh_mul * 0.20f ; } public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobParams) { try { return base.TryIssueJobPackage(pawn, jobParams); } catch (NullReferenceException) { return ThinkResult.NoJob; ; } } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ChancePerHour_Breed.cs
C#
mit
596
using RimWorld; using Verse; using Verse.AI; using System.Linq; namespace rjw { public class ThinkNode_ChancePerHour_Fappin : ThinkNode_ChancePerHour { public static float get_fappin_mtb_hours(Pawn p) { return (xxx.is_nympho(p) ? 0.5f : 1.0f) * rjw_CORE_EXPOSED.LovePartnerRelationUtility.LovinMtbSinglePawnFactor(p); } protected override float MtbHours(Pawn p) { // No fapping for animals... for now, at least. // Maybe enable this for monsters girls and such in future, but that'll need code changes to avoid errors. if (xxx.is_animal(p)) return -1.0f; bool is_horny = xxx.is_hornyorfrustrated(p); if (is_horny) { bool isAlone = !p.Map.mapPawns.AllPawnsSpawned.Any(x => p.CanSee(x) && xxx.is_human(x)); // More likely to fap if alone. float aloneFactor = isAlone ? 0.6f : 1.2f; if (xxx.has_quirk(p, "Exhibitionist")) aloneFactor = isAlone ? 1.0f : 0.6f; // More likely to fap if nude. float clothingFactor = p.apparel.PsychologicallyNude ? 0.8f : 1.0f; float SexNeedFactor = (4 - xxx.need_some_sex(p)) / 2f; return get_fappin_mtb_hours(p) * SexNeedFactor * aloneFactor * clothingFactor; } return -1.0f; } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ChancePerHour_Fappin.cs
C#
mit
1,199
using System; using UnityEngine; using Verse; using Verse.AI; using RimWorld; namespace rjw { /// <summary> /// Necro rape corpse /// </summary> public class ThinkNode_ChancePerHour_Necro : ThinkNode_ChancePerHour { protected override float MtbHours(Pawn pawn) { float base_mtb = xxx.config.comfort_prisoner_rape_mtbh_mul; // Default of 4.0 float desire_factor; { var need_sex = pawn.needs.TryGetNeed<Need_Sex>(); if (need_sex != null) { if (need_sex.CurLevel <= need_sex.thresh_frustrated()) desire_factor = 0.15f; else if (need_sex.CurLevel <= need_sex.thresh_horny()) desire_factor = 0.60f; else if (need_sex.CurLevel <= need_sex.thresh_satisfied()) desire_factor = 1.00f; else // Recently had sex. desire_factor = 2.00f; } else desire_factor = 1.00f; } float personality_factor; { personality_factor = 1.0f; if (xxx.is_nympho(pawn)) personality_factor *= 0.8f; if (xxx.is_prude(pawn) || pawn.story.traits.HasTrait(TraitDefOf.BodyPurist)) personality_factor *= 2f; if (xxx.is_psychopath(pawn)) personality_factor *= 0.5f; // Pawns with no necrophiliac trait should first try to find other outlets. if (!xxx.is_necrophiliac(pawn)) personality_factor *= 8f; else personality_factor *= 0.5f; // Less likely to engage in necrophilia if the pawn has a lover. if (!xxx.IsSingleOrPartnersNotHere(pawn)) personality_factor *= 1.25f; // Pawns with no records of prior necrophilia are less likely to engage in it. if (pawn.records.GetValue(xxx.CountOfSexWithCorpse) == 0) personality_factor *= 16f; else if (pawn.records.GetValue(xxx.CountOfSexWithCorpse) > 10) personality_factor *= 0.8f; } float fun_factor; { if ((pawn.needs.joy != null) && (xxx.is_necrophiliac(pawn))) fun_factor = Mathf.Clamp01(0.50f + pawn.needs.joy.CurLevel); else fun_factor = 1.00f; } // I'm normally against gender factors, but necrophilia is far more frequent among males. -Zaltys float gender_factor = (pawn.gender == Gender.Male) ? 1.0f : 3.0f; return base_mtb * desire_factor * personality_factor * fun_factor * gender_factor; } public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobParams) { try { return base.TryIssueJobPackage(pawn, jobParams); } catch (NullReferenceException) { return ThinkResult.NoJob; } } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ChancePerHour_Necro.cs
C#
mit
2,481
using System; using RimWorld; using UnityEngine; using Verse; using Verse.AI; namespace rjw { /// <summary> /// Colonists and prisoners try to rape CP /// </summary> public class ThinkNode_ChancePerHour_RapeCP : ThinkNode_ChancePerHour { protected override float MtbHours(Pawn pawn) { var base_mtb = xxx.config.comfort_prisoner_rape_mtbh_mul; //Default 4.0 float desire_factor; { var need_sex = pawn.needs.TryGetNeed<Need_Sex>(); if (need_sex != null) { if (need_sex.CurLevel <= need_sex.thresh_frustrated()) desire_factor = 0.10f; else if (need_sex.CurLevel <= need_sex.thresh_horny()) desire_factor = 0.50f; else desire_factor = 1.00f; } else desire_factor = 1.00f; } float personality_factor; { personality_factor = 1.0f; if (xxx.has_traits(pawn)) { // Most of the checks are done in the SexAppraiser.would_rape method. personality_factor = 1.0f; if (!RJWSettings.rape_beating) { if (xxx.is_bloodlust(pawn)) personality_factor *= 0.5f; } if (xxx.is_nympho(pawn)) personality_factor *= 0.5f; else if (xxx.is_prude(pawn) || pawn.story.traits.HasTrait(TraitDefOf.BodyPurist)) personality_factor *= 2f; if (xxx.is_rapist(pawn)) personality_factor *= 0.5f; if (xxx.is_psychopath(pawn)) personality_factor *= 0.75f; else if (xxx.is_kind(pawn)) personality_factor *= 5.0f; float rapeCount = pawn.records.GetValue(xxx.CountOfRapedHumanlikes) + pawn.records.GetValue(xxx.CountOfRapedAnimals) + pawn.records.GetValue(xxx.CountOfRapedInsects) + pawn.records.GetValue(xxx.CountOfRapedOthers); // Pawns with few or no rapes are more reluctant to rape CPs. if (rapeCount < 3.0f) personality_factor *= 1.5f; } } float fun_factor; { if ((pawn.needs.joy != null) && (xxx.is_rapist(pawn) || xxx.is_psychopath(pawn))) fun_factor = Mathf.Clamp01(0.50f + pawn.needs.joy.CurLevel); else fun_factor = 1.00f; } float animal_factor = 1.0f; if (xxx.is_animal(pawn)) { var parts = pawn.GetGenitalsList(); // Much slower for female animals. animal_factor = Genital_Helper.has_male_bits(pawn, parts) ? 2.5f : 6f; } //if (xxx.is_animal(pawn)) { Log.Message("Chance for " + pawn + " : " + base_mtb * desire_factor * personality_factor * fun_factor * animal_factor); } return base_mtb * desire_factor * personality_factor * fun_factor * animal_factor; } public override ThinkResult TryIssueJobPackage(Pawn pawn, JobIssueParams jobParams) { try { return base.TryIssueJobPackage(pawn, jobParams); } catch (NullReferenceException) { return ThinkResult.NoJob; ; } } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ChancePerHour_RapeCP.cs
C#
mit
2,822
using Verse; using Verse.AI; namespace rjw { /// <summary> /// Called to determine if the non animal is eligible for a Bestiality job /// </summary> public class ThinkNode_ConditionalBestiality : ThinkNode_Conditional { protected override bool Satisfied(Pawn p) { //if (p.Faction != null && p.Faction.IsPlayer) // ModLog.Message("ThinkNode_ConditionalBestiality " + xxx.get_pawnname(p) + " is animal: " + xxx.is_animal(p)); // No bestiality for animals, animal-on-animal is handled in Breed job. if (xxx.is_animal(p)) return false; // Bestiality off if (!RJWSettings.bestiality_enabled) return false; // No free will while designated for rape. if (!RJWSettings.designated_freewill) if ((p.IsDesignatedComfort() || p.IsDesignatedBreeding())) return false; return true; } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalBestiality.cs
C#
mit
834
using Verse; using Verse.AI; namespace rjw { /// <summary> /// Called to determine if the animal is eligible for a breed job /// </summary> public class ThinkNode_ConditionalCanBreed : ThinkNode_Conditional { protected override bool Satisfied(Pawn p) { //ModLog.Message("ThinkNode_ConditionalCanBreed " + p); //Rimworld of Magic polymorphed humanlikes also get animal think node //if (p.Faction != null && p.Faction.IsPlayer) // ModLog.Message("ThinkNode_ConditionalCanBreed " + xxx.get_pawnname(p) + " is animal: " + xxx.is_animal(p)); // No Breed jobs for humanlikes, that's handled by bestiality. if (!xxx.is_animal(p)) return false; // Animal stuff disabled. if (!RJWSettings.bestiality_enabled && !RJWSettings.animal_on_animal_enabled) return false; //return p.IsDesignatedBreedingAnimal() || RJWSettings.WildMode; return p.IsDesignatedBreedingAnimal(); } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalCanBreed.cs
C#
mit
919
using Verse; using Verse.AI; using RimWorld; namespace rjw { public class ThinkNode_ConditionalCanRapeCP : ThinkNode_Conditional { protected override bool Satisfied(Pawn p) { //ModLog.Message("ThinkNode_ConditionalCanRapeCP " + pawn); if (!RJWSettings.rape_enabled) return false; // Hostiles cannot use CP. if (p.HostileTo(Faction.OfPlayer)) return false; // Designated pawns are not allowed to rape other CP. if (!RJWSettings.designated_freewill) if ((p.IsDesignatedComfort() || p.IsDesignatedBreeding())) return false; // Animals cannot rape CP if the setting is disabled. //if (!(RJWSettings.bestiality_enabled && RJWSettings.animal_CP_rape) && xxx.is_animal(p) ) // return false; // Animals cannot rape CP if (xxx.is_animal(p)) return false; // colonists(humans) cannot rape CP if the setting is disabled. if (!RJWSettings.colonist_CP_rape && p.IsColonist && xxx.is_human(p)) return false; // Visitors(humans) cannot rape CP if the setting is disabled. if (!RJWSettings.visitor_CP_rape && p.Faction?.IsPlayer == false && xxx.is_human(p)) return false; // Visitors(animals/caravan) cannot rape CP if the setting is disabled. if (!RJWSettings.visitor_CP_rape && p.Faction?.IsPlayer == false && p.Faction != Faction.OfInsects && xxx.is_animal(p)) return false; // Wild animals, insects cannot rape CP. //if ((p.Faction == null || p.Faction == Faction.OfInsects) && xxx.is_animal(p)) // return false; return true; } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalCanRapeCP.cs
C#
mit
1,535
using Verse; using Verse.AI; namespace rjw { /// <summary> /// Pawn frustrated /// </summary> public class ThinkNode_ConditionalFrustrated : ThinkNode_Conditional { protected override bool Satisfied (Pawn p) { return xxx.is_frustrated(p); } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalFrustrated.cs
C#
mit
263
using Verse; using Verse.AI; namespace rjw { /// <summary> /// Pawn is horny /// </summary> public class ThinkNode_ConditionalHorny : ThinkNode_Conditional { protected override bool Satisfied(Pawn p) { return xxx.is_horny(p); } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalHorny.cs
C#
mit
250
using Verse; using Verse.AI; namespace rjw { /// <summary> /// Pawn HornyOrFrustrated /// </summary> public class ThinkNode_ConditionalHornyOrFrustrated : ThinkNode_Conditional { protected override bool Satisfied (Pawn p) { return xxx.is_hornyorfrustrated(p); } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalHornyOrFrustrated.cs
C#
mit
284
using Verse; using Verse.AI; namespace rjw { /// <summary> /// Called to determine if the animal can mate(vanilla reproductory sex) with animals. /// </summary> public class ThinkNode_ConditionalMate : ThinkNode_Conditional { protected override bool Satisfied(Pawn p) { //ModLog.Message("ThinkNode_ConditionalMate " + xxx.get_pawnname(p)); return (xxx.is_animal(p) && RJWSettings.animal_on_animal_enabled); } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalMate.cs
C#
mit
432
using Verse; using Verse.AI; namespace rjw { /// <summary> /// Called to determine if the pawn can engage in necrophilia. /// </summary> public class ThinkNode_ConditionalNecro : ThinkNode_Conditional { protected override bool Satisfied(Pawn p) { //ModLog.Message("ThinkNode_ConditionalNecro " + p); if (!RJWSettings.necrophilia_enabled) return false; // No necrophilia for animals. At least for now. // This would be easy to enable, if we actually want to add it. if (xxx.is_animal(p)) return false; // No free will while designated for rape. if (!RJWSettings.designated_freewill) if ((p.IsDesignatedComfort() || p.IsDesignatedBreeding())) return false; return true; } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalNecro.cs
C#
mit
732
using Verse; using Verse.AI; namespace rjw { /// <summary> /// Nymph nothing to do, seek sex-> join in bed /// </summary> public class ThinkNode_ConditionalNympho : ThinkNode_Conditional { protected override bool Satisfied(Pawn p) { //ModLog.Message("ThinkNode_ConditionalNympho " + p); if (xxx.is_nympho(p)) if (p.Faction == null || !p.Faction.IsPlayer) return false; else return true; return false; } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalNympho.cs
C#
mit
451
using Verse; using Verse.AI; namespace rjw { /// <summary> /// Will nympho rape when frustrated? /// </summary> public class ThinkNode_ConditionalNymphoFrustratedRape : ThinkNode_Conditional { protected override bool Satisfied (Pawn p) { return RJWSettings.NymphFrustratedRape; } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalNymphoFrustratedRape.cs
C#
mit
303
using Verse; using Verse.AI; namespace rjw { /// <summary> /// Rapist, chance to trigger random rape /// </summary> public class ThinkNode_ConditionalRapist : ThinkNode_Conditional { protected override bool Satisfied(Pawn p) { if (!RJWSettings.rape_enabled) return false; if (xxx.is_animal(p)) return false; if (!xxx.is_rapist(p)) return false; // No free will while designated for rape. if (!RJWSettings.designated_freewill) if ((p.IsDesignatedComfort() || p.IsDesignatedBreeding())) return false; if (!xxx.IsSingleOrPartnersNotHere(p)) { return false; } else return true; } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalRapist.cs
C#
mit
655
using RimWorld; using System.Collections.Generic; using Verse; using Verse.AI; namespace rjw { /// <summary> /// Called to determine if the pawn can engage in sex. /// This should be used as the first conditional for sex-related thinktrees. /// </summary> public class ThinkNode_ConditionalSexChecks : ThinkNode_Conditional { protected override bool Satisfied(Pawn p) { //ModLog.Message("ThinkNode_ConditionalSexChecks " + xxx.get_pawnname(p)); //if (p.Faction != null && p.Faction.IsPlayer) // ModLog.Message("ThinkNode_ConditionalSexChecks " + xxx.get_pawnname(p) + " is animal: " + xxx.is_animal(p)); // Downed, Drafted and Awake are checked in core ThinkNode_ConditionalCanDoConstantThinkTreeJobNow. if (p.Map == null) return false; // Pawn(animal) is fogged, no sex, save tps if (p.Fogged()) return false; // Setting checks. if (!xxx.can_do_loving(p)) return false; else if (xxx.is_animal(p) && !RJWSettings.bestiality_enabled && !RJWSettings.animal_on_animal_enabled) return false; // State checks. No sex while trying to leave map. if (p.mindState?.duty?.def != null) if (p.mindState.duty.def == DutyDefOf.SleepForever) return false; else if (p.mindState.duty.def == DutyDefOf.EnterTransporter) return false; else if (p.mindState.duty.def == DutyDefOf.EnterTransporterAndDefendSelf) return false; else if (p.mindState.duty.def == DutyDefOf.ExitMapBest) return false; else if (p.mindState.duty.def == DutyDefOf.ExitMapBestAndDefendSelf) return false; else if (p.mindState.duty.def == DutyDefOf.ExitMapNearDutyTarget) return false; else if (p.mindState.duty.def == DutyDefOf.ExitMapRandom) return false; else if (p.mindState.duty.def == DutyDefOf.PrepareCaravan_CollectAnimals) return false; else if (p.mindState.duty.def == DutyDefOf.PrepareCaravan_GatherAnimals) return false; else if (p.mindState.duty.def == DutyDefOf.PrepareCaravan_GatherDownedPawns) return false; else if (p.mindState.duty.def == DutyDefOf.PrepareCaravan_GatherItems) return false; // No sex while starving or badly hurt. return ((!p.needs?.food?.Starving) ?? true && (xxx.is_healthy_enough(p) || !xxx.is_human(p))); } } }
Korth95/rjw
1.4/Source/ThinkTreeNodes/ThinkNode_ConditionalSexChecks.cs
C#
mit
2,277
using RimWorld; using Verse; namespace rjw { public class ThoughtWorker_FeelingBroken : ThoughtWorker { public static int Clamp(int value, int min, int max) { return (value < min) ? min : (value > max) ? max : value; } protected override ThoughtState CurrentStateInternal(Pawn p) { var brokenstages = p.health.hediffSet.GetFirstHediffOfDef(xxx.feelingBroken); if (brokenstages != null && brokenstages.CurStageIndex != 0) { if (xxx.is_masochist(p) && brokenstages.CurStageIndex >= 2) { return ThoughtState.ActiveAtStage(2); // begging for more } return ThoughtState.ActiveAtStage(Clamp(brokenstages.CurStageIndex - 1, 0, 1)); } return ThoughtState.Inactive; } } }
Korth95/rjw
1.4/Source/Thoughts/ThoughtWorker_FeelingBroken.cs
C#
mit
721
using RimWorld; using Verse; namespace rjw { public class ThoughtWorker_NeedSex : ThoughtWorker { protected override ThoughtState CurrentStateInternal(Pawn p) { var sex_need = p.needs.TryGetNeed<Need_Sex>(); if (sex_need != null) if (xxx.can_do_loving(p)) { var lev = sex_need.CurLevel; if (lev <= sex_need.thresh_frustrated()) return ThoughtState.ActiveAtStage(0); else if (lev <= sex_need.thresh_horny()) return ThoughtState.ActiveAtStage(1); else if (lev >= sex_need.thresh_satisfied()) return ThoughtState.ActiveAtStage(2); } return ThoughtState.Inactive; } } }
Korth95/rjw
1.4/Source/Thoughts/ThoughtWorker_NeedSex.cs
C#
mit
627
using RimWorld; using Verse; namespace rjw { //This thought system of RW is retarded AF. It needs separate thought handler for each hediff. public abstract class ThoughtWorker_SexChange : ThoughtWorker { public virtual HediffDef hediff_served { get; } protected override ThoughtState CurrentStateInternal(Pawn pawn) { //Log.Message(" "+this.GetType() + " is called for " + pawn +" and hediff" + hediff_served); Hediff denial = pawn.health.hediffSet.GetFirstHediffOfDef(hediff_served); //Log.Message("Hediff of the class is null " + (hediff_served == null)); if (denial != null && denial.CurStageIndex!=0) { //Log.Message("Current denial level is " + denial.CurStageIndex ); return ThoughtState.ActiveAtStage(denial.CurStageIndex-1); } return ThoughtState.Inactive; } } public class ThoughtWorker_MtT : ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.m2t; } } } public class ThoughtWorker_MtF:ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.m2f; } } } public class ThoughtWorker_MtH : ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.m2h; } } } public class ThoughtWorker_FtT : ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.f2t; } } } public class ThoughtWorker_FtM : ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.f2m; } } } public class ThoughtWorker_FtH : ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.f2h; } } } public class ThoughtWorker_HtT : ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.h2t; } } } public class ThoughtWorker_HtM : ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.h2m; } } } public class ThoughtWorker_HtF : ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.h2f; } } } public class ThoughtWorker_TtH : ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.t2h; } } } public class ThoughtWorker_TtM : ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.t2m; } } } public class ThoughtWorker_TtF : ThoughtWorker_SexChange { public override HediffDef hediff_served { get { return GenderHelper.t2f; } } } }
Korth95/rjw
1.4/Source/Thoughts/ThoughtWorker_SexChange.cs
C#
mit
2,531
using Verse; using Verse.AI.Group; namespace rjw { public class Trigger_SexSatisfy : TriggerFilter { private const int CheckInterval = 120; private const int TickTimeout = 900; private int currentTick = 0; public float targetValue = 0.3f; public Trigger_SexSatisfy(float t) { this.targetValue = t; currentTick = 0; } public override bool AllowActivation(Lord lord, TriggerSignal signal) { currentTick++; if (signal.type == TriggerSignalType.Tick && Find.TickManager.TicksGame % CheckInterval == 0) { float? avgValue = null; foreach (var pawn in lord.ownedPawns) { /*foreach(Pawn p in lord.Map.mapPawns.PawnsInFaction(Faction.OfPlayer)) { }*/ Need_Sex n = pawn.needs.TryGetNeed<Need_Sex>(); //if (n != null && pawn.gender == Gender.Male && !pawn.Downed) if(xxx.can_rape(pawn) && (xxx.is_healthy_enough(pawn) && xxx.IsTargetPawnOkay(pawn) || !xxx.is_human(pawn)) && Find.TickManager.TicksGame > pawn.mindState.canLovinTick) { avgValue = (avgValue == null) ? n.CurLevel : (avgValue + n.CurLevel) / 2f; } } //--Log.Message("[ABF]Trigger_SexSatisfy::ActivateOn Checked value :" + avgValue + "/" + targetValue); return avgValue == null || avgValue >= targetValue; } return currentTick >= TickTimeout; } } }
Korth95/rjw
1.4/Source/Triggers/Trigger_SexSatisfy.cs
C#
mit
1,320
using RimWorld; using Verse; using Verse.AI; namespace rjw { /// <summary> /// Assigns a pawn to rape a comfort prisoner /// </summary> public class WorkGiver_BestialityF : WorkGiver_Sexchecks { public override bool MoreChecks(Pawn pawn, Thing t, bool forced = false) { if (!RJWSettings.rape_enabled) return false; Pawn target = t as Pawn; if (!RJWSettings.WildMode) { if (xxx.is_kind(pawn)) { JobFailReason.Is("refuses to rape"); return false; } //satisfied pawns //horny non rapists if ((xxx.need_some_sex(pawn) <= 1f) || (xxx.need_some_sex(pawn) <= 2f && !(xxx.is_rapist(pawn) || xxx.is_psychopath(pawn) || xxx.is_nympho(pawn)))) { JobFailReason.Is("not horny enough"); return false; } if (!target.IsDesignatedComfort()) { //JobFailReason.Is("not designated as CP", null); return false; } if (!xxx.is_healthy_enough(target) || !xxx.is_not_dying(target) && (xxx.is_bloodlust(pawn) || xxx.is_psychopath(pawn) || xxx.is_rapist(pawn) || xxx.has_quirk(pawn, "Somnophile"))) { //--Log.Message("[RJW]WorkGiver_RapeCP::HasJobOnThing called0 - target isn't healthy enough or is in a forbidden position."); JobFailReason.Is("target not healthy enough"); return false; } if (pawn.relations.OpinionOf(target) > 50 && !xxx.is_rapist(pawn) && !xxx.is_psychopath(pawn) && !xxx.is_masochist(target)) { JobFailReason.Is("refuses to rape a friend"); return false; } if (!xxx.can_rape(pawn)) { //--Log.Message("[RJW]WorkGiver_RapeCP::HasJobOnThing called1 - pawn don't need sex or is not healthy, or cannot rape"); JobFailReason.Is("cannot rape target (vulnerability too low, or age mismatch)"); return false; } if (!xxx.IsSingleOrPartnersNotHere(pawn) && !xxx.is_lecher(pawn) && !xxx.is_psychopath(pawn) && !xxx.is_nympho(pawn)) if (!LovePartnerRelationUtility.LovePartnerRelationExists(pawn, target)) { //--Log.Message("[RJW]WorkGiver_RapeCP::HasJobOnThing called2 - pawn is not single or has partner around"); JobFailReason.Is("cannot rape while in stable relationship"); return false; } } if (!pawn.CanReserve(target, xxx.max_rapists_per_prisoner, 0)) return false; //Log.Message("[RJW]" + this.GetType().ToString() + " extended checks: can start sex"); return true; } public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { //--Log.Message("[RJW]WorkGiver_RapeCP::JobOnThing(" + xxx.get_pawnname(pawn) + "," + t.ToStringSafe() + ") is called."); return new Job(xxx.comfort_prisoner_rapin, t); } } }
Korth95/rjw
1.4/Source/WorkGivers/WorkGiver_BestialityF.cs
C#
mit
2,663