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