code
stringlengths
0
56.1M
repo_name
stringclasses
515 values
path
stringlengths
2
147
language
stringclasses
447 values
license
stringclasses
7 values
size
int64
0
56.8M
using System.Collections.Generic; using RimWorld; using Verse; using Multiplayer.API; namespace rjw { public class Recipe_ForceOffGear : Recipe_Surgery { public static bool is_wearing(Pawn p, ThingDef apparel_def) { if (p.apparel != null) foreach (var app in p.apparel.WornApparel) if (app.def == apparel_def) return true; return false; } public static BodyPartRecord find_part_record(BodyPartDef part_def, Pawn p) { return p.RaceProps.body.AllParts.Find((BodyPartRecord bpr) => bpr.def == part_def); } // Puts the recipe in the operations list only if "p" is wearing the relevant apparel. The little trick here is that yielding // null causes the game to put the recipe in the list but not actually apply it to a body part. public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef generic_def) { var r = (force_off_gear_def)generic_def; if (is_wearing(p, r.removes_apparel)) yield return null; } [SyncMethod] public static void apply_burns(Pawn p, List<BodyPartDef> parts, float min_severity, float max_severity) { foreach (var part in parts) { var rec = find_part_record(part, p); if (rec != null) { //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); var to_deal = Rand.Range(min_severity, max_severity) * part.GetMaxHealth(p); var dealt = 0.0f; var counter = 0; while ((counter < 100) && (dealt < to_deal) && (!p.health.hediffSet.PartIsMissing(rec))) { var dam = Rand.RangeInclusive(3, 5); p.TakeDamage(new DamageInfo(DamageDefOf.Burn, dam, 999, -1.0f, null, rec, null)); ++counter; dealt += (float)dam; } } } } [SyncMethod] public override void ApplyOnPawn(Pawn p, BodyPartRecord null_part, Pawn surgeon, List<Thing> ingredients,Bill bill) { var r = (force_off_gear_def)recipe; if ((surgeon != null) && (p.apparel != null) && (!CheckSurgeryFail(surgeon, p, ingredients, find_part_record(r.failure_affects, p),bill))) { // Remove apparel foreach (var app in p.apparel.WornApparel) if (app.def == r.removes_apparel) { p.apparel.Remove(app); break; } // Destroy parts //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); var def_to_destroy = r.destroys_one_of.RandomElement<BodyPartDef>(); if (def_to_destroy != null) { var record_to_destroy = find_part_record(def_to_destroy, p); if (record_to_destroy != null) { var dam = (int)(1.5f * def_to_destroy.GetMaxHealth(p)); p.TakeDamage(new DamageInfo(DamageDefOf.Burn, dam, 999, -1.0f, null, record_to_destroy, null)); } } if (r.major_burns_on != null) apply_burns(p, r.major_burns_on, 0.30f, 0.60f); if (r.minor_burns_on != null) apply_burns(p, r.minor_burns_on, 0.15f, 0.35f); } } } }
TDarksword/rjw
Source/Modules/Bondage/Recipes/Recipe_ForceOffGear.cs
C#
mit
2,904
using RimWorld; using Verse; namespace rjw { public class ThoughtWorker_Bound : ThoughtWorker { protected override ThoughtState CurrentStateInternal(Pawn p) { if (p.apparel != null) { bool bound = false, gagged = false; foreach (var app in p.apparel.WornApparel) { var gear_def = app.def as bondage_gear_def; if (gear_def != null) { bound |= gear_def.gives_bound_moodlet; gagged |= gear_def.gives_gagged_moodlet; } } if (bound && gagged) return ThoughtState.ActiveAtStage(2); else if (gagged) return ThoughtState.ActiveAtStage(1); else if (bound) return ThoughtState.ActiveAtStage(0); } return ThoughtState.Inactive; } } }
TDarksword/rjw
Source/Modules/Bondage/Thoughts/ThoughtWorker_Bound.cs
C#
mit
723
using System; using System.Collections.Generic; using System.Linq; using RimWorld; using Verse; using Verse.AI; namespace rjw { //public static class bondage_gear_tradeability //{ // public static void init() // { // // Allows bondage gear to be selled by traders // if (xxx.config.bondage_gear_enabled) // { // foreach (var def in DefDatabase<bondage_gear_def>.AllDefs) // def.tradeability = Tradeability.Sellable; // } // // Forbids bondage gear to be selled by traders // else // { // foreach (var def in DefDatabase<bondage_gear_def>.AllDefs) // def.tradeability = Tradeability.None; // } // } //} public static class bondage_gear_extensions { public static bool has_lock(this Apparel app) { return (app.TryGetComp<CompHoloCryptoStamped>() != null); } public static bool is_wearing_locked_apparel(this Pawn p) { if (p.apparel != null) foreach (var app in p.apparel.WornApparel) if (app.has_lock()) return true; return false; } // Tries to get p started on the job of using an item on either another pawn or on themself (if "other" is null). // Of course in order for this method to work, the item's useJob has to be able to handle use on another pawn. This // is true for the holokey and bondage gear in RJW but not the items in the core game public static void start_job(this CompUsable usa, Pawn p, LocalTargetInfo tar) { if (p.CanReserveAndReach(usa.parent, PathEndMode.Touch, Danger.Some) && ((tar == null) || p.CanReserveAndReach(tar, PathEndMode.Touch, Danger.Some))) { var comfor = usa.parent.GetComp<CompForbiddable>(); if (comfor != null) comfor.Forbidden = false; var job = JobMaker.MakeJob(((CompProperties_Usable)usa.props).useJob, usa.parent, tar); p.jobs.TryTakeOrderedJob(job); } } // Creates a menu option to use an item. "tar" is expected to be a pawn, corpse or null if it doesn't apply (in which // case the pawn will presumably use the item on themself). "required_work" can also be null. public static FloatMenuOption make_option(this CompUsable usa, string label, Pawn p, LocalTargetInfo tar, WorkTypeDef required_work) { if ((tar != null) && (!p.CanReserve(tar))) { string key = "Reserved"; string text = TranslatorFormattedStringExtensions.Translate(key); return new FloatMenuOption(label + " (" + text + ")", null, MenuOptionPriority.DisabledOption); } else if ((tar != null) && (!p.CanReach(tar, PathEndMode.Touch, Danger.Some))) { string key = "NoPath"; string text = TranslatorFormattedStringExtensions.Translate(key); return new FloatMenuOption(label + " (" + text + ")", null, MenuOptionPriority.DisabledOption); } else if ((required_work != null) && p.WorkTagIsDisabled(required_work.workTags)) { string key = "CannotPrioritizeWorkTypeDisabled"; string text = TranslatorFormattedStringExtensions.Translate(key, required_work.gerundLabel); return new FloatMenuOption(label + " (" + text + ")", null, MenuOptionPriority.DisabledOption); } else return new FloatMenuOption( label, delegate { usa.start_job(p, tar); }, MenuOptionPriority.Default); } } public class bondage_gear_def : ThingDef { public Type soul_type; public HediffDef equipped_hediff = null; public bool gives_bound_moodlet = false; public bool gives_gagged_moodlet = false; public bool blocks_hands = false; public bool blocks_oral = false; public bool blocks_penis = false; public bool blocks_vagina = false; public bool blocks_anus = false; public bool blocks_breasts = false; private bondage_gear_soul soul_ins = null; public List<BodyPartDef> HediffTargetBodyPartDefs; //field for optional list of targeted parts for hediff applying public List<BodyPartGroupDef> BoundBodyPartGroupDefs; //field for optional list of groups restrained of verbcasting public bondage_gear_soul soul { get { if (soul_ins == null) soul_ins = (bondage_gear_soul)Activator.CreateInstance(soul_type); return soul_ins; } } } public class bondage_gear_soul { // Adds the bondage gear's associated HediffDef and spawns a matching holokey public virtual void on_wear(Pawn wearer, Apparel gear) { var def = (bondage_gear_def)gear.def; if (def.equipped_hediff != null && def.HediffTargetBodyPartDefs != null) { foreach (BodyPartDef partDef in def.HediffTargetBodyPartDefs) //getting BodyPartDef, for example "Arm" { foreach (BodyPartRecord partRec in wearer.RaceProps.body.GetPartsWithDef(partDef)) //applying hediff to every single arm found on pawn { wearer.health.AddHediff(def.equipped_hediff, partRec); } } } else if (def.equipped_hediff != null && def.HediffTargetBodyPartDefs == null) //backward compatibility/simplified gear define without HediffTargetBodyPartDefs { //Hediff applyed to whole body wearer.health.AddHediff(def.equipped_hediff); } var gear_stamp = gear.TryGetComp<CompHoloCryptoStamped>(); if (gear_stamp != null) { var key = ThingMaker.MakeThing(ThingDef.Named("Holokey")); var key_stamp = key.TryGetComp<CompHoloCryptoStamped>(); key_stamp.copy_stamp_from(gear_stamp); if (wearer.Map != null) GenSpawn.Spawn(key, wearer.Position, wearer.Map); else wearer.inventory.TryAddItemNotForSale(key); } } // Removes the gear's HediffDef public virtual void on_remove(Apparel gear, Pawn former_wearer) { var def = (bondage_gear_def)gear.def; if (def.equipped_hediff != null && def.HediffTargetBodyPartDefs != null) { //getting all Hediffs according with equipped_hediff def List<Hediff> hediffs = former_wearer.health.hediffSet.hediffs.Where(x => x.def == def.equipped_hediff).ToList(); foreach (Hediff hedToRemove in hediffs) { if (def.HediffTargetBodyPartDefs.Contains(hedToRemove.Part.def)) //removing if applyed by this bondage_gear former_wearer.health.RemoveHediff(hedToRemove); //assuming there can be several different bondages } //with the same equipped_hediff def } else if (def.equipped_hediff != null && def.HediffTargetBodyPartDefs == null) //backward compatibility/simplified gear define without HediffTargetBodyPartDefs { var hed = former_wearer.health.hediffSet.GetFirstHediffOfDef(def.equipped_hediff); if (hed != null) former_wearer.health.RemoveHediff(hed); } } } // Give bondage gear an extremely low score when it's not being worn so pawns never equip it on themselves and give // it an extremely high score when it is being worn so pawns never try to take it off to equip something "better". public class bondage_gear : Apparel { public override float GetSpecialApparelScoreOffset() { return (Wearer == null) ? -1e5f : 1e5f; } // made this method universal for any bondage_gear, won't affect anything if gear's BoundBodyPartGroupDefs is empty or null public override bool AllowVerbCast(IntVec3 root, Map map, LocalTargetInfo targ, Verb verb) { if ((this.def as bondage_gear_def).BoundBodyPartGroupDefs != null && verb.tool != null && (this.def as bondage_gear_def).BoundBodyPartGroupDefs.Contains(verb.tool.linkedBodyPartsGroup)) { return false; } return true; } //needed for save compatibility only public override void ExposeData() { base.ExposeData(); //if (Scribe.mode == LoadSaveMode.PostLoadInit) // CheckHediffs(); } //save compatibility insurance, will prevent Armbinder hediff with 0part efficiency on whole body private void CheckHediffs() { var def = (bondage_gear_def)this.def; if (this.Wearer == null || def.equipped_hediff == null) return; bool changedHediff = false; void ApplyHediffDirect(HediffDef hedDef, BodyPartRecord partRec) { Hediff hediff = (Hediff)HediffMaker.MakeHediff(hedDef, Wearer); if (partRec != null) hediff.Part = partRec; Wearer.health.hediffSet.AddDirect(hediff); changedHediff = true; } void RemoveHediffDirect(Hediff hed) { Wearer.health.hediffSet.hediffs.Remove(hed); changedHediff = true; } List<bondage_gear> wornBondageGear = Wearer.apparel.WornApparel.Where(x => x is bondage_gear).Cast<bondage_gear>().ToList(); List<Hediff> hediffs = new List<Hediff>(); foreach (Hediff h in this.Wearer.health.hediffSet.hediffs) hediffs.Add(h); //checking current hediffs defined by bondage_gear for being on defined place, cleaning up the misplaced bool equippedHediff; bool onPlace; foreach (Hediff hed in hediffs) { equippedHediff = false; onPlace = false; foreach (bondage_gear gear in wornBondageGear) { if (hed.def == (gear.def as bondage_gear_def).equipped_hediff) { //if hediff from bondage_gear and on it's defined place then don't touch it else remove //assuming there can be several different bondages with the same equipped_hediff def and different hediff target parts, don't know why equippedHediff = true; if ((hed.Part != null && (gear.def as bondage_gear_def).HediffTargetBodyPartDefs == null)) { //pass } else if ((hed.Part == null && (gear.def as bondage_gear_def).HediffTargetBodyPartDefs == null)) { onPlace = true; break; } else if (hed.Part != null && (gear.def as bondage_gear_def).HediffTargetBodyPartDefs.Contains(hed.Part.def)) { onPlace = true; break; } } } if (equippedHediff && !onPlace) { ModLog.Message("Removing Hediff " + hed.Label + " from " + Wearer + (hed.Part == null ? "'s body" : "'s " + hed.Part)); RemoveHediffDirect(hed); } } // now iterating every gear for having all hediffs in place, adding missing foreach (bondage_gear gear in wornBondageGear) { if ((gear.def as bondage_gear_def).equipped_hediff == null) continue; if ((gear.def as bondage_gear_def).HediffTargetBodyPartDefs == null) //handling gear without HediffTargetBodyPartDefs { Hediff hed = Wearer.health.hediffSet.hediffs.Find(x => (x.def == (gear.def as bondage_gear_def).equipped_hediff && x.Part == null));//checking hediff defined by gear on whole body if (hed == null) //if no legit hediff, adding { ModLog.Message("Adding missing Hediff " + (gear.def as bondage_gear_def).equipped_hediff.label + " to " + Wearer + "'s body"); ApplyHediffDirect((gear.def as bondage_gear_def).equipped_hediff, null); } } else //handling gear with defined HediffTargetBodyPartDefs { foreach (BodyPartDef partDef in (gear.def as bondage_gear_def).HediffTargetBodyPartDefs) //getting every partDef { foreach (BodyPartRecord partRec in Wearer.RaceProps.body.GetPartsWithDef(partDef)) //checking all parts of def for applyed hediff { Hediff hed = Wearer.health.hediffSet.hediffs.Find(x => (x.def == (gear.def as bondage_gear_def).equipped_hediff && x.Part == partRec));//checking hediff defined by gear on defined place if (hed == null) //if hediff missing, adding { ModLog.Message("Adding missing Hediff " + (gear.def as bondage_gear_def).equipped_hediff.label + " to " + Wearer + "'s " + partRec.Label); ApplyHediffDirect((gear.def as bondage_gear_def).equipped_hediff, partRec); } } } } //possibility of several different items with THE SAME equipped_hediff def ON THE SAME PART is not considered, that's sick } if (changedHediff) { //Possible error in current toil on Notify_HediffChanged() if capacity.Manipulation is involved so making it in the end. //Probably harmless, shouldn't happen again after corrected hediffs will be saved Wearer.health.Notify_HediffChanged(null); } } } public class armbinder : bondage_gear { // Prevents pawns in armbinders from melee attacking //public override bool AllowVerbCast (IntVec3 root, TargetInfo targ) //{ // return false; //} } public class yoke : bondage_gear { // Prevents pawns in armbinders from melee attacking //public override bool AllowVerbCast (IntVec3 root, TargetInfo targ) //{ // return false; //} } public class Restraints : bondage_gear { // Prevents pawns in armbinders from melee attacking //public override bool AllowVerbCast (IntVec3 root, TargetInfo targ) //{ // return false; //} } public class force_off_gear_def : RecipeDef { public ThingDef removes_apparel; public BodyPartDef failure_affects; public List<BodyPartDef> destroys_one_of = null; public List<BodyPartDef> major_burns_on = null; public List<BodyPartDef> minor_burns_on = null; } }
TDarksword/rjw
Source/Modules/Bondage/bondage_gear.cs
C#
mit
13,282
using RimWorld; using Verse; namespace rjw { public class CompMilkableHuman : CompHasGatherableBodyResource { protected override int GatherResourcesIntervalDays => Props.milkIntervalDays; protected override int ResourceAmount => Props.milkAmount; protected override ThingDef ResourceDef => Props.milkDef; protected override string SaveKey => "milkFullness"; public CompProperties_MilkableHuman Props => (CompProperties_MilkableHuman)props; protected override bool Active { get { if (!Active) { return false; } Pawn pawn = parent as Pawn; if (pawn != null) { //idk should probably remove non rjw stuff //should merge Lactating into .cs hediff? //vanilla //C&P? //rjw human //rjw animal if ((!pawn.health.hediffSet.HasHediff(HediffDef.Named("RJW_lactating"), false)) && ((pawn.health.hediffSet.HasHediff(HediffDef.Named("Pregnant"), false) && pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Pregnant"), false).Visible) //|| (pawn.health.hediffSet.HasHediff(HediffDef.Named("HumanPregnancy"), false) && pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("HumanPregnancy"), false).Visible) || (pawn.health.hediffSet.HasHediff(HediffDef.Named("RJW_pregnancy"), false) && pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("RJW_pregnancy"), false).Visible) || (pawn.health.hediffSet.HasHediff(HediffDef.Named("RJW_pregnancy_beast"), false) && pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("RJW_pregnancy_beast"), false).Visible))) { pawn.health.AddHediff(HediffDef.Named("RJW_lactating"), null, null, null); } if ((!Props.milkFemaleOnly || pawn.gender == Gender.Female) && (pawn.ageTracker.CurLifeStage.reproductive) && (pawn.RaceProps.Humanlike) && (pawn.health.hediffSet.HasHediff(HediffDef.Named("RJW_lactating"), false) //|| pawn.health.hediffSet.HasHediff(HediffDef.Named("Lactating_Permanent"), false) //|| pawn.health.hediffSet.HasHediff(HediffDef.Named("Lactating_Natural"), false) //|| pawn.health.hediffSet.HasHediff(HediffDef.Named("Lactating_Drug"), false) )) { return true; } } return false; } } public override string CompInspectStringExtra() { if (!Active) { return null; } return Translator.Translate("MilkFullness") + ": " + GenText.ToStringPercent(this.Fullness); } } }
TDarksword/rjw
Source/Modules/Milking/Comps/CompMilkableHuman.cs
C#
mit
2,444
using Verse; namespace rjw { public class CompProperties_MilkableHuman : CompProperties { public int milkIntervalDays; public int milkAmount = 8; public ThingDef milkDef; public bool milkFemaleOnly = true; public CompProperties_MilkableHuman() { compClass = typeof(CompMilkableHuman); } } }
TDarksword/rjw
Source/Modules/Milking/Comps/CompProperties_MilkableHuman.cs
C#
mit
316
using RimWorld; using Verse; namespace rjw { [DefOf] public static class JobDefOfZ { public static JobDef MilkHuman; static JobDefOfZ() { DefOfHelper.EnsureInitializedInCtor(typeof(JobDefOf)); } } }
TDarksword/rjw
Source/Modules/Milking/JobDrivers/JobDefOfZ.cs
C#
mit
216
using RimWorld; using System; using System.Collections.Generic; using Verse; using Verse.AI; namespace rjw { public abstract class JobDriver_GatherHumanBodyResources : JobDriver_GatherAnimalBodyResources { private float gatherProgress; /* //maybe change? protected abstract int GatherResourcesIntervalDays { get; } //add breastsize modifier? protected abstract int ResourceAmount { get; } //add more milks? protected abstract ThingDef ResourceDef { get; } */ protected override IEnumerable<Toil> MakeNewToils() { ToilFailConditions.FailOnDespawnedNullOrForbidden<JobDriver_GatherHumanBodyResources>(this, TargetIndex.A); ToilFailConditions.FailOnNotCasualInterruptible<JobDriver_GatherHumanBodyResources>(this, TargetIndex.A); yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch); Toil wait = new Toil(); wait.initAction = delegate { Pawn milker = base.pawn; LocalTargetInfo target = base.job.GetTarget(TargetIndex.A); Pawn target2 = (Pawn)target.Thing; milker.pather.StopDead(); PawnUtility.ForceWait(target2, 15000, null, true); }; wait.tickAction = delegate { Pawn milker = base.pawn; milker.skills.Learn(SkillDefOf.Animals, 0.13f, false); gatherProgress += StatExtension.GetStatValue(milker, StatDefOf.AnimalGatherSpeed, true); if (gatherProgress >= WorkTotal) { GetComp((Pawn)base.job.GetTarget(TargetIndex.A)).Gathered(base.pawn); milker.jobs.EndCurrentJob(JobCondition.Succeeded, true); } }; wait.AddFinishAction((Action)delegate { Pawn milker = base.pawn; LocalTargetInfo target = base.job.GetTarget(TargetIndex.A); Pawn target2 = (Pawn)target.Thing; if (target2 != null && target2.CurJobDef == JobDefOf.Wait_MaintainPosture) { milker.jobs.EndCurrentJob(JobCondition.InterruptForced, true); } }); ToilFailConditions.FailOnDespawnedOrNull<Toil>(wait, TargetIndex.A); ToilFailConditions.FailOnCannotTouch<Toil>(wait, TargetIndex.A, PathEndMode.Touch); wait.AddEndCondition((Func<JobCondition>)delegate { if (GetComp((Pawn)base.job.GetTarget(TargetIndex.A)).ActiveAndFull) { return JobCondition.Ongoing; } return JobCondition.Incompletable; }); wait.defaultCompleteMode = ToilCompleteMode.Never; ToilEffects.WithProgressBar(wait, TargetIndex.A, (Func<float>)(() => gatherProgress / WorkTotal), false, -0.5f); wait.activeSkill = (() => SkillDefOf.Animals); yield return wait; } } }
TDarksword/rjw
Source/Modules/Milking/JobDrivers/JobDriver_GatherHumanBodyResources.cs
C#
mit
2,524
using RimWorld; using Verse; namespace rjw { public class JobDriver_MilkHuman : JobDriver_GatherHumanBodyResources { protected override float WorkTotal => 400f; protected override CompHasGatherableBodyResource GetComp(Pawn animal) { return ThingCompUtility.TryGetComp<CompMilkableHuman>(animal); } } }
TDarksword/rjw
Source/Modules/Milking/JobDrivers/JobDriver_MilkHuman.cs
C#
mit
318
using RimWorld; using System.Collections.Generic; using Verse; using Verse.AI; namespace rjw { public abstract class WorkGiver_GatherHumanBodyResources : WorkGiver_GatherAnimalBodyResources { public override IEnumerable<Thing> PotentialWorkThingsGlobal(Pawn pawn) { //List<Pawn> pawns = pawn.Map.mapPawns.SpawnedPawnsInFaction(pawn.Faction); //int i = 0; //if (i < pawns.Count) //{ // yield return (Thing)pawns[i]; /*Error: Unable to find new state assignment for yield return*/ // ; //} foreach (Pawn targetpawn in pawn.Map.mapPawns.FreeColonistsAndPrisonersSpawned) { yield return targetpawn; } } public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false) { Pawn pawn2 = t as Pawn; if (pawn2 == null || !pawn2.RaceProps.Humanlike) { return false; } CompHasGatherableBodyResource comp = GetComp(pawn2); if (comp != null && comp.ActiveAndFull && PawnUtility.CanCasuallyInteractNow(pawn2, false) && pawn2 != pawn) { LocalTargetInfo target = pawn2; bool ignoreOtherReservations = forced; if (ReservationUtility.CanReserve(pawn, target, 1, -1, null, ignoreOtherReservations)) { return true; } } return false; } } }
TDarksword/rjw
Source/Modules/Milking/WorkGivers/WorkGiver_GatherHumanBodyResources.cs
C#
mit
1,240
using RimWorld; using Verse; namespace rjw { public class WorkGiver_MilkHuman : WorkGiver_GatherHumanBodyResources { protected override JobDef JobDef => JobDefOfZ.MilkHuman; protected override CompHasGatherableBodyResource GetComp(Pawn animal) { return ThingCompUtility.TryGetComp<CompMilkableHuman>(animal); } } }
TDarksword/rjw
Source/Modules/Milking/WorkGivers/WorkGiver_MilkHuman.cs
C#
mit
331
using Verse; using RimWorld; using Multiplayer.API; namespace rjw { [StaticConstructorOnStartup] public static class RJW_Multiplayer { static RJW_Multiplayer() { if (!MP.enabled) return; // This is where the magic happens and your attributes // auto register, similar to Harmony's PatchAll. MP.RegisterAll(); /* Log.Message("RJW MP compat testing"); var type = AccessTools.TypeByName("rjw.RJWdesignations"); //Log.Message("rjw MP compat " + type.Name); Log.Message("is host " + MP.IsHosting); Log.Message("PlayerName " + MP.PlayerName); Log.Message("IsInMultiplayer " + MP.IsInMultiplayer); //MP.RegisterSyncMethod(type, "Comfort"); /* MP.RegisterSyncMethod(type, "<GetGizmos>Service"); MP.RegisterSyncMethod(type, "<GetGizmos>BreedingHuman"); MP.RegisterSyncMethod(type, "<GetGizmos>BreedingAnimal"); MP.RegisterSyncMethod(type, "<GetGizmos>Breeder"); MP.RegisterSyncMethod(type, "<GetGizmos>Milking"); MP.RegisterSyncMethod(type, "<GetGizmos>Hero"); */ // You can choose to not auto register and do it manually // with the MP.Register* methods. // Use MP.IsInMultiplayer to act upon it in other places // user can have it enabled and not be in session } //generate PredictableSeed for Verse.Rand public static int PredictableSeed() { int seed = 0; try { Map map = Find.CurrentMap; //int seedHourOfDay = GenLocalDate.HourOfDay(map); //int seedDayOfYear = GenLocalDate.DayOfYear(map); //int seedYear = GenLocalDate.Year(map); seed = (GenLocalDate.HourOfDay(map) + GenLocalDate.DayOfYear(map)) * GenLocalDate.Year(map); //int seed = (seedHourOfDay + seedDayOfYear) * seedYear; //Log.Warning("seedHourOfDay: " + seedHourOfDay + "\nseedDayOfYear: " + seedDayOfYear + "\nseedYear: " + seedYear + "\n" + seed); } catch { seed = Rand.Int; } return seed; } //generate PredictableSeed for Verse.Rand [SyncMethod] public static float RJW_MP_RAND() { return Rand.Value; } } }
TDarksword/rjw
Source/Modules/Multiplayer/Multiplayer.cs
C#
mit
2,049
using System.Linq; using RimWorld; using Verse; using Multiplayer.API; namespace rjw { public class IncidentWorker_NymphJoins : IncidentWorker { protected override bool CanFireNowSub(IncidentParms parms) { if (!RJWSettings.NymphTamed) return false; Map map = (Map)parms.target; float colonist_count = map.mapPawns.FreeColonistsCount; float nymph_count = map.mapPawns.FreeColonists.Count(xxx.is_nympho); float nymph_fraction = nymph_count / colonist_count; return colonist_count >= 1 && (nymph_fraction < xxx.config.max_nymph_fraction); } [SyncMethod] protected override bool TryExecuteWorker(IncidentParms parms) { //--Log.Message("IncidentWorker_NymphJoins::TryExecute() called"); if (!RJWSettings.NymphTamed) return false; if (MP.IsInMultiplayer) return false; Map map = (Map) parms.target; if (map == null) { //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - map is null, abort!"); return false; } else { //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - map is ok"); } //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); if (!RCellFinder.TryFindRandomPawnEntryCell(out IntVec3 loc, map, CellFinder.EdgeRoadChance_Friendly + 0.2f)) { //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - no entry, abort!"); return false; } Pawn pawn = Nymph_Generator.GenerateNymph(loc, ref map); //generates with null faction, mod conflict ?! pawn.SetFaction(Faction.OfPlayer); GenSpawn.Spawn(pawn, loc, map); Find.LetterStack.ReceiveLetter("Nymph Joins", "A wandering nymph has decided to join your settlement.", LetterDefOf.PositiveEvent, pawn); return true; } } }
TDarksword/rjw
Source/Modules/Nymphs/Incidents/IncidentWorker_NymphJoins.cs
C#
mit
1,721
using System.Linq; using RimWorld; using Verse; using Multiplayer.API; namespace rjw { public class IncidentWorker_NymphVisitor : IncidentWorker { [SyncMethod] protected override bool TryExecuteWorker(IncidentParms parms) { //--Log.Message("IncidentWorker_NymphVisitor::TryExecute() called"); if (!RJWSettings.NymphWild) return false; if (MP.IsInMultiplayer) return false; Map map = (Map) parms.target; if (map == null) { //--Log.Message("IncidentWorker_NymphVisitor::TryExecute() - map is null, abort!"); return false; } else { //--Log.Message("IncidentWorker_NymphVisitor::TryExecute() - map is ok"); } //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); if (!RCellFinder.TryFindRandomPawnEntryCell(out IntVec3 loc, map, CellFinder.EdgeRoadChance_Friendly + 0.2f)) { //--Log.Message("IncidentWorker_NymphVisitor::TryExecute() - no entry, abort!"); return false; } Pawn pawn = Nymph_Generator.GenerateNymph(loc, ref map); //generates with null faction, mod conflict ?! GenSpawn.Spawn(pawn, loc, map); pawn.ChangeKind(PawnKindDefOf.WildMan); //if (pawn.Faction != null) // pawn.SetFaction(null); if (RJWSettings.NymphPermanentManhunter) pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent); else pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter); Find.LetterStack.ReceiveLetter("Nymph! ", "A wandering nymph has decided to visit your settlement.", LetterDefOf.ThreatSmall, pawn); return true; } } }
TDarksword/rjw
Source/Modules/Nymphs/Incidents/IncidentWorker_NymphVisitor.cs
C#
mit
1,608
using RimWorld; using Verse; using Multiplayer.API; namespace rjw { public class IncidentWorker_NymphVisitorGroupEasy : IncidentWorker_NeutralGroup { private static readonly SimpleCurve PointsCurve = new SimpleCurve { new CurvePoint(45f, 0f), new CurvePoint(50f, 1f), new CurvePoint(100f, 1f), new CurvePoint(200f, 0.25f), new CurvePoint(300f, 0.1f), new CurvePoint(500f, 0f) }; [SyncMethod] protected override void ResolveParmsPoints(IncidentParms parms) { if (!(parms.points >= 0f)) { parms.points = Rand.ByCurve(PointsCurve); } } [SyncMethod] protected override bool TryExecuteWorker(IncidentParms parms) { //--Log.Message("IncidentWorker_NymphVisitorGroup::TryExecute() called"); if (!RJWSettings.NymphRaidEasy) return false; if (MP.IsInMultiplayer) return false; Map map = (Map)parms.target; if (map == null) { //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - map is null, abort!"); return false; } else { //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - map is ok"); } //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); if (!RCellFinder.TryFindRandomPawnEntryCell(out IntVec3 loc, map, CellFinder.EdgeRoadChance_Friendly + 0.2f)) { //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - no entry, abort!"); return false; } //var PlayerHomeMap = Find.Maps.Find(map => map.IsPlayerHome); var count = (Find.World.worldPawns.AllPawnsAlive.Count + map.mapPawns.FreeColonistsAndPrisonersSpawnedCount); //Log.Message("IncidentWorker_NymphJoins::TryExecute() -count:" + count + " map:" + PlayerHomeMap); for (int i = 1; i <= count || i <= 100; ++i) { Pawn pawn = Nymph_Generator.GenerateNymph(loc, ref map); //pawn.SetFaction(Faction.OfPlayer); GenSpawn.Spawn(pawn, loc, map); pawn.ChangeKind(PawnKindDefOf.WildMan); //if (pawn.Faction != null) // pawn.SetFaction(null); if (RJWSettings.NymphPermanentManhunter) pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent); else pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter); } Find.LetterStack.ReceiveLetter("Nymphs!!!", "A group of nymphs has wandered into your settlement.", LetterDefOf.ThreatBig, null); return true; } } }
TDarksword/rjw
Source/Modules/Nymphs/Incidents/IncidentWorker_NymphVisitorGroupE.cs
C#
mit
2,383
using RimWorld; using Verse; using Multiplayer.API; namespace rjw { public class IncidentWorker_NymphVisitorGroupHard : IncidentWorker_NeutralGroup { private static readonly SimpleCurve PointsCurve = new SimpleCurve { new CurvePoint(45f, 0f), new CurvePoint(50f, 1f), new CurvePoint(100f, 1f), new CurvePoint(200f, 0.25f), new CurvePoint(300f, 0.1f), new CurvePoint(500f, 0f) }; [SyncMethod] protected override void ResolveParmsPoints(IncidentParms parms) { if (!(parms.points >= 0f)) { parms.points = Rand.ByCurve(PointsCurve); } } [SyncMethod] protected override bool TryExecuteWorker(IncidentParms parms) { //--Log.Message("IncidentWorker_NymphVisitorGroup::TryExecute() called"); if (!RJWSettings.NymphRaidHard) return false; if (MP.IsInMultiplayer) return false; Map map = (Map)parms.target; if (map == null) { //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - map is null, abort!"); return false; } else { //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - map is ok"); } //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); if (!RCellFinder.TryFindRandomPawnEntryCell(out IntVec3 loc, map, CellFinder.EdgeRoadChance_Friendly + 0.2f)) { //--Log.Message("IncidentWorker_NymphJoins::TryExecute() - no entry, abort!"); return false; } var count = map.mapPawns.AllPawnsSpawnedCount; //Log.Message("IncidentWorker_NymphJoins::TryExecute() -count:" + count); for (int i = 1; i <= count || i <= 1000; ++i) { Pawn pawn = Nymph_Generator.GenerateNymph(loc, ref map); //pawn.SetFaction(Faction.OfPlayer); GenSpawn.Spawn(pawn, loc, map); pawn.ChangeKind(PawnKindDefOf.WildMan); //if (pawn.Faction != null) // pawn.SetFaction(null); if (RJWSettings.NymphPermanentManhunter) pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent); else pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter); } Find.LetterStack.ReceiveLetter("Nymphs!!!", "A huge group of nymphs has wandered into your settlement.", LetterDefOf.ThreatBig, null); return true; } } }
TDarksword/rjw
Source/Modules/Nymphs/Incidents/IncidentWorker_NymphVisitorGroupH.cs
C#
mit
2,233
using System; using RimWorld; using Verse; using Multiplayer.API; namespace rjw { public class IncidentWorker_TestInc : IncidentWorker { public static void list_backstories() { foreach (var bs in BackstoryDatabase.allBackstories.Values) ModLog.Message("Backstory \"" + bs.title + "\" has identifier \"" + bs.identifier + "\""); } public static void inject_designator() { //var des = new Designator_ComfortPrisoner(); //Find.ReverseDesignatorDatabase.AllDesignators.Add(des); //Find.ReverseDesignatorDatabase.AllDesignators.Add(new Designator_Breed()); } // Applies permanent damage to a randomly chosen colonist, to test that this works [SyncMethod] public static void damage_virally(Map m) { var vir_dam = DefDatabase<DamageDef>.GetNamed("ViralDamage"); var p = m.mapPawns.FreeColonists.RandomElement(); var lun = p.RaceProps.body.AllParts.Find((BodyPartRecord bpr) => String.Equals(bpr.def.defName, "LeftLung")); var dam_def = HealthUtility.GetHediffDefFromDamage(vir_dam, p, lun); var inj = (Hediff_Injury)HediffMaker.MakeHediff(dam_def, p, null); inj.Severity = 2.0f; inj.TryGetComp<HediffComp_GetsPermanent>().IsPermanent = true; p.health.AddHediff(inj, lun, null); } // Gives all colonists on the map a severe syphilis or HIV infection [SyncMethod] public static void infect_the_colonists(Map m) { foreach (var p in m.mapPawns.FreeColonists) { if (Rand.Value < 0.50f) std_spreader.infect(p, std.syphilis); // var std_hed_def = (Rand.Value < 0.50f) ? std.syphilis.hediff_def : std.hiv.hediff_def; // p.health.AddHediff (std_hed_def); // p.health.hediffSet.GetFirstHediffOfDef (std_hed_def).Severity = Rand.Range (0.50f, 0.90f); } } // Reduces the sex need of the selected pawn public static void reduce_sex_need_on_select(Map m) { Pawn pawn = Find.Selector.SingleSelectedThing as Pawn; if (pawn != null) { if (pawn.needs.TryGetNeed<Need_Sex>() != null) { //--ModLog.Message("TestInc::reduce_sex_need_on_select is called"); pawn.needs.TryGetNeed<Need_Sex>().CurLevel -= 0.5f; } } } protected override bool TryExecuteWorker(IncidentParms parms) { var m = (Map)parms.target; // list_backstories (); // inject_designator (); // spawn_nymphs (m); // damage_virally (m); //infect_the_colonists(m); reduce_sex_need_on_select(m); return true; } } }
TDarksword/rjw
Source/Modules/Nymphs/Incidents/IncidentWorker_TestInc.cs
C#
mit
2,434
using RimWorld; using UnityEngine; using Verse; namespace rjw { public class IncidentWorker_TestInc2 : IncidentWorker { // Testing the mechanism of some build-in functions public static void test_funcion() { float a = Mathf.InverseLerp(0, 2, 3); //gives 1 float b = Mathf.InverseLerp(0.2f, 2, 0.1f); //gives 0 float c = Mathf.InverseLerp(2f, 1, 2.5f); //gives 0 //--ModLog.Message("TestInc2::test_function is called - value a is " + a); //--ModLog.Message("TestInc2::test_function is called - value b is " + b); //--ModLog.Message("TestInc2::test_function is called - value c is " + c); } // Gives the wanted information of the selected thing public static void info_on_select(Map m) { Pawn p = Find.Selector.SingleSelectedThing as Pawn; if (p != null) { //--ModLog.Message("TestInc2::info_on_select is called"); foreach (var q in m.mapPawns.AllPawns) { SexAppraiser.would_fuck(p, q, true); } } } protected override bool TryExecuteWorker(IncidentParms parms) { var m = (Map)parms.target; info_on_select(m); return true; } } }
TDarksword/rjw
Source/Modules/Nymphs/Incidents/IncidentWorker_TestInc2.cs
C#
mit
1,154
using System.Collections.Generic; using RimWorld; using Verse; using Multiplayer.API; using System.Linq; using System.Linq.Expressions; namespace rjw { public struct nymph_story { public Backstory child; public Backstory adult; public List<Trait> traits; } public struct nymph_passion_chances { public float major; public float minor; public nymph_passion_chances(float maj, float min) { major = maj; minor = min; } } public static class nymph_backstories { public struct child { public static Backstory vatgrown_sex_slave; }; public struct adult { public static Backstory feisty; public static Backstory curious; public static Backstory tender; public static Backstory chatty; public static Backstory broken; public static Backstory homekeeper; }; public static void init() { { Backstory bs = new Backstory(); bs.identifier = ""; // identifier will be set by ResolveReferences MiscTranslationDef MTdef = DefDatabase<MiscTranslationDef>.GetNamedSilentFail("rjw_vatgrown_sex_slave"); if (MTdef != null) { bs.SetTitle(MTdef.label, MTdef.label); bs.SetTitleShort(MTdef.stringA, MTdef.stringA); bs.baseDesc = MTdef.description; } else { bs.SetTitle("Vat-Grown Sex Slave", "Vat-Grown Sex Slave"); bs.SetTitleShort("SexSlave", "SexSlave"); bs.baseDesc = "SexSlave Nymph"; } // bs.skillGains = new Dictionary<string, int> (); bs.skillGainsResolved.Add(SkillDefOf.Social, 8); // bs.skillGainsResolved = new Dictionary<SkillDef, int> (); // populated by ResolveReferences bs.workDisables = WorkTags.Intellectual; bs.requiredWorkTags = WorkTags.None; bs.slot = BackstorySlot.Childhood; bs.spawnCategories = new List<string>() { "rjw_nymphsCategory", "Slave" }; // Not necessary (I Think) Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin); //bs.bodyTypeFemale = BodyType.Female; //bs.bodyTypeMale = BodyType.Thin; bs.forcedTraits = new List<TraitEntry>(); bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0)); bs.disallowedTraits = new List<TraitEntry>(); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0)); bs.shuffleable = true; bs.ResolveReferences(); BackstoryDatabase.AddBackstory(bs); child.vatgrown_sex_slave = bs; //--ModLog.Message("nymph_backstories::init() succeed0"); } { Backstory bs = new Backstory(); bs.identifier = ""; MiscTranslationDef MTdef = DefDatabase<MiscTranslationDef>.GetNamedSilentFail("rjw_feisty"); if (MTdef != null) { bs.SetTitle(MTdef.label, MTdef.label); bs.SetTitleShort(MTdef.stringA, MTdef.stringA); bs.baseDesc = MTdef.description; } else { bs.SetTitle("Feisty Nymph", "Feisty Nymph"); bs.SetTitleShort("Nymph", "Nymph"); bs.baseDesc = "Feisty Nymph"; } bs.skillGainsResolved.Add(SkillDefOf.Social, -3); bs.skillGainsResolved.Add(SkillDefOf.Shooting, 2); bs.skillGainsResolved.Add(SkillDefOf.Melee, 9); bs.workDisables = (WorkTags.Cleaning | WorkTags.Animals | WorkTags.Caring | WorkTags.Artistic | WorkTags.ManualSkilled); bs.requiredWorkTags = WorkTags.None; bs.slot = BackstorySlot.Adulthood; bs.spawnCategories = new List<string>() { "rjw_nymphsCategory", "Slave" }; // Not necessary (I Think) Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin); bs.forcedTraits = new List<TraitEntry>(); bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0)); bs.disallowedTraits = new List<TraitEntry>(); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0)); bs.shuffleable = true; bs.ResolveReferences(); BackstoryDatabase.AddBackstory(bs); adult.feisty = bs; //--ModLog.Message("nymph_backstories::init() succeed1"); } { Backstory bs = new Backstory(); bs.identifier = ""; MiscTranslationDef MTdef = DefDatabase<MiscTranslationDef>.GetNamedSilentFail("rjw_curious"); if (MTdef != null) { bs.SetTitle(MTdef.label, MTdef.label); bs.SetTitleShort(MTdef.stringA, MTdef.stringA); bs.baseDesc = MTdef.description; } else { bs.SetTitle("Curious Nymph", "Curious Nymph"); bs.SetTitleShort("Nymph", "Nymph"); bs.baseDesc = "Curious Nymph"; } bs.skillGainsResolved.Add(SkillDefOf.Construction, 2); bs.skillGainsResolved.Add(SkillDefOf.Crafting, 6); bs.workDisables = (WorkTags.Animals | WorkTags.Artistic | WorkTags.Caring | WorkTags.Cooking | WorkTags.Mining | WorkTags.PlantWork | WorkTags.Violent | WorkTags.ManualDumb); bs.requiredWorkTags = WorkTags.None; bs.slot = BackstorySlot.Adulthood; bs.spawnCategories = new List<string>() { "rjw_nymphsCategory", "Slave" }; // Not necessary (I Think) Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin); bs.forcedTraits = new List<TraitEntry>(); bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0)); bs.disallowedTraits = new List<TraitEntry>(); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0)); bs.shuffleable = true; bs.ResolveReferences(); BackstoryDatabase.AddBackstory(bs); adult.curious = bs; //--ModLog.Message("nymph_backstories::init() succeed2"); } { Backstory bs = new Backstory(); bs.identifier = ""; MiscTranslationDef MTdef = DefDatabase<MiscTranslationDef>.GetNamedSilentFail("rjw_tender"); if (MTdef != null) { bs.SetTitle(MTdef.label, MTdef.label); bs.SetTitleShort(MTdef.stringA, MTdef.stringA); bs.baseDesc = MTdef.description; } else { bs.SetTitle("Tender Nymph", "Tender Nymph"); bs.SetTitleShort("Nymph", "Nymph"); bs.baseDesc = "Tender Nymph"; } bs.skillGainsResolved.Add(SkillDefOf.Medicine, 4); bs.workDisables = (WorkTags.Animals | WorkTags.Artistic | WorkTags.Hauling | WorkTags.Violent | WorkTags.ManualSkilled); bs.requiredWorkTags = WorkTags.None; bs.slot = BackstorySlot.Adulthood; bs.spawnCategories = new List<string>() { "rjw_nymphsCategory", "Slave" }; // Not necessary (I Think) Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin); bs.forcedTraits = new List<TraitEntry>(); bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0)); bs.disallowedTraits = new List<TraitEntry>(); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0)); bs.shuffleable = true; bs.ResolveReferences(); BackstoryDatabase.AddBackstory(bs); adult.tender = bs; //--ModLog.Message("nymph_backstories::init() succeed3"); } { Backstory bs = new Backstory(); bs.identifier = ""; MiscTranslationDef MTdef = DefDatabase<MiscTranslationDef>.GetNamedSilentFail("rjw_chatty"); if (MTdef != null) { bs.SetTitle(MTdef.label, MTdef.label); bs.SetTitleShort(MTdef.stringA, MTdef.stringA); bs.baseDesc = MTdef.description; } else { bs.SetTitle("Chatty Nymph", "Chatty Nymph"); bs.SetTitleShort("Nymph", "Nymph"); bs.baseDesc = "Chatty Nymph"; } bs.skillGainsResolved.Add(SkillDefOf.Social, 6); bs.workDisables = (WorkTags.Animals | WorkTags.Caring | WorkTags.Artistic | WorkTags.Violent | WorkTags.ManualDumb | WorkTags.ManualSkilled); bs.requiredWorkTags = WorkTags.None; bs.slot = BackstorySlot.Adulthood; bs.spawnCategories = new List<string>() { "rjw_nymphsCategory", "Slave" }; // Not necessary (I Think) Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin); bs.forcedTraits = new List<TraitEntry>(); bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0)); bs.disallowedTraits = new List<TraitEntry>(); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0)); bs.shuffleable = true; bs.ResolveReferences(); BackstoryDatabase.AddBackstory(bs); adult.chatty = bs; //--ModLog.Message("nymph_backstories::init() succeed4"); } { Backstory bs = new Backstory(); bs.identifier = ""; MiscTranslationDef MTdef = DefDatabase<MiscTranslationDef>.GetNamedSilentFail("rjw_broken"); if (MTdef != null) { bs.SetTitle(MTdef.label, MTdef.label); bs.SetTitleShort(MTdef.stringA, MTdef.stringA); bs.baseDesc = MTdef.description; } else { bs.SetTitle("Broken Nymph", "Broken Nymph"); bs.SetTitleShort("Nymph", "Nymph"); bs.baseDesc = "Broken Nymph"; } bs.skillGainsResolved.Add(SkillDefOf.Social, -5); bs.skillGainsResolved.Add(SkillDefOf.Artistic, 8); bs.workDisables = (WorkTags.Cleaning | WorkTags.Animals | WorkTags.Caring | WorkTags.Violent | WorkTags.ManualSkilled); bs.requiredWorkTags = WorkTags.None; bs.slot = BackstorySlot.Adulthood; bs.spawnCategories = new List<string>() { "rjw_nymphsCategory", "Slave" }; // Not necessary (I Think) Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin"); Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin); Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin); bs.forcedTraits = new List<TraitEntry>(); bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0)); bs.disallowedTraits = new List<TraitEntry>(); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0)); bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0)); bs.shuffleable = true; bs.ResolveReferences(); BackstoryDatabase.AddBackstory(bs); adult.broken = bs; //--ModLog.Message("nymph_backstories::init() succeed5"); } //{ // Backstory bs = new Backstory(); // bs.identifier = ""; // MiscTranslationDef MTdef = DefDatabase<MiscTranslationDef>.GetNamedSilentFail("rjw_homekeeper"); // if (MTdef != null) // { // bs.SetTitle(MTdef.label, MTdef.label); // bs.SetTitleShort(MTdef.stringA, MTdef.stringA); // bs.baseDesc = MTdef.description; // } // else // { // bs.SetTitle("Home keeper Nymph", "Home keeper Nymph"); // bs.SetTitleShort("Nymph", "Nymph"); // bs.baseDesc = "Home keeper Nymph"; // } // bs.skillGainsResolved.Add(SkillDefOf.Cooking, 8); // bs.workDisables = (WorkTags.Animals | WorkTags.Caring | WorkTags.Violent | WorkTags.Artistic | WorkTags.Crafting | WorkTags.PlantWork | WorkTags.Mining); // bs.requiredWorkTags = (WorkTags.Cleaning | WorkTags.Cooking); // bs.slot = BackstorySlot.Adulthood; // bs.spawnCategories = new List<string>() { "rjw_nymphsCategory", "Slave" }; // Not necessary (I Think) // Unprivater.SetProtectedValue("bodyTypeGlobal", bs, "Thin"); // Unprivater.SetProtectedValue("bodyTypeFemale", bs, "Thin"); // Unprivater.SetProtectedValue("bodyTypeMale", bs, "Thin"); // Unprivater.SetProtectedValue("bodyTypeGlobalResolved", bs, BodyTypeDefOf.Thin); // Unprivater.SetProtectedValue("bodyTypeFemaleResolved", bs, BodyTypeDefOf.Thin); // Unprivater.SetProtectedValue("bodyTypeMaleResolved", bs, BodyTypeDefOf.Thin); // bs.forcedTraits = new List<TraitEntry>(); // bs.forcedTraits.Add(new TraitEntry(xxx.nymphomaniac, 0)); // bs.disallowedTraits = new List<TraitEntry>(); // bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesMen, 0)); // bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.DislikesWomen, 0)); // bs.disallowedTraits.Add(new TraitEntry(TraitDefOf.TooSmart, 0)); // bs.shuffleable = true; // bs.ResolveReferences(); // BackstoryDatabase.AddBackstory(bs); // adult.homekeeper = bs; // //--ModLog.Message("nymph_backstories::init() succeed6"); //} } public static nymph_passion_chances get_passion_chances(Backstory child_bs, Backstory adult_bs, SkillDef skill_def) { var maj = 0.0f; var min = 0.0f; if (adult_bs == adult.feisty) { if (skill_def == SkillDefOf.Melee) { maj = 0.50f; min = 1.00f; } else if (skill_def == SkillDefOf.Shooting) { maj = 0.25f; min = 0.75f; } else if (skill_def == SkillDefOf.Social) { maj = 0.10f; min = 0.67f; } } else if (adult_bs == adult.curious) { if (skill_def == SkillDefOf.Construction) { maj = 0.15f; min = 0.40f; } else if (skill_def == SkillDefOf.Crafting) { maj = 0.50f; min = 1.00f; } else if (skill_def == SkillDefOf.Social) { maj = 0.20f; min = 1.00f; } } else if (adult_bs == adult.tender) { if (skill_def == SkillDefOf.Medicine) { maj = 0.20f; min = 0.60f; } else if (skill_def == SkillDefOf.Social) { maj = 0.50f; min = 1.00f; } } else if (adult_bs == adult.chatty) { if (skill_def == SkillDefOf.Social) { maj = 1.00f; min = 1.00f; } } else if (adult_bs == adult.broken) { if (skill_def == SkillDefOf.Artistic) { maj = 0.50f; min = 1.00f; } else if (skill_def == SkillDefOf.Social) { maj = 0.00f; min = 0.33f; } } else if (adult_bs == adult.homekeeper) { if (skill_def == SkillDefOf.Cooking) { maj = 0.50f; min = 1.00f; } else if (skill_def == SkillDefOf.Social) { maj = 0.00f; min = 0.33f; } } return new nymph_passion_chances(maj, min); } // Randomly chooses backstories and traits for a nymph [SyncMethod] public static nymph_story generate() { var tr = new nymph_story(); tr.child = child.vatgrown_sex_slave; tr.traits = new List<Trait>(); tr.traits.Add(new Trait(xxx.nymphomaniac, 0, true)); //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); var beauty = 0; var rv2 = Rand.Value; var story = (BackstoryDatabase.allBackstories.Where(x => x.Value.spawnCategories.Contains("rjw_nymphsCategory") && x.Value.slot == BackstorySlot.Adulthood)).ToList().RandomElement().Value; if (story == adult.feisty) { tr.adult = adult.feisty; beauty = Rand.RangeInclusive(0, 2); if (rv2 < 0.33) tr.traits.Add(new Trait(TraitDefOf.Brawler)); else if (rv2 < 0.67) tr.traits.Add(new Trait(TraitDefOf.Bloodlust)); else tr.traits.Add(new Trait(xxx.rapist)); } else if (story == adult.curious) { tr.adult = adult.curious; beauty = Rand.RangeInclusive(0, 2); if (rv2 < 0.33) tr.traits.Add(new Trait(TraitDefOf.Transhumanist)); } else if (story == adult.tender) { tr.adult = adult.tender; beauty = Rand.RangeInclusive(1, 2); if (rv2 < 0.50) tr.traits.Add(new Trait(TraitDefOf.Kind)); } else if (story == adult.chatty) { tr.adult = adult.chatty; beauty = 2; if (rv2 < 0.33) tr.traits.Add(new Trait(TraitDefOf.Greedy)); } else if (story == adult.broken) { tr.adult = adult.broken; beauty = Rand.RangeInclusive(0, 2); if (rv2 < 0.33) tr.traits.Add(new Trait(TraitDefOf.DrugDesire, 1)); else if (rv2 < 0.67) tr.traits.Add(new Trait(TraitDefOf.DrugDesire, 2)); } //else //{ // tr.adult = adult.homekeeper; // beauty = Rand.RangeInclusive(1, 2); // if (rv2 < 0.33) // tr.traits.Add(new Trait(TraitDefOf.Kind)); //} if (beauty > 0) tr.traits.Add(new Trait(TraitDefOf.Beauty, beauty, false)); return tr; } } }
TDarksword/rjw
Source/Modules/Nymphs/Pawns/Nymph_Backstories.cs
C#
mit
17,922
using System.Collections.Generic; using RimWorld; using UnityEngine; using Verse; using System; using Multiplayer.API; namespace rjw { public static class Nymph_Generator { /// <summary> /// Returns true if the given pawnGenerationRequest is for a nymph pawnKind. /// </summary> public static bool IsNymph(PawnGenerationRequest pawnGenerationRequest) { return pawnGenerationRequest.KindDef != null && pawnGenerationRequest.KindDef.defName == "Nymph"; } private static bool is_trait_conflicting_or_duplicate(Pawn pawn, Trait t) { foreach (var existing in pawn.story.traits.allTraits) if ((existing.def == t.def) || (t.def.ConflictsWith(existing))) return true; return false; } public static bool IsNymphBodyType(Pawn pawn) { return pawn.story.bodyType == BodyTypeDefOf.Female || pawn.story.bodyType == BodyTypeDefOf.Thin; } [SyncMethod] public static Gender RandomNymphGender() { //with males 100% its still 99%, coz im to lazy to fix it //float rnd = Rand.Value; //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); float chance = RJWSettings.male_nymph_chance; Gender Pawngender = Rand.Chance(chance) ? Gender.Male: Gender.Female; //ModLog.Message(" setnymphsex: " + (rnd < chance) + " rnd:" + rnd + " chance:" + chance); //ModLog.Message(" setnymphsex: " + Pawngender); return Pawngender; } /// <summary> /// Replaces a pawn's backstory and traits to turn it into a nymph /// </summary> [SyncMethod] public static void set_story(Pawn pawn) { var gen_sto = nymph_backstories.generate(); pawn.story.childhood = gen_sto.child; pawn.story.adulthood = gen_sto.adult; // add broken body to broken nymph if (pawn.story.adulthood == nymph_backstories.adult.broken) { pawn.health.AddHediff(xxx.feelingBroken); //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); (pawn.health.hediffSet.GetFirstHediffOfDef(xxx.feelingBroken)).Severity = Rand.Range(0.4f, 1.0f); } //The mod More Trait Slots will adjust the max number of traits pawn can get, and therefore, //I need to collect pawns' traits and assign other_traits back to the pawn after adding the nymph_story traits. Stack<Trait> other_traits = new Stack<Trait>(); int numberOfTotalTraits = 0; if (!pawn.story.traits.allTraits.NullOrEmpty()) { foreach (Trait t in pawn.story.traits.allTraits) { other_traits.Push(t); ++numberOfTotalTraits; } } pawn.story.traits.allTraits.Clear(); var trait_count = 0; foreach (var t in gen_sto.traits) { pawn.story.traits.GainTrait(t); ++trait_count; } while (trait_count < numberOfTotalTraits) { Trait t = other_traits.Pop(); if (!is_trait_conflicting_or_duplicate(pawn, t)) pawn.story.traits.GainTrait(t); ++trait_count; } } [SyncMethod] private static int sum_previous_gains(SkillDef def, Pawn_StoryTracker sto, Pawn_AgeTracker age) { int total_gain = 0; int gain; // Gains from backstories if (sto.childhood.skillGainsResolved.TryGetValue(def, out gain)) total_gain += gain; if (sto.adulthood.skillGainsResolved.TryGetValue(def, out gain)) total_gain += gain; // Gains from traits foreach (var trait in sto.traits.allTraits) if (trait.CurrentData.skillGains.TryGetValue(def, out gain)) total_gain += gain; // Gains from age //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); var rgain = Rand.Value * (float)total_gain * 0.35f; var age_factor = Mathf.Clamp01((age.AgeBiologicalYearsFloat - 17.0f) / 10.0f); // Assume nymphs are 17~27 total_gain += (int)(age_factor * rgain); return Mathf.Clamp(total_gain, 0, 20); } /// <summary> /// Set a nymph's initial skills & passions from backstory, traits, and age /// </summary> [SyncMethod] public static void set_skills(Pawn pawn) { foreach (var skill_def in DefDatabase<SkillDef>.AllDefsListForReading) { var rec = pawn.skills.GetSkill(skill_def); if (!rec.TotallyDisabled) { //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); rec.Level = sum_previous_gains(skill_def, pawn.story, pawn.ageTracker); rec.xpSinceLastLevel = rec.XpRequiredForLevelUp * Rand.Range(0.10f, 0.90f); var pas_cha = nymph_backstories.get_passion_chances(pawn.story.childhood, pawn.story.adulthood, skill_def); var rv = Rand.Value; if (rv < pas_cha.major) rec.passion = Passion.Major; else if (rv < pas_cha.minor) rec.passion = Passion.Minor; else rec.passion = Passion.None; } else rec.passion = Passion.None; } } public static PawnKindDef GetFixedNymphPawnKindDef() { var def = PawnKindDef.Named("Nymph"); // This is 18 in the xml but something is overwriting it to 5. def.minGenerationAge = 18; return def; } [SyncMethod] public static Pawn GenerateNymph(IntVec3 around_loc, ref Map map, Faction faction = null) { // Most of the special properties of nymphs are in harmony patches to PawnGenerator. PawnGenerationRequest request = new PawnGenerationRequest( kind: GetFixedNymphPawnKindDef(), faction: faction, tile: map.Tile, forceGenerateNewPawn: true, canGeneratePawnRelations: true, colonistRelationChanceFactor: 0.0f, inhabitant: true, relationWithExtraPawnChanceFactor: 0 ); //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); Pawn pawn = PawnGenerator.GeneratePawn(request); //Log.Message(""+ pawn.Faction); //IntVec3 spawn_loc = CellFinder.RandomClosewalkCellNear(around_loc, map, 6);//RandomSpawnCellForPawnNear could be an alternative //GenSpawn.Spawn(pawn, spawn_loc, map); return pawn; } } }
TDarksword/rjw
Source/Modules/Nymphs/Pawns/Nymph_Generator.cs
C#
mit
5,803
using System; using RimWorld; using Verse; namespace rjw { public class BackstoryDef : Def { public BackstoryDef() { this.slot = BackstorySlot.Childhood; } public static BackstoryDef Named(string defName) { return DefDatabase<BackstoryDef>.GetNamed(defName, true); } public override void ResolveReferences() { base.ResolveReferences(); if (BackstoryDatabase.allBackstories.ContainsKey(this.defName)) { ModLog.Error("BackstoryDatabase already contains: " + this.defName); return; } { //Log.Warning("BackstoryDatabase does not contains: " + this.defName); } if (!this.title.NullOrEmpty()) { Backstory backstory = new Backstory(); backstory.SetTitle(this.title, this.titleFemale); backstory.SetTitleShort(this.titleShort, this.titleFemaleShort); backstory.baseDesc = this.baseDescription; backstory.slot = this.slot; backstory.spawnCategories.Add(this.categoryName); backstory.ResolveReferences(); backstory.PostLoad(); backstory.identifier = this.defName; BackstoryDatabase.allBackstories.Add(backstory.identifier, backstory); //Log.Warning("BackstoryDatabase added: " + backstory.identifier); //Log.Warning("BackstoryDatabase added: " + backstory.spawnCategories.ToCommaList()); } } public string baseDescription; public string title; public string titleShort; public string titleFemale; public string titleFemaleShort; public string categoryName; public BackstorySlot slot; } }
TDarksword/rjw
Source/Modules/Pregnancy/BackstoryDef.cs
C#
mit
1,519
using System.Collections.Generic; using Verse; using Multiplayer.API; namespace rjw { //MicroComputer internal class Hediff_MicroComputer : Hediff_MechImplants { protected int nextEventTick = 60000; public override void ExposeData() { base.ExposeData(); Scribe_Values.Look<int>(ref this.nextEventTick, "nextEventTick", 60000, false); } [SyncMethod] public override void PostMake() { base.PostMake(); //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); nextEventTick = Rand.Range(mcDef.minEventInterval, mcDef.maxEventInterval); } [SyncMethod] public override void Tick() { base.Tick(); if (this.pawn.IsHashIntervalTick(1000)) { if (this.ageTicks >= nextEventTick) { HediffDef randomEffectDef = DefDatabase<HediffDef>.GetNamed(randomEffect); if (randomEffectDef != null) { pawn.health.AddHediff(randomEffectDef); } else { //--ModLog.Message("" + this.GetType().ToString() + "::Tick() - There is no Random Effect"); } this.ageTicks = 0; } } } protected HediffDef_MechImplants mcDef { get { return ((HediffDef_MechImplants)def); } } protected List<string> randomEffects { get { return mcDef.randomHediffDefs; } } protected string randomEffect { get { //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); return randomEffects.RandomElement<string>(); } } } }
TDarksword/rjw
Source/Modules/Pregnancy/Hediffs/HeDiff_MicroComputer.cs
C#
mit
1,490
using System.Collections.Generic; using Verse; using System.Linq; namespace rjw { [StaticConstructorOnStartup] internal class HediffDef_EnemyImplants : HediffDef { //single parent eggs public string parentDef = ""; //multiparent eggs public List<string> parentDefs = new List<string>(); //for implanting eggs public bool IsParent(string defnam) { return //predefined parent eggs parentDef == defnam || parentDefs.Contains(defnam) || //dynamic egg (parentDef == "Unknown" && defnam == "Unknown" && RJWPregnancySettings.egg_pregnancy_implant_anyone); } } [StaticConstructorOnStartup] internal class HediffDef_InsectEgg : HediffDef_EnemyImplants { //this is filled from xml //1 day = 60000 ticks public float eggsize = 1; public bool selffertilized = false; } [StaticConstructorOnStartup] internal class HediffDef_MechImplants : HediffDef_EnemyImplants { public List<string> randomHediffDefs = new List<string>(); public int minEventInterval = 30000; public int maxEventInterval = 90000; } }
TDarksword/rjw
Source/Modules/Pregnancy/Hediffs/HediffDef_EnemyImplants.cs
C#
mit
1,065
using System; using System.Collections.Generic; using RimWorld; using Verse; using UnityEngine; using System.Text; using Multiplayer.API; using System.Linq; using RimWorld.Planet; namespace rjw { public abstract class Hediff_BasePregnancy : HediffWithComps { ///<summary> ///This hediff class simulates pregnancy. ///</summary> //Static fields private const int MiscarryCheckInterval = 1000; protected const int TicksPerDay = 60000; protected const string starvationMessage = "MessageMiscarriedStarvation"; protected const string poorHealthMessage = "MessageMiscarriedPoorHealth"; protected static readonly HashSet<string> non_genetic_traits = new HashSet<string>(DefDatabase<StringListDef>.GetNamed("NonInheritedTraits").strings); //Fields ///All babies should be premade and stored here protected List<Pawn> babies; ///Reference to daddy, goes null sometimes public Pawn father; ///Is pregnancy visible? protected bool is_discovered; protected bool ShouldMiscarry = false; ///Is pregnancy type checked? public bool is_checked = false; ///Mechanoid pregnancy, false - spawn aggressive mech public bool is_hacked = false; ///Contractions duration, effectively additional hediff stage, a dirty hack to make birthing process notable protected int contractions; ///Gestation progress per tick protected float progress_per_tick; // // Properties // public float GestationProgress { get => Severity; private set => Severity = value; } private bool IsSeverelyWounded { get { float num = 0; List<Hediff> hediffs = pawn.health.hediffSet.hediffs; foreach (Hediff h in hediffs) { if (h is Hediff_Injury && (!h.IsPermanent() || !h.IsTended())) { num += h.Severity; } } List<Hediff_MissingPart> missingPartsCommonAncestors = pawn.health.hediffSet.GetMissingPartsCommonAncestors(); foreach (Hediff_MissingPart mp in missingPartsCommonAncestors) { if (mp.IsFresh) { num += mp.Part.def.GetMaxHealth(pawn); } } return num > 38 * pawn.RaceProps.baseHealthScale; } } /// <summary> /// Indicates pregnancy can be aborted using usual means. /// </summary> public virtual bool canBeAborted { get { return true; } } /// <summary> /// Indicates pregnancy can be miscarried. /// </summary> public virtual bool canMiscarry { get { return true; } } public override void PostMake() { // Ensure the hediff always applies to the torso, regardless of incorrect directive base.PostMake(); BodyPartRecord torso = pawn.RaceProps.body.AllParts.Find(x => x.def.defName == "Torso"); if (Part != torso) Part = torso; //(debug->add heddif) //init empty preg, instabirth, cause error during birthing //Initialize(pawn, Trytogetfather(ref pawn)); } public override bool Visible => is_discovered; public virtual void DiscoverPregnancy() { is_discovered = true; if (PawnUtility.ShouldSendNotificationAbout(this.pawn)) { if (!is_checked) { string key1 = "RJW_PregnantTitle"; string message_title = TranslatorFormattedStringExtensions.Translate(key1, pawn.LabelIndefinite()); string key2 = "RJW_PregnantText"; string message_text = TranslatorFormattedStringExtensions.Translate(key2, pawn.LabelIndefinite()); Find.LetterStack.ReceiveLetter(message_title, message_text, LetterDefOf.NeutralEvent, pawn, null); } else { PregnancyMessage(); } } } public virtual void CheckPregnancy() { is_checked = true; if (!is_discovered) DiscoverPregnancy(); else PregnancyMessage(); } public virtual void PregnancyMessage() { string key1 = "RJW_PregnantTitle"; string message_title = TranslatorFormattedStringExtensions.Translate(key1, pawn.LabelIndefinite()); string key2 = "RJW_PregnantNormal"; string message_text = TranslatorFormattedStringExtensions.Translate(key2, pawn.LabelIndefinite()); Find.LetterStack.ReceiveLetter(message_title, message_text, LetterDefOf.NeutralEvent, pawn, null); } // Quick method to simply return a body part instance by a given part name internal static BodyPartRecord GetPawnBodyPart(Pawn pawn, String bodyPart) { return pawn.RaceProps.body.AllParts.Find(x => x.def == DefDatabase<BodyPartDef>.GetNamed(bodyPart)); } public virtual void Miscarry() { if (!babies.NullOrEmpty()) foreach (Pawn baby in babies) { baby.Discard(); } pawn.health?.RemoveHediff(this); } /// <summary> /// Called on abortion (noy implemented yet) /// </summary> public virtual void Abort() { Miscarry(); } /// <summary> /// Mechanoids can remove pregnancy /// </summary> public virtual void Kill() { Miscarry(); } [SyncMethod] public Pawn partstospawn(Pawn baby, Pawn mother, Pawn dad) { //decide what parts to inherit //default use own parts Pawn partstospawn = baby; //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); //spawn with mother parts if (mother != null && Rand.Range(0, 100) <= 10) partstospawn = mother; //spawn with father parts if (dad != null && Rand.Range(0, 100) <= 10) partstospawn = dad; //ModLog.Message(" Pregnancy partstospawn " + partstospawn); return partstospawn; } [SyncMethod] public bool spawnfutachild(Pawn baby, Pawn mother, Pawn dad) { int futachance = 0; if (mother != null && Genital_Helper.is_futa(mother)) futachance = futachance + 25; if (dad != null && Genital_Helper.is_futa(dad)) futachance = futachance + 25; //ModLog.Message(" Pregnancy spawnfutachild " + futachance); //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); //theres 1% change baby will be futa //bug ... or ... feature ... nature finds a way return (Rand.Range(0, 100) <= futachance); } [SyncMethod] public static Pawn Trytogetfather(ref Pawn mother) { //birthing with debug has no father //Postmake.initialize() has no father ModLog.Warning("Hediff_BasePregnancy::Trytogetfather() - debug? no father defined, trying to add one"); Pawn pawn = mother; Pawn father = null; //possible fathers List<Pawn> partners = pawn.relations.RelatedPawns.Where(x => Genital_Helper.has_penis_fertile(x) && !x.Dead && (pawn.relations.DirectRelationExists(PawnRelationDefOf.Lover, x) || pawn.relations.DirectRelationExists(PawnRelationDefOf.Fiance, x) || pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, x)) ).ToList(); //add bonded animal if (xxx.is_zoophile(mother) && RJWSettings.bestiality_enabled) partners.AddRange(pawn.relations.RelatedPawns.Where(x => Genital_Helper.has_penis_fertile(x) && pawn.relations.DirectRelationExists(PawnRelationDefOf.Bond, x)).ToList()); if (partners.Any()) { father = partners.RandomElement(); ModLog.Warning("Hediff_BasePregnancy::Trytogetfather() - father set to: " + xxx.get_pawnname(father)); } return father; } [SyncMethod] public override void Tick() { ageTicks++; GestationProgress += progress_per_tick; if (pawn.IsHashIntervalTick(1000)) { if (canMiscarry) { //ModLog.Message(" Pregnancy is ticking for " + pawn + " this is " + this.def.defName + " will end in " + 1/progress_per_tick/TicksPerDay + " days resulting in "+ babies[0].def.defName); //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); //miscarry after starving 0.5 day if (pawn.needs.food != null && pawn.needs.food.CurCategory == HungerCategory.Starving && Rand.MTBEventOccurs(0.5f, TicksPerDay, MiscarryCheckInterval)) { var hed = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.Malnutrition); if (hed.Severity > 0.4) { if (Visible && PawnUtility.ShouldSendNotificationAbout(pawn)) { string text = "MessageMiscarriedStarvation".Translate(pawn.LabelIndefinite()).CapitalizeFirst(); Messages.Message(text, pawn, MessageTypeDefOf.NegativeHealthEvent); } Miscarry(); return; } } //let beatings only be important when pregnancy is developed somewhat //miscarry after SeverelyWounded 0.5 day if (Visible && ((IsSeverelyWounded && Rand.MTBEventOccurs(0.5f, TicksPerDay, MiscarryCheckInterval)) || ShouldMiscarry)) { if (Visible && PawnUtility.ShouldSendNotificationAbout(pawn)) { string text = "MessageMiscarriedPoorHealth".Translate(pawn.LabelIndefinite()).CapitalizeFirst(); Messages.Message(text, pawn, MessageTypeDefOf.NegativeHealthEvent); } Miscarry(); return; } } // Check if pregnancy is far enough along to "show" for the body type if (!is_discovered) { BodyTypeDef bodyT = pawn?.story?.bodyType; //float threshold = 0f; if ((bodyT == BodyTypeDefOf.Thin && GestationProgress > 0.25f) || (bodyT == BodyTypeDefOf.Female && GestationProgress > 0.35f) || (GestationProgress > 0.50f)) // todo: Modded bodies? (FemaleBB for, example) DiscoverPregnancy(); //switch (bodyT) //{ //case BodyType.Thin: threshold = 0.3f; break; //case BodyType.Female: threshold = 0.389f; break; //case BodyType.Male: threshold = 0.41f; break; //default: threshold = 0.5f; break; //} //if (GestationProgress > threshold){ DiscoverPregnancy(); } } if (CurStageIndex == 3) { if (contractions == 0) { if (PawnUtility.ShouldSendNotificationAbout(pawn)) { string text = "RJW_Contractions".Translate(pawn.LabelIndefinite()); Messages.Message(text, pawn, MessageTypeDefOf.NeutralEvent); } contractions++; } if (GestationProgress >= 1 && (pawn.CarriedBy == null || pawn.CarriedByCaravan()))//birthing takes an hour { if (PawnUtility.ShouldSendNotificationAbout(pawn)) { string message_title = "RJW_GaveBirthTitle".Translate(pawn.LabelIndefinite()); string message_text = "RJW_GaveBirthText".Translate(pawn.LabelIndefinite()); string baby_text = ((babies.Count == 1) ? "RJW_ABaby".Translate() : "RJW_NBabies".Translate(babies.Count)); message_text = message_text + baby_text; Find.LetterStack.ReceiveLetter(message_title, message_text, LetterDefOf.PositiveEvent, pawn); } GiveBirth(); } } } } // //These functions are different from CnP // public override void ExposeData()//If you didn't know, this one is used to save the object for later loading of the game... and to load the data into the object, <sigh> { base.ExposeData(); Scribe_References.Look(ref father, "father", true); Scribe_Values.Look(ref is_checked, "is_checked"); Scribe_Values.Look(ref is_hacked, "is_hacked"); Scribe_Values.Look(ref is_discovered, "is_discovered"); Scribe_Values.Look(ref ShouldMiscarry, "ShouldMiscarry"); Scribe_Values.Look(ref contractions, "contractions"); Scribe_Collections.Look(ref babies, saveDestroyedThings: true, label: "babies", lookMode: LookMode.Deep, ctorArgs: new object[0]); Scribe_Values.Look(ref progress_per_tick, "progress_per_tick", 1); } //This should generate pawns to be born in due time. Should take into account all settings and parent races [SyncMethod] protected virtual void GenerateBabies() { Pawn mother = pawn; //Log.Message("Generating babies for " + this.def.defName); if (mother == null) { ModLog.Error("Hediff_BasePregnancy::GenerateBabies() - no mother defined"); return; } if (father == null) { father = Trytogetfather(ref mother); } //Babies will have average number of traits of their parents, this way it will hopefully be compatible with various mods that change number of allowed traits //int trait_count = 0; // not anymore. Using number of traits originally generated by game as a guide //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); List<Trait> traitpool = new List<Trait>(); // if both parents has the same trait chanses to give it to child are doubled. // It was a bug, now it is a feature. float skin_whiteness = Rand.Range(0, 1); //ModLog.Message("Generating babies " + traitpool.Count + " traits at first"); if (xxx.has_traits(mother) && mother.RaceProps.Humanlike) { foreach (Trait momtrait in mother.story.traits.allTraits) { if (!RJWPregnancySettings.trait_filtering_enabled || !non_genetic_traits.Contains(momtrait.def.defName)) traitpool.Add(momtrait); } skin_whiteness = mother.story.melanin; //trait_count = mother.story.traits.allTraits.Count; } if (father != null && xxx.has_traits(father) && father.RaceProps.Humanlike) { foreach (Trait poptrait in father.story.traits.allTraits) { if (!RJWPregnancySettings.trait_filtering_enabled || !non_genetic_traits.Contains(poptrait.def.defName)) traitpool.Add(poptrait); } skin_whiteness = Rand.Range(skin_whiteness, father.story.melanin); //trait_count = Mathf.RoundToInt((trait_count + father.story.traits.allTraits.Count) / 2f); } //this probably doesnt matter in 1.0 remove it and wait for bug reports =) //trait_count = trait_count > 2 ? trait_count : 2;//Tynan has hardcoded 2-3 traits per pawn. In the above, result may be less than that. Let us not have disfunctional babies. //ModLog.Message("Generating babies " + traitpool.Count + " traits aFter parents"); Pawn parent = mother; //race of child Pawn parent2 = father; //name for child //Decide on which parent is first to be inherited if (father != null && RJWPregnancySettings.use_parent_method) { //Log.Message("The baby race needs definition"); //humanality if (xxx.is_human(mother) && xxx.is_human(father)) { //Log.Message("It's of two humanlikes"); if (!Rand.Chance(RJWPregnancySettings.humanlike_DNA_from_mother)) { //Log.Message("Mother will birth father race"); parent = father; } else { //Log.Message("Mother will birth own race"); } } else { //bestiality if ((!xxx.is_human(mother) && xxx.is_human(father)) || (xxx.is_human(mother) && !xxx.is_human(father))) { if (RJWPregnancySettings.bestiality_DNA_inheritance == 0.0f) { //Log.Message("mother will birth beast"); if (xxx.is_human(mother)) parent = father; else parent = mother; } else if (RJWPregnancySettings.bestiality_DNA_inheritance == 1.0f) { //Log.Message("mother will birth humanlike"); if (xxx.is_human(mother)) parent = mother; else parent = father; } else { if (!Rand.Chance(RJWPregnancySettings.bestial_DNA_from_mother)) { //Log.Message("Mother will birth father race"); parent = father; } else { //Log.Message("Mother will birth own race"); } } } //animality else if (!Rand.Chance(RJWPregnancySettings.bestial_DNA_from_mother)) { //Log.Message("Mother will birth father race"); parent = father; } else { //Log.Message("Mother will birth own race"); } } } //androids can only birth non androids if (AndroidsCompatibility.IsAndroid(mother) && !AndroidsCompatibility.IsAndroid(father)) { parent = father; } else if (!AndroidsCompatibility.IsAndroid(mother) && AndroidsCompatibility.IsAndroid(father)) { parent = mother; } else if (AndroidsCompatibility.IsAndroid(mother) && AndroidsCompatibility.IsAndroid(father)) { ModLog.Warning("Both parents are andoids, what have you done monster!"); //this should never happen but w/e } //change baby nymph to generic colonist if (parent.kindDef.defName == "Nymph") parent.kindDef = PawnKindDefOf.Colonist; //ModLog.Message(" The main parent is " + parent); //Log.Message("Mother: " + xxx.get_pawnname(mother) + " kind: " + mother.kindDef); //Log.Message("Father: " + xxx.get_pawnname(father) + " kind: " + father.kindDef); //Log.Message("Baby base: " + xxx.get_pawnname(parent) + " kind: " + parent.kindDef); // Surname passing string last_name = ""; if (xxx.is_human(father)) last_name = NameTriple.FromString(father.Name.ToStringFull).Last; if (xxx.is_human(mother) && last_name == "") last_name = NameTriple.FromString(mother.Name.ToStringFull).Last; //ModLog.Message(" Bady surname will be " + last_name); //Pawn generation request PawnKindDef spawn_kind_def = parent.kindDef; Faction spawn_faction = mother.IsPrisoner ? null : mother.Faction; //ModLog.Message(" default child spawn_kind_def - " + spawn_kind_def); string MotherRaceName = ""; string FatherRaceName = ""; MotherRaceName = mother.kindDef.race.defName; if (father != null) FatherRaceName = father.kindDef.race.defName; //ModLog.Message(" MotherRaceName is " + MotherRaceName); //ModLog.Message(" FatherRaceName is " + FatherRaceName); if (MotherRaceName != FatherRaceName && FatherRaceName != "") { var groups = DefDatabase<RaceGroupDef>.AllDefs.Where(x => !x.hybridRaceParents.NullOrEmpty() && !x.hybridChildKindDef.NullOrEmpty()); //ModLog.Message(" found custom RaceGroupDefs " + groups.Count()); foreach (var t in groups) { //ModLog.Message(" trying custom RaceGroupDef " + t.defName); //ModLog.Message(" custom hybridRaceParents " + t.hybridRaceParents.Count()); //ModLog.Message(" contains hybridRaceParents MotherRaceName? " + t.hybridRaceParents.Contains(MotherRaceName)); //ModLog.Message(" contains hybridRaceParents FatherRaceName? " + t.hybridRaceParents.Contains(FatherRaceName)); if ((t.hybridRaceParents.Contains(MotherRaceName) && t.hybridRaceParents.Contains(FatherRaceName)) || (t.hybridRaceParents.Contains("Any") && (t.hybridRaceParents.Contains(MotherRaceName) || t.hybridRaceParents.Contains(FatherRaceName)))) { //ModLog.Message(" has hybridRaceParents"); if (t.hybridChildKindDef.Contains("MotherKindDef")) spawn_kind_def = mother.kindDef; else if (t.hybridChildKindDef.Contains("FatherKindDef") && father != null) spawn_kind_def = father.kindDef; else { //ModLog.Message(" trying hybridChildKindDef " + t.defName); var child_kind_def_list = new List<PawnKindDef>(); child_kind_def_list.AddRange(DefDatabase<PawnKindDef>.AllDefs.Where(x => t.hybridChildKindDef.Contains(x.defName))); //ModLog.Message(" found custom hybridChildKindDefs " + t.hybridChildKindDef.Count); if (!child_kind_def_list.NullOrEmpty()) spawn_kind_def = child_kind_def_list.RandomElement(); } } } } //ModLog.Message(" final child spawn_kind_def - " + spawn_kind_def); //pregnancies with slimes birth only slimes //should somehow merge with above if (xxx.is_slime(mother)) { parent = mother; spawn_kind_def = parent.kindDef; } if (father != null) { if (xxx.is_slime(father)) { parent = father; spawn_kind_def = parent.kindDef; } } PawnGenerationRequest request = new PawnGenerationRequest( kind: spawn_kind_def, faction: spawn_faction, forceGenerateNewPawn: true, newborn: true, allowDowned: true, canGeneratePawnRelations: false, colonistRelationChanceFactor: 0, allowFood: false, allowAddictions: false, relationWithExtraPawnChanceFactor: 0, fixedMelanin: skin_whiteness, fixedLastName: last_name ); //ModLog.Message(" Generated request, making babies"); //Litter size. Let's use the main parent litter size, reduced by fertility. float litter_size = (parent.RaceProps.litterSizeCurve == null) ? 1 : Rand.ByCurve(parent.RaceProps.litterSizeCurve); //ModLog.Message(" base Litter size " + litter_size); litter_size *= Math.Min(mother.health.capacities.GetLevel(xxx.reproduction), 1); litter_size *= Math.Min(father == null ? 1 : father.health.capacities.GetLevel(xxx.reproduction), 1); litter_size = Math.Max(1, litter_size); //ModLog.Message(" Litter size (w fertility) " + litter_size); //Babies size vs mother body size //assuming mother belly is 1/3 of mother body size float baby_size = spawn_kind_def.RaceProps.lifeStageAges[0].def.bodySizeFactor * spawn_kind_def.RaceProps.baseBodySize; // adult size/5 //ModLog.Message(" Baby size " + baby_size); float max_litter = 1f / 3f / baby_size; //ModLog.Message(" Max size " + max_litter); max_litter *= (mother.Has(Quirk.Breeder) || mother.Has(Quirk.Incubator)) ? 2 : 1; //ModLog.Message(" Max size (w quirks) " + max_litter); //Generate random amount of babies within litter/max size litter_size = (Rand.Range(litter_size, max_litter)); //ModLog.Message(" Litter size roll 1:" + litter_size); litter_size = Mathf.RoundToInt(litter_size); //ModLog.Message(" Litter size roll 2:" + litter_size); litter_size = Math.Max(1, litter_size); //ModLog.Message(" final Litter size " + litter_size); for (int i = 0; i < litter_size; i++) { Pawn baby = PawnGenerator.GeneratePawn(request); //Choose traits to add to the child. Unlike CnP this will allow for some random traits if (xxx.is_human(baby) && traitpool.Count > 0) { updateTraits(baby, traitpool); } babies.Add(baby); } } /// <summary> /// Update pawns traits /// Uses original pawns trains and given list of traits as a source of traits to select. /// </summary> /// <param name="pawn">humanoid pawn</param> /// <param name="traitpool">list of parent traits</param> /// <param name="traitLimit">maximum allowed number of traits</param> void updateTraits(Pawn pawn, List<Trait> parenttraitpool, int traitLimit = -1) { if (pawn?.story?.traits == null) { return; } if (traitLimit == -1) { traitLimit = pawn.story.traits.allTraits.Count; } //Personal pool List<Trait> personalTraitPool = new List<Trait>(pawn.story.traits.allTraits); //Parents pool if (parenttraitpool != null) { personalTraitPool.AddRange(parenttraitpool); } //Game suggested traits. var forcedTraits = personalTraitPool .Where(x => x.ScenForced) .Distinct(new TraitComparer(ignoreDegree: true)); // result can be a mess, because game allows this mess to be created in scenario editor List<Trait> selectedTraits = new List<Trait>(); selectedTraits.AddRange(forcedTraits); // enforcing scenario forced traits var comparer = new TraitComparer(); // trait comparision implementation, because without game compares traits *by reference*, makeing them all unique. while (selectedTraits.Count < traitLimit && personalTraitPool.Count > 0) { int index = Rand.Range(0, personalTraitPool.Count); // getting trait and removing from the pull var trait = personalTraitPool[index]; personalTraitPool.RemoveAt(index); if (!selectedTraits.Any(x => comparer.Equals(x, trait) || // skipping traits conflicting with already added x.def.ConflictsWith(trait))) { selectedTraits.Add(new Trait(trait.def, trait.Degree, false)); } } pawn.story.traits.allTraits = selectedTraits; } //Handles the spawning of pawns and adding relations //this is extended by other scripts public abstract void GiveBirth(); public virtual void PostBirth(Pawn mother, Pawn father, Pawn baby) { BabyPostBirth(mother, father, baby); //inject RJW_BabyState to the newborn if RimWorldChildren is not active //cnp patches its hediff right into pawn generator, so its already in if it can if (xxx.RimWorldChildrenIsActive) { if (xxx.is_human(mother)) { //BnC compatibility if (xxx.BnC_RJW_PostPregnancy == null) { mother.health.AddHediff(xxx.PostPregnancy, null, null); mother.health.AddHediff(xxx.Lactating, mother.RaceProps.body.AllParts.Find(x => x.def.defName == "Chest"), null); } if (xxx.is_human(baby)) if (mother.records.GetAsInt(xxx.CountOfBirthHuman) == 0 && mother.records.GetAsInt(xxx.CountOfBirthAnimal) == 0 && mother.records.GetAsInt(xxx.CountOfBirthEgg) == 0) { mother.needs.mood.thoughts.memories.TryGainMemory(xxx.IGaveBirthFirstTime); } else { mother.needs.mood.thoughts.memories.TryGainMemory(xxx.IGaveBirth); } } if (xxx.is_human(baby)) if (xxx.is_human(father)) { father.needs.mood.thoughts.memories.TryGainMemory(xxx.PartnerGaveBirth); } } if (baby.playerSettings != null && mother.playerSettings != null) { baby.playerSettings.AreaRestriction = mother.playerSettings.AreaRestriction; } //spawn futa bool isfuta = spawnfutachild(baby, mother, father); if (isfuta) { SexPartAdder.add_genitals(baby, partstospawn(baby, mother, father), Gender.Male); SexPartAdder.add_genitals(baby, partstospawn(baby, mother, father), Gender.Female); SexPartAdder.add_breasts(baby, partstospawn(baby, mother, father), Gender.Female); baby.gender = Gender.Female; //set gender to female for futas, should cause no errors since babies already generated with relations n stuff } else { SexPartAdder.add_genitals(baby, partstospawn(baby, mother, father)); SexPartAdder.add_breasts(baby, partstospawn(baby, mother, father)); } SexPartAdder.add_anus(baby, partstospawn(baby, mother, father)); if (mother.Spawned) { // Move the baby in front of the mother, rather than on top if (mother.CurrentBed() != null) { baby.Position = baby.Position + new IntVec3(0, 0, 1).RotatedBy(mother.CurrentBed().Rotation); } // Spawn guck FilthMaker.TryMakeFilth(mother.Position, mother.Map, ThingDefOf.Filth_AmnioticFluid, mother.LabelIndefinite(), 5); mother.caller?.DoCall(); baby.caller?.DoCall(); father?.caller?.DoCall(); } if (xxx.is_human(baby)) mother.records.AddTo(xxx.CountOfBirthHuman, 1); if (xxx.is_animal(baby)) mother.records.AddTo(xxx.CountOfBirthAnimal, 1); if ((mother.records.GetAsInt(xxx.CountOfBirthHuman) > 10 || mother.records.GetAsInt(xxx.CountOfBirthAnimal) > 20)) { mother.Add(Quirk.Breeder); mother.Add(Quirk.ImpregnationFetish); } } public static void BabyPostBirth(Pawn mother, Pawn father, Pawn baby) { if (!xxx.is_human(baby)) return; baby.story.childhood = null; baby.story.adulthood = null; if (baby.health.hediffSet.HasHediff(HediffDef.Named("DeathAcidifier"))) { baby.health.RemoveHediff(baby.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("DeathAcidifier"))); } foreach (Hediff hd in baby.health.hediffSet.hediffs) { if (hd is Hediff_Implant) baby.health.RestorePart(hd.Part); if (xxx.ImmortalsIsActive && hd.def == xxx.IH_Immortal) baby.health.RemoveHediff(hd); } if (!xxx.RimWorldChildrenIsActive) { try { Backstory bs = null; BackstoryDatabase.TryGetWithIdentifier("rjw_childC", out bs); if (mother.story.GetBackstory(BackstorySlot.Adulthood) != null && mother.story.GetBackstory(BackstorySlot.Adulthood).spawnCategories.Contains("Tribal")) BackstoryDatabase.TryGetWithIdentifier("rjw_childT", out bs); else if(mother.story.GetBackstory(BackstorySlot.Adulthood) == null && mother.story.GetBackstory(BackstorySlot.Childhood).spawnCategories.Contains("Tribal")) BackstoryDatabase.TryGetWithIdentifier("rjw_childT", out bs); baby.story.childhood = bs; } catch (Exception e) { ModLog.Warning(e.ToString()); } if (baby.ageTracker.CurLifeStageIndex <= 1 && baby.ageTracker.AgeBiologicalYears < 1 && !baby.Dead) { // Clean out drugs, implants, and stuff randomly generated //no support for custom race stuff, if there is any //baby.health.hediffSet.Clear(); baby.health.AddHediff(xxx.RJW_BabyState, null, null);//RJW_Babystate.tick_rare actually forces CnP switch to CnP one if it can, don't know wat do Hediff_SimpleBaby babystate = (Hediff_SimpleBaby)baby.health.hediffSet.GetFirstHediffOfDef(xxx.RJW_BabyState); if (babystate != null) { babystate.GrowUpTo(0, true); } } } else { ModLog.Message("PostBirth:: Rewriting story of " + baby); //var disabledBaby = BackstoryDatabase.allBackstories["CustomBackstory_NA_Childhood_Disabled"]; // should be this, but bnc/cnp is broken and cant undisable work var BabyStory = BackstoryDatabase.allBackstories["CustomBackstory_NA_Childhood"]; if (BabyStory != null) { baby.story.childhood = BabyStory; } else { ModLog.Error("Couldn't find the required Backstory: CustomBackstory_NA_Childhood!"); } //BnC compatibility if (xxx.BnC_RJW_PostPregnancy != null) { baby.health.AddHediff(xxx.BabyState, null, null); baby.health.AddHediff(xxx.NoManipulationFlag, null, null); } } foreach (var skill in baby.skills?.skills) skill.Level = 0; //baby.ageTracker.AgeBiologicalTicks = 0L; } //This method is doing the work of the constructor since hediffs are created through HediffMaker instead of normal oop way //This can't be in PostMake() because there wouldn't be father. public virtual void Initialize(Pawn mother, Pawn dad) { BodyPartRecord torso = mother.RaceProps.body.AllParts.Find(x => x.def.defName == "Torso"); mother.health.AddHediff(this, torso); //ModLog.Message("" + this.GetType().ToString() + " pregnancy hediff generated: " + this.Label); //ModLog.Message("" + this.GetType().ToString() + " mother: " + mother + " father: " + dad); father = dad; if (father != null) { babies = new List<Pawn>(); contractions = 0; //ModLog.Message("" + this.GetType().ToString() + " generating babies before: " + this.babies.Count); GenerateBabies(); } //progress_per_tick = babies.NullOrEmpty() ? 1f : (1.0f) / (babies[0].RaceProps.gestationPeriodDays * TicksPerDay/50); progress_per_tick = babies.NullOrEmpty() ? 1f : (1.0f) / (babies[0].RaceProps.gestationPeriodDays * TicksPerDay); if (pawn.Has(Quirk.Breeder) || pawn.health.hediffSet.HasHediff(HediffDef.Named("FertilityEnhancer"))) progress_per_tick *= 1.25f; if (xxx.ImmortalsIsActive && (mother.health.hediffSet.HasHediff(xxx.IH_Immortal) || father.health.hediffSet.HasHediff(xxx.IH_Immortal))) { ShouldMiscarry = true; } //ModLog.Message("" + this.GetType().ToString() + " generating babies after: " + this.babies.Count); } private static Dictionary<Type, string> _hediffOfClass = null; protected static Dictionary<Type, string> hediffOfClass { get { if (_hediffOfClass == null) { _hediffOfClass = new Dictionary<Type, string>(); var allRJWPregnancies = AppDomain.CurrentDomain.GetAssemblies() .SelectMany( a => a .GetTypes() .Where(t => t.IsSubclassOf(typeof(Hediff_BasePregnancy))) ); foreach (var pregClass in allRJWPregnancies) { var attribute = (RJWAssociatedHediffAttribute)pregClass.GetCustomAttributes(typeof(RJWAssociatedHediffAttribute), false).FirstOrDefault(); if (attribute != null) { _hediffOfClass[pregClass] = attribute.defName; } } } return _hediffOfClass; } } /// <summary> /// Creates pregnancy hediff and assigns it to mother /// </summary> /// <typeparam name="T">type of pregnancy, should be subclass of Hediff_BasePregnancy</typeparam> /// <param name="mother"></param> /// <param name="father"></param> /// <returns>created hediff</returns> public static T Create<T>(Pawn mother, Pawn father) where T : Hediff_BasePregnancy { if (mother == null) return null; //if (mother.RaceHasOviPregnancy() && !(T is Hediff_MechanoidPregnancy)) //{ // //return null; //} //else //{ //} BodyPartRecord torso = mother.RaceProps.body.AllParts.Find(x => x.def.defName == "Torso"); string defName = hediffOfClass.ContainsKey(typeof(T)) ? hediffOfClass[typeof(T)] : "RJW_pregnancy"; if (RJWSettings.DevMode) ModLog.Message($"Hediff_BasePregnancy::create hediff:{defName} class:{typeof(T).FullName}"); T hediff = HediffHelper.MakeHediff<T>(HediffDef.Named(defName), mother, torso); hediff.Initialize(mother, father); return hediff; } /// <summary> /// list of all known RJW pregnancy hediff names (new can be regicreted by mods) /// </summary> /// <returns></returns> public static IEnumerable<string> KnownPregnancies() { return hediffOfClass.Values.Distinct(); // todo: performance } public override string DebugString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(base.DebugString()); stringBuilder.AppendLine("Gestation progress: " + GestationProgress.ToStringPercent()); //stringBuilder.AppendLine("Time left: " + ((int)((1f - GestationProgress) * babies[0].RaceProps.gestationPeriodDays * TicksPerDay/50)).ToStringTicksToPeriod()); stringBuilder.AppendLine("Time left: " + ((int)((1f - GestationProgress) * babies[0].RaceProps.gestationPeriodDays * TicksPerDay)).ToStringTicksToPeriod()); stringBuilder.AppendLine(" Father: " + xxx.get_pawnname(father)); return stringBuilder.ToString(); } } }
TDarksword/rjw
Source/Modules/Pregnancy/Hediffs/Hediff_BasePregnancy.cs
C#
mit
33,551
using System.Collections.Generic; using System.Linq; using RimWorld; using Verse; namespace rjw { ///<summary> ///This hediff class simulates pregnancy with animal children, mother may be human. It is not intended to be reasonable. ///Differences from humanlike pregnancy are that animals are given some training and that less punishing relations are used for parent-child. ///</summary> [RJWAssociatedHediff("RJW_pregnancy_beast")] public class Hediff_BestialPregnancy : Hediff_BasePregnancy { private static readonly PawnRelationDef relation_birthgiver = DefDatabase<PawnRelationDef>.AllDefs.FirstOrDefault(d => d.defName == "RJW_Sire"); private static readonly PawnRelationDef relation_spawn = DefDatabase<PawnRelationDef>.AllDefs.FirstOrDefault(d => d.defName == "RJW_Pup"); //static int max_train_level = TrainableUtility.TrainableDefsInListOrder.Sum(tr => tr.steps); public override void PregnancyMessage() { string message_title = "RJW_PregnantTitle".Translate(pawn.LabelIndefinite()); string message_text1 = "RJW_PregnantText".Translate(pawn.LabelIndefinite()); string message_text2 = "RJW_PregnantStrange".Translate(); Find.LetterStack.ReceiveLetter(message_title, message_text1 + "\n" + message_text2, LetterDefOf.NeutralEvent, pawn); } //Makes half-human babies start off better. They start obedient, and if mother is a human, they get hediff to boost their training protected void train(Pawn baby, Pawn mother, Pawn father) { bool _; if (!xxx.is_human(baby) && baby.Faction == Faction.OfPlayer) { if (xxx.is_human(mother) && baby.Faction == Faction.OfPlayer && baby.training.CanAssignToTrain(TrainableDefOf.Obedience, out _).Accepted) { baby.training.Train(TrainableDefOf.Obedience, mother); } if (xxx.is_human(mother) && baby.Faction == Faction.OfPlayer && baby.training.CanAssignToTrain(TrainableDefOf.Tameness, out _).Accepted) { baby.training.Train(TrainableDefOf.Tameness, mother); } } //baby.RaceProps.TrainableIntelligence.LabelCap. //if (xxx.is_human(mother)) //{ // Let the animals be born as colony property // if (mother.IsPrisonerOfColony || mother.IsColonist) // { // baby.SetFaction(Faction.OfPlayer); // } // let it be trained half to the max // var baby_int = baby.RaceProps.TrainableIntelligence; // int max_int = TrainableUtility.TrainableDefsInListOrder.FindLastIndex(tr => (tr.requiredTrainableIntelligence == baby_int)); // if (max_int == -1) // return; // Log.Message("RJW training " + baby + " max_int is " + max_int); // var available_tricks = TrainableUtility.TrainableDefsInListOrder.GetRange(0, max_int + 1); // int max_steps = available_tricks.Sum(tr => tr.steps); // Log.Message("RJW training " + baby + " vill do " + max_steps/2 + " steps"); // int t_score = Rand.Range(Mathf.RoundToInt(max_steps / 4), Mathf.RoundToInt(max_steps / 2)); // for (int i = 1; i <= t_score; i++) // { // var tr = available_tricks.Where(t => !baby.training.IsCompleted(t)). RandomElement(); // Log.Message("RJW training " + baby + " for " + tr); // baby.training.Train(tr, mother); // } // baby.health.AddHediff(HediffDef.Named("RJW_smartPup")); //} } //Handles the spawning of pawns and adding relations public override void GiveBirth() { Pawn mother = pawn; if (mother == null) return; try { //fail if hediff added through debug, since babies not initialized if (babies.Count > 9999) ModLog.Message("RJW beastiality/animal pregnancy birthing pawn count: " + babies.Count); } catch { if (father == null) { ModLog.Message("RJW beastiality/animal pregnancy father is null(debug?), setting father to mother"); father = mother; } Initialize(mother, father); } List<Pawn> siblings = new List<Pawn>(); foreach (Pawn baby in babies) { PawnUtility.TrySpawnHatchedOrBornPawn(baby, mother); Need_Sex sex_need = mother.needs.TryGetNeed<Need_Sex>(); if (mother.Faction != null && !(mother.Faction?.IsPlayer ?? false) && sex_need != null) { sex_need.CurLevel = 1.0f; } baby.relations.AddDirectRelation(relation_birthgiver, mother); mother.relations.AddDirectRelation(relation_spawn, baby); if (father != null && mother != father) { baby.relations.AddDirectRelation(relation_birthgiver, father); father.relations.AddDirectRelation(relation_spawn, baby); } foreach (Pawn sibling in siblings) { baby.relations.AddDirectRelation(PawnRelationDefOf.Sibling, sibling); } siblings.Add(baby); train(baby, mother, father); PostBirth(mother, father, baby); mother.health.RemoveHediff(this); } } } }
TDarksword/rjw
Source/Modules/Pregnancy/Hediffs/Hediff_BestialPregnancy.cs
C#
mit
4,756
using System; using System.Collections.Generic; using System.Text; using RimWorld; using Verse; using UnityEngine; namespace rjw { [RJWAssociatedHediff("RJW_pregnancy")] public class Hediff_HumanlikePregnancy : Hediff_BasePregnancy ///<summary> ///This hediff class simulates pregnancy resulting in humanlike childs. ///</summary> { //Handles the spawning of pawns and adding relations public override void GiveBirth() { Pawn mother = pawn; if (mother == null) return; try { //fail if hediff added through debug, since babies not initialized if (babies.Count > 9999) ModLog.Message("RJW humanlike pregnancy birthing pawn count: " + babies.Count); } catch { if (father == null) { ModLog.Message("RJW humanlike pregnancy father is null(debug?), setting father to mother"); father = mother; } Initialize(mother, father); } List<Pawn> siblings = new List<Pawn>(); foreach (Pawn baby in babies) { PawnUtility.TrySpawnHatchedOrBornPawn(baby, mother); var sex_need = mother.needs.TryGetNeed<Need_Sex>(); if (mother.Faction != null && !(mother.Faction?.IsPlayer ?? false) && sex_need != null) { sex_need.CurLevel = 1.0f; } if (mother.Faction != null) { if (mother.Faction != baby.Faction) baby.SetFaction(mother.Faction); } if (mother.IsPrisonerOfColony) { baby.guest.CapturedBy(Faction.OfPlayer); } baby.relations.AddDirectRelation(PawnRelationDefOf.Parent, mother); if (father != null) { baby.relations.AddDirectRelation(PawnRelationDefOf.Parent, father); } foreach (Pawn sibling in siblings) { baby.relations.AddDirectRelation(PawnRelationDefOf.Sibling, sibling); } siblings.Add(baby); PostBirth(mother, father, baby); mother.health.RemoveHediff(this); } } } }
TDarksword/rjw
Source/Modules/Pregnancy/Hediffs/Hediff_HumanlikePregnancy.cs
C#
mit
1,876
using System.Collections.Generic; using RimWorld; using RimWorld.Planet; using Verse; using System.Text; using Verse.AI.Group; using Multiplayer.API; using System.Linq; namespace rjw { public class Hediff_InsectEgg : HediffWithComps { public int bornTick = 5000; public int abortTick = 0; public string parentDef { get { return ((HediffDef_InsectEgg)def).parentDef; } } public List<string> parentDefs { get { return ((HediffDef_InsectEgg)def).parentDefs; } } public Pawn father; //can be parentkind defined in egg public Pawn implanter; //can be any pawn public bool canbefertilized = true; public bool fertilized => father != null; public float eggssize = 0.1f; protected List<Pawn> babies; ///Contractions duration, effectively additional hediff stage, a dirty hack to make birthing process notable //protected const int TicksPerHour = 2500; protected int contractions = 0; public override string LabelBase { get { if (Prefs.DevMode) { if (father != null) return father.kindDef.race.label + " egg"; else if (implanter != null) return implanter.kindDef.race.label + " egg"; } if (eggssize <= 0.10f) return "Small egg"; if (eggssize <= 0.3f) return "Medium egg"; else if (eggssize <= 0.5f) return "Big egg"; else return "Huge egg"; //return Label; } } public override string LabelInBrackets { get { if (Prefs.DevMode) { if (fertilized) return "Fertilized"; else return "Unfertilized"; } return null; } } public float GestationProgress { get => Severity; private set => Severity = value; } public override bool TryMergeWith(Hediff other) { return false; } public override void PostAdd(DamageInfo? dinfo) { //--ModLog.Message("Hediff_InsectEgg::PostAdd() - added parentDef:" + parentDef+""); base.PostAdd(dinfo); } public override void Tick() { ageTicks++; if (pawn.IsHashIntervalTick(1000)) { //birthing takes an hour if (ageTicks >= bornTick - 2500 && contractions == 0) { if (PawnUtility.ShouldSendNotificationAbout(pawn) && (pawn.IsColonist || pawn.IsPrisonerOfColony)) { string key = "RJW_EggContractions"; string text = TranslatorFormattedStringExtensions.Translate(key, pawn.LabelIndefinite()); Messages.Message(text, pawn, MessageTypeDefOf.NeutralEvent); } contractions++; if (!Genital_Helper.has_ovipositorF(pawn)) pawn.health.AddHediff(HediffDef.Named("Hediff_Submitting")); } if (ageTicks >= bornTick && (pawn.CarriedBy == null || pawn.CarriedByCaravan())) { if (PawnUtility.ShouldSendNotificationAbout(pawn) && (pawn.IsColonist || pawn.IsPrisonerOfColony)) { string key1 = "RJW_GaveBirthEggTitle"; string message_title = TranslatorFormattedStringExtensions.Translate(key1, pawn.LabelIndefinite()); string key2 = "RJW_GaveBirthEggText"; string message_text = TranslatorFormattedStringExtensions.Translate(key2, pawn.LabelIndefinite()); //Find.LetterStack.ReceiveLetter(message_title, message_text, LetterDefOf.NeutralEvent, pawn, null); Messages.Message(message_text, pawn, MessageTypeDefOf.SituationResolved); } GiveBirth(); //someday add dmg to vag? //var dam = Rand.RangeInclusive(0, 1); //p.TakeDamage(new DamageInfo(DamageDefOf.Burn, dam, 999, -1.0f, null, rec, null)); } } } public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref bornTick, "bornTick"); Scribe_Values.Look(ref abortTick, "abortTick"); Scribe_References.Look(ref father, "father", true); Scribe_References.Look(ref implanter, "implanter", true); Scribe_Collections.Look(ref babies, saveDestroyedThings: true, label: "babies", lookMode: LookMode.Deep, ctorArgs: new object[0]); } public override void Notify_PawnDied() { base.Notify_PawnDied(); GiveBirth(); } protected virtual void GenerateBabies() { } //should someday remake into birth eggs and then within few ticks hatch them [SyncMethod] public void GiveBirth() { Pawn mother = pawn; Pawn baby = null; //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); if (fertilized) { //ModLog.Message("Hediff_InsectEgg::BirthBaby() - Egg of " + parentDef + " in " + mother.ToString() + " birth!"); PawnKindDef spawn_kind_def = father.kindDef; //egg mostlikely insect or implanter spawned factionless through debug, set to insect Faction spawn_faction = Faction.OfInsects; //ModLog.Message("Hediff_InsectEgg::BirthBaby() - insect " + (implanter.Faction == Faction.OfInsects || father.Faction == Faction.OfInsects || mother.Faction == Faction.OfInsects)); //ModLog.Message("Hediff_InsectEgg::BirthBaby() - human " + (xxx.is_human(implanter) && xxx.is_human(father))); //ModLog.Message("Hediff_InsectEgg::BirthBaby() - animal1 " + (!xxx.is_human(implanter) && !(implanter.Faction?.IsPlayer ?? false))); //ModLog.Message("Hediff_InsectEgg::BirthBaby() - animal2 "); //this is probably fucked up, idk how to filter insects from non insects/spiders etc //core Hive Insects... probably if (implanter.Faction == Faction.OfInsects || father.Faction == Faction.OfInsects || mother.Faction == Faction.OfInsects) { //ModLog.Message("Hediff_InsectEgg::BirthBaby() - insect "); spawn_faction = Faction.OfInsects; int chance = 5; //random chance to make insect neutral/tamable if (father.Faction == Faction.OfInsects) chance = 5; if (father.Faction != Faction.OfInsects) chance = 10; if (father.Faction == Faction.OfPlayer) chance = 25; if (implanter.Faction == Faction.OfPlayer) chance += 25; if (implanter.Faction == Faction.OfPlayer && xxx.is_human(implanter)) chance += (int)(25 * implanter.GetStatValue(StatDefOf.PsychicSensitivity)); if (Rand.Range(0, 100) <= chance) spawn_faction = null; //chance tame insect on birth if (spawn_faction == null) if (implanter.Faction == Faction.OfPlayer && xxx.is_human(implanter)) if (Rand.Range(0, 100) <= (int)(50 * implanter.GetStatValue(StatDefOf.PsychicSensitivity))) spawn_faction = Faction.OfPlayer; } //humanlikes else if (xxx.is_human(implanter) && xxx.is_human(father)) { spawn_faction = implanter.Faction; } //TODO: humnlike + animal, merge with insect stuff? //else if (xxx.is_human(implanter) && !xxx.is_human(father)) //{ // spawn_faction = implanter.Faction; //} //animal, spawn implanter faction (if not player faction/not tamed) else if (!xxx.is_human(implanter) && !(implanter.Faction?.IsPlayer ?? false)) { spawn_faction = implanter.Faction; } //spawn factionless(tamable, probably) else { spawn_faction = null; } if (spawn_kind_def.defName == "Nymph") spawn_kind_def = PawnKindDefOf.Colonist; //ModLog.Message("Hediff_InsectEgg::BirthBaby() " + spawn_kind_def + " of " + spawn_faction + " in " + (int)(50 * implanter.GetStatValue(StatDefOf.PsychicSensitivity)) + " chance!"); PawnGenerationRequest request = new PawnGenerationRequest( kind: spawn_kind_def, faction: spawn_faction, forceGenerateNewPawn: true, newborn: true, allowDowned: true, canGeneratePawnRelations: false, colonistRelationChanceFactor: 0, allowFood: false, allowAddictions: false, relationWithExtraPawnChanceFactor: 0 ); baby = PawnGenerator.GeneratePawn(request); Hediff_BasePregnancy.BabyPostBirth(mother, father, baby); Sexualizer.sexualize_pawn(baby); if (PawnUtility.TrySpawnHatchedOrBornPawn(baby, mother)) { if (spawn_faction == Faction.OfInsects || (spawn_faction != null && (spawn_faction.def.defName.Contains("insect") || spawn_faction == implanter.Faction))) { //ModLog.Message("Hediff_InsectEgg::BirthBaby() GetLord"); //ModLog.Message("Hediff_InsectEgg::BirthBaby() " + implanter.GetLord()); //add ai to pawn? //LordManager.lords Lord lord = implanter.GetLord(); if (lord != null) { //ModLog.Message("Hediff_InsectEgg::BirthBaby() lord: " +lord); //ModLog.Message("Hediff_InsectEgg::BirthBaby() LordJob: " + lord.LordJob); //ModLog.Message("Hediff_InsectEgg::BirthBaby() CurLordToil: " + lord.CurLordToil); lord.AddPawn(baby); } else { //ModLog.Message("Hediff_InsectEgg::BirthBaby() lord null"); //LordJob_DefendAndExpandHive lordJob = new LordJob_DefendAndExpandHive(); //lord = LordMaker.MakeNewLord(baby.Faction, lordJob, mother.Map); //lord.AddPawn(baby); //lord.SetJob(lordJob); } //ModLog.Message("Hediff_InsectEgg::BirthBaby() " + baby.GetLord().DebugString()); } } else { if (spawn_faction == mother.Faction) { if (mother.IsPlayerControlledCaravanMember()) mother.GetCaravan().AddPawn(baby, true); else if (mother.IsCaravanMember()) mother.GetCaravan().AddPawn(baby, false); } else Find.WorldPawns.PassToWorld(baby, PawnDiscardDecideMode.Discard); } // Move the baby in front of the mother, rather than on top if (mother.Spawned) if (mother.CurrentBed() != null) { baby.Position = baby.Position + new IntVec3(0, 0, 1).RotatedBy(mother.CurrentBed().Rotation); } /* if (Visible && baby != null) { string key = "MessageGaveBirth"; string text = TranslatorFormattedStringExtensions.Translate(key, mother.LabelIndefinite()).CapitalizeFirst(); Messages.Message(text, baby, MessageTypeDefOf.NeutralEvent); } */ mother.records.AddTo(xxx.CountOfBirthEgg, 1); if (mother.records.GetAsInt(xxx.CountOfBirthEgg) > 100) { mother.Add(Quirk.Incubator); mother.Add(Quirk.ImpregnationFetish); } } else { if (PawnUtility.ShouldSendNotificationAbout(pawn) && (pawn.IsColonist || pawn.IsPrisonerOfColony)) { string key = "EggDead"; string text = TranslatorFormattedStringExtensions.Translate(key, pawn.LabelIndefinite()).CapitalizeFirst(); Messages.Message(text, pawn, MessageTypeDefOf.SituationResolved); } } // Post birth if (mother.Spawned) { // Spawn guck if (mother.caller != null) { mother.caller.DoCall(); } if (baby != null) { if (baby.caller != null) { baby.caller.DoCall(); } } FilthMaker.TryMakeFilth(mother.Position, mother.Map, ThingDefOf.Filth_AmnioticFluid, mother.LabelIndefinite(), 5); int howmuch = xxx.has_quirk(mother, "Incubator") ? Rand.Range(1, 3) * 2 : Rand.Range(1, 3); int i = 0; if (xxx.is_insect(baby) || xxx.is_insect(mother)) { while (i++ < howmuch) { Thing jelly = ThingMaker.MakeThing(ThingDefOf.InsectJelly); jelly.SetForbidden(true, false); GenPlace.TryPlaceThing(jelly, mother.InteractionCell, mother.Map, ThingPlaceMode.Direct); } } } mother.health.RemoveHediff(this); } //set father/final egg type public void Fertilize(Pawn Pawn) { if (implanter == null) // immortal ressurrected? { return; } if (xxx.ImmortalsIsActive && (Pawn.health.hediffSet.HasHediff(xxx.IH_Immortal) || pawn.health.hediffSet.HasHediff(xxx.IH_Immortal))) { return; } if (!AndroidsCompatibility.IsAndroid(pawn)) if (!fertilized && canbefertilized && ageTicks < abortTick) { if (RJWSettings.DevMode) ModLog.Message(xxx.get_pawnname(pawn) + " fertilize eggs:" + this.ToString()); father = Pawn; ChangeEgg(father); } } //set implanter/base egg type public void Implanter(Pawn Pawn) { if (implanter == null) { if (RJWSettings.DevMode) ModLog.Message("Hediff_InsectEgg:: set implanter:" + xxx.get_pawnname(Pawn)); implanter = Pawn; ChangeEgg(implanter); if (!implanter.health.hediffSet.HasHediff(xxx.sterilized)) { if (((HediffDef_InsectEgg)def).selffertilized) Fertilize(implanter); } else canbefertilized = false; } } //Change egg type after implanting/fertilizing public void ChangeEgg(Pawn Pawn) { if (Pawn != null) { eggssize = Pawn.RaceProps.baseBodySize / 5; float gestationPeriod = Pawn.RaceProps?.gestationPeriodDays * 60000 ?? 450000; //float gestationPeriod = 10000 ; gestationPeriod = (xxx.has_quirk(pawn, "Incubator") || pawn.health.hediffSet.HasHediff(HediffDef.Named("FertilityEnhancer"))) ? gestationPeriod / 2 : gestationPeriod; bornTick = (int)(gestationPeriod * Pawn.RaceProps.baseBodySize + 0.5f); abortTick = (int)(bornTick / 3); if (!Genital_Helper.has_ovipositorF(pawn)) Severity = eggssize; else if (eggssize > 0.1f) Severity = 0.1f; else Severity = eggssize; } } //for setting implanter/fertilize eggs public bool IsParent(Pawn parent) { //anyone can fertilize if (RJWPregnancySettings.egg_pregnancy_fertilize_anyone) return true; //only set egg parent or implanter can fertilize else return parentDef == parent.kindDef.defName || parentDefs.Contains(parent.kindDef.defName) || implanter.kindDef == parent.kindDef; // unknown eggs } public override string DebugString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(base.DebugString()); stringBuilder.AppendLine(" Gestation progress: " + ((float)ageTicks / bornTick).ToStringPercent()); if (RJWSettings.DevMode) stringBuilder.AppendLine(" Implanter: " + xxx.get_pawnname(implanter)); if (RJWSettings.DevMode) stringBuilder.AppendLine(" Father: " + xxx.get_pawnname(father)); if (RJWSettings.DevMode) stringBuilder.AppendLine(" bornTick: " + bornTick); //stringBuilder.AppendLine(" potential father: " + parentDef); return stringBuilder.ToString(); } } }
TDarksword/rjw
Source/Modules/Pregnancy/Hediffs/Hediff_InsectEggPregnancy.cs
C#
mit
14,048
using RimWorld; using System.Linq; using Verse; using Verse.AI; namespace rjw { public class Hediff_Orgasm : HediffWithComps { public override void PostAdd(DamageInfo? dinfo) { string key = "FeltOrgasm"; string text = TranslatorFormattedStringExtensions.Translate(key, pawn.LabelIndefinite()).CapitalizeFirst(); Messages.Message(text, pawn, MessageTypeDefOf.NeutralEvent); } } public class Hediff_TransportCums : HediffWithComps { public override void PostAdd(DamageInfo? dinfo) { if (pawn.gender == Gender.Female) { string key = "CumsTransported"; string text = TranslatorFormattedStringExtensions.Translate(key, pawn.LabelIndefinite()).CapitalizeFirst(); Messages.Message(text, pawn, MessageTypeDefOf.NeutralEvent); PawnGenerationRequest req = new PawnGenerationRequest(PawnKindDefOf.Drifter, fixedGender:Gender.Male ); Pawn cumSender = PawnGenerator.GeneratePawn(req); Find.WorldPawns.PassToWorld(cumSender); //Pawn cumSender = (from p in Find.WorldPawns.AllPawnsAlive where p.gender == Gender.Male select p).RandomElement<Pawn>(); //--ModLog.Message("" + this.GetType().ToString() + "PostAdd() - Sending " + xxx.get_pawnname(cumSender) + "'s cum into " + xxx.get_pawnname(pawn) + "'s vagina"); PregnancyHelper.impregnate(pawn, cumSender, xxx.rjwSextype.Vaginal); } pawn.health.RemoveHediff(this); } } public class Hediff_TransportEggs : HediffWithComps { public override void PostAdd(DamageInfo? dinfo) { if (pawn.gender == Gender.Female) { string key = "EggsTransported"; string text = TranslatorFormattedStringExtensions.Translate(key, pawn.LabelIndefinite()).CapitalizeFirst(); Messages.Message(text, pawn, MessageTypeDefOf.NeutralEvent); PawnKindDef spawn = PawnKindDefOf.Megascarab; PawnGenerationRequest req1 = new PawnGenerationRequest(spawn, fixedGender:Gender.Female ); PawnGenerationRequest req2 = new PawnGenerationRequest(spawn, fixedGender:Gender.Male ); Pawn implanter = PawnGenerator.GeneratePawn(req1); Pawn fertilizer = PawnGenerator.GeneratePawn(req2); Find.WorldPawns.PassToWorld(implanter); Find.WorldPawns.PassToWorld(fertilizer); Sexualizer.sexualize_pawn(implanter); Sexualizer.sexualize_pawn(fertilizer); //Pawn cumSender = (from p in Find.WorldPawns.AllPawnsAlive where p.gender == Gender.Male select p).RandomElement<Pawn>(); //--ModLog.Message("" + this.GetType().ToString() + "PostAdd() - Sending " + xxx.get_pawnname(cumSender) + "'s cum into " + xxx.get_pawnname(pawn) + "'s vagina"); PregnancyHelper.impregnate(pawn, implanter, xxx.rjwSextype.Vaginal); PregnancyHelper.impregnate(pawn, fertilizer, xxx.rjwSextype.Vaginal); } pawn.health.RemoveHediff(this); } } }
TDarksword/rjw
Source/Modules/Pregnancy/Hediffs/Hediff_MCEvents.cs
C#
mit
2,764
using System.Collections.Generic; using Verse; namespace rjw { internal class Hediff_MechImplants : HediffWithComps { public override bool TryMergeWith(Hediff other) { return false; } } }
TDarksword/rjw
Source/Modules/Pregnancy/Hediffs/Hediff_MechImplants.cs
C#
mit
203
using System.Collections.Generic; using RimWorld; using Verse; using Verse.AI.Group; using System.Linq; using UnityEngine; namespace rjw { ///<summary> ///This hediff class simulates pregnancy with mechanoids, mother may be human. It is not intended to be reasonable. ///Differences from bestial pregnancy are that ... it is lethal ///TODO: extend with something "friendlier"? than Mech_Scyther.... two Mech_Scyther's? muhahaha ///</summary> [RJWAssociatedHediff("RJW_pregnancy_mech")] public class Hediff_MechanoidPregnancy : Hediff_BasePregnancy { public override bool canBeAborted { get { return false; } } public override bool canMiscarry { get { return false; } } public override void PregnancyMessage() { string message_title = "RJW_PregnantTitle".Translate(pawn.LabelIndefinite()); string message_text1 = "RJW_PregnantText".Translate(pawn.LabelIndefinite()); string message_text2 = "RJW_PregnantMechStrange".Translate(); Find.LetterStack.ReceiveLetter(message_title, message_text1 + "\n" + message_text2, LetterDefOf.ThreatBig, pawn); } public void Hack() { is_hacked = true; } public override void Notify_PawnDied() { base.Notify_PawnDied(); GiveBirth(); } //Handles the spawning of pawns public override void GiveBirth() { Pawn mother = pawn; if (mother == null) return; if (!babies.NullOrEmpty()) foreach (Pawn baby in babies) baby.Discard(true); Faction spawn_faction = null; if (!is_hacked) spawn_faction = Faction.OfMechanoids; PawnGenerationRequest request = new PawnGenerationRequest( kind: PawnKindDef.Named("Mech_Scyther"), faction: spawn_faction, forceGenerateNewPawn: true, newborn: true ); Pawn mech = PawnGenerator.GeneratePawn(request); PawnUtility.TrySpawnHatchedOrBornPawn(mech, mother); if (!is_hacked) { LordJob_MechanoidsDefend lordJob = new LordJob_MechanoidsDefend(); Lord lord = LordMaker.MakeNewLord(mech.Faction, lordJob, mech.Map); lord.AddPawn(mech); } FilthMaker.TryMakeFilth(mech.PositionHeld, mech.MapHeld, mother.RaceProps.BloodDef, mother.LabelIndefinite()); IEnumerable<BodyPartRecord> source = from x in mother.health.hediffSet.GetNotMissingParts() where x.IsInGroup(BodyPartGroupDefOf.Torso) && !x.IsCorePart //&& x.groups.Contains(BodyPartGroupDefOf.Torso) //&& x.depth == BodyPartDepth.Inside //&& x.height == BodyPartHeight.Bottom //someday include depth filter //so it doesnt cut out external organs (breasts)? //vag is genital part and genital is external //anal is internal //make sep part of vag? //&& x.depth == BodyPartDepth.Inside select x; if (source.Any()) { foreach (BodyPartRecord part in source) { mother.health.DropBloodFilth(); } foreach (BodyPartRecord part in source) { Hediff_MissingPart hediff_MissingPart = (Hediff_MissingPart)HediffMaker.MakeHediff(HediffDefOf.MissingBodyPart, mother, part); hediff_MissingPart.lastInjury = HediffDefOf.Cut; hediff_MissingPart.IsFresh = true; mother.health.AddHediff(hediff_MissingPart); } } mother.health.RemoveHediff(this); } } }
TDarksword/rjw
Source/Modules/Pregnancy/Hediffs/Hediff_MechanoidPregnancy.cs
C#
mit
3,335
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, newborn: true, 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(); } } } } }
TDarksword/rjw
Source/Modules/Pregnancy/Hediffs/Hediff_ParasitePregnancy.cs
C#
mit
1,888
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; //Properties public int Grown_To { get { return grown_to; } } public override string DebugString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(base.DebugString()); return stringBuilder.ToString(); } public override void PostMake() { Severity = Math.Max(0, Severity); if (grown_to == 0 && !pawn.health.hediffSet.HasHediff(HediffDef.Named("RJW_NoManipulationFlag"))) { pawn.health.AddHediff(HediffDef.Named("RJW_NoManipulationFlag"), null, null); } base.PostMake(); } public override void ExposeData() { //Scribe_Values.LookValue<int> (ref grown_to, "grown_to", 0); Scribe_Values.Look<int>(ref grown_to, "grown_to", 0); base.ExposeData(); } internal void GrowUpTo(int stage) { GrowUpTo(stage, true); } [SyncMethod] internal void GrowUpTo(int stage, bool generated) { //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); 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) { Severity = Math.Max(0.5f, Severity); //pawn.needs.food. } // Re-enable skills that were locked out from toddlers if (stage == 2) { if (!generated) { if (xxx.RimWorldChildrenIsActive) { pawn.story.childhood = BackstoryDatabase.allBackstories["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); } // The child has grown to a teenager so we no longer need this effect if (stage == 3) { if (!generated && pawn.story.childhood != null && pawn.story.childhood.title == "Child") { if (xxx.RimWorldChildrenIsActive) { pawn.story.childhood = BackstoryDatabase.allBackstories["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--; } } } pawn.health.RemoveHediff(this); } } public void TickRare() { //--ModLog.Message("Hediff_SimpleBaby::TickRare is called"); if (pawn.ageTracker.CurLifeStageIndex > Grown_To) { GrowUpTo(Grown_To + 1, 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 PostTick() { /* 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.PostTick(); if (pawn.Spawned) { if (pawn.IsHashIntervalTick(120)) { TickRare(); } } } public override bool Visible { get { return false; } } } }
TDarksword/rjw
Source/Modules/Pregnancy/Hediffs/Hediff_SimpleBaby.cs
C#
mit
8,900
using System; namespace rjw { public class RJWAssociatedHediffAttribute : Attribute { public string defName { get; private set; } public RJWAssociatedHediffAttribute(string defName) { this.defName = defName; } } }
TDarksword/rjw
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; ///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 { //called by aftersex (including rape, breed, etc) //called by mcevent //pawn - "father"; partner = mother public static void impregnate(Pawn pawn, Pawn partner, xxx.rjwSextype sextype = xxx.rjwSextype.None) { if (RJWSettings.DevMode) ModLog.Message("Rimjobworld::impregnate(" + sextype + "):: " + xxx.get_pawnname(pawn) + " + " + xxx.get_pawnname(partner) + ":"); //"mech" pregnancy if (sextype == xxx.rjwSextype.MechImplant) { if (RJWPregnancySettings.mechanoid_pregnancy_enabled) { if (RJWSettings.DevMode) ModLog.Message(" mechanoid pregnancy"); // removing old pregnancies if (RJWSettings.DevMode) ModLog.Message(" removing other pregnancies"); var preg = GetPregnancy(partner); if (preg != null) { if (preg is Hediff_BasePregnancy) { (preg as Hediff_BasePregnancy).Kill(); } else { partner.health.RemoveHediff(preg); } } // new pregnancy Hediff_MechanoidPregnancy hediff = Hediff_BasePregnancy.Create<Hediff_MechanoidPregnancy>(partner, 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; } // Sextype can result in pregnancy. if (!(sextype == xxx.rjwSextype.Vaginal || sextype == xxx.rjwSextype.DoublePenetration || sextype == xxx.rjwSextype.Anal)) return; //ModLog.Message(" RaceImplantEggs()" + pawn.RaceImplantEggs()); //"insect" pregnancy //straight, female (partner) recives egg insertion from other/sex starter (pawn) var pawnpartBPR = Genital_Helper.get_genitalsBPR(pawn); var pawnparts = Genital_Helper.get_PartsHediffList(pawn, pawnpartBPR); var partnerpartBPR = Genital_Helper.get_genitalsBPR(partner); var partnerparts = Genital_Helper.get_PartsHediffList(partner, partnerpartBPR); if ((Genital_Helper.has_vagina(partner, partnerparts) || (Genital_Helper.has_anus(partner) && sextype == xxx.rjwSextype.Anal)) && (Genital_Helper.has_ovipositorF(pawn, pawnparts) || (Genital_Helper.has_ovipositorM(pawn, pawnparts) || (Genital_Helper.has_penis_fertile(pawn, pawnparts) && pawn.RaceImplantEggs()))) ) { //TODO: add widget toggle for bind all/neutral/hostile pawns if (pawn.HostileTo(partner)) //if (!pawn.IsColonist) if (!partner.health.hediffSet.HasHediff(HediffDef.Named("RJW_Cocoon"))) //if (!partner.health.hediffSet.HasHediff(HediffDef.Named("RJW_Cocoon")) && pawn.Faction != partner.Faction) //if (!partner.health.hediffSet.HasHediff(HediffDef.Named("RJW_Cocoon")) && pawn.Faction != partner.Faction && pawn.HostileTo(partner)) partner.health.AddHediff(HediffDef.Named("RJW_Cocoon")); if (!(sextype == xxx.rjwSextype.Anal) || (partner.health.hediffSet.HasHediff(HediffDef.Named("RJW_Cocoon")) && sextype == xxx.rjwSextype.Anal)) DoEgg(pawn, partner, sextype); return; } //reverse, female (pawn) starts sex/passive bestiality and fills herself with eggs - this is likely fucked up and needs fixing at jobdriver, processsex and aftersex levels //else //if (Genital_Helper.has_vagina(pawn, pawnparts) && // (Genital_Helper.has_ovipositorF(partner, partnerparts) || // (Genital_Helper.has_ovipositorM(partner, partnerparts) || // (Genital_Helper.has_penis_fertile(partner, partnerparts) && pawn.RaceImplantEggs()))) // ) //{ // DoEgg(partner, pawn); // return; //} if (sextype == xxx.rjwSextype.Anal) return; //"normal" and "beastial" pregnancy if (RJWSettings.DevMode) ModLog.Message(" 'normal' pregnancy checks"); //futa-futa docking? //if (CanImpregnate(partner, pawn, sextype) && CanImpregnate(pawn, partner, sextype)) //{ //ModLog.Message(" futa-futa docking..."); //return; //Doimpregnate(pawn, partner); //Doimpregnate(partner, pawn); //} //normal, when female is passive/recives interaction if (Genital_Helper.has_penis_fertile(pawn, pawnparts) && Genital_Helper.has_vagina(partner, partnerparts) && CanImpregnate(pawn, partner, sextype)) { if (RJWSettings.DevMode) ModLog.Message(" impregnate forward"); Doimpregnate(pawn, partner); } //reverse, when female active/starts interaction else if (Genital_Helper.has_vagina(pawn, pawnparts) && Genital_Helper.has_penis_fertile(partner, partnerparts) && CanImpregnate(partner, pawn, sextype)) { if (RJWSettings.DevMode) ModLog.Message(" impregnate reverse"); Doimpregnate(partner, pawn); } } public static Hediff GetPregnancy(Pawn pawn) { var set = pawn.health.hediffSet; Hediff preg = Hediff_BasePregnancy.KnownPregnancies() .Select(x => set.GetFirstHediffOfDef(HediffDef.Named(x))) .FirstOrDefault(x => x != null) ?? set.GetFirstHediffOfDef(HediffDef.Named("Pregnant")); return preg; } ///<summary>Can get preg with above conditions, do impregnation.</summary> [SyncMethod] public static void DoEgg(Pawn pawn, Pawn partner, xxx.rjwSextype sextype) { if (RJWPregnancySettings.insect_pregnancy_enabled) { if (RJWSettings.DevMode) ModLog.Message(" insect pregnancy"); //female "insect" plant eggs //futa "insect" 50% plant eggs if ((Genital_Helper.has_ovipositorF(pawn) && !Genital_Helper.has_ovipositorM(pawn)) || (Genital_Helper.has_ovipositorF(pawn) && Genital_Helper.has_ovipositorM(pawn) && Rand.Value > 0.5f)) { float maxeggssize = (partner.BodySize / 5) * (xxx.has_quirk(partner, "Incubator") ? 2f : 1f) * (Genital_Helper.has_ovipositorF(partner) ? 2f : 1f); float eggedsize = 0; foreach (Hediff_InsectEgg egg in partner.health.hediffSet.GetHediffs<Hediff_InsectEgg>()) { 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(partner) + " size of eggs inside: " + eggedsize + ", max: " + maxeggssize); var eggs = pawn.health.hediffSet.GetHediffs<Hediff_InsectEgg>().ToList(); BodyPartRecord partnerGenitals = null; if (sextype == xxx.rjwSextype.Anal) partnerGenitals = Genital_Helper.get_anusBPR(partner); else partnerGenitals = Genital_Helper.get_genitalsBPR(partner); while (eggs.Any() && eggedsize < maxeggssize) { var egg = eggs.First(); eggs.Remove(egg); pawn.health.RemoveHediff(egg); partner.health.AddHediff(egg, partnerGenitals); egg.Implanter(pawn); eggedsize += egg.eggssize * (egg.def as HediffDef_InsectEgg).eggsize * RJWPregnancySettings.egg_pregnancy_eggs_size; } } //male "insect" fertilize eggs else if (!pawn.health.hediffSet.HasHediff(xxx.sterilized)) { foreach (var egg in (from x in partner.health.hediffSet.GetHediffs<Hediff_InsectEgg>() where x.IsParent(pawn) select x)) egg.Fertilize(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 fertility = RJWPregnancySettings.humanlike_impregnation_chance / 100f; if (xxx.is_animal(partner)) fertility = RJWPregnancySettings.animal_impregnation_chance / 100f; // Interspecies modifier if (pawn.def.defName != partner.def.defName) { if (RJWPregnancySettings.complex_interspecies) fertility *= SexUtility.BodySimilarity(pawn, partner); else fertility *= RJWPregnancySettings.interspecies_impregnation_modifier; } //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); float ReproductionFactor = Math.Min(pawn.health.capacities.GetLevel(xxx.reproduction), partner.health.capacities.GetLevel(xxx.reproduction)); float pregnancy_chance = fertility * ReproductionFactor; float pregnancy_roll_to_fail = Rand.Value; //BodyPartRecord torso = partner.RaceProps.body.AllParts.Find(x => x.def == BodyPartDefOf.Torso); if (pregnancy_roll_to_fail > pregnancy_chance || pregnancy_chance <= 0) { if (RJWSettings.DevMode) ModLog.Message(" Impregnation failed. Chance: " + pregnancy_chance.ToStringPercent() + " roll_to_fail: " + pregnancy_roll_to_fail.ToStringPercent()); return; } if (RJWSettings.DevMode) ModLog.Message(" Impregnation succeeded. Chance: " + pregnancy_chance.ToStringPercent() + " roll_to_fail: " + pregnancy_roll_to_fail.ToStringPercent()); PregnancyDecider(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; } if ((from x in fucked.health.hediffSet.GetHediffs<Hediff_InsectEgg>() 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 pawnpartBPR = Genital_Helper.get_genitalsBPR(fucker); var pawnparts = Genital_Helper.get_PartsHediffList(fucker, pawnpartBPR); var partnerpartBPR = Genital_Helper.get_genitalsBPR(fucked); var partnerparts = Genital_Helper.get_PartsHediffList(fucked, partnerpartBPR); 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; } return true; } //Plant babies for human/bestiality pregnancy public static void PregnancyDecider(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); } else 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_animal(father)) || (xxx.is_animal(mother) && xxx.is_human(father)))) { CompEggLayer compEggLayer = mother.TryGetComp<CompEggLayer>(); if (compEggLayer != null) { // cant fertilize eggs } else Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father); } //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 (mother.kindDef == father.kindDef) compEggLayer.Fertilize(father); } else if (RJWPregnancySettings.animal_pregnancy_enabled) { Hediff_BasePregnancy.Create<Hediff_BestialPregnancy>(mother, father); } } } //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 preg = GetPregnancy(target); if (preg != null) { if (preg is Hediff_BasePregnancy) { (preg as Hediff_BasePregnancy).Kill(); } else { target.health.RemoveHediff(preg); } } } 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 < 10) { 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(HediffDef.Named("Pregnant")); if (h != null && h.ageTicks < 10) { 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); } } }
TDarksword/rjw
Source/Modules/Pregnancy/Pregnancy_Helper.cs
C#
mit
19,277
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_checked) // Find checked pregnancies (should be visible pregnancies there?) .Any(); // return true if found something if (isMatch) { yield return part; } } } } }
TDarksword/rjw
Source/Modules/Pregnancy/Recipes/Recipe_Abortion.cs
C#
mit
1,088
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. } } }
TDarksword/rjw
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 preg = (PregnancyHelper.GetPregnancy(pawn) as Hediff_BasePregnancy); if (preg != null) { preg.CheckPregnancy(); } else { Messages.Message(xxx.get_pawnname(billDoer) + " has determined " + xxx.get_pawnname(pawn) + " is not pregnant.", MessageTypeDefOf.NeutralEvent); } } } 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.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 preg = (PregnancyHelper.GetPregnancy(pawn) as Hediff_BasePregnancy); if (preg != null) { Messages.Message(xxx.get_pawnname(billDoer) + " has determined "+ xxx.get_pawnname(pawn) + " is pregnant and " + preg.father + " is the father.", MessageTypeDefOf.NeutralEvent); preg.CheckPregnancy(); } else { Messages.Message(xxx.get_pawnname(billDoer) + " has determined " + xxx.get_pawnname(pawn) + " is not pregnant.", MessageTypeDefOf.NeutralEvent); } } } }
TDarksword/rjw
Source/Modules/Pregnancy/Recipes/Recipe_DeterminePregnancy.cs
C#
mit
2,268
using System.Collections.Generic; using Verse; namespace rjw { /// <summary> /// IUD - prevent pregnancy /// </summary> public class Recipe_InstallIUD : Recipe_InstallImplantToExistParts { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe) { if (!xxx.is_female(pawn)) { return new List<BodyPartRecord>(); } return base.GetPartsToApplyOn(pawn, recipe); } } }
TDarksword/rjw
Source/Modules/Pregnancy/Recipes/Recipe_InstallIUD.cs
C#
mit
430
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) 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(); } } } }
TDarksword/rjw
Source/Modules/Pregnancy/Recipes/Recipe_PregnancyHackMech.cs
C#
mit
1,249
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; } } } } }
TDarksword/rjw
Source/Modules/Pregnancy/Recipes/Recipe_Sterilize.cs
C#
mit
697
using RimWorld; using Verse; namespace rjw { public class ThoughtWorker_ItchyCrotch : ThoughtWorker { protected override ThoughtState CurrentStateInternal(Pawn p) { int sev = std.genital_rash_severity(p); if (sev <= 0) return ThoughtState.Inactive; else if (sev == 1) return ThoughtState.ActiveAtStage(0); else return ThoughtState.ActiveAtStage(1); } } }
TDarksword/rjw
Source/Modules/STD/Thoughts/ThoughtWorker_ItchyCrotch.cs
C#
mit
391
using RimWorld; using Verse; namespace rjw { public class ThoughtWorker_SyphiliticThoughts : ThoughtWorker { protected override ThoughtState CurrentStateInternal(Pawn p) { //Log.Message("0"); var syp = p.health.hediffSet.GetFirstHediffOfDef(std.syphilis.hediff_def); //Log.Message("1"); if (syp != null) { //Log.Message("2"); if (syp.Severity >= 0.80f) { //Log.Message("3"); return ThoughtState.ActiveAtStage(1); } else if (syp.Severity >= 0.50f) { //Log.Message("4"); return ThoughtState.ActiveAtStage(0); } //Log.Message("5"); } //Log.Message("6"); return ThoughtState.Inactive; } } }
TDarksword/rjw
Source/Modules/STD/Thoughts/ThoughtWorker_SyphiliticThoughts.cs
C#
mit
675
using RimWorld; using Verse; namespace rjw { public class ThoughtWorker_WastingAway : ThoughtWorker { protected override ThoughtState CurrentStateInternal(Pawn p) { if (!std.is_wasting_away(p)) return ThoughtState.Inactive; else return ThoughtState.ActiveAtStage(0); } } }
TDarksword/rjw
Source/Modules/STD/Thoughts/ThoughtWorker_WastingAway.cs
C#
mit
299
using System.Collections.Generic; using System.Linq; using Verse; namespace rjw { /// <summary> /// Common functions and constants relevant to STDs. /// </summary> public static class std { public static std_def hiv = DefDatabase<std_def>.GetNamed("HIV"); public static std_def herpes = DefDatabase<std_def>.GetNamed("Herpes"); public static std_def warts = DefDatabase<std_def>.GetNamed("Warts"); public static std_def syphilis = DefDatabase<std_def>.GetNamed("Syphilis"); public static std_def boobitis = DefDatabase<std_def>.GetNamed("Boobitis"); public static readonly HediffDef immunodeficiency = DefDatabase<HediffDef>.GetNamed("Immunodeficiency"); public static List<std_def> all => DefDatabase<std_def>.AllDefsListForReading; // Returns how severely affected this pawn's crotch is by rashes and warts, on a scale from 0 to 3. public static int genital_rash_severity(Pawn p) { int tr = 0; Hediff her = p.health.hediffSet.GetFirstHediffOfDef(herpes.hediff_def); if (her != null && her.Severity >= 0.25f) ++tr; Hediff war = p.health.hediffSet.GetFirstHediffOfDef(warts.hediff_def); if (war != null) tr += war.Severity < 0.40f ? 1 : 2; return tr; } public static Hediff get_infection(Pawn p, std_def sd) { return p.health.hediffSet.GetFirstHediffOfDef(sd.hediff_def); } public static BodyPartRecord GetRelevantBodyPartRecord(Pawn pawn, std_def std) { if (std.appliedOnFixedBodyParts == null) { return null; } BodyPartDef target = std.appliedOnFixedBodyParts.Single(); return pawn?.RaceProps.body.GetPartsWithDef(target).Single(); //return pawn?.RaceProps.body.GetPartsWithDef(std.appliedOnFixedBodyParts.Single()).Single(); } public static bool is_wasting_away(Pawn p) { Hediff id = p.health.hediffSet.GetFirstHediffOfDef(immunodeficiency); return id != null && id.CurStageIndex > 0; } public static bool IsImmune(Pawn pawn) { // Archotech genitalia automagically purge STDs. return !RJWSettings.stds_enabled || pawn.health.hediffSet.HasHediff(Genital_Helper.archotech_vagina) || pawn.health.hediffSet.HasHediff(Genital_Helper.archotech_penis) || xxx.is_demon(pawn) || xxx.is_slime(pawn) || xxx.is_mechanoid(pawn); } } }
TDarksword/rjw
Source/Modules/STD/std.cs
C#
mit
2,272
using System.Collections.Generic; using Verse; namespace rjw { /// <summary> /// Defines a disease that has a chance to spread during sex. /// </summary> public class std_def : Def { public HediffDef hediff_def; public HediffDef cohediff_def = null; public float catch_chance; public float environment_pitch_chance = 0.0f; public float spawn_chance = 0.0f; public float spawn_severity = 0.0f; public float autocure_below_severity = -1.0f; public List<BodyPartDef> appliedOnFixedBodyParts = null; } }
TDarksword/rjw
Source/Modules/STD/std_def.cs
C#
mit
526
using Multiplayer.API; using RimWorld; using System.Text; using UnityEngine; using Verse; namespace rjw { /// <summary> /// Responsible for spreading STDs (adding STD hediffs). Usually happens during sex. /// </summary> public static class std_spreader { /// <summary> /// Check for spreading of every STD the pitcher has to the catcher. /// Includes a small chance to spread STDs that pitcher doesn't have. /// </summary> [SyncMethod] public static void roll_to_catch(Pawn catcher, Pawn pitcher) { if (std.IsImmune(catcher) || std.IsImmune(pitcher)) { return; } //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); float cleanliness_factor = GetCleanlinessFactor(catcher); foreach (std_def sd in std.all) { if (!catcher.health.hediffSet.HasHediff(sd.hediff_def)) { if (catcher.health.immunity.GetImmunity(sd.hediff_def) <= 0.0f) { var bodyPartRecord = std.GetRelevantBodyPartRecord(catcher, sd); var artificial = bodyPartRecord != null && catcher.health.hediffSet.HasDirectlyAddedPartFor(bodyPartRecord); float catch_chance = GetCatchChance(catcher, sd); float catch_rv = Rand.Value; //if (xxx.config.std_show_roll_to_catch) //--Log.Message(" Chance to catch " + sd.label + ": " + catch_chance.ToStringPercent() + "; rolled: " + catch_rv.ToString()); if (catch_rv < catch_chance) { string pitch_source; float pitch_chance; { if (get_severity(pitcher, sd) >= xxx.config.std_min_severity_to_pitch) { pitch_source = xxx.get_pawnname(pitcher); pitch_chance = 1.0f; } else { pitch_source = "the environment"; pitch_chance = sd.environment_pitch_chance * cleanliness_factor; if (!RJWSettings.std_floor) { pitch_chance = -9001f; } } } float pitch_rv = Rand.Value; //if (xxx.config.std_show_roll_to_catch) //--Log.Message(" Chance to pitch (from " + pitch_source + "): " + pitch_chance.ToStringPercent() + "; rolled: " + pitch_rv.ToString()); if (pitch_rv < pitch_chance) { infect(catcher, sd); show_infection_letter(catcher, sd, pitch_source, catch_chance * pitch_chance); //if (xxx.config.std_show_roll_to_catch) //--Log.Message(" INFECTED!"); } } } //else //if (xxx.config.std_show_roll_to_catch) //--Log.Message(" Still immune to " + sd.label); } //else //if (xxx.config.std_show_roll_to_catch) //--Log.Message(" Already infected with " + sd.label); } } public static float get_severity(Pawn p, std_def sd) { Hediff hed = std.get_infection(p, sd); return hed?.Severity ?? 0.0f; } public static Hediff infect(Pawn p, std_def sd, bool include_coinfection = true) { Hediff existing = std.get_infection(p, sd); if (existing != null) { return existing; } BodyPartRecord part = std.GetRelevantBodyPartRecord(p, sd); p.health.AddHediff(sd.hediff_def, part); if (include_coinfection && sd.cohediff_def != null) { p.health.AddHediff(sd.cohediff_def, part); } //--ModLog.Message("std::infect genitals std"); return std.get_infection(p, sd); } static float GetCatchChance(Pawn pawn, std_def sd) { var bodyPartRecord = std.GetRelevantBodyPartRecord(pawn, sd); float artificialFactor = 1f; if (bodyPartRecord == null && pawn.health.hediffSet.HasDirectlyAddedPartFor(Genital_Helper.get_genitalsBPR(pawn))) { artificialFactor = .15f; } else if (pawn.health.hediffSet.HasDirectlyAddedPartFor(bodyPartRecord)) { artificialFactor = 0f; } return sd.catch_chance * artificialFactor; } public static void show_infection_letter(Pawn p, std_def sd, string source = null, float? chance = null) { StringBuilder info; { info = new StringBuilder(); info.Append(xxx.get_pawnname(p) + " has caught " + sd.label + (source != null ? " from " + source + "." : "")); if (chance.HasValue) info.Append(" (" + chance.Value.ToStringPercent() + " chance)"); info.AppendLine(); info.AppendLine(); info.Append(sd.description); } Find.LetterStack.ReceiveLetter("Infection: " + sd.label, info.ToString(), LetterDefOf.ThreatSmall, p); } static float GetCleanlinessFactor(Pawn catcher) { Room room = catcher.GetRoom(); float cle = room?.GetStat(RoomStatDefOf.Cleanliness) ?? xxx.config.std_outdoor_cleanliness; float exa = cle >= 0.0f ? xxx.config.std_env_pitch_cleanliness_exaggeration : xxx.config.std_env_pitch_dirtiness_exaggeration; return Mathf.Max(0.0f, 1.0f - exa * cle); } // Not called anywhere? [SyncMethod] public static void generate_on(Pawn p) { if (p == null) return; //prevent error on world gen for pawns with broken bodies(no genitals) if (p.RaceProps.body.HasPartWithTag(BodyPartTagDefOf.RJW_Fertility)) return; if (!xxx.is_human(p)) return; float nymph_mul = !xxx.is_nympho(p) ? 1.0f : xxx.config.nymph_spawn_with_std_mul; //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); foreach (std_def sd in std.all) if (Rand.Value < sd.spawn_chance * nymph_mul) { Hediff hed = infect(p, sd, false); float sev; { float r = Rand.Range(sd.hediff_def.minSeverity, sd.hediff_def.maxSeverity); sev = Mathf.Clamp(sd.spawn_severity * r, sd.hediff_def.minSeverity, sd.hediff_def.maxSeverity); } hed.Severity = sev; } } } }
TDarksword/rjw
Source/Modules/STD/std_spreader.cs
C#
mit
5,568
using Multiplayer.API; using RimWorld; using Verse; namespace rjw { /// <summary> /// Responsible for handling the periodic effects of having an STD hediff. /// Not technically tied to the infection vector itself, /// but some of the STD effects are weird and complicated. /// </summary> public static class std_updater { public const float UpdatesPerDay = 60000f / 150f / (float)Need_Sex.needsex_tick_timer; public static void update(Pawn p) { update_immunodeficiency(p); // Check if any infections are below the autocure threshold and cure them if so foreach (std_def sd in std.all) { Hediff inf = std.get_infection(p, sd); if (inf != null && (inf.Severity < sd.autocure_below_severity || std.IsImmune(p))) { p.health.RemoveHediff(inf); if (sd.cohediff_def != null) { Hediff coinf = p.health.hediffSet.GetFirstHediffOfDef(sd.cohediff_def); if (coinf != null) p.health.RemoveHediff(coinf); } } } UpdateBoobitis(p); roll_for_syphilis_damage(p); } [SyncMethod] public static void roll_for_syphilis_damage(Pawn p) { Hediff syp = p.health.hediffSet.GetFirstHediffOfDef(std.syphilis.hediff_def); if (syp == null || !(syp.Severity >= 0.60f) || syp.FullyImmune()) return; // A 30% chance per day of getting any permanent damage works out to ~891 in 1 million for each roll // The equation is (1-x)^(60000/150)=.7 // Important Note: // this function is called from Need_Sex::NeedInterval(), where it involves a needsex_tick and a std_tick to actually trigger this roll_for_syphilis_damage. // j(this is not exactly the same as the value in Need_Sex, that value is 0, but here j should be 1) std_ticks per this function called, k needsex_ticks per std_tick, 150 ticks per needsex_tick, and x is the chance per 150 ticks, // The new equation should be .7 = (1-x)^(400/kj) // 1-x = .7^(kj/400), x =1-.7^(kj/400) // Since k=10,j=1, so kj=10, new x is 1-.7^(10/400)=0.0088772362, let it be 888/100000 //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); if (Rand.RangeInclusive(1, 100000) <= 888) { BodyPartRecord part; float sev; var parts = p.RaceProps.body.AllParts; float rv = Rand.Value; if (rv < 0.10f) { part = parts.Find(bpr => string.Equals(bpr.def.defName, "Brain")); sev = 1.0f; } else if (rv < 0.50f) { part = parts.Find(bpr => string.Equals(bpr.def.defName, "Liver")); sev = Rand.RangeInclusive(1, 3); } else if (rv < 0.75f) { //LeftKidney, probably part = parts.Find(bpr => string.Equals(bpr.def.defName, "Kidney")); sev = Rand.RangeInclusive(1, 2); } else { //RightKidney, probably part = parts.FindLast(bpr => string.Equals(bpr.def.defName, "Kidney")); sev = Rand.RangeInclusive(1, 2); } if (part != null && !p.health.hediffSet.PartIsMissing(part) && !p.health.hediffSet.HasDirectlyAddedPartFor(part)) { DamageDef vir_dam = DefDatabase<DamageDef>.GetNamed("ViralDamage"); HediffDef dam_def = HealthUtility.GetHediffDefFromDamage(vir_dam, p, part); Hediff_Injury inj = (Hediff_Injury)HediffMaker.MakeHediff(dam_def, p, null); inj.Severity = sev; inj.TryGetComp<HediffComp_GetsPermanent>().IsPermanent = true; p.health.AddHediff(inj, part, null); string message_title = std.syphilis.label + " Damage"; string baby_pronoun = p.gender == Gender.Male ? "his" : "her"; string message_text = "RJW_Syphilis_Damage_Message".Translate(xxx.get_pawnname(p), baby_pronoun, part.def.label, std.syphilis.label); Find.LetterStack.ReceiveLetter(message_title, message_text, LetterDefOf.ThreatSmall, p); } } } [SyncMethod] public static void update_immunodeficiency(Pawn p) { float min_bf_for_id = 1.0f - std.immunodeficiency.minSeverity; Hediff id = p.health.hediffSet.GetFirstHediffOfDef(std.immunodeficiency); float bf = p.health.capacities.GetLevel(PawnCapacityDefOf.BloodFiltration); bool has = id != null; bool should_have = bf <= min_bf_for_id; if (has && !should_have) { p.health.RemoveHediff(id); id = null; } else if (!has && should_have) { p.health.AddHediff(std.immunodeficiency); id = p.health.hediffSet.GetFirstHediffOfDef(std.immunodeficiency); } if (id == null) return; id.Severity = 1.0f - bf; // Roll for and apply opportunistic infections: // Pawns will have a 90% chance for at least one infection each year at 0% filtration, and a 0% // chance at 40% filtration, scaling linearly. // Let x = chance infected per roll // Then chance not infected per roll = 1 - x // And chance not infected on any roll in one day = (1 - x) ^ (60000 / 150) = (1 - x) ^ 400 // And chance not infected on any roll in one year = (1 - x) ^ (400 * 60) = (1 - x) ^ 24000 // So 0.10 = (1 - x) ^ 24000 // log (0.10) = 24000 log (1 - x) // x = 0.00009593644334648975435114691213 = ~96 in 1 million // Important Note: // this function is called from Need_Sex::NeedInterval(), where it involves a needsex_tick and a std_tick to actually trigger this update_immunodeficiency. // j(this is not exactly the same as the value in Need_Sex, that value is 0, but here j should be 1) std_ticks per this function called, k needsex_ticks per std_tick, 150 ticks per needsex_tick, and x is the chance per 150 ticks, // The new equation should be .1 = (1-x)^(24000/kj) // log(.1) = (24000/kj) log(1-x), so log(1-x)= (kj/24000) log(.1), 1-x = .1^(kj/24000), x= 1-.1^(kj/24000) // Since k=10,j=1, so kj=10, new x is 1-.1^(10/24000)=0.0009589504, let it be 959/1000000 //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); if (Rand.RangeInclusive(1, 1000000) <= 959 && Rand.Value < bf / min_bf_for_id) { BodyPartRecord part; { float rv = Rand.Value; var parts = p.RaceProps.body.AllParts; if (rv < 0.25f) part = parts.Find(bpr => string.Equals(bpr.def.defName, "Jaw")); else if (rv < 0.50f) part = parts.Find(bpr => string.Equals(bpr.def.defName, "Lung")); else if (rv < 0.75f) part = parts.FindLast(bpr => string.Equals(bpr.def.defName, "Lung")); else part = parts.RandomElement(); } if (part != null && !p.health.hediffSet.PartIsMissing(part) && !p.health.hediffSet.HasDirectlyAddedPartFor(part) && p.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.WoundInfection) == null && // If the pawn already has a wound infection, we can't properly set the immunity for the new one p.health.immunity.GetImmunity(HediffDefOf.WoundInfection) <= 0.0f) { // Dont spawn infection if pawn already has immunity p.health.AddHediff(HediffDefOf.WoundInfection, part); p.health.HealthTick(); // Creates the immunity record ImmunityRecord ir = p.health.immunity.GetImmunityRecord(HediffDefOf.WoundInfection); if (ir != null) ir.immunity = xxx.config.opp_inf_initial_immunity; const string message_title = "Opportunistic Infection"; string message_text = "RJW_Opportunistic_Infection_Message".Translate(xxx.get_pawnname(p)); Find.LetterStack.ReceiveLetter(message_title, message_text, LetterDefOf.ThreatSmall); } } } /// <summary> /// For meanDays = 1.0, will return true on average once per day. For 2.0, will return true on average once every two days. /// </summary> [SyncMethod] static bool RollFor(float meanDays) { return Rand.Chance(1.0f / meanDays / UpdatesPerDay); } public static void UpdateBoobitis(Pawn pawn) { //var hediff = std.get_infection(pawn, std.boobitis); //if (hediff == null // || !(hediff.Severity >= 0.20f) // || hediff.FullyImmune() // || !BreastSize_Helper.TryGetBreastSize(pawn, out var oldSize, out var oldBoobs) // || oldSize >= BreastSize_Helper.MaxSize // || !RollFor(hediff.Severity > 0.90f ? 5f : 15f)) //{ // return; //} //var chest = Genital_Helper.get_breastsBPR(pawn); //var newSize = oldSize + 1; //var newBoobs = BreastSize_Helper.GetHediffDef(newSize); //GenderHelper.ChangeSex(pawn, () => //{ // if (oldBoobs != null) // { // pawn.health.RemoveHediff(oldBoobs); // } // pawn.health.AddHediff(newBoobs, chest); //}); //var message = "RJW_BreastsHaveGrownFromBoobitis".Translate(pawn); //Messages.Message(message, pawn, MessageTypeDefOf.SilentInput); } } }
TDarksword/rjw
Source/Modules/STD/std_updater.cs
C#
mit
8,473
using Verse; using UnityEngine; using Multiplayer.API; namespace rjw { [StaticConstructorOnStartup] public static class BukkakeContent { //UI: public static readonly Texture2D SemenIcon_little = ContentFinder<Texture2D>.Get("Bukkake/SemenIcon_little", true); public static readonly Texture2D SemenIcon_some = ContentFinder<Texture2D>.Get("Bukkake/SemenIcon_some", true); public static readonly Texture2D SemenIcon_dripping = ContentFinder<Texture2D>.Get("Bukkake/SemenIcon_dripping", true); public static readonly Texture2D SemenIcon_drenched = ContentFinder<Texture2D>.Get("Bukkake/SemenIcon_drenched", true); //on pawn: public static readonly Material semenSplatch1 = MaterialPool.MatFrom("Bukkake/splatch_1", ShaderDatabase.Cutout); public static readonly Material semenSplatch2 = MaterialPool.MatFrom("Bukkake/splatch_2", ShaderDatabase.Cutout); public static readonly Material semenSplatch3 = MaterialPool.MatFrom("Bukkake/splatch_3", ShaderDatabase.Cutout); public static readonly Material semenSplatch4 = MaterialPool.MatFrom("Bukkake/splatch_4", ShaderDatabase.Cutout); public static readonly Material semenSplatch5 = MaterialPool.MatFrom("Bukkake/splatch_5", ShaderDatabase.Cutout); public static readonly Material semenSplatch6 = MaterialPool.MatFrom("Bukkake/splatch_6", ShaderDatabase.Cutout); public static readonly Material semenSplatch7 = MaterialPool.MatFrom("Bukkake/splatch_7", ShaderDatabase.Cutout); public static readonly Material semenSplatch8 = MaterialPool.MatFrom("Bukkake/splatch_8", ShaderDatabase.Cutout); public static readonly Material semenSplatch9 = MaterialPool.MatFrom("Bukkake/splatch_9", ShaderDatabase.Cutout); [SyncMethod] public static Material pickRandomSplatch() { //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); int rand = Rand.Range(0, 8); switch (rand) { case 0: return semenSplatch1; case 1: return semenSplatch2; case 2: return semenSplatch3; case 3: return semenSplatch4; case 4: return semenSplatch5; case 5: return semenSplatch6; case 6: return semenSplatch7; case 7: return semenSplatch8; case 8: return semenSplatch9; } return null; } } }
TDarksword/rjw
Source/Modules/SemenOverlay/BukkakeContent.cs
C#
mit
2,265
using RimWorld; using Verse; namespace rjw { //I took the liberty of adding the new DefOf files since I find that easier than managing all the defs via xxx.cs [DefOf] public static class RJW_SemenoOverlayHediffDefOf { public static HediffDef Hediff_Semen;//for humans & animals; also parent for insect and mech spunk public static HediffDef Hediff_InsectSpunk; public static HediffDef Hediff_MechaFluids; public static HediffDef Hediff_Bukkake;//Master + manager } }
TDarksword/rjw
Source/Modules/SemenOverlay/DefOf/RJW_HediffDefOf.cs
C#
mit
487
using RimWorld; using Verse; namespace rjw { [DefOf] static class RJW_SemenOverlayJobDefOf { public static JobDef CleanSelf; } }
TDarksword/rjw
Source/Modules/SemenOverlay/DefOf/RJW_JobDefOf.cs
C#
mit
139
using System; using System.Collections.Generic; using System.Linq; using Verse; using RimWorld; using UnityEngine; using Multiplayer.API; namespace rjw { class Hediff_Bukkake : HediffWithComps { /* Whenever semen is applied, this hediff is also added to the pawn. Since there is always only a single hediff of this type on the pawn, it serves as master controller, adding up the individual Semen hediffs, applying debuffs and drawing overlays */ private static readonly float semenWeight = 0.2f;//how much individual semen_hediffs contribute to the overall bukkake severity List<Hediff> hediffs_semen; Dictionary<string, SemenSplatch> splatches; public override void ExposeData() { base.ExposeData(); //Scribe_Values.Look<Dictionary<string, SemenSplatch>>(ref splatches, "splatches", new Dictionary<string, SemenSplatch>()); - causes errors when loading. for now, just make a new dictionary splatches = new Dictionary<string, SemenSplatch>();//instead of loading, just recreate anew hediffs_semen = new List<Hediff>(); } public override void PostMake() { base.PostMake(); splatches = new Dictionary<string, SemenSplatch>(); } public override void PostTick() { if (pawn.RaceProps.Humanlike)//for now, only humans are supported { hediffs_semen = this.pawn.health.hediffSet.hediffs.FindAll(x => (x.def == RJW_SemenoOverlayHediffDefOf.Hediff_Semen || x.def == RJW_SemenoOverlayHediffDefOf.Hediff_InsectSpunk || x.def == RJW_SemenoOverlayHediffDefOf.Hediff_MechaFluids)); float bukkakeLevel = CalculateBukkakeLevel();//sum of severity of all the semen hediffs x semenWeight this.Severity = bukkakeLevel; bool updatePortrait = false; //loop through all semen hediffs, add missing ones to dictionary for (int i = 0; i < hediffs_semen.Count(); i++) { Hediff_Semen h = (Hediff_Semen)hediffs_semen[i]; string ID = h.GetUniqueLoadID();//unique ID for each hediff if (!splatches.ContainsKey(ID))//if it isn't here yet, make new object { updatePortrait = true; bool leftSide = h.Part.Label.Contains("left") ? true : false;//depending on whether the body part is left or right, drawing-offset on x-aixs may be inverted splatches[ID] = new SemenSplatch(h, pawn.story.bodyType, h.Part.def, leftSide, h.semenType); } } //remove splatch objects once their respective semen hediff is gone List<string> removeKeys = new List<string>(); foreach (string key in splatches.Keys) { SemenSplatch s = splatches[key]; if (!hediffs_semen.Contains(s.hediff_Semen)) { removeKeys.Add(key); updatePortrait = true; } } //loop over and remove elements that should be destroyed: foreach (string key in removeKeys) { SemenSplatch s = splatches[key]; splatches.Remove(key); } if (updatePortrait)//right now, portraits are only updated when a completely new semen hediff is added or an old one removed - maybe that should be done more frequently { PortraitsCache.SetDirty(pawn); } } } //called from the PawnWoundDrawer (see HarmonyPatches) public void DrawSemen(Vector3 drawLoc, Quaternion quat, bool forPortrait, float angle, bool inBed = false) { Rot4 bodyFacing = pawn.Rotation; int facingDir = bodyFacing.AsInt;//0: north, 1:east, 2:south, 3:west foreach (string key in splatches.Keys) { SemenSplatch s = splatches[key]; s.Draw(drawLoc, quat, forPortrait, facingDir, angle, inBed); } } //new Hediff_Bukkake added to pawn -> just combine the two public override bool TryMergeWith(Hediff other) { if (other == null || other.def != this.def) { return false; } return true; } private float CalculateBukkakeLevel() { float num = 0f; for (int i = 0; i < hediffs_semen.Count; i++) { num += hediffs_semen[i].Severity * semenWeight; } return num; } //class for handling drawing of the individual splatches private class SemenSplatch { public readonly Hediff_Semen hediff_Semen; public readonly Material semenMaterial; public readonly BodyPartDef bodyPart; private bool mirrorMesh; private const float maxSize = 0.20f;//1.0 = 1 tile private const float minSize = 0.05f; //data taken from SemenHelper.cs: private readonly float[] xAdjust; private readonly float[] zAdjust; private readonly float[] yAdjust; public SemenSplatch(Hediff_Semen hediff, BodyTypeDef bodyType, BodyPartDef bodyPart, bool leftSide = false, int semenType = SemenHelper.CUM_NORMAL) { hediff_Semen = hediff; semenMaterial = new Material(BukkakeContent.pickRandomSplatch());//needs to create new material in order to allow for different colors semenMaterial.SetTextureScale("_MainTex", new Vector2(-1, 1)); this.bodyPart = bodyPart; //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); //set color: switch (semenType) { case SemenHelper.CUM_NORMAL: semenMaterial.color = SemenHelper.color_normal; break; case SemenHelper.CUM_INSECT: semenMaterial.color = SemenHelper.color_insect; break; case SemenHelper.CUM_MECHA: semenMaterial.color = SemenHelper.color_mecha; break; } if (!MP.enabled) mirrorMesh = (Rand.Value > 0.5f);//in 50% of the cases, flip mesh horizontally for more variance //x,y,z adjustments to draw splatches over the approximately correct locations; values stored in semen helper - accessed by unique combinations of bodyTypes and bodyParts SemenHelper.key k = new SemenHelper.key(bodyType, bodyPart); if (SemenHelper.splatchAdjust.Keys.Contains(k)) { SemenHelper.values helperValues = SemenHelper.splatchAdjust[k]; //invert, x-adjust (horizontal) depending on left/right body side: if (!leftSide) { float[] xAdjTemp = new float[4]; for (int i = 0; i < xAdjTemp.Length; i++) { xAdjTemp[i] = helperValues.x[i] * -1f; } xAdjust = xAdjTemp; } else { xAdjust = helperValues.x; } zAdjust = helperValues.z;//vertical adjustment } else//fallback in the the key can't be found { if (RJWSettings.DevMode) { ModLog.Message("created semen splatch for undefined body type or part. BodyType: " + bodyType + " , BodyPart: " + bodyPart); } xAdjust = new float[] { 0f, 0f, 0f, 0f }; zAdjust = new float[] { 0f, 0f, 0f, 0f }; } //y adjustments: plane/layer of drawing, > 0 -> above certain objects, < 0 -> below SemenHelper.key_layer k2 = new SemenHelper.key_layer(leftSide, bodyPart); if (SemenHelper.layerAdjust.Keys.Contains(k2)) { SemenHelper.values_layer helperValues_layer = SemenHelper.layerAdjust[k2]; yAdjust = helperValues_layer.y; } else { yAdjust = new float[] { 0.02f, 0.02f, 0.02f, 0.02f };//over body in every direction } } public void Draw(Vector3 drawPos, Quaternion quat, bool forPortrait, int facingDir = 0, float angle = 0,bool inBed=false) { if (inBed) { if (this.bodyPart != BodyPartDefOf.Jaw && this.bodyPart != BodyPartDefOf.Head)//when pawn is in bed (=bed with sheets), only draw semen on head { return; } } //these two create new mesh instance and never destroying it, filling ram and crashing //float size = minSize+((maxSize-minSize)*hediff_Semen.Severity); //mesh = MeshMakerPlanes.NewPlaneMesh(size); //use core MeshPool.plane025 instead //if (mirrorMesh)//horizontal flip //{ //mesh = flipMesh(mesh); //} //rotation: if (angle == 0)//normal situation (pawn standing upright) { drawPos.x += xAdjust[facingDir]; drawPos.z += zAdjust[facingDir]; } else//if downed etc, more complex calculation becomes necessary { float radian = angle / 180 * (float)Math.PI; radian = -radian; drawPos.x += Mathf.Cos(radian) * xAdjust[hediff_Semen.pawn.Rotation.AsInt] - Mathf.Sin(radian) * zAdjust[facingDir];//facingDir doesn't appear to be chosen correctly in all cases drawPos.z += Mathf.Cos(radian) * zAdjust[hediff_Semen.pawn.Rotation.AsInt] + Mathf.Sin(radian) * xAdjust[facingDir]; } //drawPos.y += yAdjust[facingDir];// 0.00: over body; 0.01: over body but under face, 0.02: over face, but under hair, -99 = "never" visible drawPos.y += yAdjust[facingDir]; GenDraw.DrawMeshNowOrLater(MeshPool.plane025, drawPos, quat, semenMaterial, forPortrait); } //flips mesh UV horizontally, thereby mirroring the texture private Mesh flipMesh(Mesh meshToFlip) { var uvs = meshToFlip.uv; if (uvs.Length != 4) { return (meshToFlip); } for (var i = 0; i < uvs.Length; i++) { if (Mathf.Approximately(uvs[i].x, 1.0f)) uvs[i].x = 0.0f; else uvs[i].x = 1.0f; } meshToFlip.uv = uvs; return (meshToFlip); } } } }
TDarksword/rjw
Source/Modules/SemenOverlay/Hediffs/Hediff_Bukkake.cs
C#
mit
8,974
using System.Collections.Generic; using System.Linq; using System.Text; using Verse; using UnityEngine; using Multiplayer.API; namespace rjw { public class Hediff_Semen : HediffWithComps { public int semenType = SemenHelper.CUM_NORMAL;//-> different colors public string giverName = null;//not utilized right now, maybe in the future save origin of the semen public override string LabelInBrackets { get { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(base.LabelInBrackets); if (this.sourceHediffDef != null) { if (stringBuilder.Length != 0) { stringBuilder.Append(", "); } stringBuilder.Append(this.sourceHediffDef.label); } else if (this.source != null) { if (stringBuilder.Length != 0) { stringBuilder.Append(", "); } stringBuilder.Append(this.source.label); if (this.sourceBodyPartGroup != null) { stringBuilder.Append(" "); stringBuilder.Append(this.sourceBodyPartGroup.LabelShort); } } return stringBuilder.ToString(); } } public override string SeverityLabel { get { if (this.Severity == 0f) { return null; } return this.Severity.ToString("F1"); } } [SyncMethod] public override bool TryMergeWith(Hediff other) { //if a new Semen hediff is added to the same body part, they are combined. if severity reaches more than 1, spillover to other body parts occurs Hediff_Semen hediff_Semen = other as Hediff_Semen; if (hediff_Semen != null && hediff_Semen.def == this.def && hediff_Semen.Part == base.Part && this.def.injuryProps.canMerge) { semenType = hediff_Semen.semenType;//take over new creature color float totalAmount = hediff_Semen.Severity + this.Severity; if (totalAmount > 1.0f) { BodyPartDef spillOverTo = SemenHelper.spillover(this.Part.def);//SemenHelper saves valid other body parts for spillover if (spillOverTo != null) { //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); IEnumerable<BodyPartRecord> availableParts = SemenHelper.getAvailableBodyParts(pawn);//gets all non missing, valid body parts IEnumerable<BodyPartRecord> filteredParts = availableParts.Where(x => x.def == spillOverTo);//filters again for valid spill target BodyPartRecord spillPart = filteredParts.RandomElement<BodyPartRecord>();//then pick one if (spillPart != null) { SemenHelper.cumOn(pawn, spillPart, totalAmount - this.Severity, null, semenType); } } } return (base.TryMergeWith(other)); } return (false); } public override void ExposeData() { base.ExposeData(); Scribe_Values.Look<int>(ref semenType, "semenType", SemenHelper.CUM_NORMAL); if (Scribe.mode == LoadSaveMode.PostLoadInit && base.Part == null) { //Log.Error("Hediff_Semen has null part after loading.", false); this.pawn.health.hediffSet.hediffs.Remove(this); return; } } //handles the icon in the health tab and its color public override TextureAndColor StateIcon { get { TextureAndColor tex = TextureAndColor.None; Color color = Color.white; switch (semenType) { case SemenHelper.CUM_NORMAL: color = SemenHelper.color_normal; break; case SemenHelper.CUM_INSECT: color = SemenHelper.color_insect; break; case SemenHelper.CUM_MECHA: color = SemenHelper.color_mecha; break; } Texture2D tex2d = BukkakeContent.SemenIcon_little; switch (this.CurStageIndex) { case 0: tex2d = BukkakeContent.SemenIcon_little; break; case 1: tex2d = BukkakeContent.SemenIcon_some; break; case 2: tex2d = BukkakeContent.SemenIcon_dripping; break; case 3: tex2d = BukkakeContent.SemenIcon_drenched; break; } tex = new TextureAndColor(tex2d, color); return tex; } } } }
TDarksword/rjw
Source/Modules/SemenOverlay/Hediffs/Hediff_Semen.cs
C#
mit
3,984
using System.Collections.Generic; using Verse; using Verse.AI; namespace rjw { class JobDriver_CleanSelf : JobDriver { float cleanAmount = 1f;//severity of a single SemenHediff removed per cleaning-round; 1f = remove entirely int cleaningTime = 120;//ticks - 120 = 2 real seconds, 3 in-game minutes public override bool TryMakePreToilReservations(bool errorOnFailed) { return pawn.Reserve(pawn, job, 1, -1, null, errorOnFailed); } protected override IEnumerable<Toil> MakeNewToils() { this.FailOn(delegate { List<Hediff> hediffs = pawn.health.hediffSet.hediffs; return !hediffs.Exists(x => x.def == RJW_SemenoOverlayHediffDefOf.Hediff_Bukkake);//fail if bukkake disappears - means that also all the semen is gone }); Toil cleaning = Toils_General.Wait(cleaningTime, TargetIndex.None);//duration of cleaning.WithProgressBarToilDelay(TargetIndex.A); yield return cleaning; yield return new Toil() { initAction = delegate () { //get one of the semen hediffs, reduce its severity Hediff hediff = pawn.health.hediffSet.hediffs.Find(x => (x.def == RJW_SemenoOverlayHediffDefOf.Hediff_Semen || x.def == RJW_SemenoOverlayHediffDefOf.Hediff_InsectSpunk || x.def == RJW_SemenoOverlayHediffDefOf.Hediff_MechaFluids)); if (hediff != null) { hediff.Severity -= cleanAmount; } } }; yield break; } } }
TDarksword/rjw
Source/Modules/SemenOverlay/JobDrivers/JobDriver_CleanSelf.cs
C#
mit
1,399
using System; using System.Collections.Generic; using System.Linq; using RimWorld; using Verse; using HarmonyLib; using UnityEngine; using Multiplayer.API; namespace rjw { [StaticConstructorOnStartup] public static class SemenHelper { /* contains many important functions of use to the other classes */ //amount of semen per sex act: public static readonly Dictionary<key, values> splatchAdjust;//saves x (horizontal) and z (vertical) adjustments of texture positiion for each unique combination of bodyType and bodyPart public static readonly Dictionary<key_layer, values_layer> layerAdjust;//saves y adjustments (drawing plane) for left/right appendages + bodyPart combinations to hide spunk if pawn looks in the wrong direction //structs are used to pack related variables together - used as keys for the dictionaries public struct key//allows to save all unique combinations of bodyType and bodyPart { public readonly BodyTypeDef bodyType; public readonly BodyPartDef bodyPart; public key(BodyTypeDef bodyType, BodyPartDef bodyPart) { this.bodyType = bodyType; this.bodyPart = bodyPart; } } //for the 4 directions, use arrays to store the different adjust for north, east, south, west (in that order) public struct values { public readonly float[] x; public readonly float[] z; //public readonly bool over_clothing;//on gentials: hide when clothes are worn - in case of the other body parts it can't be said (for now) if it was added on the clothing or not public values(float[] xAdjust, float[] zAdjust) { x = xAdjust; z = zAdjust; //this.over_clothing = over_clothing; } } public struct key_layer//used to save left/right appendage + bodyPart combinations { public readonly bool left_side; public readonly BodyPartDef bodyPart; public key_layer(bool left_side, BodyPartDef bodyPart) { this.left_side = left_side; this.bodyPart = bodyPart; } } public struct values_layer//saves the y-adjustments for different body parts and sides -> e.g. allows hiding spunk on the right arm if pawn is looking to the left (aka west) { public readonly float[] y; public values_layer(float[] yAdjust) { y = yAdjust; } } //get defs of the rjw parts public static BodyPartDef genitalsDef = BodyDefOf.Human.AllParts.Find(bpr => string.Equals(bpr.def.defName, "Genitals")).def; public static BodyPartDef anusDef = BodyDefOf.Human.AllParts.Find(bpr => string.Equals(bpr.def.defName, "Anus")).def; public static BodyPartDef chestDef = BodyDefOf.Human.AllParts.Find(bpr => string.Equals(bpr.def.defName, "Chest")).def; static SemenHelper() { splatchAdjust = new Dictionary<key, values>(); //maybe there is a more elegant way to save and load this data, but I don't know about it //structure explained: //1) key: struct consisting of bodyType + bodyPart (= unique key for every combination of bodyType + part) //2) values: struct containing positioning information (xAdjust: horizontal positioning, yAdjust: vertical positioning, zAdjust: whether to draw above or below pawn //note: arms, hands, and legs (which are only visible from one direction) values need not be inverted between west and east //BodyType Thin splatchAdjust.Add(new key(BodyTypeDefOf.Thin, BodyPartDefOf.Arm), new values(new float[] { -0.13f, 0.05f, 0.13f, 0.05f }, new float[] { 0f, 0f, 0f, 0f })); splatchAdjust.Add(new key(BodyTypeDefOf.Thin, BodyPartDefOf.Hand), new values(new float[] { -0.12f, 0.15f, 0.12f, 0.15f }, new float[] { -0.25f, -0.25f, -0.25f, -0.25f })); splatchAdjust.Add(new key(BodyTypeDefOf.Thin, BodyPartDefOf.Head), new values(new float[] { 0f, -0.23f, 0f, 0.23f }, new float[] { 0.37f, 0.35f, 0.33f, 0.35f })); splatchAdjust.Add(new key(BodyTypeDefOf.Thin, BodyPartDefOf.Jaw), new values(new float[] { 0f, -0.19f, 0f, 0.19f }, new float[] { 0.15f, 0.15f, 0.15f, 0.15f })); splatchAdjust.Add(new key(BodyTypeDefOf.Thin, BodyPartDefOf.Leg), new values(new float[] { -0.1f, 0.1f, 0.1f, 0.1f }, new float[] { -0.4f, -0.4f, -0.4f, -0.4f })); splatchAdjust.Add(new key(BodyTypeDefOf.Thin, BodyPartDefOf.Neck), new values(new float[] { 0f, -0.07f, 0f, 0.07f }, new float[] { 0.06f, 0.06f, 0.06f, 0.06f })); splatchAdjust.Add(new key(BodyTypeDefOf.Thin, BodyPartDefOf.Torso), new values(new float[] { 0f, 0f, 0f, 0f }, new float[] { -0.18f, -0.20f, -0.25f, -0.25f })); splatchAdjust.Add(new key(BodyTypeDefOf.Thin, genitalsDef), new values(new float[] { 0f, 0.01f, 0f, -0.01f }, new float[] { 0, -0.35f, -0.35f, -0.35f })); splatchAdjust.Add(new key(BodyTypeDefOf.Thin, anusDef), new values(new float[] { 0, 0.18f, 0, -0.18f }, new float[] { -0.42f, -0.35f, 0, -0.35f })); splatchAdjust.Add(new key(BodyTypeDefOf.Thin, chestDef), new values(new float[] { 0f, -0.1f, 0f, 0.1f }, new float[] { -0.06f, -0.05f, -0.06f, -0.05f })); //BodyType Female splatchAdjust.Add(new key(BodyTypeDefOf.Female, BodyPartDefOf.Arm), new values(new float[] { -0.17f, 0f, 0.17f, 0f }, new float[] { 0f, 0f, 0f, 0f })); splatchAdjust.Add(new key(BodyTypeDefOf.Female, BodyPartDefOf.Hand), new values(new float[] { -0.17f, 0.1f, 0.17f, 0.1f }, new float[] { -0.25f, -0.25f, -0.25f, -0.25f })); splatchAdjust.Add(new key(BodyTypeDefOf.Female, BodyPartDefOf.Head), new values(new float[] { 0f, -0.23f, 0f, 0.23f }, new float[] { 0.37f, 0.35f, 0.33f, 0.35f })); splatchAdjust.Add(new key(BodyTypeDefOf.Female, BodyPartDefOf.Jaw), new values(new float[] { 0f, -0.19f, 0f, 0.19f }, new float[] { 0.15f, 0.15f, 0.15f, 0.15f })); splatchAdjust.Add(new key(BodyTypeDefOf.Female, BodyPartDefOf.Leg), new values(new float[] { -0.2f, 0.1f, 0.2f, 0.1f }, new float[] { -0.4f, -0.4f, -0.4f, -0.4f })); splatchAdjust.Add(new key(BodyTypeDefOf.Female, BodyPartDefOf.Neck), new values(new float[] { 0f, -0.07f, 0f, 0.07f }, new float[] { 0.06f, 0.06f, 0.06f, 0.06f })); splatchAdjust.Add(new key(BodyTypeDefOf.Female, BodyPartDefOf.Torso), new values(new float[] { 0f, -0.05f, 0f, 0.05f }, new float[] { -0.20f, -0.25f, -0.25f, -0.25f })); splatchAdjust.Add(new key(BodyTypeDefOf.Female, genitalsDef), new values(new float[] { 0f, -0.10f, 0f, 0.10f }, new float[] { 0, -0.42f, -0.45f, -0.42f })); splatchAdjust.Add(new key(BodyTypeDefOf.Female, anusDef), new values(new float[] { 0, 0.26f, 0, -0.26f }, new float[] { -0.42f, -0.35f, 0, -0.35f })); splatchAdjust.Add(new key(BodyTypeDefOf.Female, chestDef), new values(new float[] { 0f, -0.12f, 0f, 0.12f }, new float[] { -0.06f, -0.05f, -0.06f, -0.05f })); //BodyType Male splatchAdjust.Add(new key(BodyTypeDefOf.Male, BodyPartDefOf.Arm), new values(new float[] { -0.21f, 0.05f, 0.21f, 0.05f }, new float[] { 0f, -0.02f, 0f, -0.02f })); splatchAdjust.Add(new key(BodyTypeDefOf.Male, BodyPartDefOf.Hand), new values(new float[] { -0.17f, 0.07f, 0.17f, 0.07f }, new float[] { -0.25f, -0.25f, -0.25f, -0.25f })); splatchAdjust.Add(new key(BodyTypeDefOf.Male, BodyPartDefOf.Head), new values(new float[] { 0f, -0.23f, 0f, 0.23f }, new float[] { 0.37f, 0.35f, 0.33f, 0.35f })); splatchAdjust.Add(new key(BodyTypeDefOf.Male, BodyPartDefOf.Jaw), new values(new float[] { 0f, -0.19f, 0f, 0.19f }, new float[] { 0.15f, 0.15f, 0.15f, 0.15f })); splatchAdjust.Add(new key(BodyTypeDefOf.Male, BodyPartDefOf.Leg), new values(new float[] { -0.17f, 0.07f, 0.17f, 0.07f }, new float[] { -0.4f, -0.4f, -0.4f, -0.4f })); splatchAdjust.Add(new key(BodyTypeDefOf.Male, BodyPartDefOf.Neck), new values(new float[] { 0f, -0.07f, 0f, 0.07f }, new float[] { 0.06f, 0.06f, 0.06f, 0.06f })); splatchAdjust.Add(new key(BodyTypeDefOf.Male, BodyPartDefOf.Torso), new values(new float[] { 0f, -0.05f, 0f, 0.05f }, new float[] { -0.20f, -0.25f, -0.25f, -0.25f })); splatchAdjust.Add(new key(BodyTypeDefOf.Male, genitalsDef), new values(new float[] { 0f, -0.07f, 0f, 0.07f }, new float[] { 0, -0.35f, -0.42f, -0.35f })); splatchAdjust.Add(new key(BodyTypeDefOf.Male, anusDef), new values(new float[] { 0, 0.17f, 0, -0.17f }, new float[] { -0.42f, -0.35f, 0, -0.35f })); splatchAdjust.Add(new key(BodyTypeDefOf.Male, chestDef), new values(new float[] { 0f, -0.16f, 0f, 0.16f }, new float[] { -0.06f, -0.05f, -0.06f, -0.05f })); //BodyType Hulk splatchAdjust.Add(new key(BodyTypeDefOf.Hulk, BodyPartDefOf.Arm), new values(new float[] { -0.3f, 0.05f, 0.3f, 0.05f }, new float[] { 0f, -0.02f, 0f, -0.02f })); splatchAdjust.Add(new key(BodyTypeDefOf.Hulk, BodyPartDefOf.Hand), new values(new float[] { -0.22f, 0.07f, 0.22f, 0.07f }, new float[] { -0.28f, -0.28f, -0.28f, -0.28f })); splatchAdjust.Add(new key(BodyTypeDefOf.Hulk, BodyPartDefOf.Head), new values(new float[] { 0f, -0.23f, 0f, 0.23f }, new float[] { 0.37f, 0.35f, 0.33f, 0.35f })); splatchAdjust.Add(new key(BodyTypeDefOf.Hulk, BodyPartDefOf.Jaw), new values(new float[] { 0f, -0.19f, 0f, 0.19f }, new float[] { 0.15f, 0.15f, 0.15f, 0.15f })); splatchAdjust.Add(new key(BodyTypeDefOf.Hulk, BodyPartDefOf.Leg), new values(new float[] { -0.17f, 0.07f, 0.17f, 0.07f }, new float[] { -0.5f, -0.5f, -0.5f, -0.5f })); splatchAdjust.Add(new key(BodyTypeDefOf.Hulk, BodyPartDefOf.Neck), new values(new float[] { 0f, -0.07f, 0f, 0.07f }, new float[] { 0.06f, 0.06f, 0.06f, 0.06f })); splatchAdjust.Add(new key(BodyTypeDefOf.Hulk, BodyPartDefOf.Torso), new values(new float[] { 0f, -0.05f, 0f, 0.05f }, new float[] { -0.20f, -0.3f, -0.3f, -0.3f })); splatchAdjust.Add(new key(BodyTypeDefOf.Hulk, genitalsDef), new values(new float[] { 0f, -0.02f, 0f, 0.02f }, new float[] { 0, -0.55f, -0.55f, -0.55f })); splatchAdjust.Add(new key(BodyTypeDefOf.Hulk, anusDef), new values(new float[] { 0, 0.35f, 0, -0.35f }, new float[] { -0.5f, -0.5f, 0, -0.5f })); splatchAdjust.Add(new key(BodyTypeDefOf.Hulk, chestDef), new values(new float[] { 0f, -0.22f, 0f, 0.22f }, new float[] { -0.06f, -0.05f, -0.06f, -0.05f })); //BodyType Fat splatchAdjust.Add(new key(BodyTypeDefOf.Fat, BodyPartDefOf.Arm), new values(new float[] { -0.3f, 0.05f, 0.3f, 0.05f }, new float[] { 0f, -0.02f, 0f, -0.02f })); splatchAdjust.Add(new key(BodyTypeDefOf.Fat, BodyPartDefOf.Hand), new values(new float[] { -0.32f, 0.07f, 0.32f, 0.07f }, new float[] { -0.28f, -0.28f, -0.28f, -0.28f })); splatchAdjust.Add(new key(BodyTypeDefOf.Fat, BodyPartDefOf.Head), new values(new float[] { 0f, -0.23f, 0f, 0.23f }, new float[] { 0.37f, 0.35f, 0.33f, 0.35f })); splatchAdjust.Add(new key(BodyTypeDefOf.Fat, BodyPartDefOf.Jaw), new values(new float[] { 0f, -0.19f, 0f, 0.19f }, new float[] { 0.15f, 0.15f, 0.15f, 0.15f })); splatchAdjust.Add(new key(BodyTypeDefOf.Fat, BodyPartDefOf.Leg), new values(new float[] { -0.17f, 0.07f, 0.17f, 0.07f }, new float[] { -0.45f, -0.45f, -0.45f, -0.45f })); splatchAdjust.Add(new key(BodyTypeDefOf.Fat, BodyPartDefOf.Neck), new values(new float[] { 0f, -0.07f, 0f, 0.07f }, new float[] { 0.06f, 0.06f, 0.06f, 0.06f })); splatchAdjust.Add(new key(BodyTypeDefOf.Fat, BodyPartDefOf.Torso), new values(new float[] { 0f, -0.15f, 0f, 0.15f }, new float[] { -0.20f, -0.3f, -0.3f, -0.3f })); splatchAdjust.Add(new key(BodyTypeDefOf.Fat, genitalsDef), new values(new float[] { 0f, -0.25f, 0f, 0.25f }, new float[] { 0, -0.45f, -0.50f, -0.45f })); splatchAdjust.Add(new key(BodyTypeDefOf.Fat, anusDef), new values(new float[] { 0, 0.35f, 0, -0.35f }, new float[] { -0.5f, -0.4f, 0, -0.4f })); splatchAdjust.Add(new key(BodyTypeDefOf.Fat, chestDef), new values(new float[] { 0f, -0.27f, 0f, 0.27f }, new float[] { -0.07f, -0.05f, -0.07f, -0.05f })); //now for the layer/plane adjustments: layerAdjust = new Dictionary<key_layer, values_layer>(); //left body parts: //in theory, all body parts not coming in pairs should have the bool as false -> be listed as right, so I wouldn't need to add them here, but it doesn't hurt to be safe layerAdjust.Add(new key_layer(true, BodyPartDefOf.Arm), new values_layer(new float[] { 0f, -99f, 0f, 0f }));//0.00 = drawn over body (=visible) if the pawn looks in any direction except west, in which case it's hidden (-99) layerAdjust.Add(new key_layer(true, BodyPartDefOf.Hand), new values_layer(new float[] { 0f, -99f, 0f, 0f })); layerAdjust.Add(new key_layer(true, BodyPartDefOf.Leg), new values_layer(new float[] { 0f, -99f, 0f, 0f })); layerAdjust.Add(new key_layer(true, BodyPartDefOf.Head), new values_layer(new float[] { 0.02f, 0.02f, 0.02f, 0.02f }));//drawn from all directions, 0.02 = over hair layerAdjust.Add(new key_layer(true, BodyPartDefOf.Jaw), new values_layer(new float[] { -9f, 0.01f, 0.01f, 0.01f }));//0.01 = drawn over head but under hair, only hidden if facing north layerAdjust.Add(new key_layer(true, BodyPartDefOf.Neck), new values_layer(new float[] { 0f, 0f, 0f, 0f })); layerAdjust.Add(new key_layer(true, BodyPartDefOf.Torso), new values_layer(new float[] { 0f, 0f, 0f, 0f })); layerAdjust.Add(new key_layer(true, genitalsDef), new values_layer(new float[] { -99f, 0f, 0f, 0f }));//only hidden if facing north layerAdjust.Add(new key_layer(true, anusDef), new values_layer(new float[] { 0f, 0f, -99f, 0f })); layerAdjust.Add(new key_layer(true, chestDef), new values_layer(new float[] { -99f, 0f, 0f, 0f })); //right body parts: layerAdjust.Add(new key_layer(false, BodyPartDefOf.Arm), new values_layer(new float[] { 0f, 0f, 0f, -99f })); layerAdjust.Add(new key_layer(false, BodyPartDefOf.Hand), new values_layer(new float[] { 0f, 0f, 0f, -99f })); layerAdjust.Add(new key_layer(false, BodyPartDefOf.Leg), new values_layer(new float[] { 0f, 0f, 0f, -99f })); layerAdjust.Add(new key_layer(false, BodyPartDefOf.Head), new values_layer(new float[] { 0.02f, 0.02f, 0.02f, 0.02f })); layerAdjust.Add(new key_layer(false, BodyPartDefOf.Jaw), new values_layer(new float[] { -99f, 0.01f, 0.01f, 0.01f })); layerAdjust.Add(new key_layer(false, BodyPartDefOf.Neck), new values_layer(new float[] { 0f, 0f, 0f, 0f })); layerAdjust.Add(new key_layer(false, BodyPartDefOf.Torso), new values_layer(new float[] { 0f, 0f, 0f, 0f })); layerAdjust.Add(new key_layer(false, genitalsDef), new values_layer(new float[] { -99f, 0f, 0f, 0f })); layerAdjust.Add(new key_layer(false, anusDef), new values_layer(new float[] { 0f, 0f, -99f, 0f })); layerAdjust.Add(new key_layer(false, chestDef), new values_layer(new float[] { -99f, 0f, 0f, 0f })); } //all body parts that semen can theoretically be applied to: public static List<BodyPartDef> getAllowedBodyParts() { List<BodyPartDef> allowedParts = new List<BodyPartDef>(); allowedParts.Add(BodyPartDefOf.Arm); allowedParts.Add(BodyPartDefOf.Hand); allowedParts.Add(BodyPartDefOf.Leg); allowedParts.Add(BodyPartDefOf.Head); allowedParts.Add(BodyPartDefOf.Jaw); allowedParts.Add(BodyPartDefOf.Neck); allowedParts.Add(BodyPartDefOf.Torso); allowedParts.Add(genitalsDef); allowedParts.Add(anusDef); allowedParts.Add(chestDef); return allowedParts; } //get valid body parts for a specific pawn public static IEnumerable<BodyPartRecord> getAvailableBodyParts(Pawn pawn) { //get all non-missing body parts: IEnumerable<BodyPartRecord> bodyParts = pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Outside, null, null); BodyPartRecord anus = pawn.def.race.body.AllParts.Find(bpr => string.Equals(bpr.def.defName, "Anus"));//not found by above function since depth is "inside" if (anus != null) { bodyParts = bodyParts.AddItem(anus); } //filter for allowed body parts (e.g. no single fingers/toes): List<BodyPartDef> filterParts = SemenHelper.getAllowedBodyParts(); IEnumerable<BodyPartRecord> filteredParts = bodyParts.Where(item1 => filterParts.Any(item2 => item2.Equals(item1.def))); return filteredParts; } public const int CUM_NORMAL = 0; public const int CUM_INSECT = 1; public const int CUM_MECHA = 2; public static readonly Color color_normal = new Color(0.95f, 0.95f, 0.95f); public static readonly Color color_insect = new Color(0.6f, 0.83f, 0.35f);//green-yellowish public static readonly Color color_mecha = new Color(0.37f, 0.71f, 0.82f);//cyan-ish //name should be self-explanatory: public static void cumOn(Pawn receiver, BodyPartRecord bodyPart, float amount = 0.2f, Pawn giver = null, int semenType = CUM_NORMAL) { Hediff_Semen hediff; if (semenType == CUM_NORMAL) { hediff = (Hediff_Semen)HediffMaker.MakeHediff(RJW_SemenoOverlayHediffDefOf.Hediff_Semen, receiver, null); } else if (semenType == CUM_INSECT) { hediff = (Hediff_Semen)HediffMaker.MakeHediff(RJW_SemenoOverlayHediffDefOf.Hediff_InsectSpunk, receiver, null); } else { hediff = (Hediff_Semen)HediffMaker.MakeHediff(RJW_SemenoOverlayHediffDefOf.Hediff_MechaFluids, receiver, null); } hediff.Severity = amount;//if this body part is already maximally full -> spill over to other parts //idea: here, a log entry that can act as source could be linked to the hediff - maybe reuse the playlog entry of rjw: hediff.semenType = semenType; try { //error when adding to missing part receiver.health.AddHediff(hediff, bodyPart, null, null); } catch { } //Log.Message(xxx.get_pawnname(receiver) + " cum ammount" + amount); //causes significant memory leak, fixx someday //if (amount > 1f)//spillover in case of very large amounts: just apply hediff a second time //{ // Hediff_Semen hediff2 = (Hediff_Semen)HediffMaker.MakeHediff(hediff.def, receiver, null); // hediff2.semenType = semenType; // hediff2.Severity = amount - 1f; // receiver.health.AddHediff(hediff2, bodyPart, null, null); //} //always also add bukkake hediff as manager receiver.health.AddHediff(RJW_SemenoOverlayHediffDefOf.Hediff_Bukkake); } //if spunk on one body part reaches a certain level, it can spill over to others, this function returns from where to where [SyncMethod] public static BodyPartDef spillover(BodyPartDef sourcePart) { //caution: danger of infinite loop if circular spillover between 2 full parts -> don't define possible circles BodyPartDef newPart = null; int sel; //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); if (sourcePart == BodyPartDefOf.Torso) { sel = Rand.Range(0, 4); if (sel == 0) { newPart = BodyPartDefOf.Arm; } else if (sel == 1) { newPart = BodyPartDefOf.Leg; } else if (sel == 2) { newPart = BodyPartDefOf.Neck; } else if (sel == 3) { newPart = chestDef; } } else if (sourcePart == BodyPartDefOf.Jaw) { sel = Rand.Range(0, 4); if (sel == 0) { newPart = BodyPartDefOf.Head; } else if (sel == 1) { newPart = BodyPartDefOf.Torso; } else if (sel == 2) { newPart = BodyPartDefOf.Neck; } else if (sel == 3) { newPart = chestDef; } } else if (sourcePart == genitalsDef) { sel = Rand.Range(0, 2); if (sel == 0) { newPart = BodyPartDefOf.Leg; } else if (sel == 1) { newPart = BodyPartDefOf.Torso; } } else if (sourcePart == anusDef) { sel = Rand.Range(0, 2); if (sel == 0) { newPart = BodyPartDefOf.Leg; } else if (sel == 1) { newPart = BodyPartDefOf.Torso; } } else if (sourcePart == chestDef) { sel = Rand.Range(0, 3); if (sel == 0) { newPart = BodyPartDefOf.Arm; } else if (sel == 1) { newPart = BodyPartDefOf.Torso; } else if (sel == 2) { newPart = BodyPartDefOf.Neck; } } return newPart; } //determines who is the active male (or equivalent) in the exchange and the amount of semen dispensed and where to [SyncMethod] public static void calculateAndApplySemen(Pawn pawn, Pawn partner, xxx.rjwSextype sextype) { if (!RJWSettings.cum_on_body) return; Pawn giver, receiver; //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); List<Hediff> giverparts; var pawnparts = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)); var partnerparts = Genital_Helper.get_PartsHediffList(partner, Genital_Helper.get_genitalsBPR(partner)); //dispenser of the seed if (Genital_Helper.has_penis_fertile(pawn, pawnparts) || xxx.is_mechanoid(pawn) || xxx.is_insect(pawn)) { giver = pawn; giverparts = pawnparts; receiver = partner; } else if (partner != null && (Genital_Helper.has_penis_fertile(partner, partnerparts) || xxx.is_mechanoid(partner) || xxx.is_insect(partner))) { giver = partner; giverparts = partnerparts; receiver = pawn; } else//female on female or genderless - no semen dispensed; maybe add futa support? { return; } //slimes do not waste fluids? //if (xxx.is_slime(giver)) return; //determine entity: int entityType = SemenHelper.CUM_NORMAL; if (xxx.is_mechanoid(giver)) { entityType = SemenHelper.CUM_MECHA; } else if (xxx.is_insect(giver)) { entityType = SemenHelper.CUM_INSECT; } //get pawn genitalia: BodyPartRecord genitals; if (xxx.is_mechanoid(giver)) { genitals = giver.RaceProps.body.AllParts.Find(x => string.Equals(x.def.defName, "MechGenitals")); } else//insects, animals, humans { genitals = giver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.genitalsDef); } //no cum without genitals if (genitals == null) { return; } float cumAmount = giver.BodySize; //fallback for mechanoinds and w/e without hediffs float horniness = 1f; float ageScale = Math.Min(80 / SexUtility.ScaleToHumanAge(giver), 1.0f);//calculation lifted from rjw if (xxx.is_mechanoid(giver) && giverparts.NullOrEmpty()) { //use default above } else if (giverparts.NullOrEmpty()) return; else { var penisHediff = giverparts.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault(); if (penisHediff == null) penisHediff = giverparts.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault(); if (penisHediff == null) penisHediff = giverparts.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault(); if (penisHediff == null) penisHediff = giverparts.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault(); if (penisHediff != null) { cumAmount = penisHediff.Severity * giver.BodySize; CompHediffBodyPart chdf = penisHediff.TryGetComp<rjw.CompHediffBodyPart>(); if (chdf != null) { cumAmount = chdf.FluidAmmount * chdf.FluidModifier; } Need sexNeed = giver?.needs?.AllNeeds.Find(x => string.Equals(x.def.defName, "Sex")); if (sexNeed != null)//non-humans don't have it - therefore just use the default value { horniness = 1f - sexNeed.CurLevel; } } else { //something is wrong... vagina? return; } } cumAmount = cumAmount * horniness * ageScale * RJWSettings.cum_on_body_amount_adjust; cumAmount /= 100; //TODO: SemenHelper Autofellatio //if no partner -> masturbation, apply some cum on self: //if (partner == null && sextype == xxx.rjwSextype.Autofellatio) //{ // if (!xxx.is_slime(giver)) // SemenHelper.cumOn(giver, BodyPartDefOf.Jaw, cumAmount, giver); // return; //} if (partner == null && sextype == xxx.rjwSextype.Masturbation) { if (!xxx.is_slime(giver)) SemenHelper.cumOn(giver, genitals, cumAmount * 0.3f, giver);//pawns are usually not super-messy -> only apply 30% return; } else if (partner != null) { List<BodyPartRecord> targetParts = new List<BodyPartRecord>();//which to apply semen on IEnumerable<BodyPartRecord> availableParts = SemenHelper.getAvailableBodyParts(receiver); BodyPartRecord randomPart;//not always needed switch (sextype) { case rjw.xxx.rjwSextype.Anal: targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.anusDef)); break; case rjw.xxx.rjwSextype.Boobjob: targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.chestDef)); break; case rjw.xxx.rjwSextype.DoublePenetration: targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.anusDef)); targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.genitalsDef)); break; case rjw.xxx.rjwSextype.Fingering: cumAmount = 0; break; case rjw.xxx.rjwSextype.Fisting: cumAmount = 0; break; case rjw.xxx.rjwSextype.Footjob: //random part: availableParts.TryRandomElement<BodyPartRecord>(out randomPart); targetParts.Add(randomPart); break; case rjw.xxx.rjwSextype.Handjob: //random part: availableParts.TryRandomElement<BodyPartRecord>(out randomPart); targetParts.Add(randomPart); break; case rjw.xxx.rjwSextype.Masturbation: cumAmount *= 2f; break; case rjw.xxx.rjwSextype.MechImplant: //one of the openings: int random = Rand.Range(0, 3); if (random == 0) { targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.genitalsDef)); } else if (random == 1) { targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.anusDef)); } else if (random == 2) { targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == BodyPartDefOf.Jaw)); } break; case rjw.xxx.rjwSextype.MutualMasturbation: //random availableParts.TryRandomElement<BodyPartRecord>(out randomPart); targetParts.Add(randomPart); break; case rjw.xxx.rjwSextype.None: cumAmount = 0; break; case rjw.xxx.rjwSextype.Oral: targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == BodyPartDefOf.Jaw)); break; case rjw.xxx.rjwSextype.Scissoring: //I guess if it came to here, a male must be involved? targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.genitalsDef)); break; case rjw.xxx.rjwSextype.Vaginal: targetParts.Add(receiver.RaceProps.body.AllParts.Find(x => x.def == SemenHelper.genitalsDef)); break; } if (cumAmount > 0) { if (xxx.is_slime(receiver)) { //slime absorb cum //this needs balancing, since cumamount ranges 0-10(?) which is fine for cum/hentai but not very realistic for feeding //using TransferNutrition for now //Log.Message("cumAmount " + cumAmount); //float nutrition_amount = cumAmount/10; Need_Food need = need = giver.needs.TryGetNeed<Need_Food>(); if (need == null) { //Log.Message("xxx::TransferNutrition() " + xxx.get_pawnname(pawn) + " doesn't track nutrition in itself, probably shouldn't feed the others"); return; } if (receiver?.needs?.TryGetNeed<Need_Food>() != null) { //Log.Message("xxx::TransferNutrition() " + xxx.get_pawnname(partner) + " can receive"); float nutrition_amount = Math.Min(need.MaxLevel / 15f, need.CurLevel); //body size is taken into account implicitly by need.MaxLevel receiver.needs.food.CurLevel += nutrition_amount; } } else { SemenHelper.cumOn(giver, genitals, cumAmount * 0.3f, giver, entityType);//cum on self - smaller amount foreach (BodyPartRecord bpr in targetParts) { if (bpr != null) { SemenHelper.cumOn(receiver, bpr, cumAmount, giver, entityType);//cum on partner } } } } } } } }
TDarksword/rjw
Source/Modules/SemenOverlay/SemenHelper.cs
C#
mit
27,930
using RimWorld; using Verse; using Verse.AI; namespace rjw { public class WorkGiver_CleanSelf : WorkGiver_Scanner { public override PathEndMode PathEndMode { get { return PathEndMode.InteractionCell; } } public override Danger MaxPathDanger(Pawn pawn) { return Danger.Deadly; } public override ThingRequest PotentialWorkThingRequest { get { return ThingRequest.ForGroup(ThingRequestGroup.Pawn); } } //conditions for self-cleaning job to be available public override bool HasJobOnThing(Pawn pawn, Thing t, bool forced = false) { if (xxx.DubsBadHygieneIsActive) return false; Hediff hediff = pawn.health.hediffSet.hediffs.Find(x => (x.def == RJW_SemenoOverlayHediffDefOf.Hediff_Bukkake)); if (pawn != t || hediff == null) return false; if (!pawn.CanReserve(t, 1, -1, null, forced)) return false; if (pawn.IsDesignatedHero()) { if (!forced) { //ModLog.Message("WorkGiver_CleanSelf::not player interaction for hero, exit"); return false; } if (!pawn.IsHeroOwner()) { //ModLog.Message("WorkGiver_CleanSelf::player interaction for not owned hero, exit"); return false; } } else { int minAge = 3 * 2500;//3 hours in-game must have passed if (!(hediff.ageTicks > minAge)) { //ModLog.Message("WorkGiver_CleanSelf:: 3 hours in-game must pass to self-clean, exit"); return false; } } return true; } public override Job JobOnThing(Pawn pawn, Thing t, bool forced = false) { return JobMaker.MakeJob(RJW_SemenOverlayJobDefOf.CleanSelf); } } }
TDarksword/rjw
Source/Modules/SemenOverlay/WorkGivers/WorkGiver_CleanSelf.cs
C#
mit
1,623
using System; using System.Collections.Generic; using System.Linq; using System.Text; using RimWorld; using UnityEngine; using Verse; namespace rjw { public class Building_WhoreBed : Building_Bed { private static readonly Color WhoreFieldColor = new Color(170/255f, 79/255f, 255/255f); private static readonly Color sheetColorForWhores = new Color(89/255f, 55/255f, 121/255f); private static readonly List<IntVec3> WhoreField = new List<IntVec3>(); public Pawn CurOccupant { get { var list = Map.thingGrid.ThingsListAt(Position); return list.OfType<Pawn>() .Where(pawn => pawn.jobs.curJob != null) .FirstOrDefault(pawn => pawn.jobs.curJob.def == JobDefOf.LayDown && pawn.jobs.curJob.targetA.Thing == this); } } public override Color DrawColor { get { if (def.MadeFromStuff) { return base.DrawColor; } return DrawColorTwo; } } public override void Draw() { base.Draw(); if (Medical) Medical = false; if (ForPrisoners) ForPrisoners = false; } public override Color DrawColorTwo { get { return sheetColorForWhores; } } public override void DeSpawn(DestroyMode mode = DestroyMode.Vanish) { foreach (var owner in owners.ToArray()) { owner.ownership.UnclaimBed(); } var room = Position.GetRoom(Map); base.DeSpawn(mode); if (room != null) { room.Notify_RoomShapeOrContainedBedsChanged(); } } //public override void DrawExtraSelectionOverlays() //{ // base.DrawExtraSelectionOverlays(); // var room = this.GetRoom(); // if (room == null) return; // if (room.isPrisonCell) return; // // if (room.RegionCount < 20 && !room.TouchesMapEdge) // { // foreach (var current in room.Cells) // { // WhoreField.Add(current); // } // var color = WhoreFieldColor; // color.a = Pulser.PulseBrightness(1f, 0.6f); // GenDraw.DrawFieldEdges(WhoreField, color); // WhoreField.Clear(); // } //} public override string GetInspectString() { var stringBuilder = new StringBuilder(); //stringBuilder.Append(base.GetInspectString()); stringBuilder.Append(InspectStringPartsFromComps()); stringBuilder.AppendLine(); stringBuilder.Append("ForWhoreUse".Translate()); stringBuilder.AppendLine(); if (owners.Count == 0) { stringBuilder.Append("Owner".Translate() + ": " + "Nobody".Translate()); } else if (owners.Count == 1) { stringBuilder.Append("Owner".Translate() + ": " + owners[0].LabelCap); } else { stringBuilder.Append("Owners".Translate() + ": "); bool notFirst = false; foreach (Pawn owner in owners) { if (notFirst) { stringBuilder.Append(", "); } notFirst = true; stringBuilder.Append(owner.Label); } //if(notFirst) stringBuilder.AppendLine(); } return stringBuilder.ToString(); } // Is this one even being used?? public override IEnumerable<Gizmo> GetGizmos() { // Get original gizmos from Building class var method = typeof(Building).GetMethod("GetGizmos"); var ftn = method.MethodHandle.GetFunctionPointer(); var func = (Func<IEnumerable<Gizmo>>)Activator.CreateInstance(typeof(Func<IEnumerable<Gizmo>>), this, ftn); foreach (var gizmo in func()) { yield return gizmo; } if(def.building.bed_humanlike) { yield return new Command_Toggle { defaultLabel = "CommandBedSetAsWhoreLabel".Translate(), defaultDesc = "CommandBedSetAsWhoreDesc".Translate(), icon = ContentFinder<Texture2D>.Get("UI/Commands/AsWhore"), isActive = () => true, toggleAction = () => Swap(this), hotKey = KeyBindingDefOf.Misc4 }; } } public override void PostMake() { base.PostMake(); PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDef.Named("WhoreBeds"), KnowledgeAmount.Total); } public override void DrawGUIOverlay() { //if (Find.CameraMap.CurrentZoom == CameraZoomRange.Closest) //{ // if (owner != null && owner.InBed() && owner.CurrentBed().owner == owner) // { // return; // } // string text; // if (owner != null) // { // text = owner.NameStringShort; // } // else // { // text = "Unowned".Translate(); // } // GenWorldUI.DrawThingLabel(this, text, new Color(1f, 1f, 1f, 0.75f)); //} } public static void Swap(Building_Bed bed) { Building_Bed newBed; if (bed is Building_WhoreBed) { newBed = (Building_Bed) MakeBed(bed, bed.def.defName.Split(new[] { "RJW_" }, StringSplitOptions.RemoveEmptyEntries)[0]); } else { newBed = (Building_WhoreBed) MakeBed(bed, "RJW_"+bed.def.defName); } newBed.SetFactionDirect(bed.Faction); var spawnedBed = (Building_Bed)GenSpawn.Spawn(newBed, bed.Position, bed.Map, bed.Rotation); spawnedBed.HitPoints = bed.HitPoints; spawnedBed.ForPrisoners = bed.ForPrisoners; var compQuality = spawnedBed.TryGetComp<CompQuality>(); if(compQuality != null) compQuality.SetQuality(bed.GetComp<CompQuality>().Quality, ArtGenerationContext.Outsider); //var compArt = bed.TryGetComp<CompArt>(); //if (compArt != null) //{ // var art = spawnedBed.GetComp<CompArt>(); // Traverse.Create(art).Field("authorNameInt").SetValue(Traverse.Create(compArt).Field("authorNameInt").GetValue()); // Traverse.Create(art).Field("titleInt").SetValue(Traverse.Create(compArt).Field("titleInt").GetValue()); // Traverse.Create(art).Field("taleRef").SetValue(Traverse.Create(compArt).Field("taleRef").GetValue()); // // // TODO: Make this work, art is now destroyed //} Find.Selector.Select(spawnedBed, false); } public static Thing MakeBed(Building_Bed bed, string defName) { Log.Message("1"); ThingDef newDef = DefDatabase<ThingDef>.GetNamed(defName); Log.Message("2"); return ThingMaker.MakeThing(newDef, bed.Stuff); } } }
TDarksword/rjw
Source/Modules/Whoring/Building_WhoreBed.cs
C#
mit
7,695
using System.Collections.Generic; using RimWorld; using Verse; using Verse.AI; namespace rjw { public class JobDriver_WhoreInvitingVisitors : JobDriver { // List of jobs that can be interrupted by whores. public static readonly List<JobDef> allowedJobs = new List<JobDef> { null, JobDefOf.Wait_Wander, JobDefOf.GotoWander, JobDefOf.Clean, JobDefOf.ClearSnow, JobDefOf.CutPlant, JobDefOf.HaulToCell, JobDefOf.Deconstruct, JobDefOf.Harvest, JobDefOf.LayDown, JobDefOf.Research, JobDefOf.SmoothFloor, JobDefOf.SmoothWall, JobDefOf.SocialRelax, JobDefOf.StandAndBeSociallyActive, JobDefOf.RemoveApparel, JobDefOf.Strip, JobDefOf.Tame, JobDefOf.Wait, JobDefOf.Wear, JobDefOf.FixBrokenDownBuilding, JobDefOf.FillFermentingBarrel, JobDefOf.DoBill, JobDefOf.Sow, JobDefOf.Shear, JobDefOf.BuildRoof, JobDefOf.DeliverFood, JobDefOf.HaulToContainer, JobDefOf.Hunt, JobDefOf.Mine, JobDefOf.OperateDeepDrill, JobDefOf.OperateScanner, JobDefOf.RearmTurret, JobDefOf.Refuel, JobDefOf.RefuelAtomic, JobDefOf.RemoveFloor, JobDefOf.RemoveRoof, JobDefOf.Repair, JobDefOf.TakeBeerOutOfFermentingBarrel, JobDefOf.Train, JobDefOf.Uninstall, xxx.Masturbate}; public bool successfulPass = true; private Pawn Whore => GetActor(); private Pawn TargetPawn => TargetThingA as Pawn; private Building_Bed TargetBed => TargetThingB as Building_Bed; private readonly TargetIndex TargetPawnIndex = TargetIndex.A; private readonly TargetIndex TargetBedIndex = TargetIndex.B; private bool DoesTargetPawnAcceptAdvance() { if (RJWSettings.DebugWhoring) ModLog.Message($"JobDriver_InvitingVisitors::DoesTargetPawnAcceptAdvance() - {xxx.get_pawnname(TargetPawn)}"); //if (RJWSettings.WildMode) return true; if (PawnUtility.EnemiesAreNearby(TargetPawn)) { if (RJWSettings.DebugWhoring) ModLog.Message($" fail - enemy near"); return false; } if (!allowedJobs.Contains(TargetPawn.jobs.curJob.def)) { if (RJWSettings.DebugWhoring) ModLog.Message($" fail - not allowed job"); return false; } if (RJWSettings.DebugWhoring) { ModLog.Message("Will try hookup " + WhoringHelper.WillPawnTryHookup(TargetPawn)); ModLog.Message("Is whore appealing " + WhoringHelper.IsHookupAppealing(TargetPawn, Whore)); ModLog.Message("Can afford whore " + WhoringHelper.CanAfford(TargetPawn, Whore)); ModLog.Message("Need sex " + (xxx.need_some_sex(TargetPawn) >= 1)); } if (WhoringHelper.WillPawnTryHookup(TargetPawn) && WhoringHelper.IsHookupAppealing(TargetPawn, Whore) && WhoringHelper.CanAfford(TargetPawn, Whore) && xxx.need_some_sex(TargetPawn) >= 1f) { Whore.skills.Learn(SkillDefOf.Social, 1.2f); return true; } return false; } public override bool TryMakePreToilReservations(bool errorOnFailed) => true; protected override IEnumerable<Toil> MakeNewToils() { this.FailOnDespawnedOrNull(TargetPawnIndex); this.FailOnDespawnedNullOrForbidden(TargetBedIndex); this.FailOn(() => Whore is null || !xxx.CanUse(Whore, TargetBed));//|| !Whore.CanReserve(TargetPawn) this.FailOn(() => pawn.Drafted); yield return Toils_Goto.GotoThing(TargetPawnIndex, PathEndMode.Touch); Toil TryItOn = new Toil(); TryItOn.AddFailCondition(() => !xxx.IsTargetPawnOkay(TargetPawn)); TryItOn.defaultCompleteMode = ToilCompleteMode.Delay; TryItOn.initAction = delegate { //ModLog.Message("JobDriver_InvitingVisitors::MakeNewToils - TryItOn - initAction is called"); Whore.jobs.curDriver.ticksLeftThisToil = 50; MoteMaker.ThrowMetaIcon(Whore.Position, Whore.Map, ThingDefOf.Mote_Heart); }; yield return TryItOn; Toil AwaitResponse = new Toil(); AwaitResponse.AddFailCondition(() => !successfulPass); AwaitResponse.defaultCompleteMode = ToilCompleteMode.Instant; AwaitResponse.initAction = delegate { List<RulePackDef> extraSentencePacks = new List<RulePackDef>(); successfulPass = DoesTargetPawnAcceptAdvance(); //ModLog.Message("JobDriver_InvitingVisitors::MakeNewToils - AwaitResponse - initAction is called"); if (successfulPass) { MoteMaker.ThrowMetaIcon(TargetPawn.Position, TargetPawn.Map, ThingDefOf.Mote_Heart); TargetPawn.jobs.EndCurrentJob(JobCondition.Incompletable); if (xxx.RomanceDiversifiedIsActive) { extraSentencePacks.Add(RulePackDef.Named("HookupSucceeded")); } if (Whore.health.HasHediffsNeedingTend()) { successfulPass = false; const string key = "RJW_VisitorSickWhore"; string text = key.Translate(TargetPawn.LabelIndefinite(), Whore.LabelIndefinite()).CapitalizeFirst(); Messages.Message(text, Whore, MessageTypeDefOf.TaskCompletion); } else { const string key = "RJW_VisitorAcceptWhore"; string text = key.Translate(TargetPawn.LabelIndefinite(), Whore.LabelIndefinite()).CapitalizeFirst(); Messages.Message(text, TargetPawn, MessageTypeDefOf.TaskCompletion); } } if (!successfulPass) { MoteMaker.ThrowMetaIcon(TargetPawn.Position, TargetPawn.Map, ThingDefOf.Mote_IncapIcon); TargetPawn.needs.mood.thoughts.memories.TryGainMemory( TargetPawn.Faction == Whore.Faction ? ThoughtDef.Named("RJWTurnedDownWhore") : ThoughtDef.Named("RJWFailedSolicitation"), Whore); if (xxx.RomanceDiversifiedIsActive) { Whore.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("RebuffedMyHookupAttempt"), TargetPawn); TargetPawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDef.Named("FailedHookupAttemptOnMe"), Whore); extraSentencePacks.Add(RulePackDef.Named("HookupFailed")); } //Disabled rejection notifications //Messages.Message("RJW_VisitorRejectWhore".Translate(new object[] { xxx.get_pawnname(TargetPawn), xxx.get_pawnname(Whore) }), TargetPawn, MessageTypeDefOf.SilentInput); } if (xxx.RomanceDiversifiedIsActive) { Find.PlayLog.Add(new PlayLogEntry_Interaction(DefDatabase<InteractionDef>.GetNamed("TriedHookupWith"), pawn, TargetPawn, extraSentencePacks)); } }; yield return AwaitResponse; Toil BothGoToBed = new Toil(); BothGoToBed.AddFailCondition(() => !successfulPass || !xxx.CanUse(Whore, TargetBed)); BothGoToBed.defaultCompleteMode = ToilCompleteMode.Instant; BothGoToBed.initAction = delegate { //ModLog.Message("JobDriver_InvitingVisitors::MakeNewToils - BothGoToBed - initAction is called0"); if (!successfulPass) return; if (!xxx.CanUse(Whore, TargetBed) && Whore.CanReserve(TargetPawn, 1, 0)) { //ModLog.Message("JobDriver_InvitingVisitors::MakeNewToils - BothGoToBed - cannot use the whore bed"); return; } //ModLog.Message("JobDriver_InvitingVisitors::MakeNewToils - BothGoToBed - initAction is called1"); Whore.jobs.jobQueue.EnqueueFirst(JobMaker.MakeJob(xxx.whore_is_serving_visitors, TargetPawn, TargetBed)); //TargetPawn.jobs.jobQueue.EnqueueFirst(JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("WhoreIsServingVisitors"), Whore, TargetBed, (TargetBed.MaxAssignedPawnsCount>1)?TargetBed.GetSleepingSlotPos(1): TargetBed.)), null); Whore.jobs.curDriver.EndJobWith(JobCondition.InterruptOptional); //TargetPawn.jobs.curDriver.EndJobWith(JobCondition.InterruptOptional); }; yield return BothGoToBed; } } }
TDarksword/rjw
Source/Modules/Whoring/JobDrivers/JobDriver_WhoreInvitingVisitors.cs
C#
mit
7,280
using System.Collections.Generic; using RimWorld; using Verse; using Verse.AI; using Multiplayer.API; namespace rjw { public class JobDriver_WhoreIsServingVisitors : JobDriver_SexBaseInitiator { public static readonly ThoughtDef thought_free = ThoughtDef.Named("Whorish_Thoughts"); public static readonly ThoughtDef thought_captive = ThoughtDef.Named("Whorish_Thoughts_Captive"); public IntVec3 SleepSpot => Bed.SleepPosOfAssignedPawn(pawn); public override bool TryMakePreToilReservations(bool errorOnFailed) { return pawn.Reserve(Target, job, 1, 0, null, errorOnFailed); } [SyncMethod] protected override IEnumerable<Toil> MakeNewToils() { if (RJWSettings.DebugWhoring) ModLog.Message("" + this.GetType().ToString() + ":MakeNewToils() - making toils"); setup_ticks(); var PartnerJob = xxx.gettin_loved; this.FailOnDespawnedOrNull(iTarget); this.FailOnDespawnedNullOrForbidden(iBed); if (RJWSettings.DebugWhoring) ModLog.Message("" + this.GetType().ToString() + ":MakeNewToils() fail conditions check " + !xxx.CanUse(pawn, Bed) + " " + !pawn.CanReserve(Partner)); this.FailOn(() => !xxx.CanUse(pawn, Bed) || !pawn.CanReserve(Partner)); this.FailOn(() => pawn.Drafted); this.FailOn(() => Partner.IsFighting()); yield return Toils_Reserve.Reserve(iTarget, 1, 0); //yield return Toils_Reserve.Reserve(BedInd, Bed.SleepingSlotsCount, 0); if (RJWSettings.DebugWhoring) ModLog.Message("" + this.GetType().ToString() + ":MakeNewToils() - generate toils"); Toil gotoBed = new Toil(); gotoBed.defaultCompleteMode = ToilCompleteMode.PatherArrival; gotoBed.FailOnWhorebedNoLongerUsable(iBed, Bed); gotoBed.AddFailCondition(() => Partner.Downed); gotoBed.FailOn(() => !Partner.CanReach(Bed, PathEndMode.Touch, Danger.Deadly)); gotoBed.initAction = delegate { if (RJWSettings.DebugWhoring) ModLog.Message("" + this.GetType().ToString() + ":MakeNewToils() - gotoWhoreBed initAction is called"); pawn.pather.StartPath(SleepSpot, PathEndMode.OnCell); Partner.jobs.StopAll(); Job job = JobMaker.MakeJob(JobDefOf.GotoMindControlled, SleepSpot); Partner.jobs.StartJob(job, JobCondition.InterruptForced); }; yield return gotoBed; ticks_left = (int)(2000.0f * Rand.Range(0.30f, 1.30f)); Toil waitInBed = new Toil(); waitInBed.initAction = delegate { ticksLeftThisToil = 5000; }; waitInBed.tickAction = delegate { pawn.GainComfortFromCellIfPossible(); if (IsInOrByBed(Bed, Partner) && pawn.PositionHeld == Partner.PositionHeld) { ReadyForNextToil(); } }; waitInBed.defaultCompleteMode = ToilCompleteMode.Delay; yield return waitInBed; Toil StartPartnerJob = new Toil(); StartPartnerJob.defaultCompleteMode = ToilCompleteMode.Instant; StartPartnerJob.socialMode = RandomSocialMode.Off; StartPartnerJob.initAction = delegate { if (RJWSettings.DebugWhoring) ModLog.Message("" + this.GetType().ToString() + ":MakeNewToils() - StartPartnerJob"); var gettin_loved = JobMaker.MakeJob(PartnerJob, pawn, Bed); Partner.jobs.StartJob(gettin_loved, JobCondition.InterruptForced); }; yield return StartPartnerJob; Toil SexToil = new Toil(); SexToil.defaultCompleteMode = ToilCompleteMode.Never; SexToil.socialMode = RandomSocialMode.Off; SexToil.handlingFacing = true; SexToil.FailOn(() => Partner.Dead); SexToil.FailOn(() => Partner.CurJob.def != PartnerJob); SexToil.initAction = delegate { if (RJWSettings.DebugWhoring) ModLog.Message("" + this.GetType().ToString() + ":MakeNewToils() - loveToil"); // TODO: replace this quick n dirty way CondomUtility.GetCondomFromRoom(pawn); // Try to use whore's condom first, then client's usedCondom = CondomUtility.TryUseCondom(pawn) || CondomUtility.TryUseCondom(Partner); Start(); if (xxx.HasNonPolyPartnerOnCurrentMap(Partner)) { Pawn lover = LovePartnerRelationUtility.ExistingLovePartner(Partner); // We have to do a few other checks because the pawn might have multiple lovers and ExistingLovePartner() might return the wrong one if (lover != null && pawn != lover && !lover.Dead && (lover.Map == Partner.Map || Rand.Value < 0.25)) { lover.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.CheatedOnMe, Partner); } } }; SexToil.AddPreTickAction(delegate { --ticks_left; if (pawn.IsHashIntervalTick(ticks_between_hearts)) if (xxx.is_nympho(pawn)) ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart); else ThrowMetaIcon(pawn.Position, pawn.Map, xxx.mote_noheart); SexUtility.reduce_rest(Partner, 1); SexUtility.reduce_rest(pawn, 2); if (ticks_left <= 0) ReadyForNextToil(); }); SexToil.AddFinishAction(delegate { End(); }); yield return SexToil; Toil afterSex = new Toil { initAction = delegate { // Adding interactions, social logs, etc SexUtility.ProcessSex(pawn, Partner, usedCondom: usedCondom, whoring: isWhoring, sextype: sexType); if (!(Partner.IsColonist && (pawn.IsPrisonerOfColony || pawn.IsColonist))) { int price = WhoringHelper.PriceOfWhore(pawn); if (RJWSettings.DebugWhoring) ModLog.Message(this.GetType().ToString() + ":MakeNewToils() - Partner should pay the price now in afterSex.initAction"); int remainPrice = WhoringHelper.PayPriceToWhore(Partner, price, pawn); if (RJWSettings.DebugWhoring && remainPrice <= 0) ModLog.Message(this.GetType().ToString() + ":MakeNewToils() - Paying price is success"); else if (RJWSettings.DebugWhoring) ModLog.Message(this.GetType().ToString() + ":MakeNewToils() - Paying price failed"); xxx.UpdateRecords(pawn, price - remainPrice); } var thought = (pawn.IsPrisoner || xxx.is_slave(pawn)) ? thought_captive : thought_free; pawn.needs.mood.thoughts.memories.TryGainMemory(thought); if (SexUtility.ConsiderCleaning(pawn)) { LocalTargetInfo cum = pawn.PositionHeld.GetFirstThing<Filth>(pawn.Map); Job clean = JobMaker.MakeJob(JobDefOf.Clean); clean.AddQueuedTarget(TargetIndex.A, cum); pawn.jobs.jobQueue.EnqueueFirst(clean); } }, defaultCompleteMode = ToilCompleteMode.Instant }; yield return afterSex; } } }
TDarksword/rjw
Source/Modules/Whoring/JobDrivers/JobDriver_WhoreIsServingVisitors.cs
C#
mit
6,327
using System.Collections.Generic; using System.Linq; using RimWorld; using Verse; using Verse.AI; using Multiplayer.API; namespace rjw { public class JobGiver_WhoreInvitingVisitors : ThinkNode_JobGiver { // Checks if pawn has a memory. // Maybe not the best place for function, might be useful elsewhere too. public static bool MemoryChecker(Pawn pawn, ThoughtDef thought) { Thought_Memory val = pawn.needs.mood.thoughts.memories.Memories.Find((Thought_Memory x) => (object)x.def == thought); return val == null ? false : true; } [SyncMethod] private static bool Roll_to_skip(Pawn client, Pawn whore) { //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); float fuckability = SexAppraiser.would_fuck(client, whore); // 0.0 to 1. // More likely to skip other whores, because they're supposed to be working. if (client.IsDesignatedService()) fuckability *= 0.6f; return fuckability >= 0.1f && xxx.need_some_sex(client) >= 1f && Rand.Chance(0.5f); } /* public static Pawn Find_pawn_to_fuck(Pawn whore, Map map) { Pawn best_fuckee = null; float best_distance = 1.0e6f; foreach (Pawn q in map.mapPawns.FreeColonists) if ((q != whore) && xxx.need_some_sex(q)>0 && whore.CanReserve(q, 1, 0) && q.CanReserve(whore, 1, 0) && Roll_to_skip(whore, q) && (!q.Position.IsForbidden(whore)) && xxx.is_healthy(q)) { var dis = whore.Position.DistanceToSquared(q.Position); if (dis < best_distance) { best_fuckee = q; best_distance = dis; } } return best_fuckee; } */ private sealed class FindAttractivePawnHelper { internal Pawn whore; internal bool TraitCheckFail(Pawn client) { if (!xxx.is_human(client)) return true; if (!xxx.has_traits(client)) return true; if (!(xxx.can_fuck(client) || xxx.can_be_fucked(client)) || !xxx.IsTargetPawnOkay(client)) return true; //Log.Message("client:" + client + " whore:" + whore); if (CompRJW.CheckPreference(client, whore) == false) return true; return false; // Everything ok. } //Use this check when client is not in the same faction as the whore internal bool FactionCheckPass(Pawn client) { return ((client.Map == whore.Map) && (client.Faction != null && client.Faction != whore.Faction) && !client.IsPrisoner && !client.HostileTo(whore)); } //Use this check when client is in the same faction as the whore [SyncMethod] internal bool RelationCheckPass(Pawn client) { //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); if (xxx.isSingleOrPartnerNotHere(client) || xxx.is_lecher(client) || Rand.Value < 0.9f) { if (client != LovePartnerRelationUtility.ExistingLovePartner(whore)) { //Exception for prisoners to account for PrisonerWhoreSexualEmergencyTree, which allows prisoners to try to hook up with anyone who's around (mostly other prisoners or warden) return (client != whore) & (client.Map == whore.Map) && (client.Faction == whore.Faction || whore.IsPrisoner) && (client.IsColonist || whore.IsPrisoner) && WhoringHelper.IsHookupAppealing(whore, client); } } return false; } } [SyncMethod] public static Pawn FindAttractivePawn(Pawn whore, out int price) { price = 0; if (whore == null || xxx.is_asexual(whore)) { if (RJWSettings.DebugWhoring) ModLog.Message($" {xxx.get_pawnname(whore)} is asexual, abort"); return null; } //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); FindAttractivePawnHelper client = new FindAttractivePawnHelper { whore = whore }; price = WhoringHelper.PriceOfWhore(whore); int priceOfWhore = price; IntVec3 pos = whore.Position; IEnumerable<Pawn> potentialClients = whore.Map.mapPawns.AllPawnsSpawned; potentialClients = potentialClients.Where(x => x != whore && !x.IsForbidden(whore) && !x.HostileTo(whore) && !x.IsPrisoner && x.Position.DistanceTo(pos) < 100 && whore.CanReserveAndReach(x, PathEndMode.ClosestTouch, Danger.Some, 1) && xxx.is_healthy_enough(x)); potentialClients = potentialClients.Except(potentialClients.Where(client.TraitCheckFail)); if (!potentialClients.Any()) return null; if (RJWSettings.DebugWhoring) ModLog.Message($" FindAttractivePawn number of all potential clients {potentialClients.Count()}"); List<Pawn> valid_targets = new List<Pawn>(); foreach (Pawn target in potentialClients) { if(xxx.can_path_to_target(whore, target.Position)) valid_targets.Add(target); } IEnumerable<Pawn> guestsSpawned = valid_targets.Where(x => x.Faction != whore.Faction && WhoringHelper.CanAfford(x, whore, priceOfWhore) && !MemoryChecker(x, ThoughtDef.Named("RJWFailedSolicitation")) && x != LovePartnerRelationUtility.ExistingLovePartner(whore)); if (guestsSpawned.Any()) { if (RJWSettings.DebugWhoring) ModLog.Message($" FindAttractivePawn number of all acceptable Guests {guestsSpawned.Count()}"); return guestsSpawned.RandomElement(); } return null; //use casual sex for colonist hooking if (RJWSettings.DebugWhoring) ModLog.Message($" FindAttractivePawn found no guests, trying colonists"); if (!WhoringHelper.WillPawnTryHookup(whore))// will hookup colonists? { return null; } IEnumerable<Pawn> freeColonists = valid_targets.Where(x => x.Faction == whore.Faction && Roll_to_skip(x, whore)); if (RJWSettings.DebugWhoring) ModLog.Message($" FindAttractivePawn number of free colonists {freeColonists.Count()}"); freeColonists = freeColonists.Where(x => client.RelationCheckPass(x) && !MemoryChecker(x, ThoughtDef.Named("RJWTurnedDownWhore"))); if (freeColonists.Any()) { if (RJWSettings.DebugWhoring) ModLog.Message($" FindAttractivePawn number of all acceptable Colonists {freeColonists.Count()}"); return freeColonists.RandomElement(); } return null; } protected override Job TryGiveJob(Pawn pawn) { // Most things are now checked in the ThinkNode_ConditionalWhore. if (pawn.Drafted) return null; if (MP.IsInMultiplayer) return null; //fix error someday, maybe if (pawn.jobs.curDriver is JobDriver_Sex || pawn.jobs.curDriver is JobDriver_WhoreInvitingVisitors) return null; // already having sex if (!SexUtility.ReadyForLovin(pawn)) { //Whores need rest too, but this'll reduxe the wait a bit every it triggers. pawn.mindState.canLovinTick -= 40; return null; } if (RJWSettings.DebugWhoring) ModLog.Message($"JobGiver_WhoreInvitingVisitors.TryGiveJob:({xxx.get_pawnname(pawn)})"); Building_Bed whorebed = xxx.FindBed(pawn); if (whorebed == null || !xxx.CanUse(pawn, whorebed)) { if (RJWSettings.DebugWhoring) ModLog.Message($" {xxx.get_pawnname(pawn)} has no bed or can use it"); return null; } int price; Pawn client = FindAttractivePawn(pawn, out price); if (client == null) { if (RJWSettings.DebugWhoring) ModLog.Message($" no clients found"); return null; } if (RJWSettings.DebugWhoring) ModLog.Message($" {xxx.get_pawnname(client)} is client"); if (!client.CanReach(whorebed, PathEndMode.OnCell, Danger.Some)) { if (RJWSettings.DebugWhoring) ModLog.Message($" {xxx.get_pawnname(client)} cant reach bed"); return null; } //whorebed.priceOfWhore = price; return JobMaker.MakeJob(xxx.whore_inviting_visitors, client, whorebed); } } }
TDarksword/rjw
Source/Modules/Whoring/JobGivers/JobGiver_WhoreInvitingVisitors.cs
C#
mit
7,514
namespace rjw { //This class is not used now. /* public class ThinkNode_ChancePerHour_Whore : ThinkNode_ChancePerHour { protected override float MtbHours(Pawn pawn) { // Use the fappin mtb hours as the base number b/c it already accounts for things like age var base_mtb = xxx.config.whore_mtbh_mul * ThinkNode_ChancePerHour_Fappin.get_fappin_mtb_hours(pawn); if (base_mtb < 0.0f) return -1.0f; 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 desire_factor = 1.00f; } else desire_factor = 1.00f; } float personality_factor; { personality_factor = 1.0f; if (pawn.story != null) { foreach (var trait in pawn.story.traits.allTraits) { if (trait.def == xxx.nymphomaniac) personality_factor *= 0.25f; else if (trait.def == TraitDefOf.Greedy) personality_factor *= 0.50f; else if (xxx.RomanceDiversifiedIsActive&&(trait.def==xxx.philanderer || trait.def == xxx.polyamorous)) personality_factor *= 0.75f; else if (xxx.RomanceDiversifiedIsActive && (trait.def == xxx.faithful)&& LovePartnerRelationUtility.HasAnyLovePartner(pawn)) personality_factor *= 30f; } } } float fun_factor; { if ((pawn.needs.joy != null) && (xxx.is_nympho(pawn))) fun_factor = Mathf.Clamp01(0.50f + pawn.needs.joy.CurLevel); else fun_factor = 1.00f; } var gender_factor = (pawn.gender == Gender.Male) ? 1.0f : 3.0f; return base_mtb * desire_factor * personality_factor * fun_factor * gender_factor; } } */ }
TDarksword/rjw
Source/Modules/Whoring/ThinkTreeNodes/ThinkNode_ChancePerHour_Whore.cs
C#
mit
1,781
using Verse; using Verse.AI; using RimWorld; namespace rjw { /// <summary> /// Whore/prisoner look for customers /// </summary> public class ThinkNode_ConditionalWhore : ThinkNode_Conditional { protected override bool Satisfied(Pawn p) { // No animal whorin' for now. if (xxx.is_animal(p)) return false; if (!InteractionUtility.CanInitiateInteraction(p)) return false; return xxx.is_whore(p); } } }
TDarksword/rjw
Source/Modules/Whoring/ThinkTreeNodes/ThinkNode_ConditionalWhore.cs
C#
mit
433
using RimWorld; using Verse; using System; using System.Collections.Generic; namespace rjw { /// <summary> /// Extends the standard thought to add a counter for the whore stages /// </summary> class ThoughtDef_Whore : ThoughtDef { public List<int> stageCounts = new List<int>(); public int storyOffset = 0; } class ThoughtWorker_Whore : Thought_Memory { public static readonly HashSet<string> backstories = new HashSet<string>(DefDatabase<StringListDef>.GetNamed("WhoreBackstories").strings); protected List<int> stages { get {return ((ThoughtDef_Whore)def).stageCounts; } } protected int storyOffset { get { return ((ThoughtDef_Whore)def).storyOffset; } } //protected virtual readonly List<int> stages = new List<int>() { 10, 40}; //protected virtual readonly int story_offset = 10; public override int CurStageIndex { get { //Log.Message("Static fields are not null " + !(backstories is null) + !(whore_count is null)); var c = pawn.records.GetAsInt(xxx.CountOfWhore); //Log.Message("Whore count of " + pawn + " is " + c); var b = backstories.Contains(pawn.story?.adulthood?.titleShort) ? storyOffset : 0; //Log.Message("Backstory offset " + b); var score = c + b; if (score > stages[stages.Count-1]) { return stages.Count - 1; } //Log.Message("Starting search"); var stage = stages.FindLastIndex(v => score > v)+1; //Log.Message("Search done, stage is " + stage); return stage; } } } }
TDarksword/rjw
Source/Modules/Whoring/Thoughts/ThoughtWorker_Whore.cs
C#
mit
1,491
// #define TESTMODE // Uncomment to enable logging. using Verse; using Verse.AI; using System.Collections.Generic; using System.Linq; using RimWorld; using System.Diagnostics; using System; using UnityEngine; using Verse.AI.Group; using Multiplayer.API; namespace rjw { /// <summary> /// Helper for whoring related stuff /// </summary> public class WhoringHelper { public const float baseMinPrice = 10f; public const float baseMaxPrice = 20f; private static readonly SimpleCurve whoring_age_curve = new SimpleCurve { // life expectancy to price modifier new CurvePoint(12, 0.1f), new CurvePoint(18, 1.5f), new CurvePoint(24, 1.4f), new CurvePoint(32, 1f), new CurvePoint(48, 0.5f), new CurvePoint(80, 0.2f), new CurvePoint(400, 0.1f), // Lifespan extended by bionics, misconfigurated alien races, etc. }; public static int WhoreMinPrice(Pawn whore) { float min_price = baseMinPrice; min_price *= WhoreAgeAdjustment(whore); min_price *= WhoreGenderAdjustment(whore); min_price *= WhoreInjuryAdjustment(whore); min_price *= WhoreRoomAdjustment(whore); if (xxx.has_traits(whore)) min_price *= WhoreTraitAdjustmentMin(whore); return (int)min_price; } public static int WhoreMaxPrice(Pawn whore) { float max_price = baseMaxPrice; max_price *= WhoreAgeAdjustment(whore); max_price *= WhoreGenderAdjustment(whore); max_price *= WhoreInjuryAdjustment(whore); max_price *= WhoreRoomAdjustment(whore); if (xxx.has_traits(whore)) max_price *= WhoreTraitAdjustmentMax(whore); return (int)max_price; } public static float WhoreGenderAdjustment(Pawn whore) { if (GenderHelper.GetSex(whore) == GenderHelper.Sex.futa) return 1.2f; return 1f; } public static float WhoreAgeAdjustment(Pawn whore) { return whoring_age_curve.Evaluate(SexUtility.ScaleToHumanAge(whore)); } public static float WhoreInjuryAdjustment(Pawn whore) { float modifier = 1.0f; int injuries = whore.health.hediffSet.hediffs.Count(x => x.Visible && x.def.everCurableByItem && x.IsPermanent()); if (injuries == 0) return modifier; while (injuries > 0) { modifier *= 0.85f; injuries--; } return modifier; } public static float WhoreTraitAdjustmentMin(Pawn whore) { float multiplier = WhoreTraitAdjustment(whore); if (xxx.is_masochist(whore)) // Won't haggle, may settle for low price multiplier *= 0.7f; if (xxx.is_nympho(whore)) // Same as above multiplier *= 0.4f; return multiplier; } public static float WhoreTraitAdjustmentMax(Pawn whore) { float multiplier = WhoreTraitAdjustment(whore); if (xxx.IndividualityIsActive && whore.story.traits.HasTrait(xxx.SYR_Haggler)) multiplier *= 1.5f; if (whore.story.traits.HasTrait(TraitDefOf.Greedy)) multiplier *= 2f; return multiplier; } public static float WhoreTraitAdjustment(Pawn whore) { float multiplier = 1f; if (xxx.has_traits(whore)) { if (whore.story.traits.DegreeOfTrait(TraitDefOf.Industriousness) == 2) // Industrious multiplier *= 1.2f; if (whore.story.traits.DegreeOfTrait(TraitDefOf.Industriousness) == 1) // Hard Worker multiplier *= 1.1f; if (whore.story.traits.HasTrait(TraitDefOf.CreepyBreathing)) multiplier *= 0.75f; if (whore.GetStatValue(StatDefOf.PawnBeauty) >= 2) multiplier *= 3.5f; else if (whore.GetStatValue(StatDefOf.PawnBeauty) >= 1) multiplier *= 2f; else if (whore.GetStatValue(StatDefOf.PawnBeauty) < 0) if (whore.GetStatValue(StatDefOf.PawnBeauty) >= -1) multiplier *= 0.8f; else multiplier *= 0.6f; } return multiplier; } public static float WhoreRoomAdjustment(Pawn whore) { float room_multiplier = 1f; Room ownedRoom = whore.ownership.OwnedRoom; if (ownedRoom == null) return 0f; //Room sharing is not liked by patrons room_multiplier = room_multiplier / (2 * (ownedRoom.Owners.Count() - 1) + 1); int scoreStageIndex = RoomStatDefOf.Impressiveness.GetScoreStageIndex(ownedRoom.GetStat(RoomStatDefOf.Impressiveness)); //Room impressiveness factor //0 < scoreStageIndex < 10 (Last time checked) //3 is mediocore if (scoreStageIndex == 0) { room_multiplier *= 0.3f; } else if (scoreStageIndex > 3) { room_multiplier *= 1 + ((float)scoreStageIndex - 3) / 3.5f; } //top room triples the price return room_multiplier; } [SyncMethod] public static int PriceOfWhore(Pawn whore) { float NeedSexFactor = xxx.is_hornyorfrustrated(whore) ? 1 - xxx.need_some_sex(whore) / 8 : 1f; //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); float price = Rand.Range(WhoreMinPrice(whore), WhoreMaxPrice(whore)); price *= NeedSexFactor; //--ModLog.Message(" xxx::PriceOfWhore - price is " + price); return (int)Math.Round(price); } public static bool CanAfford(Pawn targetPawn, Pawn whore, int priceOfWhore = -1) { if (targetPawn.Faction == whore.Faction) return true; int price = priceOfWhore < 0 ? PriceOfWhore(whore) : priceOfWhore; if (price == 0) return true; Lord lord = targetPawn.GetLord(); Faction faction = targetPawn.Faction; int totalAmountOfSilvers = targetPawn.inventory.innerContainer.TotalStackCountOfDef(ThingDefOf.Silver); if (faction != null) { List<Pawn> caravanMembers = targetPawn.Map.mapPawns.PawnsInFaction(targetPawn.Faction).Where(x => x.GetLord() == lord && x.inventory?.innerContainer?.TotalStackCountOfDef(ThingDefOf.Silver) > 0).ToList(); if (!caravanMembers.Any()) { //--ModLog.Message("CanAfford::(" + xxx.get_pawnname(targetPawn) + "," + xxx.get_pawnname(whore) + ") - totalAmountOfSilvers is " + totalAmountOfSilvers); return totalAmountOfSilvers >= price; } totalAmountOfSilvers += caravanMembers.Sum(member => member.inventory.innerContainer.TotalStackCountOfDef(ThingDefOf.Silver)); } //ModLog.Message("CanAfford:: caravan can afford the price: " + (totalAmountOfSilvers >= price)); return totalAmountOfSilvers >= price; } //priceOfWhore is assumed >=0, and targetPawn is assumed to be able to pay the price(either by caravan, or by himself) //This means that targetPawn has total stackcount of silvers >= priceOfWhore. public static int PayPriceToWhore(Pawn targetPawn, int priceOfWhore, Pawn whore) { int AmountLeft = priceOfWhore; if (targetPawn.Faction == whore.Faction || priceOfWhore == 0) { //--ModLog.Message(" xxx::PayPriceToWhore - No need to pay price"); return AmountLeft; } Lord lord = targetPawn.GetLord(); //Caravan guestCaravan = Find.WorldObjects.Caravans.Where(x => x.Spawned && x.ContainsPawn(targetPawn) && x.Faction == targetPawn.Faction && !x.IsPlayerControlled).FirstOrDefault(); List<Pawn> caravanAnimals = targetPawn.Map.mapPawns.PawnsInFaction(targetPawn.Faction).Where(x => x.GetLord() == lord && x.inventory?.innerContainer != null && x.inventory.innerContainer.TotalStackCountOfDef(ThingDefOf.Silver) > 0).ToList(); IEnumerable<Thing> TraderSilvers; if (!caravanAnimals.Any()) { TraderSilvers = targetPawn.inventory.innerContainer.Where(x => x.def == ThingDefOf.Silver); foreach (Thing silver in TraderSilvers) { if (AmountLeft <= 0) return AmountLeft; int dropAmount = silver.stackCount >= AmountLeft ? AmountLeft : silver.stackCount; if (targetPawn.inventory.innerContainer.TryDrop(silver, whore.Position, whore.Map, ThingPlaceMode.Near, dropAmount, out Thing resultingSilvers)) { if (resultingSilvers is null) { //--ModLog.Message(" xxx::PayPriceToWhore - silvers is null0"); return AmountLeft; } AmountLeft -= resultingSilvers.stackCount; if (AmountLeft <= 0) { return AmountLeft; } } else { //--ModLog.Message(" xxx::PayPriceToWhore - TryDrop failed0"); return AmountLeft; } } return AmountLeft; } foreach (Pawn animal in caravanAnimals) { TraderSilvers = animal.inventory.innerContainer.Where(x => x.def == ThingDefOf.Silver); foreach (Thing silver in TraderSilvers) { if (AmountLeft <= 0) return AmountLeft; int dropAmount = silver.stackCount >= AmountLeft ? AmountLeft : silver.stackCount; if (animal.inventory.innerContainer.TryDrop(silver, whore.Position, whore.Map, ThingPlaceMode.Near, dropAmount, out Thing resultingSilvers)) { if (resultingSilvers is null) { //--ModLog.Message(" xxx::PayPriceToWhore - silvers is null1"); return AmountLeft; } AmountLeft -= resultingSilvers.stackCount; if (AmountLeft <= 0) { return AmountLeft; } } } } return AmountLeft; } [SyncMethod] public static bool IsHookupAppealing(Pawn target, Pawn whore) { if (PawnUtility.WillSoonHaveBasicNeed(target)) { //Log.Message("IsHookupAppealing - fail: " + xxx.get_pawnname(target) + " has need to do"); return false; } float num = target.relations.SecondaryRomanceChanceFactor(whore) / 1.5f; if (xxx.is_frustrated(target)) { num *= 3.0f; } else if (xxx.is_hornyorfrustrated(target)) { num *= 2.0f; } if (xxx.is_zoophile(target) && !xxx.is_animal(whore)) { num *= 0.5f; } if (xxx.AlienFrameworkIsActive) { if (xxx.is_xenophile(target)) { if (target.def.defName == whore.def.defName) num *= 0.5f; // Same species, xenophile less interested. else num *= 1.5f; // Different species, xenophile more interested. } else if (xxx.is_xenophobe(target)) { if (target.def.defName != whore.def.defName) num *= 0.25f; // Different species, xenophobe less interested. } } num *= 0.8f + ((float)whore.skills.GetSkill(SkillDefOf.Social).Level / 40); // 0.8 to 1.3 num *= Mathf.InverseLerp(-100f, 0f, target.relations.OpinionOf(whore)); // 1 to 0 reduce score by negative opinion/relations to whore //Log.Message("IsHookupAppealing - score: " + num); //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); return Rand.Range(0.05f, 1f) < num; } // Summary: // Check if the pawn is willing to hook up. Checked for both target and the whore(when hooking colonists). [SyncMethod] public static bool WillPawnTryHookup(Pawn target) { if (target.story.traits.HasTrait(TraitDefOf.Asexual)) { return false; } Pawn lover = LovePartnerRelationUtility.ExistingMostLikedLovePartner(target, false); if (lover == null) { return true; } float num = target.relations.OpinionOf(lover); float num2 = Mathf.InverseLerp(30f, -80f, num); if (xxx.is_prude(target)) { num2 = 0f; } else if (xxx.is_lecher(target)) { //Lechers are always up for it. num2 = Mathf.InverseLerp(100f, 50f, num); } else if (target.Map == lover.Map) { //Less likely to cheat if the lover is on the same map. num2 = Mathf.InverseLerp(70f, 15f, num); } //else default values if (xxx.is_frustrated(target)) { num2 *= 1.8f; } else if (xxx.is_hornyorfrustrated(target)) { num2 *= 1.4f; } num2 /= 1.5f; //Rand.PopState(); //Rand.PushState(RJW_Multiplayer.PredictableSeed()); return Rand.Range(0f, 1f) < num2; } } }
TDarksword/rjw
Source/Modules/Whoring/Whoring_Helper.cs
C#
mit
11,357
using System; using System.Collections.Generic; using RimWorld; using Verse; namespace rjw { public class Need_Sex : Need_Seeker { private bool isInvisible => pawn.Map == null; private bool BootStrapTriggered = false; private int needsex_tick = needsex_tick_timer; public const int needsex_tick_timer = 10; private static float decay_per_day = 0.3f; private float decay_rate_modifier = RJWSettings.sexneed_decay_rate; public float thresh_frustrated() { return 0.05f; } public float thresh_horny() { return 0.25f; } public float thresh_neutral() { return 0.50f; } public float thresh_satisfied() { return 0.75f; } public float thresh_ahegao() { return 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() }; } 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 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 druggedfactor(Pawn pawn) { if (pawn.health.hediffSet.HasHediff(HediffDef.Named("HumpShroomAddiction")) && !pawn.health.hediffSet.HasHediff(HediffDef.Named("HumpShroomEffect"))) { //ModLog.Message("Need_Sex::druggedfactor 0.5 pawn is " + xxx.get_pawnname(pawn)); return 0.5f; } if (pawn.health.hediffSet.HasHediff(HediffDef.Named("HumpShroomEffect"))) { //ModLog.Message("Need_Sex::druggedfactor 3 pawn is " + xxx.get_pawnname(pawn)); return 3f; } //ModLog.Message("Need_Sex::druggedfactor 1 pawn is " + xxx.get_pawnname(pawn)); return 1f; } static float diseasefactor(Pawn pawn) { if (pawn.health.hediffSet.HasHediff(HediffDef.Named("Boobitis"))) { return 3f; } return 1f; } static float agefactor(Pawn pawn) { if (xxx.is_human(pawn)) { int age = pawn.ageTracker.AgeBiologicalYears; Need_Sex horniness = pawn.needs.TryGetNeed<Need_Sex>(); if (horniness.CurLevel > 0.5f) return 1f; if (age < RJWSettings.sex_minimum_age) return 0f; } return 1f; } static float fall_per_tick(Pawn pawn) { var partBPR = Genital_Helper.get_genitalsBPR(pawn); var parts = Genital_Helper.get_PartsHediffList(pawn, partBPR); var fall_per_tick = //def.fallPerDay * decay_per_day * brokenbodyfactor(pawn) * druggedfactor(pawn) * diseasefactor(pawn) * agefactor(pawn) * (((Genital_Helper.has_penis_fertile(pawn, parts) || Genital_Helper.has_penis_infertile(pawn, parts)) && Genital_Helper.has_vagina(pawn, parts)) ? 2.0f : 1.0f) / 60000.0f; //--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() //150 ticks between each calls from Pawn_NeedsTracker() { if (isInvisible) return; // no caravans if (needsex_tick <= 0) // every 10 ticks - real tick { std_updater.update(pawn); if (xxx.is_asexual(pawn)) { CurLevel = 0.5f; return; } //--ModLog.Message("Need_Sex::NeedInterval is called0 - pawn is "+xxx.get_pawnname(pawn)); needsex_tick = needsex_tick_timer; if (!def.freezeWhileSleeping || pawn.Awake()) { var fall_per_call = 150 * needsex_tick_timer * fall_per_tick(pawn); CurLevel -= fall_per_call * xxx.get_sex_drive(pawn) * RJWSettings.sexneed_decay_rate; // Each day has 60000 ticks, each hour has 2500 ticks, so each hour has 50/3 calls, in other words, each call takes .06 hour. //ModLog.Message(" " + xxx.get_pawnname(pawn) + "'s sex need stats:: Decay/call: " + fall_per_call * decay_rate_modifier * xxx.get_sex_drive(pawn) + ", Cur.lvl: " + CurLevel + ", Dec. rate: " + decay_rate_modifier + ", Sex drive: " + xxx.get_sex_drive(pawn)); if (CurLevel < thresh_frustrated()) { SexUtility.OffsetPsyfocus(pawn, -0.01f); } //if (CurLevel < thresh_horny()) //{ // SexUtility.OffsetPsyfocus(pawn, -0.01f); //} //if (CurLevel < thresh_frustrated() || CurLevel > thresh_ahegao()) //{ // SexUtility.OffsetPsyfocus(pawn, -0.05f); //} } //--ModLog.Message("Need_Sex::NeedInterval is called1"); //If they need it, they should seek it if (CurLevel < thresh_horny() && (pawn.mindState.canLovinTick - Find.TickManager.TicksGame > 300) ) { pawn.mindState.canLovinTick = Find.TickManager.TicksGame + 300; } // the bootstrap of the mapInjector will only be triggered once per visible pawn. if (!BootStrapTriggered) { //--ModLog.Message("Need_Sex::NeedInterval::calling boostrap - pawn is " + xxx.get_pawnname(pawn)); xxx.bootstrap(pawn.Map); BootStrapTriggered = true; } } else { needsex_tick--; } //--ModLog.Message("Need_Sex::NeedInterval is called2 - needsex_tick is "+needsex_tick); } } }
TDarksword/rjw
Source/Needs/Need_Sex.cs
C#
mit
6,120
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; } }
TDarksword/rjw
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 partBPR = Genital_Helper.get_genitalsBPR(pawn); var parts = Genital_Helper.get_PartsHediffList(pawn, partBPR); 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)); RaceProperties race = diffSet.pawn.RaceProps; 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; } //archotech always fertile mode if (pawn.health.hediffSet.HasHediff(HediffDef.Named("FertilityEnhancer"))) { //Log.Message(" has archotech FertilityEnhancer set fertility to 100%"); return 1f; } 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%. } } 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) startMaxAge = lifestage.minAge; } } //Log.Message(" Fertility ages for " + pawn.Name + " are: " + startAge + ", " + startMaxAge + ", " + endAge + ", " + endMaxAge); float result = PawnCapacityUtility.CalculateTagEfficiency(diffSet, BodyPartTagDefOf.RJW_Fertility, 1f, FloatRange.ZeroToOne, impactors); result *= GenMath.FlatHill(startAge, startMaxAge, endAge, zeroFertility, pawn.ageTracker.AgeBiologicalYearsFloat); //ModLog.Message("PawnCapacityWorker_Fertility::CalculateCapacityLevel result is: " + result); return result; } public override bool CanHaveCapacity(BodyDef body) { return body.HasPartWithTag(BodyPartTagDefOf.RJW_Fertility); } } }
TDarksword/rjw
Source/PawnCapacities/PawnCapacityWorker_Fertility.cs
C#
mit
3,652
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; } } }
TDarksword/rjw
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; } } }
TDarksword/rjw
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; } } }
TDarksword/rjw
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) } } }
TDarksword/rjw
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; } } } }
TDarksword/rjw
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) { 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; } } }
TDarksword/rjw
Source/Recipes/Recipe_Restraints.cs
C#
mit
706
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; } } } }
TDarksword/rjw
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; } } } }
TDarksword/rjw
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; } } } }
TDarksword/rjw
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; } } } }
TDarksword/rjw
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); } else { //Log.Message("dead harvest " + part); ThoughtUtility.GiveThoughtsForPawnExecuted(p, 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)); } } */ }
TDarksword/rjw
Source/Recipes/Remove_Part/Recipe_RemovePart.cs
C#
mit
2,689
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; } } } }
TDarksword/rjw
Source/Recipes/Remove_Part/Recipe_RemovePenis.cs
C#
mit
595
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; } } } }
TDarksword/rjw
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 partBPR = Genital_Helper.get_genitalsBPR(p); var parts = Genital_Helper.get_PartsHediffList(p, partBPR); 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_penis_fertile(p, parts) || Genital_Helper.has_penis_infertile(p, parts) || Genital_Helper.has_ovipositorF(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 partBPR = Genital_Helper.get_genitalsBPR(p); var parts = Genital_Helper.get_PartsHediffList(p, partBPR); 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_penis_fertile(p, parts) || Genital_Helper.has_penis_infertile(p, parts) || Genital_Helper.has_ovipositorF(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 doesnt exist yet //add multi parts public class Recipe_AddMultiPart : Recipe_MakeFuta { public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r) { //dont add artifical - peg, hydraulics, bionics, archo, ovi if (r.addsHediff.addedPartProps?.solid ?? false) yield break; //dont add if artifical 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 partBPR = Genital_Helper.get_genitalsBPR(p); var parts = Genital_Helper.get_PartsHediffList(p, partBPR); //dont add if no ovi //if (Genital_Helper.has_ovipositorF(p, parts) || Genital_Helper.has_ovipositorM(p, parts)) // yield break; //dont 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; } } }
TDarksword/rjw
Source/Recipes/Transgender/Recipe_MakeFuta.cs
C#
mit
3,843
using System; using UnityEngine; using Verse; using System.Collections.Generic; namespace rjw { public class RJWDebugSettings : ModSettings { public static void DoWindowContents(Rect inRect) { Listing_Standard listingStandard = new Listing_Standard(); listingStandard.ColumnWidth = inRect.width / 2.05f; listingStandard.Begin(inRect); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("whoringtab_enabled".Translate(), ref RJWSettings.whoringtab_enabled); 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); listingStandard.CheckboxLabeled("designated_freewill".Translate(), ref RJWSettings.designated_freewill, "designated_freewill_desc".Translate()); listingStandard.Gap(5f); if (listingStandard.ButtonText("Rjw Parts " + RJWSettings.ShowRjwParts)) { Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>() { 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(5f); listingStandard.CheckboxLabeled("StackRjwParts_name".Translate(), ref RJWSettings.StackRjwParts, "StackRjwParts_desc".Translate()); listingStandard.Gap(5f); listingStandard.Label("maxDistancetowalk_name".Translate() + ": " + (RJWSettings.maxDistancetowalk), -1f, "maxDistancetowalk_desc".Translate()); RJWSettings.maxDistancetowalk = listingStandard.Slider((int)RJWSettings.maxDistancetowalk, 0, 5000); 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.NewColumn(); listingStandard.Gap(4f); GUI.contentColor = Color.yellow; listingStandard.CheckboxLabeled("ForbidKidnap".Translate(), ref RJWSettings.ForbidKidnap, "ForbidKidnap_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("WildMode_name".Translate(), ref RJWSettings.WildMode, "WildMode_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("GenderlessAsFuta_name".Translate(), ref RJWSettings.GenderlessAsFuta, "GenderlessAsFuta_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("DevMode_name".Translate(), ref RJWSettings.DevMode, "DevMode_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("DebugLogJoinInBed".Translate(), ref RJWSettings.DebugLogJoinInBed, "DebugLogJoinInBed_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("DebugWhoring".Translate(), ref RJWSettings.DebugWhoring, "DebugWhoring_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("DebugRape".Translate(), ref RJWSettings.DebugRape, "DebugRape_desc".Translate()); listingStandard.Gap(5f); GUI.contentColor = Color.white; listingStandard.End(); } public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref RJWSettings.whoringtab_enabled, "whoringtab_enabled", RJWSettings.whoringtab_enabled, true); 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.StackRjwParts, "StackRjwParts", RJWSettings.StackRjwParts, true); Scribe_Values.Look(ref RJWSettings.maxDistancetowalk, "maxDistancetowalk", RJWSettings.maxDistancetowalk, 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.ForbidKidnap, "ForbidKidnap", RJWSettings.ForbidKidnap, 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_mayin", RJWSettings.override_matin, true); Scribe_Values.Look(ref RJWSettings.WildMode, "Wildmode", RJWSettings.WildMode, 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.DebugWhoring, "DebugWhoring", RJWSettings.DebugWhoring, true); Scribe_Values.Look(ref RJWSettings.DebugRape, "DebugRape", RJWSettings.DebugRape, true); } } }
TDarksword/rjw
Source/Settings/RJWDebugSettings.cs
C#
mit
7,863
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; 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); Listing_Standard listingStandard = new Listing_Standard(); listingStandard.ColumnWidth = inRect.width / 2.05f; listingStandard.Begin(inRect); 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(); } 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"); } } }
TDarksword/rjw
Source/Settings/RJWHookupSettings.cs
C#
mit
7,089
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 bestial_pregnancy_enabled = true; public static bool insect_pregnancy_enabled = true; public static bool egg_pregnancy_implant_anyone = true; public static bool egg_pregnancy_fertilize_anyone = false; public static float egg_pregnancy_eggs_size = 1.0f; public static bool mechanoid_pregnancy_enabled = true; public static bool trait_filtering_enabled = true; public static bool use_parent_method = true; 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 humanlike_DNA_from_mother = 0.5f; public static float bestial_DNA_from_mother = 1.0f; public static float bestiality_DNA_inheritance = 0.5f; 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; private static Vector2 scrollPosition; private static float height_modifier = 300f; public static void DoWindowContents(Rect inRect) { //30f for top page description and bottom close button Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f); //-16 for slider, height_modifier - additional height for options Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + height_modifier); Listing_Standard listingStandard = new Listing_Standard(); listingStandard.maxOneColumn = true; listingStandard.ColumnWidth = viewRect.width / 2.05f; listingStandard.BeginScrollView(outRect, ref scrollPosition, ref viewRect); listingStandard.Begin(viewRect); listingStandard.Gap(4f); listingStandard.CheckboxLabeled("RJWH_pregnancy".Translate(), ref humanlike_pregnancy_enabled, "RJWH_pregnancy_desc".Translate()); if (humanlike_pregnancy_enabled) { listingStandard.Gap(5f); listingStandard.CheckboxLabeled(" " + "genetic_trait_filter".Translate(), ref trait_filtering_enabled, "genetic_trait_filter_desc".Translate()); } else { trait_filtering_enabled = false; } listingStandard.Gap(5f); listingStandard.CheckboxLabeled("RJWA_pregnancy".Translate(), ref animal_pregnancy_enabled, "RJWA_pregnancy_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); 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); 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() + ": <--->", -1f, "OffspringIsHuman2_desc".Translate()); bestiality_DNA_inheritance = listingStandard.Slider(bestiality_DNA_inheritance, 0.0f, 1.0f); } } else humanlike_DNA_from_mother = 100; listingStandard.CheckboxLabeled("MechanoidImplanting".Translate(), ref mechanoid_pregnancy_enabled, "MechanoidImplanting_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.EndScrollView(ref viewRect); listingStandard.End(); } public override void ExposeData() { base.ExposeData(); Scribe_Values.Look(ref humanlike_pregnancy_enabled, "humanlike_pregnancy_enabled", humanlike_pregnancy_enabled, true); Scribe_Values.Look(ref animal_pregnancy_enabled, "animal_enabled", animal_pregnancy_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 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_eggs_size, "egg_pregnancy_eggs_size", egg_pregnancy_eggs_size, true); Scribe_Values.Look(ref mechanoid_pregnancy_enabled, "mechanoid_enabled", mechanoid_pregnancy_enabled, true); Scribe_Values.Look(ref trait_filtering_enabled, "trait_filtering_enabled", trait_filtering_enabled, 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); } } }
TDarksword/rjw
Source/Settings/RJWPregnancySettings.cs
C#
mit
14,506
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 cum_on_body = true; public static float cum_on_body_amount_adjust = 1.0f; public static bool cum_overlays = 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 bool stds_enabled = true; public static bool std_floor = false; public static bool NymphTamed = false; public static bool NymphWild = true; public static bool NymphRaidEasy = false; public static bool NymphRaidHard = false; public static bool NymphPermanentManhunter = false; 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 int sex_minimum_age = 13; public static int sex_free_for_all_age = 18; public static float sexneed_decay_rate = 1.0f; 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 whoringtab_enabled = true; public static bool submit_button_enabled = true; public static bool show_RJW_designation_box = true; public static ShowParts ShowRjwParts = ShowParts.Show; public static bool StackRjwParts = false; public static float maxDistancetowalk = 250; public static bool WildMode = false; public static bool ForbidKidnap = 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 GenderlessAsFuta = false; public static bool DevMode = false; public static bool DebugLogJoinInBed = false; public static bool DebugWhoring = false; public static bool DebugRape = 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; private static Vector2 scrollPosition; private static float height_modifier = 300f; public enum ShowParts { Show, Known, Hide }; public static void DoWindowContents(Rect inRect) { sexneed_decay_rate = Mathf.Clamp(sexneed_decay_rate, 0.0f, 10000.0f); cum_on_body_amount_adjust = Mathf.Clamp(cum_on_body_amount_adjust, 0.1f, 10f); nonFutaWomenRaping_MaxVulnerability = Mathf.Clamp(nonFutaWomenRaping_MaxVulnerability, 0.0f, 3.0f); rapee_MinVulnerability_human = Mathf.Clamp(rapee_MinVulnerability_human, 0.0f, 3.0f); //some cluster fuck code barely working //something like that //inRect - label, close button //outRect - slider //viewRect - options //30f for top page description and bottom close button Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f); //-16 for slider, height_modifier - additional height for options Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + height_modifier); //-16 for slider, height_modifier - additional height for options //Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, inRect.height + height_modifier); //Log.Message("1 - " + inRect.width); //Log.Message("2 - " + outRect.width); //Log.Message("3 - " + viewRect.width); //GUI.Button(new Rect(10, 10, 200, 20), "Meet the flashing button"); Listing_Standard listingStandard = new Listing_Standard(); listingStandard.maxOneColumn = true; listingStandard.ColumnWidth = viewRect.width / 2.05f; listingStandard.BeginScrollView(outRect, ref scrollPosition, ref viewRect); 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.CheckboxLabeled("STD_enabled".Translate(), ref stds_enabled, "STD_enabled_desc".Translate()); listingStandard.Gap(5f); if (stds_enabled) listingStandard.CheckboxLabeled(" " + "STD_FromFloors".Translate(), ref std_floor, "STD_FromFloors_desc".Translate()); else std_floor = false; listingStandard.Gap(5f); listingStandard.CheckboxLabeled("cum_filth".Translate(), ref cum_filth, "cum_filth_desc".Translate()); listingStandard.Gap(5f); listingStandard.CheckboxLabeled("cum_on_body".Translate(), ref cum_on_body, "cum_on_body_desc".Translate()); listingStandard.Gap(5f); if (cum_on_body) { listingStandard.Label("cum_on_body_amount_adjust".Translate() + ": " + Math.Round(cum_on_body_amount_adjust * 100f, 0) + "%", -1f, "cum_on_body_amount_adjust_desc".Translate()); cum_on_body_amount_adjust = listingStandard.Slider(cum_on_body_amount_adjust, 0.1f, 10.0f); listingStandard.CheckboxLabeled("cum_overlays".Translate(), ref cum_overlays, "cum_overlays_desc".Translate()); } else cum_overlays = false; 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.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.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.Label("SexMinimumAge".Translate() + ": " + sex_minimum_age, -1f, "SexMinimumAge_desc".Translate()); sex_minimum_age = (int)listingStandard.Slider(sex_minimum_age, 0, 100); listingStandard.Label("SexFreeForAllAge".Translate() + ": " + sex_free_for_all_age, -1f, "SexFreeForAllAge_desc".Translate()); sex_free_for_all_age = (int)listingStandard.Slider(sex_free_for_all_age, 0, 100); 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("NymphPermanentManhunter".Translate(), ref NymphPermanentManhunter, "NymphPermanentManhunter_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.EndScrollView(ref viewRect); listingStandard.End(); //height_modifier = listingStandard.CurHeight; } 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 NymphPermanentManhunter, "NymphPermanentManhunter", NymphPermanentManhunter, true); Scribe_Values.Look(ref FemaleFuta, "FemaleFuta", FemaleFuta, true); Scribe_Values.Look(ref MaleTrap, "MaleTrap", MaleTrap, true); Scribe_Values.Look(ref stds_enabled, "STD_enabled", stds_enabled, true); Scribe_Values.Look(ref std_floor, "STD_FromFloors", std_floor, 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 cum_filth, "cum_filth", cum_filth, true); Scribe_Values.Look(ref cum_on_body, "cum_on_body", cum_on_body, true); Scribe_Values.Look(ref cum_on_body_amount_adjust, "cum_on_body_amount_adjust", cum_on_body_amount_adjust, true); Scribe_Values.Look(ref cum_overlays, "cum_overlays", cum_overlays, true); Scribe_Values.Look(ref sex_minimum_age, "sex_minimum_age", sex_minimum_age, true); Scribe_Values.Look(ref sex_free_for_all_age, "sex_free_for_all", sex_free_for_all_age, true); Scribe_Values.Look(ref sexneed_decay_rate, "sexneed_decay_rate", sexneed_decay_rate, 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); } } }
TDarksword/rjw
Source/Settings/RJWSettings.cs
C#
mit
18,335
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); } } }
TDarksword/rjw
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 bool std_show_roll_to_catch; // Updated public float std_min_severity_to_pitch; // Updated public float std_env_pitch_cleanliness_exaggeration; // Updated public float std_env_pitch_dirtiness_exaggeration; // Updated public float std_outdoor_cleanliness; // Updated 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 opp_inf_initial_immunity; // Updated public float comfort_prisoner_rape_mtbh_mul; // Updated public float whore_mtbh_mul; // Updated public float nymph_spawn_with_std_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 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; 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) { Listing_Standard listingStandard = new Listing_Standard(); listingStandard.ColumnWidth = inRect.width / 3.15f; listingStandard.Begin(inRect); 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.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(); } 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 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); } } }
TDarksword/rjw
Source/Settings/RJWSexSettings.cs
C#
mit
16,095
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; } } }
TDarksword/rjw
Source/Settings/Settings.cs
C#
mit
2,007
using Verse; namespace rjw { public class config : Def { // TODO: Clean these. // Commented out old configs that are no longer in use (or have been converted into settings). // Feature Toggles //public bool comfort_prisoners_enabled; //public bool colonists_can_be_comfort_prisoners; //public bool cum_enabled; //public bool rape_me_sticky_enabled; //public bool sounds_enabled; //public bool stds_enabled; //public bool bondage_gear_enabled; //public bool nymph_joiners_enabled; //public bool whore_beds_enabled; //public bool necro_enabled; //public bool random_rape_enabled; //public bool always_accept_whores; //public bool nymphs_always_JoinInBed; //public bool zoophis_always_rape; //public bool rapists_always_rape; //public bool pawns_always_do_fapping; //public bool pawns_always_rapeCP; //public bool whores_always_findjob; // STD config public bool std_show_roll_to_catch; public float std_min_severity_to_pitch; public float std_env_pitch_cleanliness_exaggeration; public float std_env_pitch_dirtiness_exaggeration; public float std_outdoor_cleanliness; // Age Config //public int sex_free_for_all_age; //public int sex_minimum_age; 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 opp_inf_initial_immunity; public float comfort_prisoner_rape_mtbh_mul; //public float whore_mtbh_mul; public float nymph_spawn_with_std_mul; //public float chance_to_rim; //public float fertility_endAge_male; //public float fertility_endAge_female_humanlike; //public float fertility_endAge_female_animal; } }
TDarksword/rjw
Source/Settings/config.cs
C#
mit
1,883
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.isSingleOrPartnerNotHere(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; ; } } } }
TDarksword/rjw
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; ; } } } }
TDarksword/rjw
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; } } }
TDarksword/rjw
Source/ThinkTreeNodes/ThinkNode_ChancePerHour_Fappin.cs
C#
mit
1,200
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.isSingleOrPartnerNotHere(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; } } } }
TDarksword/rjw
Source/ThinkTreeNodes/ThinkNode_ChancePerHour_Necro.cs
C#
mit
2,480
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 partBPR = Genital_Helper.get_genitalsBPR(pawn); var parts = Genital_Helper.get_PartsHediffList(pawn, partBPR); // Much slower for female animals. animal_factor = (Genital_Helper.has_penis_fertile(pawn, parts) || Genital_Helper.has_penis_infertile(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; ; } } } }
TDarksword/rjw
Source/ThinkTreeNodes/ThinkNode_ChancePerHour_RapeCP.cs
C#
mit
2,962
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; } } }
TDarksword/rjw
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(); } } }
TDarksword/rjw
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; // 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; } } }
TDarksword/rjw
Source/ThinkTreeNodes/ThinkNode_ConditionalCanRapeCP.cs
C#
mit
1,454
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); } } }
TDarksword/rjw
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); } } }
TDarksword/rjw
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); } } }
TDarksword/rjw
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); } } }
TDarksword/rjw
Source/ThinkTreeNodes/ThinkNode_ConditionalMate.cs
C#
mit
433
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; } } }
TDarksword/rjw
Source/ThinkTreeNodes/ThinkNode_ConditionalNecro.cs
C#
mit
736