code
stringlengths 0
56.1M
| repo_name
stringclasses 515
values | path
stringlengths 2
147
| language
stringclasses 447
values | license
stringclasses 7
values | size
int64 0
56.8M
|
---|---|---|---|---|---|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Verse;
using Verse.AI;
using RimWorld;
using Multiplayer.API;
namespace rjw
{
public static class QuirkAdder
{
public static void Add(Pawn pawn, Quirk quirk)
{
if (!pawn.Has(quirk))
{
var hasFertility = pawn.RaceHasFertility();
if (quirk == Quirk.Fertile && (!hasFertility || CompRJW.Comp(pawn).quirks.ToString().Contains(Quirk.Infertile.Key)))
{
return;
}
if (quirk == Quirk.Infertile && (!hasFertility || CompRJW.Comp(pawn).quirks.ToString().Contains(Quirk.Fertile.Key)))
{
return;
}
// No fair having a fetish for your own race.
// But tags don't conflict so having a fetish for robot plant dragons is fine.
if (quirk.RaceTag != null && pawn.Has(quirk.RaceTag))
{
return;
}
if (quirk == Quirk.Fertile)
{
var fertility = HediffDef.Named("IncreasedFertility");
if (fertility != null)
pawn.health.AddHediff(fertility);
}
if (quirk == Quirk.Infertile)
{
var infertility = HediffDef.Named("DecreasedFertility");
if (infertility != null)
pawn.health.AddHediff(infertility);
}
CompRJW.Comp(pawn).quirks.AppendWithComma(quirk.Key);
CompRJW.Comp(pawn).quirksave = CompRJW.Comp(pawn).quirks.ToString();
quirk.DoAfterAdd(pawn);
}
}
public static void Clear(Pawn pawn)
{
Hediff fertility = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("IncreasedFertility"));
if (fertility != null)
pawn.health.RemoveHediff(fertility);
Hediff infertility = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("DecreasedFertility"));
if (infertility != null)
pawn.health.RemoveHediff(infertility);
CompRJW.Comp(pawn).quirks = new StringBuilder();
if (CompRJW.Comp(pawn).quirks.Length == 0)
CompRJW.Comp(pawn).quirks.Append("None");
CompRJW.Comp(pawn).quirksave = CompRJW.Comp(pawn).quirks.ToString();
}
public static void Generate(Pawn pawn)
{
if (!pawn.RaceHasSexNeed() || (pawn.kindDef.race.defName.ToLower().Contains("droid") && !AndroidsCompatibility.IsAndroid(pawn)))
{
return;
}
else if (pawn.IsAnimal())
{
GenerateForAnimal(pawn);
}
else
{
GenerateForHumanlike(pawn);
}
}
[SyncMethod]
static void GenerateForHumanlike(Pawn pawn)
{
var count = Rand.RangeInclusive(0, RJWPreferenceSettings.MaxQuirks);
var list = Quirk.All.ToList();
list.Shuffle();
// Some quirks may be hard for a given pawn to indulge in.
// For example a female homosexual will have a hard time satisfying an impregnation fetish.
// But rimworld is a weird place and you never know what the pawn will be capable of in the future.
// We still don't want straight up contradictory results like fertile + infertile.
var hasFertility = pawn.RaceHasFertility();
var actual = new List<Quirk>();
foreach (var quirk in list)
{
if (count == 0)
{
break;
}
// These special cases are sort of hacked in.
// In theory there should be a general way for the quirk itself to decide when it applies.
if (quirk == Quirk.Fertile && (!hasFertility || actual.Contains(Quirk.Infertile)))
{
continue;
}
if (quirk == Quirk.Infertile && (!hasFertility || actual.Contains(Quirk.Fertile)))
{
continue;
}
// Have to earn these.
if (quirk == Quirk.Breeder || quirk == Quirk.Incubator)
{
continue;
}
// No fair having a fetish for your own race.
// But tags don't conflict so having a fetish for robot plant dragons is fine.
if (quirk.RaceTag != null && pawn.Has(quirk.RaceTag))
{
continue;
}
count--;
actual.Add(quirk);
}
foreach (var quirk in actual)
{
pawn.Add(quirk);
}
}
[SyncMethod]
static void GenerateForAnimal(Pawn pawn)
{
if (Rand.Chance(0.1f))
{
pawn.Add(Quirk.Messy);
}
if (!pawn.RaceHasFertility())
{
return;
}
if (Rand.Chance(0.1f))
{
pawn.Add(Quirk.Fertile);
}
else if (Rand.Chance(0.1f))
{
pawn.Add(Quirk.Infertile);
}
}
}
}
|
TDarksword/rjw
|
Source/Comps/QuirkAdder.cs
|
C#
|
mit
| 4,151 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Verse;
using Verse.AI;
using RimWorld;
namespace rjw
{
public class SexProps
{
//quirks
public Pawn Pawn { get; }
public Pawn Partner { get; }
public bool Violent { get; }
//sex
public Pawn Giver { get; set; }
public Pawn Reciever { get; set; }
public xxx.rjwSextype SexType { get; set; }
public InteractionDef DictionaryKey { get; set; }
public string RulePack { get; set; }
public bool HasPartner => Partner != null;
public SexProps(Pawn pawn, Pawn partner, xxx.rjwSextype sexType, bool violent, Pawn giver = null, Pawn reciever = null, string rulepack = null, InteractionDef dictionaryKey = null)
{
Pawn = pawn;
Partner = partner;
Violent = violent;
Giver = giver;
Reciever = reciever;
SexType = sexType;
RulePack = rulepack;
DictionaryKey = dictionaryKey;
}
}
}
|
TDarksword/rjw
|
Source/Comps/SexProps.cs
|
C#
|
mit
| 921 |
using RimWorld;
using Verse;
namespace rjw
{
[DefOf]
public static class RJW_RecipeDefOf
{
public static RecipeDef AttachPenis;
public static RecipeDef InstallPenis;
public static RecipeDef RemovePenis;
}
}
|
TDarksword/rjw
|
Source/DefOf/RJW_RecipeDefOf.cs
|
C#
|
mit
| 221 |
using Verse;
using RimWorld;
using Multiplayer.API;
namespace rjw
{
public static class PawnDesignations_Breedee
{
public static bool UpdateCanDesignateBreeding(this Pawn pawn)
{
//no permission to change designation for NON prisoner hero/ other player
if (!pawn.CanChangeDesignationPrisoner() && !pawn.CanChangeDesignationColonist())
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreeding = false;
//no permission to change designation for prisoner hero/ self
if (!pawn.CanChangeDesignationPrisoner())
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreeding = false;
//cant have penetrative sex
if (!xxx.can_be_fucked(pawn))
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreeding = false;
if (RJWSettings.bestiality_enabled && xxx.is_human(pawn))
{
if (!pawn.IsDesignatedHero())
{
if ((xxx.is_zoophile(pawn) || (RJWSettings.override_RJW_designation_checks && !MP.IsInMultiplayer)) && pawn.IsColonist)
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreeding = true;
}
else if (pawn.IsHeroOwner())
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreeding = true;
if (pawn.IsPrisonerOfColony || xxx.is_slave(pawn))
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreeding = true;
}
if (RJWSettings.animal_on_animal_enabled && xxx.is_animal(pawn)
&& pawn.Faction == Faction.OfPlayer)
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreeding = true;
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreeding = false;
}
public static bool CanDesignateBreeding(this Pawn pawn)
{
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreeding;
}
public static void ToggleBreeding(this Pawn pawn)
{
pawn.UpdateCanDesignateBreeding();
if (pawn.CanDesignateBreeding())
{
if (!pawn.IsDesignatedBreeding())
DesignateBreeding(pawn);
else
UnDesignateBreeding(pawn);
}
}
public static bool IsDesignatedBreeding(this Pawn pawn)
{
if (SaveStorage.DataStore.GetPawnData(pawn).Breeding)
{
if (!xxx.is_animal(pawn))
{
if (!RJWSettings.bestiality_enabled)
UnDesignateBreeding(pawn);
else if (!pawn.IsDesignatedHero())
if (!(xxx.is_zoophile(pawn) || pawn.IsPrisonerOfColony || xxx.is_slave(pawn)))
if (!(RJWSettings.WildMode || (RJWSettings.override_RJW_designation_checks && !MP.IsInMultiplayer)))
UnDesignateBreeding(pawn);
}
else
{
if (!RJWSettings.animal_on_animal_enabled)
UnDesignateBreeding(pawn);
else if (!pawn.Faction?.IsPlayer ?? false)
UnDesignateBreeding(pawn);
}
if (pawn.Dead)
pawn.UnDesignateBreeding();
}
return SaveStorage.DataStore.GetPawnData(pawn).Breeding;
}
[SyncMethod]
public static void DesignateBreeding(this Pawn pawn)
{
DesignatorsData.rjwBreeding.AddDistinct(pawn);
SaveStorage.DataStore.GetPawnData(pawn).Breeding = true;
}
[SyncMethod]
public static void UnDesignateBreeding(this Pawn pawn)
{
DesignatorsData.rjwBreeding.Remove(pawn);
SaveStorage.DataStore.GetPawnData(pawn).Breeding = false;
}
}
}
|
TDarksword/rjw
|
Source/Designators/Breedee.cs
|
C#
|
mit
| 3,204 |
using Verse;
using RimWorld;
using Multiplayer.API;
namespace rjw
{
public static class PawnDesignations_Breeder
{
public static bool UpdateCanDesignateBreedingAnimal(this Pawn pawn)
{
//no permission to change designation for NON prisoner hero/ other player
if (!pawn.CanChangeDesignationPrisoner() && !pawn.CanChangeDesignationColonist())
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreedingAnimal = false;
//no permission to change designation for prisoner hero/ self
if (!pawn.CanChangeDesignationPrisoner())
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreedingAnimal = false;
//Log.Message("CanDesignateAnimal for " + xxx.get_pawnname(pawn) + " " + SaveStorage.bestiality_enabled);
//Log.Message("checking animal props " + (pawn.Faction?.IsPlayer.ToString()?? "tynanfag") + xxx.is_animal(pawn) + xxx.can_rape(pawn));
if ((RJWSettings.bestiality_enabled || RJWSettings.animal_on_animal_enabled)
&& xxx.is_animal(pawn)
&& xxx.can_fuck(pawn)
&& pawn.Faction == Faction.OfPlayer)
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreedingAnimal = true;
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreedingAnimal = false;
}
public static bool CanDesignateBreedingAnimal(this Pawn pawn)
{
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateBreedingAnimal;
}
public static void ToggleBreedingAnimal(this Pawn pawn)
{
pawn.UpdateCanDesignateBreedingAnimal();
if (pawn.CanDesignateBreedingAnimal())
{
if (!pawn.IsDesignatedBreedingAnimal())
DesignateBreedingAnimal(pawn);
else
UnDesignateBreedingAnimal(pawn);
}
}
public static bool IsDesignatedBreedingAnimal(this Pawn pawn)
{
if (SaveStorage.DataStore.GetPawnData(pawn).BreedingAnimal)
{
if (!pawn.Faction?.IsPlayer ?? false)
UnDesignateBreedingAnimal(pawn);
if (pawn.Dead)
pawn.UnDesignateBreedingAnimal();
}
return SaveStorage.DataStore.GetPawnData(pawn).BreedingAnimal;
}
[SyncMethod]
public static void DesignateBreedingAnimal(this Pawn pawn)
{
DesignatorsData.rjwBreedingAnimal.AddDistinct(pawn);
SaveStorage.DataStore.GetPawnData(pawn).BreedingAnimal = true;
}
[SyncMethod]
public static void UnDesignateBreedingAnimal(this Pawn pawn)
{
DesignatorsData.rjwBreedingAnimal.Remove(pawn);
SaveStorage.DataStore.GetPawnData(pawn).BreedingAnimal = false;
}
}
}
|
TDarksword/rjw
|
Source/Designators/Breeder.cs
|
C#
|
mit
| 2,443 |
using Verse;
using Multiplayer.API;
namespace rjw
{
public static class PawnDesignations_Comfort
{
public static bool UpdateCanDesignateComfort(this Pawn pawn)
{
//rape disabled
if (!RJWSettings.rape_enabled)
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateComfort = false;
//no permission to change designation for NON prisoner hero/ other player
if (!pawn.CanChangeDesignationPrisoner() && !pawn.CanChangeDesignationColonist())
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateComfort = false;
//no permission to change designation for prisoner hero/ self
if (!pawn.CanChangeDesignationPrisoner())
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateComfort = false;
//cant sex
if (!(xxx.can_fuck(pawn) || xxx.can_be_fucked(pawn)))
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateComfort = false;
if (!pawn.IsDesignatedHero())
{
if ((xxx.is_masochist(pawn) || (RJWSettings.override_RJW_designation_checks && !MP.IsInMultiplayer)) && pawn.IsColonist)
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateComfort = true;
}
else if (pawn.IsHeroOwner())
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateComfort = true;
if (pawn.IsPrisonerOfColony || xxx.is_slave(pawn))
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateComfort = true;
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateComfort = false;
}
public static bool CanDesignateComfort(this Pawn pawn)
{
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateComfort;
}
public static void ToggleComfort(this Pawn pawn)
{
pawn.UpdateCanDesignateComfort();
if (pawn.CanDesignateComfort())
{
if (!pawn.IsDesignatedComfort())
DesignateComfort(pawn);
else
UnDesignateComfort(pawn);
}
}
public static bool IsDesignatedComfort(this Pawn pawn)
{
if (SaveStorage.DataStore.GetPawnData(pawn).Comfort)
{
if (!pawn.IsDesignatedHero())
{
if (!pawn.IsPrisonerOfColony)
if (!(xxx.is_masochist(pawn) || xxx.is_slave(pawn)))
{
if (!pawn.IsColonist)
UnDesignateComfort(pawn);
else if (!(RJWSettings.WildMode || (RJWSettings.override_RJW_designation_checks && !MP.IsInMultiplayer)))
UnDesignateComfort(pawn);
}
}
if (pawn.Dead)
pawn.UnDesignateComfort();
}
return SaveStorage.DataStore.GetPawnData(pawn).Comfort;
}
[SyncMethod]
public static void DesignateComfort(this Pawn pawn)
{
DesignatorsData.rjwComfort.AddDistinct(pawn);
SaveStorage.DataStore.GetPawnData(pawn).Comfort = true;
}
[SyncMethod]
public static void UnDesignateComfort(this Pawn pawn)
{
DesignatorsData.rjwComfort.Remove(pawn);
SaveStorage.DataStore.GetPawnData(pawn).Comfort = false;
}
}
}
|
TDarksword/rjw
|
Source/Designators/Comfort.cs
|
C#
|
mit
| 2,831 |
using Verse;
using RimWorld;
using Multiplayer.API;
namespace rjw
{
public static class PawnDesignations_Hero
{
public static bool UpdateCanDesignateHero(this Pawn pawn)
{
if ((RJWSettings.RPG_hero_control)
&& xxx.is_human(pawn)
&& pawn.IsColonist)
{
if (!pawn.IsDesignatedHero())
{
foreach (Pawn item in DesignatorsData.rjwHero)
{
if (item.IsHeroOwner())
{
if (RJWSettings.RPG_hero_control_Ironman && !SaveStorage.DataStore.GetPawnData(item).Ironman)
SetHeroIronman(item);
if (item.Dead && !SaveStorage.DataStore.GetPawnData(item).Ironman)
{
UnDesignateHero(item);
//Log.Warning("CanDesignateHero:: " + MP.PlayerName + " hero is dead remove hero tag from " + item.Name);
}
else
{
//Log.Warning("CanDesignateHero:: " + MP.PlayerName + " already has hero - " + item.Name);
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateHero = false;
}
}
else
continue;
}
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateHero = true;
}
}
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateHero = false;
}
public static bool CanDesignateHero(this Pawn pawn)
{
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateHero;
}
public static void ToggleHero(this Pawn pawn)
{
pawn.UpdateCanDesignateHero();
if (pawn.CanDesignateHero() && Find.Selector.NumSelected == 1)
{
if (!pawn.IsDesignatedHero())
DesignateHero(pawn);
}
}
public static bool IsDesignatedHero(this Pawn pawn)
{
return SaveStorage.DataStore.GetPawnData(pawn).Hero;
}
public static void DesignateHero(this Pawn pawn)
{
MyMethod(pawn, MP.PlayerName);
}
[SyncMethod]
public static void UnDesignateHero(this Pawn pawn)
{
DesignatorsData.rjwHero.Remove(pawn);
SaveStorage.DataStore.GetPawnData(pawn).Hero = false;
}
public static bool IsHeroOwner(this Pawn pawn)
{
if (!MP.enabled)
return SaveStorage.DataStore.GetPawnData(pawn).HeroOwner == "Player" || SaveStorage.DataStore.GetPawnData(pawn).HeroOwner == null || SaveStorage.DataStore.GetPawnData(pawn).HeroOwner == "";
else
return SaveStorage.DataStore.GetPawnData(pawn).HeroOwner == MP.PlayerName;
}
[SyncMethod]
static void MyMethod(Pawn pawn, string theName)
{
if (!MP.enabled)
theName = "Player";
SaveStorage.DataStore.GetPawnData(pawn).Hero = true;
SaveStorage.DataStore.GetPawnData(pawn).HeroOwner = theName;
SaveStorage.DataStore.GetPawnData(pawn).Ironman = RJWSettings.RPG_hero_control_Ironman;
DesignatorsData.rjwHero.AddDistinct(pawn);
string text = pawn.Name + " is now hero of " + theName;
Messages.Message(text, pawn, MessageTypeDefOf.NeutralEvent);
//Log.Message(MP.PlayerName + " set " + pawn.Name + " to hero:" + SaveStorage.DataStore.GetPawnData(pawn).Hero);
pawn.UpdatePermissions();
}
[SyncMethod]
public static void SetHeroIronman(this Pawn pawn)
{
SaveStorage.DataStore.GetPawnData(pawn).Ironman = true;
}
}
}
|
TDarksword/rjw
|
Source/Designators/Hero.cs
|
C#
|
mit
| 3,083 |
using Verse;
using Multiplayer.API;
namespace rjw
{
public static class PawnDesignations_Milking
{
public static bool UpdateCanDesignateMilking(this Pawn pawn)
{
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateMilking = false;
}
public static bool CanDesignateMilking(this Pawn pawn)
{
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateMilking = false;
}
public static void ToggleMilking(this Pawn pawn)
{
if (pawn.CanDesignateMilking())
{
if (!pawn.IsDesignatedMilking())
DesignateMilking(pawn);
else
UnDesignateMilking(pawn);
}
}
public static bool IsDesignatedMilking(this Pawn pawn)
{
if (SaveStorage.DataStore.GetPawnData(pawn).Milking)
{
if (!pawn.IsDesignatedHero())
if (!(pawn.IsColonist || pawn.IsPrisonerOfColony || xxx.is_slave(pawn)))
UnDesignateMilking(pawn);
if (pawn.Dead)
pawn.UnDesignateMilking();
}
return SaveStorage.DataStore.GetPawnData(pawn).Milking;
}
[SyncMethod]
public static void DesignateMilking(this Pawn pawn)
{
DesignatorsData.rjwMilking.AddDistinct(pawn);
SaveStorage.DataStore.GetPawnData(pawn).Milking = true;
}
[SyncMethod]
public static void UnDesignateMilking(this Pawn pawn)
{
DesignatorsData.rjwMilking.Remove(pawn);
SaveStorage.DataStore.GetPawnData(pawn).Milking = false;
}
}
}
|
TDarksword/rjw
|
Source/Designators/Milking.cs
|
C#
|
mit
| 1,366 |
using Verse;
using Multiplayer.API;
namespace rjw
{
public static class PawnDesignations_Service
{
public static bool UpdateCanDesignateService(this Pawn pawn)
{
//no permission to change designation for NON prisoner hero/ other player
if (!pawn.CanChangeDesignationPrisoner() && !pawn.CanChangeDesignationColonist())
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateService = false;
//no permission to change designation for prisoner hero/ self
if (!pawn.CanChangeDesignationPrisoner())
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateService = false;
//cant sex
if (!(xxx.can_fuck(pawn) || xxx.can_be_fucked(pawn)))
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateService = false;
if (!pawn.IsDesignatedHero())
{
if (pawn.IsColonist)
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateService = true;
}
else if (pawn.IsHeroOwner())
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateService = true;
if (pawn.IsPrisonerOfColony || xxx.is_slave(pawn))
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateService = true;
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateService = false;
}
public static bool CanDesignateService(this Pawn pawn)
{
return SaveStorage.DataStore.GetPawnData(pawn).CanDesignateService;
}
public static void ToggleService(this Pawn pawn)
{
pawn.UpdateCanDesignateService();
if (pawn.CanDesignateService())
{
if (!pawn.IsDesignatedService())
DesignateService(pawn);
else
UnDesignateService(pawn);
}
}
public static bool IsDesignatedService(this Pawn pawn)
{
if (SaveStorage.DataStore.GetPawnData(pawn).Service)
{
if (!pawn.IsDesignatedHero())
if (!(pawn.IsColonist || pawn.IsPrisonerOfColony || xxx.is_slave(pawn)))
UnDesignateService(pawn);
if (pawn.Dead)
pawn.UnDesignateService();
}
return SaveStorage.DataStore.GetPawnData(pawn).Service;
}
[SyncMethod]
public static void DesignateService(this Pawn pawn)
{
DesignatorsData.rjwService.AddDistinct(pawn);
SaveStorage.DataStore.GetPawnData(pawn).Service = true;
}
[SyncMethod]
public static void UnDesignateService(this Pawn pawn)
{
DesignatorsData.rjwService.Remove(pawn);
SaveStorage.DataStore.GetPawnData(pawn).Service = false;
}
}
}
|
TDarksword/rjw
|
Source/Designators/Service.cs
|
C#
|
mit
| 2,375 |
using Verse;
using System.Diagnostics;
using RimWorld;
namespace rjw
{
public static class PawnDesignations_Utility
{
public static bool UpdatePermissions(this Pawn pawn)
{
pawn.UpdateCanChangeDesignationPrisoner();
pawn.UpdateCanChangeDesignationColonist();
pawn.UpdateCanDesignateService();
pawn.UpdateCanDesignateComfort();
pawn.UpdateCanDesignateBreedingAnimal();
pawn.UpdateCanDesignateBreeding();
pawn.UpdateCanDesignateHero();
pawn.UpdateRMB_Menu();
return true;
}
public static bool UpdateCanChangeDesignationColonist(this Pawn pawn)
{
//check if pawn is a hero of other player
//if yes - limit widget access in mp for this pawn
if ((pawn.IsDesignatedHero() && !pawn.IsHeroOwner()))
{
//Log.Warning("CanChangeDesignationColonist:: Pawn:" + xxx.get_pawnname(pawn));
//Log.Warning("CanChangeDesignationColonist:: IsDesignatedHero:" + pawn.IsDesignatedHero());
//Log.Warning("CanChangeDesignationColonist:: IsHeroOwner:" + pawn.IsHeroOwner());
return SaveStorage.DataStore.GetPawnData(pawn).CanChangeDesignationColonist = false;
}
return SaveStorage.DataStore.GetPawnData(pawn).CanChangeDesignationColonist = true;
}
public static bool CanChangeDesignationColonist(this Pawn pawn)
{
return SaveStorage.DataStore.GetPawnData(pawn).CanChangeDesignationColonist;
}
public static bool UpdateCanChangeDesignationPrisoner(this Pawn pawn)
{
//check if player hero is a slave/prisoner
//if yes - limit widget access in mp for all widgets
//Stopwatch sw = new Stopwatch();
//sw.Start();
//Log.Warning("rjwHero:: Count " + DesignatorsData.rjwHero.Count);
//Log.Warning("rjwComfort:: Count " + DesignatorsData.rjwComfort.Count);
//Log.Warning("rjwService:: Count " + DesignatorsData.rjwService.Count);
//Log.Warning("rjwMilking:: Count " + DesignatorsData.rjwMilking.Count);
//Log.Warning("rjwBreeding:: Count " + DesignatorsData.rjwBreeding.Count);
//Log.Warning("rjwBreedingAnimal:: Count " + DesignatorsData.rjwBreedingAnimal.Count);
foreach (Pawn item in DesignatorsData.rjwHero)
{
//Log.Warning("CanChangeDesignationPrisoner:: Pawn:" + xxx.get_pawnname(item));
//Log.Warning("CanChangeDesignationPrisoner:: IsHeroOwner:" + item.IsHeroOwner());
if (item.IsHeroOwner())
{
if (item.IsPrisonerOfColony || item.IsPrisoner || xxx.is_slave(item))
{
//Log.Warning("CanChangeDesignationPrisoner:: Pawn:" + xxx.get_pawnname(item));
//Log.Warning("CanChangeDesignationPrisoner:: Hero of " + MP.PlayerName);
//Log.Warning("CanChangeDesignationPrisoner:: is prisoner(colony):" + item.IsPrisonerOfColony);
//Log.Warning("CanChangeDesignationPrisoner:: is prisoner:" + item.IsPrisoner);
//Log.Warning("CanChangeDesignationPrisoner:: is slave:" + xxx.is_slave(item));
return SaveStorage.DataStore.GetPawnData(pawn).CanChangeDesignationPrisoner = false;
}
}
}
//sw.Stop();
//Log.Warning("Elapsed={0}" + sw.Elapsed);
return SaveStorage.DataStore.GetPawnData(pawn).CanChangeDesignationPrisoner = true;
}
public static bool CanChangeDesignationPrisoner(this Pawn pawn)
{
return SaveStorage.DataStore.GetPawnData(pawn).CanChangeDesignationPrisoner;
}
public static bool CheckRMB_Menu(this Pawn pawn)
{
return true;
var show = false;
//not heromode or override_control - quit
//not heromode or override_control - quit
if (!(RJWSettings.RPG_hero_control || RJWSettings.override_control))
{
pawn.UpdateRMB_Menu(show);
}
var HeroOK0 = false; //is hero
var HeroOK1 = false; //owned hero?
var HeroOK2 = false; //not owned hero? maybe prison check etc in future
if (RJWSettings.RPG_hero_control)
{
HeroOK0 = pawn.IsDesignatedHero();
HeroOK1 = HeroOK0 && pawn.IsHeroOwner();
HeroOK2 = HeroOK0 && !pawn.IsHeroOwner();
}
else if (!RJWSettings.override_control)
{ }
//not hero, not override_control - quit
if (!(HeroOK0 && RJWSettings.override_control))
return false;
//not owned hero - quit
if (!HeroOK1)
return false;
SaveStorage.DataStore.GetPawnData(pawn).ShowRMB_Menu = show;
return SaveStorage.DataStore.GetPawnData(pawn).ShowRMB_Menu;
}
public static bool UpdateRMB_Menu(this Pawn pawn , bool show = false)
{
return SaveStorage.DataStore.GetPawnData(pawn).ShowRMB_Menu = show;
}
}
}
|
TDarksword/rjw
|
Source/Designators/Utility.cs
|
C#
|
mit
| 4,399 |
using System.Collections.Generic;
using Verse;
using UnityEngine;
namespace rjw
{
/// <summary>
/// Handles creation of RJWdesignations button group for gui
/// </summary>
public class RJWdesignations : Command
{
//is actually a group of four buttons, but I've wanted them be small and so vanilla gizmo system is mostly bypassed for them
private const float ContentPadding = 5f;
private const float IconSize = 32f;
private const float IconGap = 1f;
private readonly Pawn parent;
private Rect gizmoRect;
/// <summary>
/// This should keep track of last pressed pseudobutton. It is set in the pseudobutton callback.
/// Then, the callback to encompassed Gizmo is performed by game, and this field is used to determine what exact button was pressed
/// The callback is called by the tynancode right after the loop which detects click on button,
/// so it will be called then and only then when it should be (no unrelated events).
/// event handling shit is needed to apply settings to all selected pawns.
/// </summary>
private static SubIcon lastClicked;
static readonly List<SubIcon> subIcons = new List<SubIcon> {
new Comfort(),
//new Service(),
//new BreederHuman(),
new BreedingHuman(),
new BreedingAnimal(),
new Breeder(),
//new Milking(),
new Hero()
};
public RJWdesignations(Pawn pawn)
{
parent = pawn;
defaultLabel = "RJWdesignations";
defaultDesc = "RJWdesignations";
}
public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth)
{
Rect rect = new Rect(topLeft.x, topLeft.y, 75f, 75f);
gizmoRect = rect.ContractedBy(ContentPadding);
Widgets.DrawWindowBackground(rect);
//Log.Message("RJWgizmo");
foreach (SubIcon icon in subIcons)
{
if (DrawSubIcon(icon))
{
lastClicked = icon;
icon.state = icon.applied(parent);
return new GizmoResult(GizmoState.Interacted, Event.current);
}
}
return new GizmoResult(GizmoState.Clear);
}
//this and class mess below was supposed to be quick shortcut to not write four repeated chunks of code in GizmoOnGUI
private bool DrawSubIcon(SubIcon icon)
{
if (!icon.applicable(parent)) { return false; }
//Log.Message("sub gizmo");
Rect iconRect = new Rect(gizmoRect.x + icon.offset.x, gizmoRect.y + icon.offset.y, IconSize, IconSize);
TooltipHandler.TipRegion(iconRect, icon.desc(parent).Translate());
bool applied = icon.applied(parent);
Texture2D texture = applied ? icon.cancel : icon.texture(parent);
GUI.DrawTexture(iconRect, texture);
//GUI.color = Color.white;
return Widgets.ButtonInvisible(iconRect, false);
}
public override void ProcessInput(Event ev)
{
SubIcon icon = lastClicked;
if (icon.state)
icon.unapply(parent);
else
icon.apply(parent);
}
[StaticConstructorOnStartup]//this is needed for textures
public abstract class SubIcon
{
public abstract Texture2D texture(Pawn pawn);
public abstract Vector2 offset { get; }
public abstract string desc(Pawn pawn);
public abstract bool applicable(Pawn pawn);
public abstract bool applied(Pawn pawn);
public abstract void apply(Pawn pawn);
public abstract void unapply(Pawn pawn);
static readonly Texture2D cancellText = ContentFinder<Texture2D>.Get("UI/Commands/cancel");
public virtual Texture2D cancel => cancellText;
public bool state;
}
[StaticConstructorOnStartup]
public class Comfort : SubIcon
{
//comfort raping
static readonly Texture2D iconAccept = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_off");
static readonly Texture2D iconRefuse = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_Refuse");
static readonly Texture2D iconCancel = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_on");
public override Texture2D texture(Pawn pawn) => (pawn.CanDesignateComfort() || pawn.IsDesignatedComfort()) && xxx.is_human(pawn) ? iconAccept : iconRefuse;
public override Texture2D cancel { get; } = iconCancel;
static readonly Vector2 posComf = new Vector2(IconGap + IconSize, 0);
public override Vector2 offset => posComf;
public override string desc(Pawn pawn) => pawn.CanDesignateComfort() ? "ForComfortDesc" :
!pawn.CanChangeDesignationPrisoner() ? "ForHeroRefuse2Desc" :
!pawn.CanChangeDesignationColonist() ? "ForHeroRefuse1Desc" : "ForComfortRefuseDesc";
public override bool applicable(Pawn pawn) => RJWSettings.rape_enabled && xxx.is_human(pawn);
public override bool applied(Pawn pawn) => pawn.IsDesignatedComfort();
public override void apply(Pawn pawn) => pawn.ToggleComfort();
public override void unapply(Pawn pawn) => pawn.ToggleComfort();
}
[StaticConstructorOnStartup]
public class Service : SubIcon
{
//whoring
static readonly Texture2D iconAccept = ContentFinder<Texture2D>.Get("UI/Commands/Service_off");
static readonly Texture2D iconRefuse = ContentFinder<Texture2D>.Get("UI/Commands/Service_Refuse");
static readonly Texture2D iconCancel = ContentFinder<Texture2D>.Get("UI/Commands/Service_on");
public override Texture2D texture(Pawn pawn) => (pawn.CanDesignateService() || pawn.IsDesignatedService()) && xxx.is_human(pawn) ? iconAccept : iconRefuse;
public override Texture2D cancel { get; } = iconCancel;
public override Vector2 offset { get; } = new Vector2(0, 0);
public override string desc(Pawn pawn) => pawn.CanDesignateService() ? "ForServiceDesc" :
!pawn.CanChangeDesignationPrisoner() ? "ForHeroRefuse2Desc" :
!pawn.CanChangeDesignationColonist() ? "ForHeroRefuse1Desc" : "ForServiceRefuseDesc";
public override bool applicable(Pawn pawn) => xxx.is_human(pawn);
public override bool applied(Pawn pawn) => pawn.IsDesignatedService() && xxx.is_human(pawn);
public override void apply(Pawn pawn) => pawn.ToggleService();
public override void unapply(Pawn pawn) => pawn.ToggleService();
}
[StaticConstructorOnStartup]
public class BreedingHuman : SubIcon
{
//Breed humanlike
static readonly Texture2D iconAccept = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_off");
static readonly Texture2D iconRefuse = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_Refuse");
static readonly Texture2D iconCancel = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Pawn_on");
public override Texture2D texture(Pawn pawn) => (pawn.CanDesignateBreeding() || pawn.IsDesignatedBreeding()) && xxx.is_human(pawn) ? iconAccept : iconRefuse;
public override Texture2D cancel { get; } = iconCancel;
public override Vector2 offset { get; } = new Vector2(0, IconSize + IconGap);
public override string desc(Pawn pawn) => pawn.CanDesignateBreeding() && xxx.is_human(pawn) ? "ForBreedingDesc" :
!pawn.CanChangeDesignationPrisoner() ? "ForHeroRefuse2Desc" :
!pawn.CanChangeDesignationColonist() ? "ForHeroRefuse1Desc" : "ForBreedingRefuseDesc";
public override bool applicable(Pawn pawn) => RJWSettings.bestiality_enabled && xxx.is_human(pawn);
public override bool applied(Pawn pawn) => pawn.IsDesignatedBreeding() && xxx.is_human(pawn);
public override void apply(Pawn pawn) => pawn.ToggleBreeding();
public override void unapply(Pawn pawn) => pawn.ToggleBreeding();
}
[StaticConstructorOnStartup]
public class BreedingAnimal : SubIcon
{
//Breed animal
static readonly Texture2D iconAccept = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Animal_off");
static readonly Texture2D iconCancel = ContentFinder<Texture2D>.Get("UI/Commands/Breeding_Animal_on");
public override Texture2D texture(Pawn pawn) => iconAccept;
public override Texture2D cancel { get; } = iconCancel;
public override Vector2 offset { get; } = new Vector2(0, IconSize + IconGap);
public override string desc(Pawn pawn) => !pawn.CanChangeDesignationPrisoner() ? "ForHeroRefuse2Desc" : "ForBreedingDesc";
public override bool applicable(Pawn pawn) => (pawn.CanDesignateBreeding() || pawn.IsDesignatedBreeding()) && xxx.is_animal(pawn);
public override bool applied(Pawn pawn) => pawn.IsDesignatedBreeding() && xxx.is_animal(pawn);
public override void apply(Pawn pawn) => pawn.ToggleBreeding();
public override void unapply(Pawn pawn) => pawn.ToggleBreeding();
}
[StaticConstructorOnStartup]
public class Breeder : SubIcon
{
//Breeder(fucker) animal
static readonly Texture2D iconAccept = ContentFinder<Texture2D>.Get("UI/Commands/Breeder_Animal_off");
static readonly Texture2D iconCancel = ContentFinder<Texture2D>.Get("UI/Commands/Breeder_Animal_on");
public override Texture2D texture(Pawn pawn) => iconAccept;
public override Texture2D cancel { get; } = iconCancel;
public override Vector2 offset { get; } = new Vector2(0, 0);
public override string desc(Pawn pawn) => !pawn.CanChangeDesignationPrisoner() ? "ForHeroRefuse2Desc" : "ForBreedingAnimalDesc";
public override bool applicable(Pawn pawn) => pawn.CanDesignateBreedingAnimal() || pawn.IsDesignatedBreedingAnimal();
public override bool applied(Pawn pawn) => pawn.IsDesignatedBreedingAnimal();
public override void apply(Pawn pawn) => pawn.ToggleBreedingAnimal();
public override void unapply(Pawn pawn) => pawn.ToggleBreedingAnimal();
}
[StaticConstructorOnStartup]
public class Milking : SubIcon
{
static readonly Texture2D iconAccept = ContentFinder<Texture2D>.Get("UI/Commands/Milking_off");
static readonly Texture2D iconCancel = ContentFinder<Texture2D>.Get("UI/Commands/Milking_on");
public override Texture2D texture(Pawn pawn) => iconAccept;
public override Texture2D cancel { get; } = iconCancel;
public override Vector2 offset { get; } = new Vector2(IconGap + IconSize, IconSize + IconGap);
public override string desc(Pawn pawn) => !pawn.CanChangeDesignationPrisoner() ? "ForHeroRefuse2Desc" : "ForMilkingDesc";
public override bool applicable(Pawn pawn) => pawn.CanDesignateMilking() || pawn.IsDesignatedMilking();
public override bool applied(Pawn pawn) => pawn.IsDesignatedMilking();
public override void apply(Pawn pawn) => pawn.ToggleMilking();
public override void unapply(Pawn pawn) => pawn.ToggleMilking();
}
[StaticConstructorOnStartup]
public class Hero : SubIcon
{
static readonly Texture2D iconAccept = ContentFinder<Texture2D>.Get("UI/Commands/Hero_off");
static readonly Texture2D iconCancel = ContentFinder<Texture2D>.Get("UI/Commands/Hero_on");
public override Texture2D texture(Pawn pawn) => iconAccept;
public override Texture2D cancel { get; } = iconCancel;
public override Vector2 offset { get; } = new Vector2(IconGap + IconSize, IconSize + IconGap);
//public override string desc(Pawn pawn) => pawn.CanDesignateHero() || (pawn.IsDesignatedHero() && pawn.IsHeroOwner()) ? "ForHeroDesc" : "Hero of " + SaveStorage.DataStore.GetPawnData(pawn).HeroOwner;
public override string desc(Pawn pawn) => pawn.CanDesignateHero() ? "ForHeroDesc" :
pawn.IsDesignatedHero() ? "Hero of " + SaveStorage.DataStore.GetPawnData(pawn).HeroOwner : "ForHeroDesc";
public override bool applicable(Pawn pawn) => pawn.CanDesignateHero() || pawn.IsDesignatedHero();
public override bool applied(Pawn pawn) => pawn.IsDesignatedHero();
public override void apply(Pawn pawn) => pawn.ToggleHero();
public override void unapply(Pawn pawn) => pawn.ToggleHero();
}
}
}
|
TDarksword/rjw
|
Source/Designators/_RJWdesignationsWidget.cs
|
C#
|
mit
| 11,439 |
using System.Collections.Generic;
using Harmony;
using RimWorld;
using UnityEngine;
using Verse;
namespace rjw
{
public static class Building_Bed_Patch
{
[HarmonyPatch(typeof(Building_Bed))]
[HarmonyPatch("ForPrisoners", MethodType.Setter)]
public static class ForPrisoners
{
[HarmonyPostfix]
public static void Postfix(Building_Bed __instance)
{
if (!__instance.ForPrisoners) return;
if (__instance is Building_WhoreBed)
{
Building_WhoreBed.Swap(__instance);
}
}
}
[HarmonyPatch(typeof(Building_Bed), "GetGizmos")]
public static class GetGizmos
{
[HarmonyPostfix]
public static void Postfix(Building_Bed __instance, ref IEnumerable<Gizmo> __result)
{
__result = Process(__instance, __result);
}
private static IEnumerable<Gizmo> Process(Building_Bed __instance, IEnumerable<Gizmo> __result)
{
foreach (var gizmo in __result)
{
yield return gizmo;
}
if (__instance!=null && !__instance.ForPrisoners && !__instance.Medical && __instance.def.building.bed_humanlike)
{
//--Log.Message("[RJW]Building_Bed_Patch::Process - before new Command_Toggle is called");
yield return
new Command_Toggle
{
defaultLabel = "CommandBedSetAsWhoreLabel".Translate(),
defaultDesc = "CommandBedSetAsWhoreDesc".Translate(),
icon = ContentFinder<Texture2D>.Get("UI/Commands/AsWhore"),
isActive = () => __instance is Building_WhoreBed,
toggleAction = () => Building_WhoreBed.Swap(__instance),
hotKey = KeyBindingDefOf.Misc4
};
}
}
}
}
}
|
TDarksword/rjw
|
Source/Harmony/Building_Bed_Patch.cs
|
C#
|
mit
| 1,594 |
using System.Reflection;
using Harmony;
using RimWorld;
using Verse;
namespace rjw
{
/// <summary>
/// Conditional patching class that only does patching if CnP is active
/// </summary>
public class CnPcompatibility
{
//CnP (or BnC) try to address the joy need of a child, prisoners don't have that.
//Considering how you can arrest children without rjw, it is more of a bug of that mod than ours.
[HarmonyPatch(typeof(Pawn_NeedsTracker), "BindDirectNeedFields")]
static class jfpk
{
[HarmonyPostfix]
static void postfix(ref Pawn_NeedsTracker __instance)
{
Pawn_NeedsTracker tr = __instance;
FieldInfo fieldInfo = AccessTools.Field(typeof(Pawn_NeedsTracker), "pawn");
Pawn pawn = fieldInfo.GetValue(__instance) as Pawn;
if (xxx.is_human(pawn) && pawn.ageTracker.CurLifeStageIndex < AgeStage.Teenager)
{
if (tr.TryGetNeed(NeedDefOf.Joy) == null)
{
MethodInfo method = AccessTools.Method(typeof(Pawn_NeedsTracker), "AddNeed");
method.Invoke(tr, new object[] { NeedDefOf.Joy });
}
}
}
}
//For whatever reason, harmony shits itself, when trying to patch non void private fields, below are variants the code that would work nicely, if it didn't
//[HarmonyPatch]
//[StaticConstructorOnStartup]
//internal static class joy_for_prison_kids
//{
// [HarmonyTargetMethod]
// static MethodBase CalculateMethod(HarmonyInstance instance)
// {
// var r = AccessTools.Method(typeof(Pawn_NeedsTracker), "ShouldHaveNeed");
// //Log.Message("Found method "+ r.ReturnType + ' ' + r.FullDescription());
// //Log.Message("Parameters " + r.GetType() );
// //Log.Message("return " + r.ReturnParameter);
// return AccessTools.Method(typeof(Pawn_NeedsTracker), "ShouldHaveNeed");
// }
// [HarmonyPrepare]
// static bool should_patch(HarmonyInstance instance)
// {
// Log.Clear();
// Log.Message("Will patch "+ xxx.RimWorldChildrenIsActive);
// return xxx.RimWorldChildrenIsActive;
// }
//doesn't work, gets: System.Reflection.TargetParameterCountException: parameters do not match signature
//static void Postfix(HarmonyInstance instance)
//{
// Log.Message("FOO");
//}
//[HarmonyPrefix]
//static bool foo(NeedDef nd)
//{
// Log.Message("Prerun ");
// return true;
//}
//[HarmonyPostfix]
//static void postfix(ref bool __result, ref Pawn_NeedsTracker __instance, NeedDef nd)
//{
// if (nd != NeedDefOf.Joy) { return; }
// FieldInfo fieldInfo = AccessTools.Field(typeof(Pawn_NeedsTracker), "pawn");
// Pawn pawn = fieldInfo.GetValue(__instance) as Pawn;
// if (pawn.ageTracker.CurLifeStageIndex < AgeStage.Teenager)
// {
// __result = true;
// }
//}
//}
public static void Patch(HarmonyInstance harmony)
{
if (!xxx.RimWorldChildrenIsActive) return;
Doit(harmony);
}
private static void Doit(HarmonyInstance harmony)
{
var original = typeof(RimWorldChildren.ChildrenUtility).GetMethod("CanBreastfeed");
var postfix = typeof(CnPcompatibility).GetMethod("CanBreastfeed");
harmony.Patch(original, null, new HarmonyMethod(postfix));
original = typeof(Building_Bed).GetMethod("get_AssigningCandidates");
postfix = typeof(CnPcompatibility).GetMethod("BedCandidates");
harmony.Patch(original, null, new HarmonyMethod(postfix));
//doesn't work cannot reflect private class
//original = typeof(RimWorldChildren.Hediff_UnhappyBaby).GetMethod("IsBabyUnhappy", BindingFlags.Static | BindingFlags.NonPublic);
//Log.Message("original is nul " + (original == null));
//var prefix = typeof(CnPcompatibility).GetMethod("IsBabyUnhappy");
//harmony.Patch(original, new HarmonyMethod(prefix), null);
}
private static void CanBreastfeed(ref bool __result, ref Pawn __instance)//Postfix
{
__result = __instance.health.hediffSet.HasHediff(HediffDef.Named("Lactating"));//I'm a simple man
}
private static void BedCandidates(ref IEnumerable<Pawn> __result, ref Building_Bed bed)
{
if (!RimWorldChildren.BedPatchMethods.IsCrib(bed)) return;
__result = bed.Map.mapPawns.FreeColonists.Where(x => x.ageTracker.CurLifeStageIndex <= 2 && x.Faction == Faction.OfPlayer);//Basically do all the work second time but with a tweak
}
private static bool IsBabyUnhappy(ref bool __result, ref RimWorldChildren.Hediff_UnhappyBaby __instance)
{
var pawn = __instance.pawn;
if ((pawn.needs?.joy.CurLevelPercentage??1) < 0.2f)
__result = true;
else
__result = false;
return false;
}
}
}
|
TDarksword/rjw
|
Source/Harmony/CnPcompatibility.cs
|
C#
|
mit
| 4,612 |
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Linq;
using HarmonyLib;
using RimWorld;
using Verse;
namespace rjw
{
[StaticConstructorOnStartup]
internal static class First
{
/*private static void show_bpr(String body_part_record_def_name)
{
var bpr = BodyDefOf.Human.AllParts.Find((BodyPartRecord can) => String.Equals(can.def.defName, body_part_record_def_name));
--Log.Message(body_part_record_def_name + " BPR internals:");
--Log.Message(" def: " + bpr.def.ToString());
--Log.Message(" parts: " + bpr.parts.ToString());
--Log.Message(" parts.count: " + bpr.parts.Count.ToString());
--Log.Message(" height: " + bpr.height.ToString());
--Log.Message(" depth: " + bpr.depth.ToString());
--Log.Message(" coverage: " + bpr.coverage.ToString());
--Log.Message(" groups: " + bpr.groups.ToString());
--Log.Message(" groups.count: " + bpr.groups.Count.ToString());
--Log.Message(" parent: " + bpr.parent.ToString());
--Log.Message (" fleshCoverage: " + bpr.fleshCoverage.ToString ());
--Log.Message (" absoluteCoverage: " + bpr.absoluteCoverage.ToString ());
--Log.Message (" absoluteFleshCoverage: " + bpr.absoluteFleshCoverage.ToString ());
}*/
//Children mod use same defname. but not has worker class. so overriding here.
public static void inject_Reproduction()
{
PawnCapacityDef reproduction = DefDatabase<PawnCapacityDef>.GetNamed("RJW_Fertility");
reproduction.workerClass = typeof(PawnCapacityWorker_Fertility);
}
public static void inject_whoringtab()
{
//InjectTab(typeof(MainTab.MainTabWindow_Brothel), def => def.race?.Humanlike == true);
}
private static void InjectTab(Type tabType, Func<ThingDef, bool> qualifier)
{
var defs = DefDatabase<ThingDef>.AllDefs.Where(qualifier).ToList();
defs.RemoveDuplicates();
var tabBase = InspectTabManager.GetSharedInstance(tabType);
foreach (var def in defs)
{
if (def.inspectorTabs == null || def.inspectorTabsResolved == null) continue;
if (!def.inspectorTabs.Contains(tabType))
{
def.inspectorTabs.Add(tabType);
def.inspectorTabsResolved.Add(tabBase);
//Log.Message(def.defName+": "+def.inspectorTabsResolved.Select(d=>d.GetType().Name).Aggregate((a,b)=>a+", "+b));
}
}
}
private static void inject_recipes()
{
//--ModLog.Message(" First::inject_recipes");
// Inject the recipes to create the artificial privates into the crafting spot or machining bench.
// BUT, also dynamically detect if EPOE is loaded and, if it is, inject the recipes into EPOE's
// crafting benches instead.
try
{
//Vanilla benches
var cra_spo = DefDatabase<ThingDef>.GetNamed("CraftingSpot");
var mac_ben = DefDatabase<ThingDef>.GetNamed("TableMachining");
var fab_ben = DefDatabase<ThingDef>.GetNamed("FabricationBench");
var tai_ben = DefDatabase<ThingDef>.GetNamed("ElectricTailoringBench");
//EPOE benches
var bas_ben = DefDatabase<ThingDef>.GetNamed("TableBasicProsthetic", false);
var sim_ben = DefDatabase<ThingDef>.GetNamed("TableSimpleProsthetic", false);
var bio_ben = DefDatabase<ThingDef>.GetNamed("TableBionics", false);
(bas_ben ?? cra_spo).AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakePegDick"));
(sim_ben ?? mac_ben).AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeHydraulicAnus"));
(sim_ben ?? mac_ben).AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeHydraulicBreasts"));
(sim_ben ?? mac_ben).AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeHydraulicPenis"));
(sim_ben ?? mac_ben).AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeHydraulicVagina"));
(bio_ben ?? fab_ben).AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeBionicAnus"));
(bio_ben ?? fab_ben).AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeBionicBreasts"));
(bio_ben ?? fab_ben).AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeBionicPenis"));
(bio_ben ?? fab_ben).AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeBionicVagina"));
// Inject the bondage gear recipes into their appropriate benches
//if (xxx.config.bondage_gear_enabled)
//{
fab_ben.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeHololock"));
//tai_ben.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeArmbinder"));
//tai_ben.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeChastityBelt"));
//tai_ben.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeChastityBeltO"));
//tai_ben.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeChastityCage"));
//tai_ben.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeBallGag"));
//tai_ben.AllRecipes.Add(DefDatabase<RecipeDef>.GetNamed("MakeRingGag"));
//}
}
catch
{
ModLog.Warning("Unable to inject recipes.");
ModLog.Warning("Yay! Your medieval mod broke recipes. And, likely, parts too, expect errors.");
}
}
/*private static void show_bs(Backstory bs)
{
--Log.Message("Backstory \"" + bs.Title + "\" internals:");
--Log.Message(" identifier: " + bs.identifier);
--Log.Message(" slot: " + bs.slot.ToString());
--Log.Message(" Title: " + bs.Title);
--Log.Message(" TitleShort: " + bs.TitleShort);
--Log.Message(" baseDesc: " + bs.baseDesc);
--Log.Message(" skillGains: " + ((bs.skillGains == null) ? "null" : bs.skillGains.ToString()));
--Log.Message(" skillGainsResolved: " + ((bs.skillGainsResolved == null) ? "null" : bs.skillGainsResolved.ToString()));
--Log.Message(" workDisables: " + bs.workDisables.ToString());
--Log.Message(" requiredWorkTags: " + bs.requiredWorkTags.ToString());
--Log.Message(" spawnCategories: " + bs.spawnCategories.ToString());
--Log.Message(" bodyTypeGlobal: " + bs.bodyTypeGlobal.ToString());
--Log.Message(" bodyTypeFemale: " + bs.bodyTypeFemale.ToString());
--Log.Message(" bodyTypeMale: " + bs.bodyTypeMale.ToString());
--Log.Message(" forcedTraits: " + ((bs.forcedTraits == null) ? "null" : bs.forcedTraits.ToString()));
--Log.Message(" disallowedTraits: " + ((bs.disallowedTraits == null) ? "null" : bs.disallowedTraits.ToString()));
--Log.Message(" shuffleable: " + bs.shuffleable.ToString());
}*/
//Quick check to see if an another mod is loaded.
private static bool IsLoaded(string mod)
{
return LoadedModManager.RunningModsListForReading.Any(x => x.Name == mod);
}
private static void CheckingCompatibleMods()
{
{//Humanoid Alien Races Framework 2.0
xxx.xenophobia = DefDatabase<TraitDef>.GetNamedSilentFail("Xenophobia");
if (xxx.xenophobia is null)
{
xxx.AlienFrameworkIsActive = false;
}
else
{
xxx.AlienFrameworkIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("Humanoid Alien Races 2.0 is detected. Xenophile and Xenophobe traits active.");
}
}
{//relations-orientation mods
{//RomanceDiversified
xxx.straight = DefDatabase<TraitDef>.GetNamedSilentFail("Straight");
xxx.faithful = DefDatabase<TraitDef>.GetNamedSilentFail("Faithful");
xxx.philanderer = DefDatabase<TraitDef>.GetNamedSilentFail("Philanderer");
xxx.polyamorous = DefDatabase<TraitDef>.GetNamedSilentFail("Polyamorous");
if (xxx.straight is null || xxx.faithful is null || xxx.philanderer is null || xxx.polyamorous is null)
{
xxx.RomanceDiversifiedIsActive = false;
}
else
{
xxx.RomanceDiversifiedIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("RomanceDiversified is detected.");
}
}
{//[SYR] Individuality
xxx.SYR_CreativeThinker = DefDatabase<TraitDef>.GetNamedSilentFail("SYR_CreativeThinker");
xxx.SYR_Haggler = DefDatabase<TraitDef>.GetNamedSilentFail("SYR_Haggler");
if (xxx.SYR_CreativeThinker is null || xxx.SYR_Haggler is null)
{
xxx.IndividualityIsActive = false;
if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.SYRIndividuality)
RJWPreferenceSettings.sexuality_distribution = RJWPreferenceSettings.Rjw_sexuality.Vanilla;
}
else
{
xxx.IndividualityIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("Individuality is detected.");
}
}
{//Psychology
xxx.prude = DefDatabase<TraitDef>.GetNamedSilentFail("Prude");
xxx.lecher = DefDatabase<TraitDef>.GetNamedSilentFail("Lecher");
xxx.polygamous = DefDatabase<TraitDef>.GetNamedSilentFail("Polygamous");
if (xxx.prude is null || xxx.lecher is null || xxx.polygamous is null)
{
xxx.PsychologyIsActive = false;
if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.Psychology)
RJWPreferenceSettings.sexuality_distribution = RJWPreferenceSettings.Rjw_sexuality.Vanilla;
}
else
{
xxx.PsychologyIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("Psychology is detected. (Note: only partially supported)");
}
}
if (xxx.PsychologyIsActive == false && xxx.IndividualityIsActive == false)
{
if (RJWPreferenceSettings.sexuality_distribution != RJWPreferenceSettings.Rjw_sexuality.Vanilla)
{
RJWPreferenceSettings.sexuality_distribution = RJWPreferenceSettings.Rjw_sexuality.Vanilla;
}
}
}
{//SimpleSlavery
xxx.Enslaved = DefDatabase<HediffDef>.GetNamedSilentFail("Enslaved");
if (xxx.Enslaved is null)
{
xxx.SimpleSlaveryIsActive = false;
}
else
{
xxx.SimpleSlaveryIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("SimpleSlavery is detected.");
}
}
{//[KV] Consolidated Traits
xxx.RCT_NeatFreak = DefDatabase<TraitDef>.GetNamedSilentFail("RCT_NeatFreak");
xxx.RCT_Savant = DefDatabase<TraitDef>.GetNamedSilentFail("RCT_Savant");
xxx.RCT_Inventor = DefDatabase<TraitDef>.GetNamedSilentFail("RCT_Inventor");
xxx.RCT_AnimalLover = DefDatabase<TraitDef>.GetNamedSilentFail("RCT_AnimalLover");
if (xxx.RCT_NeatFreak is null || xxx.RCT_Savant is null || xxx.RCT_Inventor is null || xxx.RCT_AnimalLover is null)
{
xxx.CTIsActive = false;
}
else
{
xxx.CTIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("Consolidated Traits found, adding trait compatibility.");
}
}
{//Rimworld of Magic
xxx.Succubus = DefDatabase<TraitDef>.GetNamedSilentFail("Succubus");
xxx.Warlock = DefDatabase<TraitDef>.GetNamedSilentFail("Warlock");
xxx.TM_Mana = DefDatabase<NeedDef>.GetNamedSilentFail("TM_Mana");
xxx.TM_ShapeshiftHD = DefDatabase<HediffDef>.GetNamedSilentFail("TM_ShapeshiftHD");
if (xxx.Succubus is null || xxx.Warlock is null || xxx.TM_Mana is null || xxx.TM_ShapeshiftHD is null)
{
xxx.RoMIsActive = false;
}
else
{
xxx.RoMIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("Rimworld of Magic is detected.");
}
}
{//Nightmare Incarnation
xxx.NI_Need_Mana = DefDatabase<NeedDef>.GetNamedSilentFail("NI_Need_Mana");
if (xxx.NI_Need_Mana is null)
{
xxx.NightmareIncarnationIsActive = false;
}
else
{
xxx.NightmareIncarnationIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("Nightmare Incarnation is detected.");
}
}
{//DubsBadHygiene
xxx.DBHThirst = DefDatabase<NeedDef>.GetNamedSilentFail("DBHThirst");
if (xxx.DBHThirst is null)
{
xxx.DubsBadHygieneIsActive = false;
}
else
{
xxx.DubsBadHygieneIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("Dubs Bad Hygiene is detected.");
}
}
{//Immortals
xxx.IH_Immortal = DefDatabase<HediffDef>.GetNamedSilentFail("IH_Immortal");
if (xxx.IH_Immortal is null)
{
xxx.ImmortalsIsActive = false;
}
else
{
xxx.ImmortalsIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("Immortals is detected.");
}
}
{//Children and Pregnancy
xxx.BabyState = DefDatabase<HediffDef>.GetNamedSilentFail("BabyState");
xxx.PostPregnancy = DefDatabase<HediffDef>.GetNamedSilentFail("PostPregnancy");
xxx.Lactating = DefDatabase<HediffDef>.GetNamedSilentFail("Lactating");
xxx.NoManipulationFlag = DefDatabase<HediffDef>.GetNamedSilentFail("NoManipulationFlag");
xxx.IGaveBirthFirstTime = DefDatabase<ThoughtDef>.GetNamedSilentFail("IGaveBirthFirstTime");
xxx.IGaveBirth = DefDatabase<ThoughtDef>.GetNamedSilentFail("IGaveBirth");
xxx.PartnerGaveBirth = DefDatabase<ThoughtDef>.GetNamedSilentFail("PartnerGaveBirth");
if (xxx.BabyState is null || xxx.PostPregnancy is null || xxx.Lactating is null || xxx.NoManipulationFlag is null || xxx.IGaveBirthFirstTime is null || xxx.IGaveBirth is null || xxx.PartnerGaveBirth is null)
{
xxx.RimWorldChildrenIsActive = false;
}
else
{
xxx.RimWorldChildrenIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("Children&Pregnancy is detected.");
}
}
{//Babies and Children
xxx.BnC_RJW_PostPregnancy = DefDatabase<HediffDef>.GetNamedSilentFail("BnC_RJW_PostPregnancy");
}
{//Combat Extended
xxx.MuscleSpasms = DefDatabase<HediffDef>.GetNamedSilentFail("MuscleSpasms");
if (xxx.MuscleSpasms is null)
{
xxx.CombatExtendedIsActive = false;
}
else
{
xxx.CombatExtendedIsActive = true;
if (RJWSettings.DevMode) ModLog.Message("Combat Extended is detected. Current compatibility unknown, use at your own risk. ");
}
}
}
static First()
{
//--ModLog.Message(" First::First() called");
// check for required mods
//CheckModRequirements();
CheckIncompatibleMods();
CheckingCompatibleMods();
inject_Reproduction();
inject_recipes();
nymph_backstories.init();
//bondage_gear_tradeability.init();
var har = new Harmony("rjw");
har.PatchAll(Assembly.GetExecutingAssembly());
PATCH_Pawn_ApparelTracker_TryDrop.apply(har);
//CnPcompatibility.Patch(har); //CnP IS NO OUT YET
}
internal static void CheckModRequirements()
{
//--Log.Message("First::CheckModRequirements() called");
List<string> required_mods = new List<string> {
"HugsLib",
};
foreach (string required_mod in required_mods)
{
bool found = false;
foreach (ModMetaData installed_mod in ModLister.AllInstalledMods)
{
if (installed_mod.Active && installed_mod.Name.Contains(required_mod))
{
found = true;
}
if (!found)
{
ErrorMissingRequirement(required_mod);
}
}
}
}
internal static void CheckIncompatibleMods()
{
//--Log.Message("First::CheckIncompatibleMods() called");
List<string> incompatible_mods = new List<string> {
"Bogus Test Mod That Doesn't Exist",
"Lost Forest"
};
foreach (string incompatible_mod in incompatible_mods)
{
foreach (ModMetaData installed_mod in ModLister.AllInstalledMods)
{
if (installed_mod.Active && installed_mod.Name.Contains(incompatible_mod))
{
ErrorIncompatibleMod(installed_mod);
}
}
}
}
internal static void ErrorMissingRequirement(string missing)
{
ModLog.Error("Initialization error: Unable to find required mod '" + missing + "' in mod list");
}
internal static void ErrorIncompatibleMod(ModMetaData othermod)
{
ModLog.Error("Initialization Error: Incompatible mod '" + othermod.Name + "' detected in mod list");
}
}
}
|
TDarksword/rjw
|
Source/Harmony/First.cs
|
C#
|
mit
| 15,396 |
using HarmonyLib;
using Verse;
/// <summary>
/// patches PawnGenerator to add genitals to pawns and spawn nymph when needed
/// </summary>
namespace rjw
{
[HarmonyPatch(typeof(PawnGenerator), "GenerateNewPawnInternal")]
static class Patch_PawnGenerator
{
[HarmonyPrefix]
static void Before_GenerateNewPawnInternal(ref PawnGenerationRequest request)
{
if (Nymph_Generator.IsNymph(request))
{
request = new PawnGenerationRequest(
kind: request.KindDef = Nymph_Generator.GetFixedNymphPawnKindDef(),
canGeneratePawnRelations: request.CanGeneratePawnRelations = false,
validatorPreGear: Nymph_Generator.IsNymphBodyType,
validatorPostGear: Nymph_Generator.IsNymphBodyType,
fixedGender: request.FixedGender = Nymph_Generator.RandomNymphGender()
);
}
}
[HarmonyPostfix]
static void After_GenerateNewPawnInternal(ref PawnGenerationRequest request, ref Pawn __result)
{
if (Nymph_Generator.IsNymph(request))
{
Nymph_Generator.set_story(__result);
Nymph_Generator.set_skills(__result);
}
//ModLog.Message("After_GenerateNewPawnInternal:: " + xxx.get_pawnname(__result));
if (CompRJW.Comp(__result) != null && CompRJW.Comp(__result).orientation == Orientation.None)
{
//ModLog.Message("After_GenerateNewPawnInternal::Sexualize " + xxx.get_pawnname(__result));
CompRJW.Comp(__result).Sexualize(__result);
}
}
}
}
|
TDarksword/rjw
|
Source/Harmony/Patch_PawnGenerator.cs
|
C#
|
mit
| 1,406 |
using HarmonyLib;
using RimWorld;
using UnityEngine;
using Verse;
using Verse.Sound;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
namespace rjw
{
[HarmonyPatch(typeof(CharacterCardUtility), "DrawCharacterCard")]
public static class SexcardPatch
{
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
MethodInfo HighlightOpportunity = AccessTools.Method(typeof(UIHighlighter), "HighlightOpportunity");
MethodInfo SexualityCardToggle = AccessTools.Method(typeof(SexcardPatch), nameof(SexualityCardToggle));
bool traits = false;
bool found = false;
foreach (CodeInstruction i in instructions)
{
if (found)
{
yield return new CodeInstruction(OpCodes.Ldarg_0) { labels = i.labels.ListFullCopy() };//rect
yield return new CodeInstruction(OpCodes.Ldarg_1);//pawn
yield return new CodeInstruction(OpCodes.Ldarg_3);//creationRect
yield return new CodeInstruction(OpCodes.Call, SexualityCardToggle);
found = false;
i.labels.Clear();
}
if (i.opcode == OpCodes.Call && i.operand == HighlightOpportunity)
{
found = true;
}
if (i.opcode == OpCodes.Ldstr && i.operand.Equals("Traits"))
{
traits = true;
}
if (traits && i.opcode == OpCodes.Ldc_R4 && i.operand.Equals(2f))//replaces rect y calculation
{
yield return new CodeInstruction(OpCodes.Ldc_R4, 0f);
traits = false;
continue;
}
yield return i;
}
}
public static void SexualityCardToggle(Rect rect, Pawn pawn, Rect creationRect)
{
if (pawn == null) return;
if (CompRJW.Comp(pawn) == null) return;
Rect rectNew = new Rect(CharacterCardUtility.BasePawnCardSize.x - 50f, 2f, 24f, 24f);
if (Current.ProgramState != ProgramState.Playing)
{
if (xxx.IndividualityIsActive) // Move icon lower to avoid overlap.
rectNew = new Rect(creationRect.width - 24f, 56f, 24f, 24f);
else
rectNew = new Rect(creationRect.width - 24f, 30f, 24f, 24f);
}
Color old = GUI.color;
GUI.color = rectNew.Contains(Event.current.mousePosition) ? new Color(0.25f, 0.59f, 0.75f) : new Color(1f, 1f, 1f);
// TODO: Replace the placeholder icons with... something
if (CompRJW.Comp(pawn).quirks.ToString() != "None")
GUI.DrawTexture(rectNew, ContentFinder<Texture2D>.Get("UI/Commands/Service_on"));
else
GUI.DrawTexture(rectNew, ContentFinder<Texture2D>.Get("UI/Commands/Service_off"));
TooltipHandler.TipRegion(rectNew, "SexcardTooltip".Translate());
if (Widgets.ButtonInvisible(rectNew))
{
SoundDefOf.InfoCard_Open.PlayOneShotOnCamera();
Find.WindowStack.Add(new Dialog_Sexcard(pawn));
}
GUI.color = old;
}
}
}
|
TDarksword/rjw
|
Source/Harmony/SexualityCard.cs
|
C#
|
mit
| 2,737 |
using System.Text;
using RimWorld;
using UnityEngine;
using Verse;
using System;
using System.Collections.Generic;
using System.Linq;
using Multiplayer.API;
namespace rjw
{
//TODO: check slime stuff working in mp
//TODO: separate menus in sub scripts
//TODO: add demon switch parts
//TODO: figure out and make interface?
//TODO: add vibration toggle for bionics(+50% partner satisfaction?)
public class Dialog_Sexcard : Window
{
private readonly Pawn pawn;
public Dialog_Sexcard(Pawn editFor)
{
pawn = editFor;
}
public static breasts Breasts;
public enum breasts
{
selectone,
none,
featureless_chest,
flat_breasts,
small_breasts,
average_breasts,
large_breasts,
huge_breasts,
slime_breasts,
};
public static anuses Anuses;
public enum anuses
{
selectone,
none,
micro_anus,
tight_anus,
average_anus,
loose_anus,
gaping_anus,
slime_anus,
};
public static vaginas Vaginas;
public enum vaginas
{
selectone,
none,
micro_vagina,
tight_vagina,
average_vagina,
loose_vagina,
gaping_vagina,
slime_vagina,
feline_vagina,
canine_vagina,
equine_vagina,
dragon_vagina,
};
public static penises Penises;
public enum penises
{
selectone,
none,
micro_penis,
small_penis,
average_penis,
big_penis,
huge_penis,
slime_penis,
feline_penis,
canine_penis,
equine_penis,
dragon_penis,
raccoon_penis,
hemipenis,
crocodilian_penis,
};
public void SexualityCard(Rect rect, Pawn pawn)
{
CompRJW comp = pawn.TryGetComp<CompRJW>();
if (pawn == null || comp == null) return;
Text.Font = GameFont.Medium;
Rect rect1 = new Rect(8f, 4f, rect.width - 8f, rect.height - 20f);
Widgets.Label(rect1, "RJW");//rjw
Text.Font = GameFont.Tiny;
float num = rect1.y + 40f;
Rect row1 = new Rect(10f, num, rect.width - 8f, 24f);//sexuality
Rect row2 = new Rect(10f, num + 24, rect.width - 8f, 24f);//quirks
Rect row3 = new Rect(10f, num + 48, rect.width - 8f, 24f);//whore price
//Rect sexuality_button = new Rect(10f, rect1.height - 0f, rect.width - 8f, 24f);//change sex pref
Rect button1 = new Rect(10f, rect1.height - 10f, rect.width - 8f, 24f);//re sexualize
Rect button2 = new Rect(10f, rect1.height - 34f, rect.width - 8f, 24f);//archtech toggle
Rect button3 = new Rect(10f, rect1.height - 58f, rect.width - 8f, 24f);//breast
Rect button4 = new Rect(10f, rect1.height - 82f, rect.width - 8f, 24f);//anus
Rect button5 = new Rect(10f, rect1.height - 106f, rect.width - 8f, 24f);//vagina
Rect button6 = new Rect(10f, rect1.height - 130f, rect.width - 8f, 24f);//penis 1
Rect button7 = new Rect(10f, rect1.height - 154f, rect.width - 8f, 24f);//penis 2
DrawSexuality(pawn, row1);
DrawQuirks(pawn, row2);
DrawWhoring(pawn, row3);
// TODO: Add translations. or not
if (Prefs.DevMode || Current.ProgramState != ProgramState.Playing)
{
if (Widgets.ButtonText(button1, Current.ProgramState != ProgramState.Playing ? "Reroll sexuality" : "[DEV] Reroll sexuality"))
{
Re_sexualize(pawn);
}
}
if (pawn.health.hediffSet.HasHediff(Genital_Helper.archotech_penis) || pawn.health.hediffSet.HasHediff(Genital_Helper.archotech_vagina))
{
if (pawn.health.hediffSet.HasHediff(HediffDef.Named("ImpregnationBlocker")))
{
if (Widgets.ButtonText(button2, "[Archotech genitalia] Enable reproduction"))
{
Change_Archotechmode(pawn);
}
}
else if (!pawn.health.hediffSet.HasHediff(HediffDef.Named("FertilityEnhancer")))
{
if (Widgets.ButtonText(button2, "[Archotech genitalia] Enchance fertility"))
{
Change_Archotechmode(pawn);
}
}
else if (Widgets.ButtonText(button2, "[Archotech genitalia] Disable reproduction"))
{
Change_Archotechmode(pawn);
}
}
// TODO: add mp synchronizers
// TODO: clean that mess
// TODO: add demon toggles
if (MP.IsInMultiplayer)
return;
//List<String> Parts = null;
//if (xxx.is_slime(pawn))
// Parts = new List<string>(DefDatabase<StringListDef>.GetNamed("SlimeMorphFilters").strings);
//if (xxx.is_demon(pawn))
// Parts = new List<string>(DefDatabase<StringListDef>.GetNamed("DemonMorphFilters").strings);
// TODO: replace that mess with floating menu
//if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && Event.current.clickCount == 2 && Mouse.IsOver(rect))
//{
//Event.current.Use();//?
//DrawMedOperationsTab(0, pawn, Parts,0);
//}
//if (Parts.Any() && (pawn.IsColonistPlayerControlled || pawn.IsPrisonerOfColony))
//if (xxx.is_slime(pawn) && (pawn.IsColonistPlayerControlled || pawn.IsPrisonerOfColony))
//{
// BodyPartRecord bpr_genitalia = Genital_Helper.get_genitals(pawn);
// BodyPartRecord bpr_breasts = Genital_Helper.get_breasts(pawn);
// BodyPartRecord bpr_anus = Genital_Helper.get_anus(pawn);
// BodyPartRecord bpr = null;
// HediffDef hed = null;
// if (Widgets.ButtonText(button3, "Morph breasts"))
// {
// Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>()
// {
// new FloatMenuOption("none", (() => Breasts = breasts.none), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.featureless_chest.label.CapitalizeFirst(), (() => Breasts = breasts.featureless_chest), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.flat_breasts.label.CapitalizeFirst(), (() => Breasts = breasts.flat_breasts), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.small_breasts.label.CapitalizeFirst(), (() => Breasts = breasts.small_breasts), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.average_breasts.label.CapitalizeFirst(), (() => Breasts = breasts.average_breasts), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.large_breasts.label.CapitalizeFirst(), (() => Breasts = breasts.large_breasts), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.huge_breasts.label.CapitalizeFirst(), (() => Breasts = breasts.huge_breasts), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.slime_breasts.label.CapitalizeFirst(), (() => Breasts = breasts.slime_breasts), MenuOptionPriority.Default),
// }));
// }
// switch (Breasts)
// {
// case breasts.none:
// bpr = bpr_breasts;
// break;
// case breasts.featureless_chest:
// bpr = bpr_breasts;
// hed = Genital_Helper.featureless_chest;
// break;
// case breasts.flat_breasts:
// bpr = bpr_breasts;
// hed = Genital_Helper.flat_breasts;
// break;
// case breasts.small_breasts:
// bpr = bpr_breasts;
// hed = Genital_Helper.small_breasts;
// break;
// case breasts.average_breasts:
// bpr = bpr_breasts;
// hed = Genital_Helper.average_breasts;
// break;
// case breasts.large_breasts:
// bpr = bpr_breasts;
// hed = Genital_Helper.large_breasts;
// break;
// case breasts.huge_breasts:
// bpr = bpr_breasts;
// hed = Genital_Helper.huge_breasts;
// break;
// case breasts.slime_breasts:
// bpr = bpr_breasts;
// hed = Genital_Helper.slime_breasts;
// break;
// default:
// break;
// }
// if (Widgets.ButtonText(button4, "Morph anus"))
// {
// Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>()
// {
// new FloatMenuOption("none", (() => Anuses = anuses.none), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.micro_anus.label.CapitalizeFirst(), (() => Anuses = anuses.micro_anus), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.tight_anus.label.CapitalizeFirst(), (() => Anuses = anuses.tight_anus), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.average_anus.label.CapitalizeFirst(), (() => Anuses = anuses.average_anus), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.loose_anus.label.CapitalizeFirst(), (() => Anuses = anuses.loose_anus), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.gaping_anus.label.CapitalizeFirst(), (() => Anuses = anuses.gaping_anus), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.slime_anus.label.CapitalizeFirst(), (() => Anuses = anuses.slime_anus), MenuOptionPriority.Default),
// }));
// }
// switch (Anuses)
// {
// case anuses.none:
// bpr = bpr_anus;
// break;
// case anuses.micro_anus:
// bpr = bpr_anus;
// hed = Genital_Helper.micro_anus;
// break;
// case anuses.tight_anus:
// bpr = bpr_anus;
// hed = Genital_Helper.tight_anus;
// break;
// case anuses.average_anus:
// bpr = bpr_anus;
// hed = Genital_Helper.average_anus;
// break;
// case anuses.loose_anus:
// bpr = bpr_anus;
// hed = Genital_Helper.loose_anus;
// break;
// case anuses.gaping_anus:
// bpr = bpr_anus;
// hed = Genital_Helper.gaping_anus;
// break;
// case anuses.slime_anus:
// bpr = bpr_anus;
// hed = Genital_Helper.slime_anus;
// break;
// default:
// break;
// }
// if (Widgets.ButtonText(button5, "Morph vagina"))
// {
// Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>()
// {
// new FloatMenuOption("none", (() => Vaginas = vaginas.none), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.micro_vagina.label.CapitalizeFirst(), (() => Vaginas = vaginas.micro_vagina), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.tight_vagina.label.CapitalizeFirst(), (() => Vaginas = vaginas.tight_vagina), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.average_vagina.label.CapitalizeFirst(), (() => Vaginas = vaginas.average_vagina), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.loose_vagina.label.CapitalizeFirst(), (() => Vaginas = vaginas.loose_vagina), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.gaping_vagina.label.CapitalizeFirst(), (() => Vaginas = vaginas.gaping_vagina), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.slime_vagina.label.CapitalizeFirst(), (() => Vaginas = vaginas.slime_vagina), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.feline_vagina.label.CapitalizeFirst(), (() => Vaginas = vaginas.feline_vagina), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.canine_vagina.label.CapitalizeFirst(), (() => Vaginas = vaginas.canine_vagina), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.equine_vagina.label.CapitalizeFirst(), (() => Vaginas = vaginas.equine_vagina), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.dragon_vagina.label.CapitalizeFirst(), (() => Vaginas = vaginas.dragon_vagina), MenuOptionPriority.Default),
// }));
// }
// switch (Vaginas)
// {
// case vaginas.none:
// bpr = bpr_genitalia;
// break;
// case vaginas.micro_vagina:
// bpr = bpr_genitalia;
// hed = Genital_Helper.micro_vagina;
// break;
// case vaginas.tight_vagina:
// bpr = bpr_genitalia;
// hed = Genital_Helper.tight_vagina;
// break;
// case vaginas.average_vagina:
// bpr = bpr_genitalia;
// hed = Genital_Helper.average_vagina;
// break;
// case vaginas.loose_vagina:
// bpr = bpr_genitalia;
// hed = Genital_Helper.loose_vagina;
// break;
// case vaginas.gaping_vagina:
// bpr = bpr_genitalia;
// hed = Genital_Helper.gaping_vagina;
// break;
// case vaginas.slime_vagina:
// bpr = bpr_genitalia;
// hed = Genital_Helper.slime_vagina;
// break;
// case vaginas.feline_vagina:
// bpr = bpr_genitalia;
// hed = Genital_Helper.feline_vagina;
// break;
// case vaginas.canine_vagina:
// bpr = bpr_genitalia;
// hed = Genital_Helper.canine_vagina;
// break;
// case vaginas.equine_vagina:
// bpr = bpr_genitalia;
// hed = Genital_Helper.equine_vagina;
// break;
// case vaginas.dragon_vagina:
// bpr = bpr_genitalia;
// hed = Genital_Helper.dragon_vagina;
// break;
// default:
// break;
// }
// if (Widgets.ButtonText(button6, "Morph penis"))
// {
// Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>()
// {
// new FloatMenuOption("none", (() => Penises = penises.none), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.micro_penis.label.CapitalizeFirst(), (() => Penises = penises.micro_penis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.small_penis.label.CapitalizeFirst(), (() => Penises = penises.small_penis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.average_penis.label.CapitalizeFirst(), (() => Penises = penises.average_penis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.big_penis.label.CapitalizeFirst(), (() => Penises = penises.big_penis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.huge_penis.label.CapitalizeFirst(), (() => Penises = penises.huge_penis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.slime_penis.label.CapitalizeFirst(), (() => Penises = penises.slime_penis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.feline_penis.label.CapitalizeFirst(), (() => Penises = penises.feline_penis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.canine_penis.label.CapitalizeFirst(), (() => Penises = penises.canine_penis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.equine_penis.label.CapitalizeFirst(), (() => Penises = penises.equine_penis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.dragon_penis.label.CapitalizeFirst(), (() => Penises = penises.dragon_penis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.raccoon_penis.label.CapitalizeFirst(), (() => Penises = penises.raccoon_penis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.hemipenis.label.CapitalizeFirst(), (() => Penises = penises.hemipenis), MenuOptionPriority.Default),
// new FloatMenuOption(Genital_Helper.crocodilian_penis.label.CapitalizeFirst(), (() => Penises = penises.crocodilian_penis), MenuOptionPriority.Default),
// }));
// }
// switch (Penises)
// {
// case penises.none:
// bpr = bpr_genitalia;
// break;
// case penises.micro_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.micro_penis;
// break;
// case penises.small_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.small_penis;
// break;
// case penises.average_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.average_penis;
// break;
// case penises.big_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.big_penis;
// break;
// case penises.huge_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.huge_penis;
// break;
// case penises.slime_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.slime_penis;
// break;
// case penises.feline_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.feline_penis;
// break;
// case penises.canine_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.canine_penis;
// break;
// case penises.equine_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.equine_penis;
// break;
// case penises.dragon_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.dragon_penis;
// break;
// case penises.raccoon_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.raccoon_penis;
// break;
// case penises.hemipenis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.hemipenis;
// break;
// case penises.crocodilian_penis:
// bpr = bpr_genitalia;
// hed = Genital_Helper.crocodilian_penis;
// break;
// default:
// break;
// }
// if (bpr != null)
// {
// //Log.Message("start ");
// if (bpr != bpr_genitalia)
// {
// if (pawn.needs.TryGetNeed<Need_Food>().CurLevel > 0.5f)
// {
// pawn.needs.food.CurLevel -= 0.5f;
// pawn.health.RestorePart(bpr);
// if (hed != null)
// pawn.health.AddHediff(hed, bpr);
// }
// Anuses = anuses.selectone;
// Breasts = breasts.selectone;
// }
// else if (bpr == bpr_genitalia && Vaginas != vaginas.selectone)
// {
// if (pawn.needs.TryGetNeed<Need_Food>().CurLevel > 0.5f)
// {
// pawn.needs.food.CurLevel -= 0.5f;
// List<Hediff> list = new List<Hediff>();
// foreach (Hediff heddif in pawn.health.hediffSet.hediffs.Where(x =>
// x.Part == bpr &&
// x.def.defName.ToLower().Contains("vagina")))
// list.Add(heddif);
// foreach (Hediff heddif in list)
// pawn.health.hediffSet.hediffs.Remove(heddif);
// if (hed != null)
// pawn.health.AddHediff(hed, bpr);
// }
// Vaginas = vaginas.selectone;
// }
// else if (bpr == bpr_genitalia && Penises != penises.selectone)
// {
// if (pawn.needs.TryGetNeed<Need_Food>().CurLevel > 0.5f)
// {
// pawn.needs.food.CurLevel -= 0.5f;
// List<Hediff> list = new List<Hediff>();
// foreach (Hediff heddif in pawn.health.hediffSet.hediffs.Where(x =>
// x.Part == bpr &&
// x.def.defName.ToLower().Contains("penis") ||
// x.def.defName.ToLower().Contains("tentacle")))
// list.Add(heddif);
// foreach (Hediff heddif in list)
// pawn.health.hediffSet.hediffs.Remove(heddif);
// if (hed != null)
// pawn.health.AddHediff(hed, bpr);
// }
// Penises = penises.selectone;
// }
// //Log.Message("end ");
// }
//}
}
static void DrawSexuality(Pawn pawn, Rect row)
{
string sexuality;
if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.Vanilla)
CompRJW.VanillaTraitCheck(pawn);
if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.SYRIndividuality)
CompRJW.CopyIndividualitySexuality(pawn);
if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.Psychology)
CompRJW.CopyPsychologySexuality(pawn);
switch (CompRJW.Comp(pawn).orientation)
{
case Orientation.Asexual:
sexuality = "Asexual";
break;
case Orientation.Bisexual:
sexuality = "Bisexual";
break;
case Orientation.Heterosexual:
sexuality = "Hetero";
break;
case Orientation.Homosexual:
sexuality = "Gay";
break;
case Orientation.LeaningHeterosexual:
sexuality = "Bisexual, leaning hetero";
break;
case Orientation.LeaningHomosexual:
sexuality = "Bisexual, leaning gay";
break;
case Orientation.MostlyHeterosexual:
sexuality = "Mostly hetero";
break;
case Orientation.MostlyHomosexual:
sexuality = "Mostly gay";
break;
case Orientation.Pansexual:
sexuality = "Pansexual";
break;
default:
sexuality = "None";
break;
}
//allow to change pawn sexuality for:
//own hero, game start
if (RJWPreferenceSettings.sexuality_distribution == RJWPreferenceSettings.Rjw_sexuality.RimJobWorld &&
(((Current.ProgramState == ProgramState.Playing &&
pawn.IsDesignatedHero() && pawn.IsHeroOwner()) ||
Prefs.DevMode) ||
Current.ProgramState == ProgramState.Entry))
{
if (Widgets.ButtonText(row, "Sexuality: " + sexuality, false))
{
Find.WindowStack.Add(new FloatMenu(new List<FloatMenuOption>() //this needs fixing in 1.1 with vanilla orientation traits
{
new FloatMenuOption("Asexual", (() => Change_orientation(pawn, Orientation.Asexual)), MenuOptionPriority.Default),
new FloatMenuOption("Pansexual", (() => Change_orientation(pawn, Orientation.Pansexual)), MenuOptionPriority.Default),
new FloatMenuOption("Heterosexual", (() => Change_orientation(pawn, Orientation.Heterosexual)), MenuOptionPriority.Default),
new FloatMenuOption("MostlyHeterosexual", (() => Change_orientation(pawn, Orientation.MostlyHeterosexual)), MenuOptionPriority.Default),
new FloatMenuOption("LeaningHeterosexual", (() => Change_orientation(pawn, Orientation.LeaningHeterosexual)), MenuOptionPriority.Default),
new FloatMenuOption("Bisexual", (() => Change_orientation(pawn, Orientation.Bisexual)), MenuOptionPriority.Default),
new FloatMenuOption("LeaningHomosexual", (() => Change_orientation(pawn, Orientation.LeaningHomosexual)), MenuOptionPriority.Default),
new FloatMenuOption("MostlyHomosexual", (() => Change_orientation(pawn, Orientation.MostlyHomosexual)), MenuOptionPriority.Default),
new FloatMenuOption("Homosexual", (() => Change_orientation(pawn, Orientation.Homosexual)), MenuOptionPriority.Default),
}));
}
}
else
{
Widgets.Label(row, "Sexuality: " + sexuality);
if (Mouse.IsOver(row))
Widgets.DrawHighlight(row);
}
}
static void DrawQuirks(Pawn pawn, Rect row)
{
var quirks = Quirk.All
.Where(quirk => pawn.Has(quirk))
.OrderBy(quirk => quirk.Key)
.ToList();
// Not actually localized.
var quirkString = quirks.Select(quirk => quirk.Key).ToCommaList();
if ((Current.ProgramState == ProgramState.Playing &&
pawn.IsDesignatedHero() && pawn.IsHeroOwner() ||
Prefs.DevMode) ||
Current.ProgramState == ProgramState.Entry)
{
var quirksAll = Quirk.All
.OrderBy(quirk => quirk.Key)
.ToList();
if (!RJWSettings.DevMode)
{
quirksAll.Remove(Quirk.Breeder);
quirksAll.Remove(Quirk.Incubator);
}
if (xxx.is_insect(pawn))
quirksAll.Add(Quirk.Incubator);
if (Widgets.ButtonText(row, "Quirks".Translate() + quirkString, false))
{
var list = new List<FloatMenuOption>();
list.Add(new FloatMenuOption("Reset", (() => QuirkAdder.Clear(pawn)), MenuOptionPriority.Default));
foreach (Quirk quirk in quirksAll)
{
list.Add(new FloatMenuOption(quirk.Key, (() => QuirkAdder.Add(pawn, quirk))));
//TODO: fix quirk description box in 1.1 menus
//list.Add(new FloatMenuOption(quirk.Key, (() => QuirkAdder.Add(pawn, quirk)), MenuOptionPriority.Default, delegate
//{
// TooltipHandler.TipRegion(row, quirk.LocaliztionKey.Translate(pawn.Named("pawn")));
//}
//));
}
Find.WindowStack.Add(new FloatMenu(list));
}
}
else
{
// TODO: long quirk list support
// This can be too long and line wrap.
// Should probably be a vertical list like traits.
Widgets.Label(row, "Quirks".Translate() + quirkString);
}
if (!Mouse.IsOver(row)) return;
Widgets.DrawHighlight(row);
if (quirks.NullOrEmpty())
{
TooltipHandler.TipRegion(row, "NoQuirks".Translate());
}
else
{
StringBuilder stringBuilder = new StringBuilder();
foreach (var q in quirks)
{
stringBuilder.AppendLine(q.Key.Colorize(Color.yellow));
stringBuilder.AppendLine(q.LocaliztionKey.Translate(pawn.Named("pawn")).AdjustedFor(pawn).Resolve());
stringBuilder.AppendLine("");
}
string str = stringBuilder.ToString().TrimEndNewlines();
TooltipHandler.TipRegion(row, str);
}
}
static string DrawWhoring(Pawn pawn, Rect row)
{
string price;
if (pawn.ageTracker.AgeBiologicalYears < RJWSettings.sex_minimum_age)
price = "Inapplicable (too young)";
else if (pawn.ownership.OwnedRoom == null)
{
if (Current.ProgramState == ProgramState.Playing)
price = WhoringHelper.WhoreMinPrice(pawn) + " - " + WhoringHelper.WhoreMaxPrice(pawn) + " (base, needs suitable bedroom)";
else
price = WhoringHelper.WhoreMinPrice(pawn) + " - " + WhoringHelper.WhoreMaxPrice(pawn) + " (base, modified by bedroom quality)";
}
else if (xxx.is_animal(pawn))
price = "Incapable of whoring";
else
price = WhoringHelper.WhoreMinPrice(pawn) + " - " + WhoringHelper.WhoreMaxPrice(pawn);
Widgets.Label(row, "WhorePrice".Translate() + price);
if (Mouse.IsOver(row))
Widgets.DrawHighlight(row);
return price;
}
[SyncMethod]
static void Change_orientation(Pawn pawn, Orientation orientation)
{
CompRJW.Comp(pawn).orientation = orientation;
}
[SyncMethod]
static void Change_Archotechmode(Pawn pawn)
{
BodyPartRecord genitalia = Genital_Helper.get_genitalsBPR(pawn);
Hediff blocker = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("ImpregnationBlocker"));
Hediff enhancer = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("FertilityEnhancer"));
if (blocker != null)
{
pawn.health.RemoveHediff(blocker);
}
else if (enhancer == null)
{
pawn.health.AddHediff(HediffDef.Named("FertilityEnhancer"), genitalia);
}
else
{
if (enhancer != null)
pawn.health.RemoveHediff(enhancer);
pawn.health.AddHediff(HediffDef.Named("ImpregnationBlocker"), genitalia);
}
}
[SyncMethod]
static void Re_sexualize(Pawn pawn)
{
CompRJW.Comp(pawn).Sexualize(pawn, true);
}
public override void DoWindowContents(Rect inRect)
{
bool flag = false;
soundClose = SoundDefOf.InfoCard_Close;
closeOnClickedOutside = true;
absorbInputAroundWindow = false;
forcePause = true;
preventCameraMotion = false;
if (Event.current.type == EventType.KeyDown && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.Escape))
{
flag = true;
Event.current.Use();
}
Rect windowRect = inRect.ContractedBy(17f);
Rect mainRect = new Rect(windowRect.x, windowRect.y, windowRect.width, windowRect.height - 20f);
Rect okRect = new Rect(inRect.width / 3, mainRect.yMax + 10f, inRect.width / 3f, 30f);
SexualityCard(mainRect, pawn);
if (Widgets.ButtonText(okRect, "CloseButton".Translate()) || flag)
{
Close();
}
}
}
}
|
TDarksword/rjw
|
Source/Harmony/SexualityCardInternal.cs
|
C#
|
mit
| 26,291 |
using HarmonyLib;
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using Verse;
using Verse.AI.Group;
namespace rjw
{
class SocialCardUtilityPatch
{
[HarmonyPatch(typeof(SocialCardUtility))]
[HarmonyPatch("DrawDebugOptions")]
public static class Patch_SocialCardUtility_DrawDebugOptions
{
//Create a new menu option that will contain some of the relevant data for debugging RJW
//Window space is limited, so keep to one line per pawn. Additional data may need a separate menu
static FloatMenuOption newMenuOption(Pawn pawn) {
return new FloatMenuOption("RJW WouldFuck", () =>
{
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.AppendLine();
stringBuilder.AppendLine("canFuck: " + xxx.can_fuck(pawn) + ", canBeFucked: " + xxx.can_be_fucked(pawn) + ", loving: " + xxx.can_do_loving(pawn));
stringBuilder.AppendLine("canRape: " + xxx.can_rape(pawn) + ", canBeRaped: " + xxx.can_get_raped(pawn));
if (!pawn.IsColonist)
if (pawn.Faction != null)
{
int pawnAmountOfSilvers = pawn.inventory.innerContainer.TotalStackCountOfDef(ThingDefOf.Silver);
int caravanAmountOfSilvers = 0;
Lord lord = pawn.GetLord();
List<Pawn> caravanMembers = pawn.Map.mapPawns.PawnsInFaction(pawn.Faction).Where(x => x.GetLord() == lord && x.inventory?.innerContainer?.TotalStackCountOfDef(ThingDefOf.Silver) > 0).ToList();
caravanAmountOfSilvers += caravanMembers.Sum(member => member.inventory.innerContainer.TotalStackCountOfDef(ThingDefOf.Silver));
stringBuilder.AppendLine("pawnSilvers: " + pawnAmountOfSilvers + ", caravanSilvers: " + caravanAmountOfSilvers);
}
stringBuilder.AppendLine();
stringBuilder.AppendLine("Humans - Colonists:");
List<Pawn> pawns = pawn.Map.mapPawns.AllPawnsSpawned.Where(x => x != pawn && x.RaceProps.Humanlike && x.IsColonist).OrderBy(x => xxx.get_pawnname(x)).ToList();
foreach (Pawn partner in pawns)
{
stringBuilder.AppendLine(partner.LabelShort + " (" + partner.gender.GetLabel() +
", age: " + partner.ageTracker.AgeBiologicalYears +
", " + CompRJW.Comp(partner).orientation +
"): (would fuck) " + SexAppraiser.would_fuck(pawn, partner).ToString("F3") +
"): (be fucked) " + SexAppraiser.would_fuck(partner, pawn).ToString("F3") +
": (rape) " + SexAppraiser.would_rape(pawn, partner));
}
stringBuilder.AppendLine();
stringBuilder.AppendLine("Humans - Prisoners:");
pawns = pawn.Map.mapPawns.AllPawnsSpawned.Where(x => x != pawn && x.RaceProps.Humanlike && !x.IsColonist && x.IsPrisonerOfColony).OrderBy(x => xxx.get_pawnname(x)).ToList();
foreach (Pawn partner in pawns)
{
stringBuilder.AppendLine(partner.LabelShort + " (" + partner.gender.GetLabel() +
", age: " + partner.ageTracker.AgeBiologicalYears +
", " + CompRJW.Comp(partner).orientation +
"): (would fuck) " + SexAppraiser.would_fuck(pawn, partner).ToString("F3") +
"): (be fucked) " + SexAppraiser.would_fuck(partner, pawn).ToString("F3") +
": (rape) " + SexAppraiser.would_rape(pawn, partner));
}
stringBuilder.AppendLine();
stringBuilder.AppendLine("Humans - non Colonists:");
pawns = pawn.Map.mapPawns.AllPawnsSpawned.Where(x => x != pawn && x.RaceProps.Humanlike && !x.IsColonist && !x.IsPrisonerOfColony).OrderBy(x => xxx.get_pawnname(x)).ToList();
foreach (Pawn partner in pawns)
{
stringBuilder.AppendLine(partner.LabelShort + " (" + partner.gender.GetLabel() +
", age: " + partner.ageTracker.AgeBiologicalYears +
", " + CompRJW.Comp(partner).orientation +
"): (would fuck) " + SexAppraiser.would_fuck(pawn, partner).ToString("F3") +
"): (be fucked) " + SexAppraiser.would_fuck(partner, pawn).ToString("F3") +
": (rape) " + SexAppraiser.would_rape(pawn, partner));
}
stringBuilder.AppendLine();
stringBuilder.AppendLine("Animals - Colony:");
pawns = pawn.Map.mapPawns.AllPawnsSpawned.Where(x => x != pawn && x.RaceProps.Animal && x.Faction == Faction.OfPlayer).OrderBy(x => xxx.get_pawnname(x)).ToList();
foreach (Pawn partner in pawns)
{
stringBuilder.AppendLine(partner.LabelShort + " (" + partner.gender.GetLabel() +
", age: " + partner.ageTracker.AgeBiologicalYears +
//", " + CompRJW.Comp(partner).orientation +
"): (would fuck) " + SexAppraiser.would_fuck(pawn, partner).ToString("F3") +
"): (be fucked) " + SexAppraiser.would_fuck(partner, pawn).ToString("F3") +
": (rape) " + SexAppraiser.would_rape(pawn, partner));
}
stringBuilder.AppendLine();
stringBuilder.AppendLine("Animals - non Colony:");
pawns = pawn.Map.mapPawns.AllPawnsSpawned.Where(x => x != pawn && x.RaceProps.Animal && x.Faction != Faction.OfPlayer).OrderBy(x => xxx.get_pawnname(x)).ToList();
foreach (Pawn partner in pawns)
{
stringBuilder.AppendLine(partner.LabelShort + " (" + partner.gender.GetLabel() +
", age: " + partner.ageTracker.AgeBiologicalYears +
//", " + CompRJW.Comp(partner).orientation +
"): (would fuck) " + SexAppraiser.would_fuck(pawn, partner).ToString("F3") +
"): (be fucked) " + SexAppraiser.would_fuck(partner, pawn).ToString("F3") +
": (rape) " + SexAppraiser.would_rape(pawn, partner));
}
Find.WindowStack.Add(new Dialog_MessageBox(stringBuilder.ToString(), null, null, null, null, null, false, null, null));
}, MenuOptionPriority.Default, null, null, 0.0f, null, null);
}
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
List<CodeInstruction> codes = instructions.ToList();
var addFunc = typeof(List<FloatMenuOption>).GetMethod("Add", new Type[] { typeof(FloatMenuOption) });
//Identify the last time options.Add() is called so we can place our new option afterwards
CodeInstruction lastAdd = codes.FindLast(ins => ins.opcode == OpCodes.Callvirt && ins.operand == addFunc);
for (int i = 0; i < codes.Count; ++i) {
yield return codes[i];
if (codes[i] == lastAdd) {
yield return new CodeInstruction(OpCodes.Ldloc_1);
yield return new CodeInstruction(OpCodes.Ldarg_1);
yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(Patch_SocialCardUtility_DrawDebugOptions), nameof(newMenuOption)));
yield return new CodeInstruction(OpCodes.Callvirt, addFunc);
}
}
}
}
}
}
|
TDarksword/rjw
|
Source/Harmony/SocialCardUtilityPatch.cs
|
C#
|
mit
| 6,562 |
using System;
using System.Collections.Generic;
using HarmonyLib;
using RimWorld;
using Verse;
using Verse.AI.Group;
using System.Reflection;
namespace rjw
{
//ABF?? raid rape before leaving?
[HarmonyPatch(typeof(LordJob_AssaultColony), "CreateGraph")]
internal static class Patches_AssaultColonyForRape
{
public static void Postfix(StateGraph __result)
{
//--Log.Message("[ABF]AssaultColonyForRape::CreateGraph");
if (__result == null) return;
//--ModLog.Message("AssaultColonyForRape::CreateGraph");
foreach (var trans in __result.transitions)
{
if (HasDesignatedTransition(trans))
{
foreach (Trigger t in trans.triggers)
{
if (t.filters == null)
{
t.filters = new List<TriggerFilter>() { new Trigger_SexSatisfy(0.3f) };
}
else
{
t.filters.Add(new Trigger_SexSatisfy(0.3f));
}
}
//--Log.Message("[ABF]AssaultColonyForRape::CreateGraph Adding SexSatisfyTrigger to " + trans.ToString());
}
}
}
private static bool HasDesignatedTransition(Transition t)
{
if (t.target == null) return false;
if (t.target.GetType() == typeof(LordToil_KidnapCover)) return true;
foreach (Trigger ta in t.triggers)
{
if (ta.GetType() == typeof(Trigger_FractionColonyDamageTaken)) return true;
}
return false;
}
}
//disable kidnaping
[HarmonyPatch(typeof(KidnapAIUtility), "TryFindGoodKidnapVictim")]
internal static class Patches_TryFindGoodKidnapVictim
{
public static void Postfix(ref bool __result)
{
if (!__result) return;
//ModLog.Message("KidnapAIUtility::TryFindGoodKidnapVictim");
//Log.Message("__result " + __result);
if (!RJWSettings.ForbidKidnap) return;
__result = false;
}
}
/*
[HarmonyPatch(typeof(JobGiver_Manhunter), "TryGiveJob")]
static class Patches_ABF_MunHunt
{
public static void Postfix(Job __result, ref Pawn pawn)
{
//--ModLog.Message("Patches_ABF_MunHunt::Postfix called");
if (__result == null) return;
if (__result.def == JobDefOf.Wait || __result.def == JobDefOf.Goto) __result = null;
}
}
*/
[HarmonyPatch(typeof(SkillRecord), "CalculateTotallyDisabled")]
internal static class Patches_SkillRecordDebug
{
public static bool Prefix(SkillRecord __instance,ref bool __result)
{
var field = __instance.GetType().GetField("pawn", BindingFlags.GetField | BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Instance);
Pawn pawn = (field.GetValue(__instance) as Pawn);
if (__instance.def == null)
{
ModLog.Message("no def!");
__result = false;
return false;
}
return true;
}
}
}
|
TDarksword/rjw
|
Source/Harmony/patch_ABF.cs
|
C#
|
mit
| 2,627 |
using System;
using HarmonyLib;
using Verse;
using Verse.AI;
namespace rjw
{
[HarmonyPatch(typeof(JobDriver), "Cleanup")]
internal static class PATCH_JobDriver_DubsBadHygiene
{
//not very good solution, some other mod can have same named jobdriver but w/e
//Dubs Bad Hygiene washing
private readonly static Type JobDriver_useWashBucket = AccessTools.TypeByName("JobDriver_useWashBucket");
//private readonly static Type JobDriver_washAtCell = AccessTools.TypeByName("JobDriver_washAtCell");
private readonly static Type JobDriver_UseHotTub = AccessTools.TypeByName("JobDriver_UseHotTub");
private readonly static Type JobDriver_takeShower = AccessTools.TypeByName("JobDriver_takeShower");
private readonly static Type JobDriver_takeBath = AccessTools.TypeByName("JobDriver_takeBath");
[HarmonyPrefix]
private static bool on_cleanup_driver(JobDriver __instance, JobCondition condition)
{
if (__instance == null)
return true;
if (condition == JobCondition.Succeeded)
{
Pawn pawn = __instance.pawn;
//ModLog.Message("patches_DubsBadHygiene::on_cleanup_driver" + xxx.get_pawnname(pawn));
if (xxx.DubsBadHygieneIsActive)
//clear one instance of semen
if (
__instance.GetType() == JobDriver_useWashBucket// ||
//__instance.GetType() == JobDriver_washAtCell
)
{
Hediff hediff = pawn.health.hediffSet.hediffs.Find(x => ( x.def == RJW_SemenoOverlayHediffDefOf.Hediff_Semen
|| x.def == RJW_SemenoOverlayHediffDefOf.Hediff_InsectSpunk
|| x.def == RJW_SemenoOverlayHediffDefOf.Hediff_MechaFluids
));
if (hediff != null)
{
//ModLog.Message("patches_DubsBadHygiene::" + __instance.GetType() + " clear => " + hediff.Label);
hediff.Severity -= 1f;
}
}
//clear all instance of semen
else if (
__instance.GetType() == JobDriver_UseHotTub ||
__instance.GetType() == JobDriver_takeShower ||
__instance.GetType() == JobDriver_takeBath
)
{
foreach (Hediff hediff in pawn.health.hediffSet.hediffs)
{
if (hediff.def == RJW_SemenoOverlayHediffDefOf.Hediff_Semen ||
hediff.def == RJW_SemenoOverlayHediffDefOf.Hediff_InsectSpunk ||
hediff.def == RJW_SemenoOverlayHediffDefOf.Hediff_MechaFluids
)
{
//ModLog.Message("patches_DubsBadHygiene::" + __instance.GetType() + " clear => " + hediff.Label);
hediff.Severity -= 1f;
}
}
}
}
return true;
}
}
}
|
TDarksword/rjw
|
Source/Harmony/patch_DubsBadHygiene.cs
|
C#
|
mit
| 2,571 |
using System;
using System.Reflection;
using HarmonyLib;
using RimWorld;
using RimWorld.Planet;
using Verse;
using Verse.AI;
namespace rjw
{
[HarmonyPatch(typeof(Pawn_ApparelTracker))]
[HarmonyPatch("Wear")]
internal static class PATCH_Pawn_ApparelTracker_Wear
{
// Prevents pawns from equipping a piece of apparel if it conflicts with some locked apparel that they're already wearing
[HarmonyPrefix]
private static bool prevent_wear_by_gear(Pawn_ApparelTracker __instance, ref Apparel newApparel)
{
var tra = __instance;
// //--Log.Message ("Pawn_ApparelTracker.Wear called for " + newApparel.Label + " on " + tra.xxx.get_pawnname(pawn));
foreach (var app in tra.WornApparel)
if (app.has_lock() && (!ApparelUtility.CanWearTogether(newApparel.def, app.def, tra.pawn.RaceProps.body)))
{
if (PawnUtility.ShouldSendNotificationAbout(tra.pawn))
Messages.Message(xxx.get_pawnname(tra.pawn) + " can't wear " + newApparel.def.label + " (blocked by " + app.def.label + ")", tra.pawn, MessageTypeDefOf.NegativeEvent);
return false;
}
return true;
}
// Add the appropriate hediff when gear is worn
[HarmonyPostfix]
private static void on_wear(Pawn_ApparelTracker __instance, Apparel newApparel)
{
var tra = __instance;
if ((newApparel.def is bondage_gear_def def) &&
(newApparel.Wearer == tra.pawn))
{ // Check that the apparel was actually worn
def.soul.on_wear(tra.pawn, newApparel);
}
}
}
// Remove the hediff when the gear is removed
[HarmonyPatch(typeof(Pawn_ApparelTracker))]
[HarmonyPatch("Notify_ApparelRemoved")]
internal static class PATCH_Pawn_ApparelTracker_Remove
{
[HarmonyPostfix]
private static void on_remove(Pawn_ApparelTracker __instance, Apparel apparel)
{
if (apparel.def is bondage_gear_def def)
{
def.soul.on_remove(apparel, __instance.pawn);
}
}
}
// Patch the TryDrop method so that locked apparel cannot be dropped by JobDriver_RemoveApparel or by stripping
// a corpse or downed pawn
internal static class PATCH_Pawn_ApparelTracker_TryDrop
{
// Can't call MakeByRefType in an attribute, which is why this method is necessary.
private static MethodInfo get_target()
{
return typeof(Pawn_ApparelTracker).GetMethod("TryDrop", new Type[] {
typeof(Apparel),
typeof(Apparel).MakeByRefType (),
typeof(IntVec3),
typeof(bool)
});
}
// Can't just put [HarmonyTargetMethod] on get_target, which is why this method is necessary. BTW I don't
// know why HarmonyTargetMethod wasn't working. I'm sure I had everything set up properly so it might be a
// bug in Harmony itself, but I can't be bothered to look into it in detail.
public static void apply(Harmony har)
{
var tar = get_target();
var pat = typeof(PATCH_Pawn_ApparelTracker_TryDrop).GetMethod("prevent_locked_apparel_drop");
har.Patch(tar, new HarmonyMethod(pat), null);
}
public static bool prevent_locked_apparel_drop(Pawn_ApparelTracker __instance, ref Apparel ap, ref bool __result)
{
if (!ap.has_lock())
return true;
else
{
__result = false;
return false;
}
}
}
// Prevent locked apparel from being removed from a pawn who's out on a caravan
// TODO: Allow the apparel to be removed if the key is in the caravan's inventory
//[HarmonyPatch (typeof (WITab_Caravan_Gear))]
//[HarmonyPatch ("TryRemoveFromCurrentWearer")]
//static class PATCH_WITab_Caravan_Gear_TryRemoveFromCurrentWearer {
// [HarmonyPrefix]
// static bool prevent_locked_apparel_removal (WITab_Caravan_Gear __instance, Thing t, ref bool __result)
// {
// var app = t as Apparel;
// if ((app == null) || (! app.has_lock ()))
// return true;
// else {
// __result = false;
// return false;
// }
// }
//}
// Check for the special case where a player uses the caravan gear tab to equip a piece of lockable apparel on a pawn that
// is wearing an identical piece of already locked apparel, and make sure that doesn't work or change anything. This is to
// fix a bug where, even though the new apparel would fail to be equipped on the pawn, it would somehow copy the holostamp
// info from the equipped apparel.
[HarmonyPatch(typeof(WITab_Caravan_Gear))]
[HarmonyPatch("TryEquipDraggedItem")]
internal static class PATCH_WITab_Caravan_Gear_TryEquipDraggedItem
{
private static Thing get_dragged_item(WITab_Caravan_Gear tab)
{
return (Thing)typeof(WITab_Caravan_Gear).GetField("draggedItem", xxx.ins_public_or_no).GetValue(tab);
}
private static void set_dragged_item(WITab_Caravan_Gear tab, Thing t)
{
typeof(WITab_Caravan_Gear).GetField("draggedItem", xxx.ins_public_or_no).SetValue(tab, t);
}
[HarmonyPrefix]
private static bool prevent_locked_apparel_conflict(WITab_Caravan_Gear __instance, ref Pawn p)
{
if (__instance == null) return true;
if (get_dragged_item(__instance) is Apparel dragged_app && p.apparel != null && dragged_app.has_lock())
{
foreach (var equipped_app in p.apparel.WornApparel)
{
if (equipped_app.has_lock() && (!ApparelUtility.CanWearTogether(dragged_app.def, equipped_app.def, p.RaceProps.body)))
{
set_dragged_item(__instance, null);
return false;
}
}
}
return true;
}
}
/* GONE IN b19
// Prevent locked apparel from being removed from a corpse
// TODO: Find out when this method is actually called (probably doesn't matter but still)
[HarmonyPatch(typeof(Dialog_FormCaravan))]
[HarmonyPatch("RemoveFromCorpseIfPossible")]
internal static class PATCH_Dialog_FormCaravan_RemoveFromCorpseIfPossible
{
[HarmonyPrefix]
private static bool prevent_locked_apparel_removal(Dialog_FormCaravan __instance, Thing thing)
{
var app = thing as Apparel;
return (app == null) || (!app.has_lock());
}
}
*/
// Patch a method in a pawn gear tab to give the pawn a special job driver if the player tells them to
// drop locked apparel they have equipped
// TODO: Search for the key and, if the pawn can access it, give them a new job that has them go to the key
// and use it to unlock the apparel
[HarmonyPatch(typeof(ITab_Pawn_Gear))]
[HarmonyPatch("InterfaceDrop")]
internal static class PATCH_ITab_Pawn_Gear_InterfaceDrop
{
private static Pawn SelPawnForGear(ITab_Pawn_Gear tab)
{
var pro = typeof(ITab_Pawn_Gear).GetProperty("SelPawnForGear", xxx.ins_public_or_no);
return (Pawn)pro.GetValue(tab, null);
}
[HarmonyPrefix]
private static bool drop_locked_apparel(ITab_Pawn_Gear __instance, Thing t)
{
var tab = __instance;
var apparel = t as Apparel;
if ((apparel == null) || (!apparel.has_lock()))
return true;
else
{
var p = SelPawnForGear(tab);
if ((p.apparel != null) && (p.apparel.WornApparel.Contains(apparel)))
{
p.jobs.TryTakeOrderedJob(JobMaker.MakeJob(xxx.struggle_in_BondageGear, apparel));
return false;
}
else
return true;
}
}
}
// Patch the method that prisoners use to find apparel in their cell so that they don't try to wear
// something that conflicts with locked apparel. The method used to prevent pawns from trying to
// optimize away locked apparel won't work here because prisoners don't check GetSpecialApparelScoreOffset.
[HarmonyPatch(typeof(JobGiver_PrisonerGetDressed))]
[HarmonyPatch("FindGarmentCoveringPart")]
internal static class PATCH_JobGiver_PrisonerGetDressed_FindGarmentCoveringPart
{
private static bool conflicts(Pawn_ApparelTracker tra, Apparel new_app)
{
foreach (var worn_app in tra.WornApparel)
if (worn_app.has_lock() && (!ApparelUtility.CanWearTogether(worn_app.def, new_app.def, tra.pawn.RaceProps.body)))
return true;
return false;
}
[HarmonyPrefix]
private static bool prevent_locked_apparel_conflict(JobGiver_PrisonerGetDressed __instance, Pawn pawn, BodyPartGroupDef bodyPartGroupDef, ref Apparel __result)
{
// If the prisoner is not wearing locked apparel then just run the regular method
if (!pawn.is_wearing_locked_apparel())
return true;
// Otherwise, duplicate the logic in the regular method except with an additional check
// to filter out apparel that conflicts with worn locked apparel.
else
{
var room = pawn.GetRoom();
if (room.isPrisonCell)
foreach (var c in room.Cells)
foreach (var t in c.GetThingList(pawn.Map))
{
if ((t is Apparel app) &&
app.def.apparel.bodyPartGroups.Contains(bodyPartGroupDef) &&
pawn.CanReserve(app) &&
ApparelUtility.HasPartsToWear(pawn, app.def) &&
(!conflicts(pawn.apparel, app)))
{
__result = app;
return false;
}
}
__result = null;
return false;
}
}
}
}
|
TDarksword/rjw
|
Source/Harmony/patch_bondage_gear.cs
|
C#
|
mit
| 8,700 |
using System;
using System.Reflection;
using HarmonyLib;
using RimWorld;
using Verse;
using Verse.AI;
namespace rjw
{
/// <summary>
/// Patch:
/// Core Loving, Mating
/// Rational Romance LovinCasual
/// CnP, remove pregnancy if rjw human preg enabled
/// </summary>
// Add a fail condition to JobDriver_Lovin that prevents pawns from lovin' if they aren't physically able/have genitals
[HarmonyPatch(typeof(JobDriver_Lovin), "MakeNewToils")]
internal static class PATCH_JobDriver_Lovin_MakeNewToils
{
[HarmonyPrefix]
private static bool on_begin_lovin(JobDriver_Lovin __instance)
{
Pawn pawn = __instance.pawn;
Pawn partner = null;
Building_Bed Bed = null;
var any_ins = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
partner = (Pawn)(__instance.GetType().GetProperty("Partner", any_ins).GetValue(__instance, null));
Bed = (Building_Bed)(__instance.GetType().GetProperty("Bed", any_ins).GetValue(__instance, null));
if (!(xxx.can_fuck(pawn) || xxx.can_be_fucked(pawn)))
return false;
if (!(xxx.can_fuck(partner) || xxx.can_be_fucked(partner)))
return false;
if (RJWSettings.override_lovin)
{
pawn.jobs.EndCurrentJob(JobCondition.Incompletable);
Job job = JobMaker.MakeJob(xxx.casual_sex, partner, Bed);
pawn.jobs.jobQueue.EnqueueFirst(job);
}
return true;
}
}
// Add a fail condition to JobDriver_Mate that prevents animals from lovin' if they aren't physically able/have genitals
[HarmonyPatch(typeof(JobDriver_Mate), "MakeNewToils")]
internal static class PATCH_JobDriver_Mate_MakeNewToils
{
[HarmonyPrefix]
private static bool on_begin_matin(JobDriver_Mate __instance)
{
//only reproductive male starts mating job
Pawn pawn = __instance.pawn;
Pawn partner = null;
var any_ins = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
partner = (Pawn)(__instance.GetType().GetProperty("Female", any_ins).GetValue(__instance, null));
if (!(xxx.can_fuck(pawn) || xxx.can_be_fucked(pawn)))
return false;
if (!(xxx.can_fuck(partner) || xxx.can_be_fucked(partner)))
return false;
if (RJWSettings.override_matin)
{
Job job;
if (pawn.kindDef == partner.kindDef)
job = JobMaker.MakeJob(xxx.animalMate, partner);
else
job = JobMaker.MakeJob(xxx.animalBreed, partner);
pawn.jobs.EndCurrentJob(JobCondition.Incompletable);
pawn.jobs.jobQueue.EnqueueFirst(job);
}
return true;
}
}
//// Add a fail condition to JobDriver_Mate that prevents animals from lovin' if they aren't physically able/have genitals
//[HarmonyPatch(typeof(PawnUtility), "FertileMateTarget")]
//internal static class PATCH_JobDriver_Mate_MakeNewToils
//{
// [HarmonyPostfix]
// public static void Postfix(Job __result, Pawn pawn)
// {
// if (__result == null)
// {
// if (female.gender != Gender.Female || !female.ageTracker.CurLifeStage.reproductive)
// {
// return false;
// }
// CompEggLayer compEggLayer = female.TryGetComp<CompEggLayer>();
// if (compEggLayer != null)
// {
// return !compEggLayer.FullyFertilized;
// }
// return !female.health.hediffSet.HasHediff(HediffDefOf.Pregnant, false);
// __result = JobMaker.MakeJob(JobDefOf.Mate, pawn2);
// }
// }
//}
//Patch for futa animals to initiate mating (vanialla - only male)
[HarmonyPatch(typeof(JobGiver_Mate), "TryGiveJob")]
internal static class PATCH_JobGiver_Mate_TryGiveJob
{
[HarmonyPostfix]
public static void Postfix(ref Job __result, Pawn pawn)
{
//ModLog.Message("patches_lovin::JobGiver_Mate fail, try rjw for " + xxx.get_pawnname(pawn));
var partBPR = Genital_Helper.get_genitalsBPR(pawn);
var parts = Genital_Helper.get_PartsHediffList(pawn, partBPR);
if (!(Genital_Helper.has_penis_fertile(pawn, parts) || Genital_Helper.has_penis_infertile(pawn, parts)) || !pawn.ageTracker.CurLifeStage.reproductive)
{
//ModLog.Message("patches_lovin::JobGiver_Mate " + xxx.get_pawnname(pawn) + ", has no penis " + (Genital_Helper.has_penis(pawn) || Genital_Helper.has_penis_infertile(pawn)));
//ModLog.Message("patches_lovin::JobGiver_Mate " + xxx.get_pawnname(pawn) + ", not reproductive " + !pawn.ageTracker.CurLifeStage.reproductive);
return;
}
Predicate<Thing> validator = delegate (Thing t)
{
Pawn pawn3 = t as Pawn;
var valid = !pawn3.Downed
&& pawn3 != pawn
&& pawn3.CanCasuallyInteractNow()
&& !pawn3.IsForbidden(pawn)
&& !pawn3.HostileTo(pawn)
&& PawnUtility.FertileMateTarget(pawn, pawn3);
if (!valid && pawn3 != pawn)
{
//ModLog.Message("patches_lovin::JobGiver_Mate " + xxx.get_pawnname(pawn3) + ", not valid");
//ModLog.Message("patches_lovin::JobGiver_Mate Downed " + pawn3.Downed);
//ModLog.Message("patches_lovin::JobGiver_Mate CanCasuallyInteractNow " + pawn3.CanCasuallyInteractNow());
//ModLog.Message("patches_lovin::JobGiver_Mate IsForbidden " + pawn3.IsForbidden(pawn));
//ModLog.Message("patches_lovin::JobGiver_Mate FertileMateTarget " + PawnUtility.FertileMateTarget(pawn, pawn3));
}
return valid;
};
ThingRequest request = ThingRequest.ForDef(pawn.def); // mate sames species
if (RJWSettings.WildMode) // go wild xD
request = ThingRequest.ForGroup(ThingRequestGroup.Pawn); // mate everyone
//add animal check?
Pawn pawn2 = (Pawn)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, request, PathEndMode.Touch, TraverseParms.For(pawn), 30f, validator);
if (pawn2 == null)
{
//ModLog.Message("patches_lovin::JobGiver_Mate " + xxx.get_pawnname(pawn) + ", no valid partner found");
return;
}
//__result = JobMaker.MakeJob(xxx.animalBreed, pawn2);
__result = JobMaker.MakeJob(JobDefOf.Mate, pawn2);
//ModLog.Message("patches_lovin::JobGiver_Mate " + xxx.get_pawnname(pawn) + ", female " + xxx.get_pawnname(pawn2) + ", job " + __result);
}
}
//check if female can be impregnated for animal mating (also check rjw pregnancies)
[HarmonyPatch(typeof(PawnUtility), "FertileMateTarget")]
internal static class PATCH_PawnUtility_FertileMateTarget
{
[HarmonyPrefix]
public static bool Prefix(Pawn male, Pawn female, ref bool __state)
{
__state = female.IsPregnant();
//Log.Message("Prefix FertileMateTarget is vanilla/rjw pregnant: " + __state);
return true;
}
[HarmonyPostfix]
public static bool Postfix(bool __result, ref bool __state)
{
if (__result)
{
//Log.Message("Postfix FertileMateTarget is fertile and not vanilla pregnant: " + __result);
if (__state)
{
//Log.Message("Postfix FertileMateTarget is fertile and rjw pregnant: " + __state);
__result = false;
}
}
return __result;
}
}
//Suboptions when starting rjw sex through workgiver
//[HarmonyPatch(typeof(FloatMenuOption), "Chosen")]
//internal static class PATCH_test
//{
// [HarmonyPostfix]
// public static void Postfix(FloatMenuOption __instance)
// {
// try
// {
// if (Find.Selector.NumSelected == 1) //&& (Find.Selector.SingleSelectedThing as Pawn).IsDesignatedHero()
// {
// //TODO: check if rjw jobdriver,
// //Insert another menu or 2 that will modify initiator sex jobdriver to
// //use selected parts - oral/anal/vaginal/etc
// //use selectable sex action - give/recieve?
// //use selectable sex action - fuck/fisting?
// Log.Message("---");
// ModLog.Message("FloatMenuOption::Chosen " + __instance);
// ModLog.Message("FloatMenuOption::Chosen " + __instance.Label);
// ModLog.Message("FloatMenuOption::Chosen " + __instance.action.Target);
// ModLog.Message("FloatMenuOption::Chosen initiator - " + Find.Selector.SingleSelectedThing);
// ModLog.Message("FloatMenuOption::Chosen target - " + __instance.revalidateClickTarget);
// ModLog.Message("FloatMenuOption::Chosen initiator - " + (Find.Selector.SingleSelectedThing as Pawn).CurJob);
// Log.Message("---");
// }
// }
// catch
// { }
// }
//}
//JobDriver_DoLovinCasual from RomanceDiversified should have handled whether pawns can do casual lovin,
//so I don't bothered to do a check here, unless some bugs occur due to this.
//this prob needs a patch like above, but who cares
// Call xxx.aftersex after pawns have finished lovin'
// You might be thinking, "wouldn't it be easier to add this code as a finish condition to JobDriver_Lovin in the patch above?" I tried that
// at first but it didn't work because the finish condition is always called regardless of how the job ends (i.e. if it's interrupted or not)
// and there's no way to find out from within the finish condition how the job ended. I want to make sure not apply the effects of sex if the
// job was interrupted somehow.
[HarmonyPatch(typeof(JobDriver), "Cleanup")]
internal static class PATCH_JobDriver_Loving_Cleanup
{
//RomanceDiversified lovin
//not very good solution, some other mod can have same named jobdrivers, but w/e
private readonly static Type JobDriverDoLovinCasual = AccessTools.TypeByName("JobDriver_DoLovinCasual");
//Nightmare Incarnation
//not very good solution, some other mod can have same named jobdrivers, but w/e
private readonly static Type JobDriverNIManaSqueeze = AccessTools.TypeByName("JobDriver_NIManaSqueeze");
//vanilla lovin
private readonly static Type JobDriverLovin = typeof(JobDriver_Lovin);
//vanilla mate
private readonly static Type JobDriverMate = typeof(JobDriver_Mate);
[HarmonyPrefix]
private static bool on_cleanup_driver(JobDriver __instance, JobCondition condition)
{
if (__instance == null)
return true;
if (condition == JobCondition.Succeeded)
{
Pawn pawn = __instance.pawn;
Pawn partner = null;
//ModLog.Message("patches_lovin::on_cleanup_driver" + xxx.get_pawnname(pawn));
//[RF] Rational Romance [1.0] loving
if (xxx.RomanceDiversifiedIsActive && __instance.GetType() == JobDriverDoLovinCasual)
{
// not sure RR can even cause pregnancies but w/e
var any_ins = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
partner = (Pawn)(__instance.GetType().GetProperty("Partner", any_ins).GetValue(__instance, null));
ModLog.Message("patches_lovin::on_cleanup_driver RomanceDiversified/RationalRomance:" + xxx.get_pawnname(pawn) + "+" + xxx.get_pawnname(partner));
}
//Nightmare Incarnation
else if (xxx.NightmareIncarnationIsActive && __instance.GetType() == JobDriverNIManaSqueeze)
{
var any_ins = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
partner = (Pawn)(__instance.GetType().GetProperty("Victim", any_ins).GetValue(__instance, null));
ModLog.Message("patches_lovin::on_cleanup_driver Nightmare Incarnation:" + xxx.get_pawnname(pawn) + "+" + xxx.get_pawnname(partner));
}
//Vanilla loving
else if (__instance.GetType() == JobDriverLovin)
{
var any_ins = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
partner = (Pawn)(__instance.GetType().GetProperty("Partner", any_ins).GetValue(__instance, null));
//CnP loving
if (xxx.RimWorldChildrenIsActive && RJWPregnancySettings.humanlike_pregnancy_enabled && xxx.is_human(pawn) && xxx.is_human(partner))
{
ModLog.Message("patches_lovin:: RimWorldChildren/ChildrenAndPregnancy pregnancy:" + xxx.get_pawnname(pawn) + "+" + xxx.get_pawnname(partner));
PregnancyHelper.cleanup_CnP(pawn);
PregnancyHelper.cleanup_CnP(partner);
}
else
ModLog.Message("patches_lovin:: JobDriverLovin pregnancy:" + xxx.get_pawnname(pawn) + "+" + xxx.get_pawnname(partner));
}
//Vanilla mating
else if (__instance.GetType() == JobDriverMate)
{
var any_ins = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
partner = (Pawn)(__instance.GetType().GetProperty("Female", any_ins).GetValue(__instance, null));
ModLog.Message("patches_lovin:: JobDriverMate pregnancy:" + xxx.get_pawnname(pawn) + "+" + xxx.get_pawnname(partner));
}
else
return true;
// TODO: Doing TryUseCondom here is a bit weird... it should happen before.
var usedCondom = CondomUtility.TryUseCondom(pawn) || CondomUtility.TryUseCondom(partner);
//vanilla will probably be fucked up for non humanlikes... but only humanlikes do loving, right?
//if rjw pregnancy enabled, remove vanilla for:
//human-human
//animal-animal
//bestiality
//always remove when someone is insect or mech
if (RJWPregnancySettings.humanlike_pregnancy_enabled && xxx.is_human(pawn) && xxx.is_human(partner)
|| RJWPregnancySettings.animal_pregnancy_enabled && xxx.is_animal(pawn) && xxx.is_animal(partner)
|| (RJWPregnancySettings.bestial_pregnancy_enabled && xxx.is_human(pawn) && xxx.is_animal(partner)
|| RJWPregnancySettings.bestial_pregnancy_enabled && xxx.is_animal(pawn) && xxx.is_human(partner))
|| xxx.is_insect(pawn) || xxx.is_insect(partner) || xxx.is_mechanoid(pawn) || xxx.is_mechanoid(partner)
)
{
ModLog.Message("patches_lovin::on_cleanup_driver vanilla pregnancy:" + xxx.get_pawnname(pawn) + "+" + xxx.get_pawnname(partner));
PregnancyHelper.cleanup_vanilla(pawn);
PregnancyHelper.cleanup_vanilla(partner);
}
SexUtility.ProcessSex(pawn, partner, usedCondom, false, true);
}
return true;
}
}
}
|
TDarksword/rjw
|
Source/Harmony/patch_lovin.cs
|
C#
|
mit
| 13,400 |
using HarmonyLib;
using RimWorld;
using Verse;
namespace rjw
{
/// <summary>
/// disable meditation effects for nymphs
/// </summary>
[HarmonyPatch(typeof(JobDriver_Meditate), "MeditationTick")]
internal static class PATCH_JobDriver_Meditate_MeditationTick
{
[HarmonyPrefix]
private static bool on_JobDriver_Meditate(JobDriver_Meditate __instance)
{
Pawn pawn = __instance.pawn;
if (xxx.is_nympho(pawn))
return false;
return true;
}
}
/// <summary>
/// disable meditation for nymphs
/// </summary>
[HarmonyPatch(typeof(JobGiver_Meditate), "GetPriority")]
internal static class PATCH_JobGiver_Meditate_GetPriority
{
[HarmonyPostfix]
public static void Postfix(ref float __result, Pawn pawn)
{
if (xxx.is_nympho(pawn))
__result = 0f;
}
}
}
|
TDarksword/rjw
|
Source/Harmony/patch_meditate.cs
|
C#
|
mit
| 794 |
namespace rjw
{
/*
[HarmonyPatch(typeof(Pawn_NeedsTracker))]
[HarmonyPatch("ShouldHaveNeed")]
static class patches_need
{
[HarmonyPostfix]
static void on_postfix(Pawn_NeedsTracker __instance, NeedDef nd, ref bool __result){
Pawn p=(Pawn)(typeof(Pawn_NeedsTracker).GetField("pawn", xxx.ins_public_or_no).GetValue(__instance));
__result = __result && (nd.defName != "Sex" || (p!=null && p.Map!=null));
}
}
*/
}
|
TDarksword/rjw
|
Source/Harmony/patch_need.cs
|
C#
|
mit
| 430 |
using HarmonyLib;
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
using Multiplayer.API;
namespace rjw
{
[HarmonyPatch(typeof(Hediff_Pregnant), "DoBirthSpawn")]
internal static class PATCH_Hediff_Pregnant_DoBirthSpawn
{
/// <summary>
/// This one overrides vanilla pregnancy hediff behavior.
/// 0 - try to find suitable father for debug pregnancy
/// 1st part if character pregnant and rjw pregnancies enabled - creates rjw pregnancy and instantly births it instead of vanilla
/// 2nd part if character pregnant with rjw pregnancy - birth it
/// 3rd part - debug - create rjw/vanila pregnancy and birth it
/// </summary>
/// <param name="mother"></param>
/// <param name="father"></param>
/// <returns></returns>
[HarmonyPrefix]
[SyncMethod]
private static bool on_begin_DoBirthSpawn(ref Pawn mother, ref Pawn father)
{
//--Log.Message("patches_pregnancy::PATCH_Hediff_Pregnant::DoBirthSpawn() called");
if (mother == null)
{
ModLog.Error("Hediff_Pregnant::DoBirthSpawn() - no mother defined -> exit");
return false;
}
//vanilla debug?
if (mother.gender == Gender.Male)
{
ModLog.Error("Hediff_Pregnant::DoBirthSpawn() - mother is male -> exit");
return false;
}
// get a reference to the hediff we are applying
//do birth for vanilla pregnancy Hediff
//if using rjw pregnancies - add RJW pregnancy Hediff and birth it instead
Hediff_Pregnant self = (Hediff_Pregnant)mother.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("Pregnant"));
if (self != null)
{
return ProcessVanillaPregnancy(self, mother, father);
}
// do birth for existing RJW pregnancies
if (ProcessRJWPregnancy(mother, father))
{
return false;
}
return ProcessDebugPregnancy(mother, father);
}
private static bool ProcessVanillaPregnancy(Hediff_Pregnant pregnancy, Pawn mother, Pawn father)
{
void CreateAndBirth<T>() where T : Hediff_BasePregnancy
{
T hediff = Hediff_BasePregnancy.Create<T>(mother, father);
//hediff.Initialize(mother, father);
hediff.GiveBirth();
if (pregnancy != null)
mother.health.RemoveHediff(pregnancy);
}
if (father == null)
{
father = Hediff_BasePregnancy.Trytogetfather(ref mother);
}
ModLog.Message("patches_pregnancy::PATCH_Hediff_Pregnant::DoBirthSpawn():Vanilla_pregnancy birthing:" + xxx.get_pawnname(mother));
if (RJWPregnancySettings.animal_pregnancy_enabled && ((father == null || xxx.is_animal(father)) && xxx.is_animal(mother)))
{
//RJW Bestial pregnancy animal-animal
ModLog.Message(" override as Bestial birthing(animal-animal): Father-" + xxx.get_pawnname(father) + " Mother-" + xxx.get_pawnname(mother));
CreateAndBirth<Hediff_BestialPregnancy>();
return false;
}
else if (RJWPregnancySettings.bestial_pregnancy_enabled && ((xxx.is_animal(father) && xxx.is_human(mother)) || (xxx.is_human(father) && xxx.is_animal(mother))))
{
//RJW Bestial pregnancy human-animal
ModLog.Message(" override as Bestial birthing(human-animal): Father-" + xxx.get_pawnname(father) + " Mother-" + xxx.get_pawnname(mother));
CreateAndBirth<Hediff_BestialPregnancy>();
return false;
}
else if (RJWPregnancySettings.humanlike_pregnancy_enabled && (xxx.is_human(father) && xxx.is_human(mother)))
{
//RJW Humanlike pregnancy
ModLog.Message(" override as Humanlike birthing: Father-" + xxx.get_pawnname(father) + " Mother-" + xxx.get_pawnname(mother));
CreateAndBirth<Hediff_HumanlikePregnancy>();
return false;
}
else
{
ModLog.Warning("Hediff_Pregnant::DoBirthSpawn() - rjw checks failed, vanilla pregnancy birth");
ModLog.Warning("Hediff_Pregnant::DoBirthSpawn(): Father-" + xxx.get_pawnname(father) + " Mother-" + xxx.get_pawnname(mother));
//vanilla pregnancy code, no effects on rjw
return true;
}
}
private static bool ProcessRJWPregnancy(Pawn mother, Pawn father)
{
Hediff_BasePregnancy preg =
(Hediff_BasePregnancy)mother.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("RJW_pregnancy")) ?? //RJW Humanlike pregnancy
(Hediff_BasePregnancy)mother.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("RJW_pregnancy_beast")) ?? //RJW Bestial pregnancy
(Hediff_BasePregnancy)mother.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("RJW_pregnancy_mech")); //RJW Bestial pregnancy
if (preg != null)
{
ModLog.Message($"patches_pregnancy::{preg.GetType().Name}::DoBirthSpawn() birthing:" + xxx.get_pawnname(mother));
preg.GiveBirth();
return true;
}
return false;
}
private static bool ProcessDebugPregnancy(Pawn mother, Pawn father)
{
void CreateAndBirth<T>() where T : Hediff_BasePregnancy
{
T hediff = Hediff_BasePregnancy.Create<T>(mother, father);
//hediff.Initialize(mother, father);
hediff.GiveBirth();
}
//CreateAndBirth<Hediff_HumanlikePregnancy>();
//CreateAndBirth<Hediff_BestialPregnancy>();
//CreateAndBirth<Hediff_MechanoidPregnancy>();
//return false;
//debug, add RJW pregnancy and birth it
ModLog.Message("patches_pregnancy::PATCH_Hediff_Pregnant::DoBirthSpawn():Debug_pregnancy birthing:" + xxx.get_pawnname(mother));
if (father == null)
{
father = Hediff_BasePregnancy.Trytogetfather(ref mother);
if (RJWPregnancySettings.bestial_pregnancy_enabled && ((xxx.is_animal(father) || xxx.is_animal(mother)))
|| (xxx.is_animal(mother) && RJWPregnancySettings.animal_pregnancy_enabled))
{
//RJW Bestial pregnancy
ModLog.Message(" override as Bestial birthing, mother: " + xxx.get_pawnname(mother));
CreateAndBirth<Hediff_BestialPregnancy>();
}
else if (RJWPregnancySettings.humanlike_pregnancy_enabled && ((father == null || xxx.is_human(father)) && xxx.is_human(mother)))
{
//RJW Humanlike pregnancy
ModLog.Message(" override as Humanlike birthing, mother: " + xxx.get_pawnname(mother));
CreateAndBirth<Hediff_HumanlikePregnancy>();
}
else
{
ModLog.Warning("Hediff_Pregnant::DoBirthSpawn() - debug vanilla pregnancy birth");
return true;
}
}
return false;
}
}
[HarmonyPatch(typeof(Hediff_Pregnant), "Tick")]
class PATCH_Hediff_Pregnant_Tick
{
[HarmonyPrefix]
static bool on_begin_Tick(Hediff_Pregnant __instance)
{
if (__instance.pawn.IsHashIntervalTick(1000))
{
if (!Genital_Helper.has_vagina(__instance.pawn))
{
__instance.pawn.health.RemoveHediff(__instance);
}
}
return true;
}
}
}
|
TDarksword/rjw
|
Source/Harmony/patch_pregnancy.cs
|
C#
|
mit
| 6,540 |
using System.Linq;
using Verse;
namespace rjw
{
/// <summary>
/// Patch all races into rjw parts recipes
/// </summary>
[StaticConstructorOnStartup]
public static class HarmonyPatches
{
static HarmonyPatches()
{
//summons carpet bombing
//inject races into rjw recipes
foreach (RecipeDef x in DefDatabase<RecipeDef>.AllDefsListForReading.Where(x => x.IsSurgery && (x.targetsBodyPart || !x.appliedOnFixedBodyParts.NullOrEmpty())))
{
if (x.appliedOnFixedBodyParts.Contains(xxx.genitalsDef)
|| x.appliedOnFixedBodyParts.Contains(xxx.breastsDef)
|| x.appliedOnFixedBodyParts.Contains(xxx.anusDef)
)
foreach (ThingDef thingDef in DefDatabase<ThingDef>.AllDefs.Where(thingDef =>
thingDef.race != null && (
thingDef.race.Humanlike ||
thingDef.race.Animal
)))
{
//filter out something, probably?
//if (thingDef.race. == "Human")
// continue;
if (!x.recipeUsers.Contains(thingDef))
{
x.recipeUsers.Add(item: thingDef);
//Log.Message("recipe: " + x.defName + ", thing: " + thingDef.defName);
}
}
}
}
}
}
|
TDarksword/rjw
|
Source/Harmony/patch_recipes.cs
|
C#
|
mit
| 1,144 |
using HarmonyLib;
using RimWorld;
using System;
using Verse;
namespace rjw
{
///<summary>
///RJW Designators checks/update
///update designators only for selected pawn, once, instead of every tick(60 times per sec)
///</summary>
[HarmonyPatch(typeof(Selector), "Select")]
[StaticConstructorOnStartup]
static class PawnSelect
{
[HarmonyPrefix]
private static bool pawnSelect(Selector __instance, ref object obj)
{
if (obj is Pawn)
{
//ModLog.Message("Selector patch");
Pawn pawn = (Pawn)obj;
//ModLog.Message("pawn: " + xxx.get_pawnname(pawn));
pawn.UpdatePermissions();
}
return true;
}
}
//[HarmonyPatch(typeof(Dialog_InfoCard), "Setup")]
////[HarmonyPatch(typeof(Dialog_InfoCard), "Dialog_InfoCard", new Type[] {typeof(Def)})]
//[StaticConstructorOnStartup]
//static class Button
//{
// [HarmonyPostfix]
// public static bool Postfix()
// {
// ModLog.Message("InfoCardButton");
// return true;
// }
//}
}
|
TDarksword/rjw
|
Source/Harmony/patch_selector.cs
|
C#
|
mit
| 968 |
using System.Collections.Generic;
using Verse;
using HarmonyLib;
using UnityEngine;
using System;
using RimWorld;
using Multiplayer.API;
namespace rjw
{
[HarmonyPatch(typeof(RimWorld.PawnWoundDrawer))]
[HarmonyPatch("RenderOverBody")]
[HarmonyPatch(new Type[] { typeof(Vector3), typeof(Mesh), typeof(Quaternion), typeof(bool) })]
class patch_semenOverlay
{
static void Postfix(RimWorld.PawnWoundDrawer __instance, Vector3 drawLoc, Mesh bodyMesh, Quaternion quat, bool forPortrait)
{
Pawn pawn = Traverse.Create(__instance).Field("pawn").GetValue<Pawn>();//get local variable
//TODO add support for animals? unlikely as they has weird meshes
//for now, only draw humans
if (pawn.RaceProps.Humanlike && RJWSettings.cum_overlays)
{
//find bukkake hediff. if it exists, use its draw function
List<Hediff> hediffs = pawn.health.hediffSet.hediffs;
if (hediffs.Exists(x => x.def == RJW_SemenoOverlayHediffDefOf.Hediff_Bukkake))
{
Hediff_Bukkake h = hediffs.Find(x => x.def == RJW_SemenoOverlayHediffDefOf.Hediff_Bukkake) as Hediff_Bukkake;
quat.ToAngleAxis(out float angle, out Vector3 axis);//angle changes when pawn is e.g. downed
//adjustments if the pawn is sleeping in a bed:
bool inBed = false;
Building_Bed building_Bed = pawn.CurrentBed();
if (building_Bed != null)
{
inBed = !building_Bed.def.building.bed_showSleeperBody;
AltitudeLayer altLayer = (AltitudeLayer)Mathf.Max((int)building_Bed.def.altitudeLayer, 15);
Vector3 vector2 = pawn.Position.ToVector3ShiftedWithAltitude(altLayer);
vector2.y += 0.02734375f+0.01f;//just copied from rimworld code+0.01f
drawLoc.y = vector2.y;
}
h.DrawSemen(drawLoc, quat, forPortrait, angle);
}
}
}
}
//adds new gizmo for adding semen for testing
[HarmonyPatch(typeof(Pawn), "GetGizmos")]
class Patch_AddGizmo
{
static void Postfix(Pawn __instance, ref IEnumerable<Gizmo> __result)
{
List<Gizmo> NewList = new List<Gizmo>();
// copy vanilla entries into the new list
foreach (Gizmo entry in __result)
{
NewList.Add(entry);
}
if (Prefs.DevMode && RJWSettings.DevMode && !MP.IsInMultiplayer)
{
Command_Action addSemen = new Command_Action();
addSemen.defaultDesc = "AddSemenHediff";
addSemen.defaultLabel = "AddSemen";
addSemen.action = delegate ()
{
Addsemen(__instance);
};
NewList.Add(addSemen);
}
IEnumerable<Gizmo> output = NewList;
// make caller use the list
__result = output;
}
[SyncMethod]
static void Addsemen(Pawn pawn)
{
//Log.Message("add semen button is pressed for " + pawn);
if (!pawn.Dead && pawn.records != null)
{
//get all acceptable body parts:
IEnumerable<BodyPartRecord> filteredParts = SemenHelper.getAvailableBodyParts(pawn);
//select random part:
BodyPartRecord randomPart;
//filteredParts.TryRandomElement<BodyPartRecord>(out randomPart);
//for testing - choose either genitals or anus:
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
if (Rand.Value > 0.5f)
{
randomPart = pawn.RaceProps.body.AllParts.Find(x => x.def == xxx.anusDef);
}
else
{
randomPart = pawn.RaceProps.body.AllParts.Find(x => x.def == xxx.genitalsDef);
}
if (randomPart != null)
{
SemenHelper.cumOn(pawn, randomPart, 0.2f, null, SemenHelper.CUM_NORMAL);
}
};
}
}
}
|
TDarksword/rjw
|
Source/Harmony/patch_semenOverlay.cs
|
C#
|
mit
| 3,455 |
namespace rjw
{
/// <summary>
/// Patch:
/// recipes
/// </summary>
//TODO: inject rjw recipes
//[HarmonyPatch(typeof(HealthCardUtility), "GenerateSurgeryOption")]
//internal static class PATCH_HealthCardUtility_recipes
//{
// //private static FloatMenuOption GenerateSurgeryOption(Pawn pawn, Thing thingForMedBills, RecipeDef recipe, IEnumerable<ThingDef> missingIngredients, BodyPartRecord part = null)
// //public FloatMenuOption(string label, Action action, MenuOptionPriority priority = MenuOptionPriority.Default, Action mouseoverGuiAction = null, Thing revalidateClickTarget = null, float extraPartWidth = 0, Func<Rect, bool> extraPartOnGUI = null, WorldObject revalidateWorldClickTarget = null);
// //floatMenuOption = new FloatMenuOption(text, action, MenuOptionPriority.Default, null, null, 0f, null, null);
// [HarmonyPostfix]
// private static void Postfix(ref FloatMenuOption __result, ref Pawn pawn)
// {
// ModLog.Message("PATCH_HealthCardUtility_recipes");
// ModLog.Message("PATCH_HealthCardUtility_recipes list: " + __result);
// //foreach (FloatMenuOption recipe in recipeOptionsMaker)
// // {
// // ModLog.Message("PATCH_HealthCardUtility_recipes: " + recipe);
// // }
// return;
// }
//}
//erm.. idk ?
//[HarmonyPatch(typeof(HealthCardUtility), "GetTooltip")]
//internal static class PATCH_HealthCardUtility_GetTooltip
//{
// [HarmonyPostfix]
// private static void Postfix(Pawn pawn)
// {
// ModLog.Message("GetTooltip");
// //ModLog.Message("PATCH_HealthCardUtility_recipes list: " + floatMenuOption);
// //foreach (FloatMenuOption recipe in recipeOptionsMaker)
// // {
// // ModLog.Message("PATCH_HealthCardUtility_recipes: " + recipe);
// // }
// return;
// }
//}
//TODO: make toggle/floatmenu to parts switching
//[HarmonyPatch(typeof(HealthCardUtility), "EntryClicked")]
//internal static class PATCH_HealthCardUtility_EntryClicked
//{
// [HarmonyPostfix]
// private static void Postfix(Pawn pawn)
// {
// ModLog.Message("EntryClicked");
// //ModLog.Message("PATCH_HealthCardUtility_recipes list: " + floatMenuOption);
// //foreach (FloatMenuOption recipe in recipeOptionsMaker)
// // {
// // ModLog.Message("PATCH_HealthCardUtility_recipes: " + recipe);
// // }
// return;
// }
//}
}
|
TDarksword/rjw
|
Source/Harmony/patch_surgery.cs
|
C#
|
mit
| 2,301 |
using System.Linq;
using Verse;
using System.Collections.Generic;
using HarmonyLib;
using RimWorld;
namespace rjw
{
/// <summary>
/// Patch ui for hero mode
/// - disable pawn control for non owned hero
/// - disable equipment management for non owned hero
/// hardcore mode:
/// - disable equipment management for non hero
/// - disable pawn rmb menu for non hero
/// - remove drafting widget for non hero
/// </summary>
//disable forced works(rmb workgivers)
[HarmonyPatch(typeof(FloatMenuMakerMap), "CanTakeOrder")]
[StaticConstructorOnStartup]
static class disable_FloatMenuMakerMap
{
[HarmonyPostfix]
static void this_is_postfix(ref bool __result, Pawn pawn)
{
if (RJWSettings.RPG_hero_control)
{
if ((pawn.IsDesignatedHero() && !pawn.IsHeroOwner()))
{
__result = false; //not hero owner, disable menu
return;
}
if (!pawn.IsDesignatedHero() && RJWSettings.RPG_hero_control_HC)
{
if (pawn.Drafted && pawn.CanChangeDesignationPrisoner() && pawn.CanChangeDesignationColonist())
{
//allow control over drafted pawns, this is limited by below disable_Gizmos patch
}
else
{
__result = false; //not hero, disable menu
}
}
}
}
}
//TODO: disable equipment management
/*
//disable equipment management
[HarmonyPatch(typeof(ITab_Pawn_Gear), "CanControl")]
static class disable_equipment_management
{
[HarmonyPostfix]
static bool this_is_postfix(ref bool __result, Pawn selPawnForGear)
{
Pawn pawn = selPawnForGear;
if (RJWSettings.RPG_hero_control)
{
if ((pawn.IsDesignatedHero() && !pawn.IsHeroOwner())) //not hero owner, disable drafting
{
__result = false; //not hero owner, disable menu
}
else if (!pawn.IsDesignatedHero() && RJWSettings.RPG_hero_control_HC) //not hero, disable drafting
{
if (false)
{
//add some filter for bots and stuff? if there is such stuff
//so it can be drafted and controlled for fighting
}
else
{
__result = false; //not hero, disable menu
}
}
}
return true;
}
}
*/
//TODO: fix error
//TODO: allow shared control over non colonists(droids, etc)?
//disable drafting
[HarmonyPatch(typeof(Pawn), "GetGizmos")]
[StaticConstructorOnStartup]
static class disable_Gizmos
{
[HarmonyPostfix]
static void this_is_postfix(ref IEnumerable<Gizmo> __result, ref Pawn __instance)
{
Pawn pawn = __instance;
List<Gizmo> gizmos = __result.ToList();
if (RJWSettings.RPG_hero_control)
{
if ((pawn.IsDesignatedHero() && !pawn.IsHeroOwner())) //not hero owner, disable drafting
{
foreach (var x in __result.ToList())
{
try
{
//Log.Message("disable_drafter gizmos: " + x);
if ((x as Command).defaultLabel == "Draft")
gizmos.Remove(x as Gizmo);
}
catch
{ }
};
}
else if (!pawn.IsDesignatedHero() && RJWSettings.RPG_hero_control_HC) //not hero, disable drafting
{
//no permission to change designation for NON prisoner hero/ other player
if (pawn.CanChangeDesignationPrisoner() && pawn.CanChangeDesignationColonist()
&& (pawn.kindDef.race.defName.Contains("AIRobot")
|| (pawn.kindDef.race.defName.Contains("Droid") && !pawn.kindDef.race.defName.Contains("AndDroid"))
|| pawn.kindDef.race.defName.Contains("RPP_Bot")
))
//if (false)
{
//add some filter for bots and stuff? if there is such stuff
//so it can be drafted and controlled for fighting
}
else
{
foreach (var x in __result.ToList())
{
try
{
//this may cause error
//ie pawn with shield, or maybe other equipment added gizmos
//maybe because they are not Command?
//w/e just catch error and ignore
//Log.Message("disable_drafter gizmos: " + x);
if ((x as Command).defaultLabel == "Draft")
gizmos.Remove(x);
}
catch
{ }
};
}
}
}
__result = gizmos.AsEnumerable();
}
}
}
|
TDarksword/rjw
|
Source/Harmony/patch_ui_hero.cs
|
C#
|
mit
| 4,076 |
using System.Collections.Generic;
using System.Linq;
using HarmonyLib;
using RimWorld;
using Verse;
using UnityEngine;
using Multiplayer.API;
namespace rjw
{
/// <summary>
/// Harmony patch to toggle the RJW designation box showing
/// </summary>
[HarmonyPatch(typeof(PlaySettings), "DoPlaySettingsGlobalControls")]
[StaticConstructorOnStartup]
public static class RJW_corner_toggle
{
static readonly Texture2D icon = ContentFinder<Texture2D>.Get("UI/Commands/ComfortPrisoner_off");
[HarmonyPostfix]
public static void adding_RJW_toggle(WidgetRow row, bool worldView)
{
if (worldView) return;
row.ToggleableIcon(ref RJWSettings.show_RJW_designation_box, icon, "RJW_designation_box_desc".Translate());
}
}
///<summary>
///Compact button group containing rjw designations on pawn
///</summary>
[HarmonyPatch(typeof(Pawn), "GetGizmos")]
[StaticConstructorOnStartup]
static class Rjw_buttons
{
[HarmonyPostfix]
static void this_is_postfix(ref IEnumerable<Gizmo> __result, ref Pawn __instance)
{
if (!RJWSettings.show_RJW_designation_box) return;
if (!(__instance.Faction == Faction.OfPlayer || __instance.IsPrisonerOfColony)) return;
//ModLog.Message("Harmony patch submit_button is called");
var pawn = __instance;
var gizmos = __result.ToList();
gizmos.Add(new RJWdesignations(pawn));
__result = gizmos.AsEnumerable();
}
}
///<summary>
///Submit gizmo
///</summary>
[HarmonyPatch(typeof(Pawn), "GetGizmos")]
[StaticConstructorOnStartup]
static class submit_button
{
[HarmonyPostfix]
static void this_is_postfix(ref IEnumerable<Gizmo> __result, ref Pawn __instance)
{
//ModLog.Message("Harmony patch submit_button is called");
var pawn = __instance;
var gizmos = __result.ToList();
var enabled = RJWSettings.submit_button_enabled;
if (enabled && pawn.IsColonistPlayerControlled && pawn.Drafted)
if (pawn.CanChangeDesignationColonist())
if (!(pawn.kindDef.race.defName.Contains("Droid") && !AndroidsCompatibility.IsAndroid(pawn)))
{
gizmos.Add(new Command_Action
{
defaultLabel = "CommandSubmit".Translate(),
icon = submit_icon,
defaultDesc = "CommandSubmitDesc".Translate(),
action = delegate
{
LayDownAndAccept(pawn);
},
hotKey = KeyBindingDefOf.Misc3
});
}
__result = gizmos.AsEnumerable();
}
static Texture2D submit_icon = ContentFinder<Texture2D>.Get("UI/Commands/Submit", true);
static HediffDef submit_hediff = HediffDef.Named("Hediff_Submitting");
[SyncMethod]
static void LayDownAndAccept(Pawn pawn)
{
//Log.Message("Submit button is pressed for " + pawn);
pawn.health.AddHediff(submit_hediff);
}
}
}
|
TDarksword/rjw
|
Source/Harmony/patch_ui_rjw_buttons.cs
|
C#
|
mit
| 2,720 |
using Verse;
using RimWorld;
namespace rjw
{
/// <summary>
/// FeelingBroken raise/lower severity
/// </summary>
public class HediffCompProperties_FeelingBrokenSeverityReduce : HediffCompProperties
{
public HediffCompProperties_FeelingBrokenSeverityReduce()
{
this.compClass = typeof(HediffComp_FeelingBrokenSeverityReduce);
}
public SimpleCurve severityPerDayReduce;
}
class HediffComp_FeelingBrokenSeverityReduce : HediffComp_SeverityPerDay
{
private HediffCompProperties_FeelingBrokenSeverityReduce Props
{
get
{
return (HediffCompProperties_FeelingBrokenSeverityReduce)this.props;
}
}
public override void CompPostTick(ref float severityAdjustment)
{
base.CompPostTick(ref severityAdjustment);
if (base.Pawn.IsHashIntervalTick(SeverityUpdateInterval))
{
float num = this.SeverityChangePerDay();
num *= 0.00333333341f;
if (xxx.has_traits(Pawn))
{
if (xxx.RoMIsActive)
if (Pawn.story.traits.HasTrait(xxx.Succubus))
num *= 4.0f;
if (Pawn.story.traits.HasTrait(TraitDefOf.Tough))
{
num *= 2.0f;
}
if (Pawn.story.traits.HasTrait(TraitDefOf.Tough))
{
num *= 2.0f;
}
if (Pawn.story.traits.HasTrait(TraitDef.Named("Wimp")))
{
num *= 0.5f;
}
if (Pawn.story.traits.HasTrait(TraitDefOf.Nerves))
{
int td = Pawn.story.traits.DegreeOfTrait(TraitDefOf.Nerves);
switch (td)
{
case -2:
num *= 2.0f;
break;
case -1:
num *= 1.5f;
break;
case 1:
num *= 0.5f;
break;
case 2:
num *= 0.25f;
break;
}
}
}
severityAdjustment += num;
}
}
protected override float SeverityChangePerDay()
{
return this.Props.severityPerDayReduce.Evaluate(this.parent.ageTicks / 60000f);
}
}
public class HediffCompProperties_FeelingBrokenSeverityIncrease : HediffCompProperties
{
public HediffCompProperties_FeelingBrokenSeverityIncrease()
{
this.compClass = typeof(HediffComp_FeelingBrokenSeverityIncrease);
}
public SimpleCurve severityPerDayIncrease;
}
class HediffComp_FeelingBrokenSeverityIncrease : AdvancedHediffComp
{
private HediffCompProperties_FeelingBrokenSeverityIncrease Props
{
get
{
return (HediffCompProperties_FeelingBrokenSeverityIncrease)this.props;
}
}
public override void CompPostMerged(Hediff other)
{
float num = Props.severityPerDayIncrease.Evaluate(this.parent.ageTicks / 60000f);
if (xxx.has_traits(Pawn))
{
if (xxx.RoMIsActive)
if (Pawn.story.traits.HasTrait(xxx.Succubus))
num *= 0.25f;
if (Pawn.story.traits.HasTrait(TraitDefOf.Tough))
{
num *= 0.5f;
}
if (Pawn.story.traits.HasTrait(TraitDef.Named("Wimp")))
{
num *= 2.0f;
}
if (Pawn.story.traits.HasTrait(TraitDefOf.Nerves))
{
int td = Pawn.story.traits.DegreeOfTrait(TraitDefOf.Nerves);
switch (td)
{
case -2:
num *= 0.25f;
break;
case -1:
num *= 0.5f;
break;
case 1:
num *= 1.5f;
break;
case 2:
num *= 2.0f;
break;
}
}
}
other.Severity *= num;
}
}
public class AdvancedHediffWithComps : HediffWithComps
{
public override bool TryMergeWith(Hediff other)
{
for (int i = 0; i < this.comps.Count; i++)
{
if(this.comps[i] is AdvancedHediffComp) ((AdvancedHediffComp)this.comps[i]).CompBeforeMerged(other);
}
return base.TryMergeWith(other);
}
}
public class AdvancedHediffComp : HediffComp
{
public virtual void CompBeforeMerged(Hediff other)
{
}
}
}
|
TDarksword/rjw
|
Source/Hediffs/HediffComp_FeelingBroken.cs
|
C#
|
mit
| 3,657 |
using System.Linq;
using Verse;
using RimWorld;
using System.Text;
using Multiplayer.API;
using UnityEngine;
namespace rjw
{
//TODO figure out how this thing works and move eggs to comps
[StaticConstructorOnStartup]
public class HediffDef_PartBase : HediffDef
{
public bool discovered = false;
public string Eggs = ""; //for ovi eggs, maybe
public string FluidType = ""; //cummies/milk - insectjelly/honey etc
public string DefaultBodyPart = ""; //Bodypart to move this part to, after fucking up with pc or other mod
public float FluidAmmount = 0; //ammount of Milk/Ejaculation/Wetness
public bool produceEggs; //set in xml
public int minEggTick = 12000;
public int maxEggTick = 120000;
}
}
|
TDarksword/rjw
|
Source/Hediffs/HediffDef_PartBase.cs
|
C#
|
mit
| 726 |
using RimWorld;
using System.Collections.Generic;
using System.Linq;
using Verse;
namespace rjw
{
public class Cocoon : HediffWithComps
{
public int tickNext;
public override void PostMake()
{
Severity = 1.0f;
SetNextTick();
}
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref tickNext, "tickNext", 1000, true);
}
public override void Tick()
{
if (Find.TickManager.TicksGame >= tickNext)
{
//Log.Message("Cocoon::Tick() " + base.xxx.get_pawnname(pawn));
HealWounds();
SatisfyHunger();
SatisfyThirst();
SetNextTick();
}
}
public void HealWounds()
{
IEnumerable<Hediff> enumerable = from hd in pawn.health.hediffSet.hediffs
where !hd.IsTended() && hd.TendableNow()
select hd;
if (enumerable != null)
{
foreach (Hediff item in enumerable)
{
HediffWithComps val = item as HediffWithComps;
if (val != null)
if (val.Bleeding)
{
//Log.Message("TrySealWounds " + xxx.get_pawnname(pawn) + ", Bleeding " + item.Label);
//HediffComp_TendDuration val2 = HediffUtility.TryGetComp<HediffComp_TendDuration>(val);
val.Heal(0.5f);
//val2.tendQuality = 1f;
//val2.tendTicksLeft = 10000;
//pawn.health.Notify_HediffChanged(item);
}
// tend infections
// tend lifeThreatening chronic
else if ((!val.def.chronic && val.def.lethalSeverity > 0f) || (val.CurStage?.lifeThreatening ?? false))
{
//Log.Message("TryHeal " + xxx.get_pawnname(pawn) + ", infection(?) " + item.Label);
HediffComp_TendDuration val2 = HediffUtility.TryGetComp<HediffComp_TendDuration>(val);
val2.tendQuality = 1f;
val2.tendTicksLeft = 10000;
pawn.health.Notify_HediffChanged(item);
}
}
}
}
public void SatisfyHunger()
{
Need_Food need = pawn.needs.TryGetNeed<Need_Food>();
if (need == null)
{
return;
}
//pawn.PositionHeld.IsInPrisonCell(pawn.Map)
//Log.Message("Cocoon::SatisfyHunger() " + xxx.get_pawnname(pawn) + " IsInPrisonCell " + pawn.PositionHeld.IsInPrisonCell(pawn.Map));
//Log.Message("Cocoon::SatisfyHunger() " + xxx.get_pawnname(pawn) + " GetRoom " + pawn.PositionHeld.GetRoom(pawn.Map));
//Log.Message("Cocoon::SatisfyHunger() " + xxx.get_pawnname(pawn) + " GetRoom " + pawn.PositionHeld.GetZone(pawn.Map));
if (need.CurLevel < 0.15f)
{
//Log.Message("Cocoon::SatisfyHunger() " + xxx.get_pawnname(pawn) + " need to eat");
float nutrition_amount = need.MaxLevel / 5f;
pawn.needs.food.CurLevel += nutrition_amount;
}
}
public void SatisfyThirst()
{
if (!xxx.DubsBadHygieneIsActive)
return;
Need need = pawn.needs.AllNeeds.Find(x => x.def == xxx.DBHThirst);
if (need == null)
{
return;
}
if (need.CurLevel < 0.15f)
{
//Log.Message("Cocoon::SatisfyThirst() " + xxx.get_pawnname(pawn) + " need to drink");
float nutrition_amount = need.MaxLevel / 5f;
pawn.needs.TryGetNeed(need.def).CurLevel += nutrition_amount;
}
}
public void SetNextTick()
{
//make actual tick every 16.6 sec
tickNext = Find.TickManager.TicksGame + 1000;
//Log.Message("Cocoon::SetNextTick() " + tickNext);
}
}
}
|
TDarksword/rjw
|
Source/Hediffs/Hediff_Cocoon.cs
|
C#
|
mit
| 3,255 |
using Verse;
namespace rjw
{
public class Hediff_ID : Hediff
{
public override string LabelBase
{
get
{
if (!pawn.health.hediffSet.HasHediff(std.hiv.hediff_def))
return base.LabelBase;
else
return "AIDS";
}
}
}
}
|
TDarksword/rjw
|
Source/Hediffs/Hediff_ID.cs
|
C#
|
mit
| 252 |
using System.Linq;
using Verse;
using RimWorld;
using System.Text;
using Multiplayer.API;
using UnityEngine;
namespace rjw
{
public class Hediff_PartBaseArtifical : Hediff_Implant
{
public override bool ShouldRemove => false;
public bool discovered = false;
// Used for ovipositors.
public int nextEggTick = -1;
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref this.nextEggTick, "nextEggTick");
// Scribe_Values.Look(ref this.produceEggs, "produceEggs");
// Scribe_Defs.Look(ref this.pawnKindDefOverride, "pawnKindDefOverride");
// Scribe_Values.Look(ref this.genitalType, "genitalType");
}
public override string LabelBase
{
get
{
/*
* make patch to make/save capmods?
if (CapMods.Count < 5)
{
PawnCapacityModifier pawnCapacityModifier = new PawnCapacityModifier();
pawnCapacityModifier.capacity = PawnCapacityDefOf.Moving;
pawnCapacityModifier.offset += 0.5f;
CapMods.Add(pawnCapacityModifier);
}
*/
//name/kind
return this.def.label;
}
}
//public override string LabelInBrackets
//{
// get
// {
// string size = "on fire!";
// size = (this.comps.Find(x => x is CompHediffBodyPart) as CompHediffBodyPart).Size;
// return size;
// //vanilla
// //return (this.CurStage != null && !this.CurStage.label.NullOrEmpty()) ? this.CurStage.label : null;
// }
//}
//overrides comps
//public override string TipStringExtra
//{
// get
// {
// StringBuilder stringBuilder = new StringBuilder();
// foreach (StatDrawEntry current in HediffStatsUtility.SpecialDisplayStats(this.CurStage, this))
// {
// if (current.ShouldDisplay)
// {
// stringBuilder.AppendLine(current.LabelCap + ": " + current.ValueString);
// }
// }
// //stringBuilder.AppendLine("Size: " + this.TryGetComp<CompHediffBodyPart>.Size);
// //stringBuilder.AppendLine("1");// size?
// //stringBuilder.AppendLine("2");// erm something?
// return stringBuilder.ToString();
// }
//}
/// <summary>
/// stack hediff in health tab?
/// </summary>
public override int UIGroupKey
{
get
{
if (RJWSettings.StackRjwParts)
//(Label x count)
return this.Label.GetHashCode();
else
//dont
return loadID;
}
}
/// <summary>
/// do not merge same rjw parts into one
/// </summary>
public override bool TryMergeWith(Hediff other)
{
return false;
}
/// <summary>
/// show rjw parts in health tab or not
/// </summary>
public override bool Visible
{
get
{
if (RJWSettings.ShowRjwParts == RJWSettings.ShowParts.Hide)
{
discovered = false;
}
else if (!discovered)
{
if (RJWSettings.ShowRjwParts == RJWSettings.ShowParts.Show)
{
discovered = true;
return discovered;
}
//show at game start
if (Current.ProgramState != ProgramState.Playing && Prefs.DevMode)
return true;
//show for hero
if (pawn.IsDesignatedHero() && pawn.IsHeroOwner())
{
discovered = true;
return discovered;
}
//show if no clothes
if (pawn.apparel != null)// animals?
{
bool hasPants;
bool hasShirt;
pawn.apparel.HasBasicApparel(out hasPants, out hasShirt);// naked?
if (!hasPants)
{
bool flag3 = false;
foreach (BodyPartRecord current in this.pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null, null))
{
if (current.IsInGroup(BodyPartGroupDefOf.Legs))
{
flag3 = true;
break;
}
}
if (!flag3)
{
hasPants = true;
}
}
if (this.def.defName.ToLower().Contains("breast") || this.def.defName.ToLower().Contains("chest"))
discovered = !hasShirt;
else
discovered = !hasPants;
}
}
return discovered;
}
}
/// <summary>
/// egg production ticks
/// </summary>
[SyncMethod]
public override void Tick()
{
ageTicks++;
if (!pawn.IsHashIntervalTick(10000)) // run every ~3min
{
return;
}
var partBase = def as HediffDef_PartBase;
if (partBase != null)
{
if (partBase.produceEggs)
{
//Log.Message("genital tick");
//Log.Message("pawn " + pawn.Label);
//Log.Message("id " + pawn.ThingID);
var IsPlayerFaction = pawn.Faction?.IsPlayer ?? false; //colonists/animals
var IsPlayerHome = pawn.Map?.IsPlayerHome ?? false;
if (IsPlayerHome || IsPlayerFaction || pawn.IsPrisonerOfColony)
{
//Log.Message("-1 ");
if (nextEggTick < 0)
{
nextEggTick = Rand.Range(partBase.minEggTick, partBase.maxEggTick);
return;
}
//Log.Message("-2 ");
if (pawn.health.capacities.GetLevel(PawnCapacityDefOf.Moving) <= 0.5)
{
return;
}
//Log.Message("-3 ");
if (nextEggTick > 0 && ageTicks >= nextEggTick)
{
float maxEggsSize = (pawn.BodySize / 5) * (xxx.has_quirk(pawn, "Incubator") ? 2f : 1f) *
(Genital_Helper.has_ovipositorF(pawn) ? 2f : 0.5f);
float eggedsize = 0;
//Log.Message("-4 ");
foreach (var ownEgg in pawn.health.hediffSet.GetHediffs<Hediff_InsectEgg>())
{
if (ownEgg.father != null)
eggedsize += ownEgg.father.RaceProps.baseBodySize / 5;
else if (ownEgg.implanter != null)
eggedsize += ownEgg.implanter.RaceProps.baseBodySize / 5;
else //something fucked up, father/implanter null / immortal pawn reborn /egg is broken?
eggedsize += ownEgg.eggssize;
}
//Log.Message("-5 ");
if (RJWSettings.DevMode) ModLog.Message($"{xxx.get_pawnname(pawn)} filled with {eggedsize} out of max capacity of {maxEggsSize} eggs.");
if (eggedsize < maxEggsSize)
{
HediffDef_InsectEgg egg = null;
string defname = "";
//Log.Message("-6 ");
while (egg == null)
{
if (defname == "")
{
if (RJWSettings.DevMode) ModLog.Message(" trying to find " + pawn.kindDef.defName + " egg");
defname = pawn.kindDef.defName;
}
else
{
if (RJWSettings.DevMode) ModLog.Message(" no " + defname + " egg found, defaulting to Unknown egg");
defname = "Unknown";
}
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
//Log.Message("-7 ");
egg = (from x in DefDatabase<HediffDef_InsectEgg>.AllDefs where x.IsParent(defname) select x)
.RandomElement();
}
//Log.Message("-8 ");
if (RJWSettings.DevMode) ModLog.Message("I choose you " + egg + "!");
//Log.Message("-9 ");
var genitals = Genital_Helper.get_genitalsBPR(pawn);
if (genitals != null)
{
//Log.Message("-10 ");
var addedEgg = pawn.health.AddHediff(egg, genitals) as Hediff_InsectEgg;
//Log.Message("-11 ");
addedEgg?.Implanter(pawn);
}
//Log.Message("-12 ");
}
// Reset for next egg.
ageTicks = 0;
nextEggTick = -1;
}
}
}
}
}
}
}
|
TDarksword/rjw
|
Source/Hediffs/Hediff_PartBaseArtifical.cs
|
C#
|
mit
| 7,235 |
using System.Linq;
using Verse;
using RimWorld;
using System.Text;
using Multiplayer.API;
using UnityEngine;
namespace rjw
{
public class Hediff_PartBaseNatural : HediffWithComps
{
public override bool ShouldRemove => false;
public bool discovered = false;
// Used for ovipositors.
public int nextEggTick = -1;
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref this.nextEggTick, "nextEggTick");
// Scribe_Values.Look(ref this.produceEggs, "produceEggs");
// Scribe_Defs.Look(ref this.pawnKindDefOverride, "pawnKindDefOverride");
// Scribe_Values.Look(ref this.genitalType, "genitalType");
}
public override string LabelBase
{
get
{
/*
* make patch to make/save capmods?
if (CapMods.Count < 5)
{
PawnCapacityModifier pawnCapacityModifier = new PawnCapacityModifier();
pawnCapacityModifier.capacity = PawnCapacityDefOf.Moving;
pawnCapacityModifier.offset += 0.5f;
CapMods.Add(pawnCapacityModifier);
}
*/
//name/kind
return this.def.label;
}
}
//public override string LabelInBrackets
//{
// get
// {
// string size = "on fire!";
// size = (this.comps.Find(x => x is CompHediffBodyPart) as CompHediffBodyPart).Size;
// return size;
// //vanilla
// //return (this.CurStage != null && !this.CurStage.label.NullOrEmpty()) ? this.CurStage.label : null;
// }
//}
//overrides comps
//public override string TipStringExtra
//{
// get
// {
// StringBuilder stringBuilder = new StringBuilder();
// foreach (StatDrawEntry current in HediffStatsUtility.SpecialDisplayStats(this.CurStage, this))
// {
// if (current.ShouldDisplay)
// {
// stringBuilder.AppendLine(current.LabelCap + ": " + current.ValueString);
// }
// }
// //stringBuilder.AppendLine("Size: " + this.TryGetComp<CompHediffBodyPart>.Size);
// //stringBuilder.AppendLine("1");// size?
// //stringBuilder.AppendLine("2");// erm something?
// return stringBuilder.ToString();
// }
//}
/// <summary>
/// stack hediff in health tab?
/// </summary>
public override int UIGroupKey
{
get
{
if (RJWSettings.StackRjwParts)
//(Label x count)
return this.Label.GetHashCode();
else
//dont
return loadID;
}
}
/// <summary>
/// do not merge same rjw parts into one
/// </summary>
public override bool TryMergeWith(Hediff other)
{
return false;
}
/// <summary>
/// show rjw parts in health tab or not
/// </summary>
public override bool Visible
{
get
{
if (RJWSettings.ShowRjwParts == RJWSettings.ShowParts.Hide)
{
discovered = false;
}
else if (!discovered)
{
if (RJWSettings.ShowRjwParts == RJWSettings.ShowParts.Show)
{
discovered = true;
return discovered;
}
//show at game start
if (Current.ProgramState != ProgramState.Playing && Prefs.DevMode)
return true;
//show for hero
if (pawn.IsDesignatedHero() && pawn.IsHeroOwner())
{
discovered = true;
return discovered;
}
//show if no clothes
if (pawn.apparel != null)// animals?
{
bool hasPants;
bool hasShirt;
pawn.apparel.HasBasicApparel(out hasPants, out hasShirt);// naked?
if (!hasPants)
{
bool flag3 = false;
foreach (BodyPartRecord current in this.pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null, null))
{
if (current.IsInGroup(BodyPartGroupDefOf.Legs))
{
flag3 = true;
break;
}
}
if (!flag3)
{
hasPants = true;
}
}
if (this.def.defName.ToLower().Contains("breast") || this.def.defName.ToLower().Contains("chest"))
discovered = !hasShirt;
else
discovered = !hasPants;
}
}
return discovered;
}
}
/// <summary>
/// egg production ticks
/// </summary>
[SyncMethod]
public override void Tick()
{
ageTicks++;
if (!pawn.IsHashIntervalTick(10000)) // run every ~3min
{
return;
}
var partBase = def as HediffDef_PartBase;
if (partBase != null)
{
if (partBase.produceEggs)
{
//Log.Message("genital tick");
//Log.Message("pawn " + pawn.Label);
//Log.Message("id " + pawn.ThingID);
var IsPlayerFaction = pawn.Faction?.IsPlayer ?? false; //colonists/animals
var IsPlayerHome = pawn.Map?.IsPlayerHome ?? false;
if (IsPlayerHome || IsPlayerFaction || pawn.IsPrisonerOfColony)
{
//Log.Message("-1 ");
if (nextEggTick < 0)
{
nextEggTick = Rand.Range(partBase.minEggTick, partBase.maxEggTick);
return;
}
//Log.Message("-2 ");
if (pawn.health.capacities.GetLevel(PawnCapacityDefOf.Moving) <= 0.5)
{
return;
}
//Log.Message("-3 ");
if (nextEggTick > 0 && ageTicks >= nextEggTick)
{
float maxEggsSize = (pawn.BodySize / 5) * (xxx.has_quirk(pawn, "Incubator") ? 2f : 1f) *
(Genital_Helper.has_ovipositorF(pawn) ? 2f : 0.5f);
float eggedsize = 0;
//Log.Message("-4 ");
foreach (var ownEgg in pawn.health.hediffSet.GetHediffs<Hediff_InsectEgg>())
{
if (ownEgg.father != null)
eggedsize += ownEgg.father.RaceProps.baseBodySize / 5;
else if (ownEgg.implanter != null)
eggedsize += ownEgg.implanter.RaceProps.baseBodySize / 5;
else //something fucked up, father/implanter null / immortal pawn reborn /egg is broken?
eggedsize += ownEgg.eggssize;
}
//Log.Message("-5 ");
if (RJWSettings.DevMode) ModLog.Message($"{xxx.get_pawnname(pawn)} filled with {eggedsize} out of max capacity of {maxEggsSize} eggs.");
if (eggedsize < maxEggsSize)
{
HediffDef_InsectEgg egg = null;
string defname = "";
//Log.Message("-6 ");
while (egg == null)
{
if (defname == "")
{
if (RJWSettings.DevMode) ModLog.Message(" trying to find " + pawn.kindDef.defName + " egg");
defname = pawn.kindDef.defName;
}
else
{
if (RJWSettings.DevMode) ModLog.Message(" no " + defname + " egg found, defaulting to Unknown egg");
defname = "Unknown";
}
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
//Log.Message("-7 ");
egg = (from x in DefDatabase<HediffDef_InsectEgg>.AllDefs where x.IsParent(defname) select x)
.RandomElement();
}
//Log.Message("-8 ");
if (RJWSettings.DevMode) ModLog.Message("I choose you " + egg + "!");
//Log.Message("-9 ");
var genitals = Genital_Helper.get_genitalsBPR(pawn);
if (genitals != null)
{
//Log.Message("-10 ");
var addedEgg = pawn.health.AddHediff(egg, genitals) as Hediff_InsectEgg;
//Log.Message("-11 ");
addedEgg?.Implanter(pawn);
}
//Log.Message("-12 ");
}
// Reset for next egg.
ageTicks = 0;
nextEggTick = -1;
}
}
}
}
}
}
}
|
TDarksword/rjw
|
Source/Hediffs/Hediff_PartBaseNatural.cs
|
C#
|
mit
| 7,232 |
using System.Linq;
using Verse;
namespace rjw
{
public class Hediff_PartsSizeChangerPC : HediffWithComps
{
public override void PostAdd(DamageInfo? dinfo)
{
foreach (Hediff hed in pawn.health.hediffSet.hediffs.Where(x => x.Part != null && x.Part == Part && (x is Hediff_PartBaseNatural || x is Hediff_PartBaseArtifical)).ToList())
{
CompHediffBodyPart CompHediff = hed.TryGetComp<rjw.CompHediffBodyPart>();
if (CompHediff != null)
{
//Log.Message(" Hediff_PartsSizeChanger: " + hed.Label);
//Log.Message(" Hediff_PartsSizeChanger: " + hed.Severity);
//Log.Message(" Hediff_PartsSizeChanger: " + CompHediff.SizeBase);
//Log.Message(" Hediff_PartsSizeChanger: " + "-----");
//Log.Message(" Hediff_PartsSizeChanger: " + this.Label);
//Log.Message(" Hediff_PartsSizeChanger: " + this.Severity);
CompHediff.SizeBase = this.CurStage.minSeverity;
CompHediff.initComp(reroll: true);
CompHediff.updatesize();
//Log.Message(" Hediff_PartsSizeChanger: " + "-----");
//Log.Message(" Hediff_PartsSizeChanger: " + hed.Label);
//Log.Message(" Hediff_PartsSizeChanger: " + hed.Severity);
//Log.Message(" Hediff_PartsSizeChanger: " + CompHediff.SizeBase);
}
}
pawn.health.RemoveHediff(this);
}
}
public class Hediff_PartsSizeChangerCE : HediffWithComps
{
public override void PostAdd(DamageInfo? dinfo)
{
foreach (Hediff hed in pawn.health.hediffSet.hediffs.Where(x => x.Part != null && x.Part == Part && (x is Hediff_PartBaseNatural || x is Hediff_PartBaseArtifical)).ToList())
{
CompHediffBodyPart CompHediff = hed.TryGetComp<rjw.CompHediffBodyPart>();
if (CompHediff != null)
{
CompHediff.SizeBase = this.def.initialSeverity;
CompHediff.initComp(reroll: true);
CompHediff.updatesize();
}
}
pawn.health.RemoveHediff(this);
}
}
}
|
TDarksword/rjw
|
Source/Hediffs/Hediff_PartsSizeChanger.cs
|
C#
|
mit
| 1,881 |
using Verse;
//Hediff worker for pawns' "lay down and submit" button
namespace rjw
{
public class Hediff_Submitting: HediffWithComps
{
public override bool ShouldRemove {
get
{
Pawn daddy = pawn.CarriedBy;
if (daddy != null && daddy.Faction == pawn.Faction)
{
return true;
}
else
return base.ShouldRemove;
}
}
}
}
|
TDarksword/rjw
|
Source/Hediffs/Hediff_Submitting.cs
|
C#
|
mit
| 364 |
using System;
using System.Collections.Generic;
using System.Linq;
using Verse;
namespace rjw
{
public class PartSizeExtension : DefModExtension
{
/// <summary>
/// Human standard would be 1.0. Null for no weight display.
/// </summary>
public float? density = null;
public List<float> lengths;
public List<float> girths;
public List<float> cupSizes;
public static bool TryGetLength(Hediff hediff, out float size)
{
return TryGetSizeFromCurve(hediff, extension => extension.lengths, true, out size);
}
public static bool TryGetGirth(Hediff hediff, out float size)
{
return TryGetSizeFromCurve(hediff, extension => extension.girths, true, out size);
}
public static bool TryGetCupSize(Hediff hediff, out float size)
{
// Cup size is already "scaled" because the same breast volume has a smaller cup size on a larger band size.
return TryGetSizeFromCurve(hediff, extension => extension.cupSizes, false, out size);
}
public static float GetBandSize(Hediff hediff)
{
var size = GetUnderbustSize(hediff);
size /= PartStagesDef.Instance.bandSizeInterval;
size = (float)Math.Round(size, MidpointRounding.AwayFromZero);
size *= PartStagesDef.Instance.bandSizeInterval;
return size;
}
public static float GetUnderbustSize(Hediff hediff)
{
return PartStagesDef.Instance.bandSizeBase * GetLinearScale(hediff);
}
static float GetLinearScale(Hediff hediff)
{
return (float)Math.Pow(hediff.pawn.BodySize, 1.0 / 3.0);
}
public static bool TryGetOverbustSize(Hediff hediff, out float size)
{
if (!TryGetCupSize(hediff, out var cupSize))
{
size = 0f;
return false;
}
// Cup size is rounded up, so to do the math backwards subtract .9
size = GetUnderbustSize(hediff) + ((cupSize - .9f) * PartStagesDef.Instance.cupSizeInterval);
return true;
}
static bool TryGetSizeFromCurve(
Hediff hediff,
Func<PartSizeExtension, List<float>> getList,
bool shouldScale,
out float size)
{
if (!hediff.def.HasModExtension<PartSizeExtension>())
{
size = 0f;
return false;
}
var extension = hediff.def.GetModExtension<PartSizeExtension>();
var list = getList(extension);
if (list == null)
{
size = 0f;
return false;
}
var curve = new SimpleCurve(hediff.def.stages.Zip(list, (stage, size) => new CurvePoint(stage.minSeverity, size)));
var scaleFactor = shouldScale ? GetLinearScale(hediff) : 1.0f;
size = curve.Evaluate(hediff.Severity) * scaleFactor;
return true;
}
public static bool TryGetPenisWeight(Hediff hediff, out float weight)
{
if (!TryGetLength(hediff, out float length) ||
!TryGetGirth(hediff, out float girth))
{
weight = 0f;
return false;
}
var density = hediff.def.GetModExtension<PartSizeExtension>().density;
if (density == null)
{
weight = 0f;
return false;
}
var r = girth / (2.0 * Math.PI);
var volume = r * r * Math.PI * length;
weight = (float)(volume * density.Value / 1000f);
return true;
}
public static bool TryGetBreastWeight(Hediff hediff, out float weight)
{
if (!TryGetCupSize(hediff, out float rawSize))
{
weight = 0f;
return false;
}
var density = hediff.def.GetModExtension<PartSizeExtension>().density;
if (density == null)
{
weight = 0f;
return false;
}
// Up a band size and down a cup size is about the same volume.
var extraBandSize = PartStagesDef.Instance.bandSizeBase * (1.0f - GetLinearScale(hediff));
var extraCupSizes = extraBandSize / PartStagesDef.Instance.bandSizeInterval;
var size = rawSize + extraCupSizes;
var pounds = 0.765f
+ 0.415f * size
+ -0.0168f * size * size
+ 2.47E-03f * size * size * size;
var kg = Math.Max(0, pounds * 0.45359237f);
weight = kg * density.Value;
return true;
}
}
}
|
TDarksword/rjw
|
Source/Hediffs/PartSizeExtension.cs
|
C#
|
mit
| 3,860 |
using System;
using System.Collections.Generic;
using System.Linq;
using Verse;
namespace rjw
{
public class InteractionExtension : DefModExtension
{
/// <summary>
/// </summary>
public string RMBLabelM = ""; // rmb menu for male
public string RMBLabelF = ""; // rmb menu for female
public string RMBDescription = ""; // rmb menu description for initiator
public string i_role = ""; // initiator role passive/active /mutual?(69)
public List<string> tags; // tags for filtering/finding interaction
public List<string> i_tags; // tags for what initiator does
public List<string> r_tags; // tags for what reciever does
public List<string> forced_rulepack_def; //forced rulepack(s) for this interaction
}
}
|
TDarksword/rjw
|
Source/Interactions/InteractionExtension.cs
|
C#
|
mit
| 734 |
using System.Collections.Generic;
using System.Text;
using RimWorld;
using Verse;
namespace rjw
{
internal class InteractionWorker_AnalSexAttempt : InteractionWorker
{
//initiator - rapist
//recipient - victim
public static bool AttemptAnalSex(Pawn initiator, Pawn recipient)
{
//--Log.Message(xxx.get_pawnname(initiator) + " is attempting to anally rape " + xxx.get_pawnname(recipient));
return true;
}
public override float RandomSelectionWeight(Pawn initiator, Pawn recipient)
{
// this interaction is triggered by the jobdriver
if (initiator == null || recipient == null)
return 0.0f;
return 0.0f; // base.RandomSelectionWeight(initiator, recipient);
}
public override void Interacted(Pawn initiator, Pawn recipient, List<RulePackDef> extraSentencePacks, out string letterText, out string letterLabel, out LetterDef letterDef, out LookTargets lookTargets)
{
//add something fancy here later?
letterText = null;
letterLabel = null;
letterDef = null;
lookTargets = recipient;
//Find.LetterStack.ReceiveLetter("Rape attempt", "A wandering nymph has decided to join your colony.", LetterDefOf.NegativeEvent, recipient);
if (initiator == null || recipient == null)
return;
//--ModLog.Message(" InteractionWorker_AnalRapeAttempt::Interacted( " + xxx.get_pawnname(initiator) + ", " + xxx.get_pawnname(recipient) + " ) called");
AttemptAnalSex(initiator, recipient);
}
}
internal class InteractionWorker_VaginalSexAttempt : InteractionWorker
{
//initiator - rapist
//recipient - victim
public static bool AttemptAnalSex(Pawn initiator, Pawn recipient)
{
//--Log.Message(xxx.get_pawnname(initiator) + " is attempting to anally rape " + xxx.get_pawnname(recipient));
return false;
}
public override float RandomSelectionWeight(Pawn initiator, Pawn recipient)
{
// this interaction is triggered by the jobdriver
if (initiator == null || recipient == null)
return 0.0f;
return 0.0f; // base.RandomSelectionWeight(initiator, recipient);
}
public override void Interacted(Pawn initiator, Pawn recipient, List<RulePackDef> extraSentencePacks, out string letterText, out string letterLabel, out LetterDef letterDef, out LookTargets lookTargets)
{
//add something fancy here later?
letterText = null;
letterLabel = null;
letterDef = null;
lookTargets = recipient;
//Find.LetterStack.ReceiveLetter("Rape attempt", "A wandering nymph has decided to join your colony.", LetterDefOf.NegativeEvent, recipient);
if (initiator == null || recipient == null)
return;
//--ModLog.Message(" InteractionWorker_AnalRapeAttempt::Interacted( " + xxx.get_pawnname(initiator) + ", " + xxx.get_pawnname(recipient) + " ) called");
AttemptAnalSex(initiator, recipient);
}
}
internal class InteractionWorker_OtherSexAttempt : InteractionWorker
{
//initiator - rapist
//recipient - victim
public static bool AttemptAnalSex(Pawn initiator, Pawn recipient)
{
//--Log.Message(xxx.get_pawnname(initiator) + " is attempting to anally rape " + xxx.get_pawnname(recipient));
return false;
}
public override float RandomSelectionWeight(Pawn initiator, Pawn recipient)
{
// this interaction is triggered by the jobdriver
if (initiator == null || recipient == null)
return 0.0f;
return 0.0f; // base.RandomSelectionWeight(initiator, recipient);
}
public override void Interacted(Pawn initiator, Pawn recipient, List<RulePackDef> extraSentencePacks, out string letterText, out string letterLabel, out LetterDef letterDef, out LookTargets lookTargets)
{
//add something fancy here later?
letterText = null;
letterLabel = null;
letterDef = null;
lookTargets = recipient;
//Find.LetterStack.ReceiveLetter("Rape attempt", "A wandering nymph has decided to join your colony.", LetterDefOf.NegativeEvent, recipient);
if (initiator == null || recipient == null)
return;
//--ModLog.Message(" InteractionWorker_AnalRapeAttempt::Interacted( " + xxx.get_pawnname(initiator) + ", " + xxx.get_pawnname(recipient) + " ) called");
AttemptAnalSex(initiator, recipient);
}
}
}
|
TDarksword/rjw
|
Source/Interactions/InteractionWorker_SexAttempt.cs
|
C#
|
mit
| 4,158 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
using Multiplayer.API;
namespace rjw
{
public class JobDriver_BestialityForFemale : JobDriver_SexBaseInitiator
{
public IntVec3 SleepSpot => Bed.SleepPosOfAssignedPawn(pawn);
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return pawn.Reserve(Target, job, 1, 0, null, errorOnFailed);
}
[SyncMethod]
protected override IEnumerable<Toil> MakeNewToils()
{
setup_ticks();
this.FailOnDespawnedOrNull(iTarget);
this.FailOnDespawnedNullOrForbidden(iBed);
this.FailOn(() => !pawn.CanReserveAndReach(Partner, PathEndMode.Touch, Danger.Deadly));
this.FailOn(() => pawn.Drafted);
this.FailOn(() => Partner.IsFighting());
this.FailOn(() => !Partner.CanReach(pawn, PathEndMode.Touch, Danger.Deadly));
yield return Toils_Reserve.Reserve(iTarget, 1, 0);
Toil gotoAnimal = Toils_Goto.GotoThing(iTarget, PathEndMode.Touch);
yield return gotoAnimal;
Toil gotoBed = new Toil();
gotoBed.defaultCompleteMode = ToilCompleteMode.PatherArrival;
gotoBed.FailOnBedNoLongerUsable(iBed);
gotoBed.AddFailCondition(() => Partner.Downed);
gotoBed.initAction = delegate
{
pawn.pather.StartPath(SleepSpot, PathEndMode.OnCell);
Partner.jobs.StopAll();
Job job = JobMaker.MakeJob(JobDefOf.GotoMindControlled, SleepSpot);
Partner.jobs.StartJob(job, JobCondition.InterruptForced);
};
yield return gotoBed;
Toil waitInBed = new Toil();
waitInBed.FailOn(() => pawn.GetRoom(RegionType.Set_Passable) == null);
waitInBed.defaultCompleteMode = ToilCompleteMode.Delay;
waitInBed.initAction = delegate
{
ticksLeftThisToil = 5000;
};
waitInBed.tickAction = delegate
{
pawn.GainComfortFromCellIfPossible();
if (IsInOrByBed(Bed, Partner) && pawn.PositionHeld == Partner.PositionHeld)
{
ReadyForNextToil();
}
};
yield return waitInBed;
Toil StartPartnerJob = new Toil();
StartPartnerJob.defaultCompleteMode = ToilCompleteMode.Instant;
StartPartnerJob.socialMode = RandomSocialMode.Off;
StartPartnerJob.initAction = delegate
{
var gettin_loved = JobMaker.MakeJob(xxx.gettin_loved, pawn, Bed);
Partner.jobs.StartJob(gettin_loved, JobCondition.InterruptForced);
};
yield return StartPartnerJob;
Toil SexToil = new Toil();
SexToil.AddFailCondition(() => Partner.Dead || !IsInOrByBed(Bed, Partner));
SexToil.socialMode = RandomSocialMode.Off;
SexToil.defaultCompleteMode = ToilCompleteMode.Never;
SexToil.handlingFacing = true;
SexToil.initAction = delegate
{
Partner.pather.StopDead();
Partner.jobs.curDriver.asleep = false;
usedCondom = CondomUtility.TryUseCondom(pawn);
Start();
};
SexToil.AddPreTickAction(delegate
{
--ticks_left;
if (pawn.IsHashIntervalTick(ticks_between_hearts))
if (xxx.is_zoophile(pawn))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
else
ThrowMetaIcon(pawn.Position, pawn.Map, xxx.mote_noheart);
SexTick(pawn, Partner);
SexUtility.reduce_rest(pawn, 1);
SexUtility.reduce_rest(Partner, 2);
if (ticks_left <= 0)
ReadyForNextToil();
});
SexToil.AddFinishAction(delegate
{
End();
});
yield return SexToil;
Toil afterSex = new Toil
{
initAction = delegate
{
//Log.Message("JobDriver_BestialityForFemale::MakeNewToils() - Calling aftersex");
SexUtility.ProcessSex(Partner, pawn, usedCondom: usedCondom, sextype: sexType);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
yield return afterSex;
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_BestialityForFemale.cs
|
C#
|
mit
| 3,627 |
using System.Collections.Generic;
using System.Linq;
using RimWorld;
using Verse;
using Verse.AI;
using Multiplayer.API;
namespace rjw
{
public class JobDriver_BestialityForMale : JobDriver_Rape
{
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return pawn.Reserve(Target, job, 1, 0, null, errorOnFailed);
}
[SyncMethod]
protected override IEnumerable<Toil> MakeNewToils()
{
//--ModLog.Message(" JobDriver_BestialityForMale::MakeNewToils() called");
setup_ticks();
var PartnerJob = xxx.gettin_bred;
//this.FailOn (() => (!Partner.health.capacities.CanBeAwake) || (!comfort_prisoners.is_designated (Partner)));
// Fail if someone else reserves the prisoner before the pawn arrives or colonist can't reach animal
this.FailOn(() => !pawn.CanReserveAndReach(Partner, PathEndMode.Touch, Danger.Deadly));
this.FailOn(() => Partner.HostileTo(pawn));
this.FailOnDespawnedNullOrForbidden(iTarget);
this.FailOn(() => pawn.Drafted);
yield return Toils_Reserve.Reserve(iTarget, 1, 0);
//ModLog.Message(" JobDriver_BestialityForMale::MakeNewToils() - moving towards animal");
yield return Toils_Goto.GotoThing(iTarget, PathEndMode.Touch);
yield return Toils_Interpersonal.WaitToBeAbleToInteract(pawn);
yield return Toils_Interpersonal.GotoInteractablePosition(iTarget);
if (xxx.is_kind(pawn)
|| (xxx.CTIsActive && xxx.has_traits(pawn) && pawn.story.traits.HasTrait(xxx.RCT_AnimalLover)))
{
yield return TalkToAnimal(pawn, Partner);
yield return TalkToAnimal(pawn, Partner);
}
if (Rand.Chance(0.6f))
yield return TalkToAnimal(pawn, Partner);
yield return Toils_Goto.GotoThing(iTarget, PathEndMode.OnCell);
SexUtility.RapeTargetAlert(pawn, Partner);
Toil StartPartnerJob = new Toil();
StartPartnerJob.defaultCompleteMode = ToilCompleteMode.Instant;
StartPartnerJob.socialMode = RandomSocialMode.Off;
StartPartnerJob.initAction = delegate
{
//--ModLog.Message(" JobDriver_BestialityForMale::MakeNewToils() - Setting animal job driver");
var dri = Partner.jobs.curDriver as JobDriver_SexBaseRecieverRaped;
if (dri == null)
{
//wild animals may flee or attack
if (pawn.Faction != Partner.Faction && Partner.RaceProps.wildness > Rand.Range(0.22f, 1.0f)
&& !(pawn.TicksPerMoveCardinal < (Partner.TicksPerMoveCardinal / 2) && !Partner.Downed && xxx.is_not_dying(Partner)))
{
Partner.jobs.StopAll(); // Wake up animal if sleeping.
float aggro = Partner.kindDef.RaceProps.manhunterOnTameFailChance;
if (Partner.kindDef.RaceProps.predator)
aggro += 0.2f;
else
aggro -= 0.1f;
//wild animals may attack
if (Rand.Chance(aggro) && Partner.CanSee(pawn))
{
Partner.rotationTracker.FaceTarget(pawn);
LifeStageUtility.PlayNearestLifestageSound(Partner, (ls) => ls.soundAngry, 1.4f);
ThrowMetaIcon(Partner.Position, Partner.Map, ThingDefOf.Mote_IncapIcon);
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_ColonistFleeing); //red '!'
Partner.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter);
if (Partner.kindDef.RaceProps.herdAnimal && Rand.Chance(0.2f))
{ // 20% chance of turning the whole herd hostile...
List<Pawn> packmates = Partner.Map.mapPawns.AllPawnsSpawned.Where(x =>
x != Partner && x.def == Partner.def && x.Faction == Partner.Faction &&
x.Position.InHorDistOf(Partner.Position, 24f) && x.CanSee(Partner)).ToList();
foreach (Pawn packmate in packmates)
{
packmate.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter);
}
}
Messages.Message(pawn.Name.ToStringShort + " is being attacked by " + xxx.get_pawnname(Partner) + ".", pawn, MessageTypeDefOf.ThreatSmall);
}
//wild animals may flee
else
{
ThrowMetaIcon(Partner.Position, Partner.Map, ThingDefOf.Mote_ColonistFleeing);
LifeStageUtility.PlayNearestLifestageSound(Partner, (ls) => ls.soundCall);
Partner.mindState.StartFleeingBecauseOfPawnAction(pawn);
Partner.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.PanicFlee);
}
pawn.jobs.EndCurrentJob(JobCondition.Incompletable);
}
else
{
Job gettin_bred = JobMaker.MakeJob(PartnerJob, pawn, Partner);
Partner.jobs.StartJob(gettin_bred, JobCondition.InterruptForced, null, true);
(Partner.jobs.curDriver as JobDriver_SexBaseRecieverRaped)?.increase_time(ticks_left);
}
}
};
yield return StartPartnerJob;
Toil SexToil = new Toil();
SexToil.defaultCompleteMode = ToilCompleteMode.Delay;
SexToil.defaultDuration = duration;
SexToil.handlingFacing = true;
SexToil.FailOn(() => Partner.CurJob.def != PartnerJob);
SexToil.initAction = delegate
{
Partner.pather.StopDead();
Partner.jobs.curDriver.asleep = false;
Start();
};
SexToil.tickAction = delegate
{
if (pawn.IsHashIntervalTick(ticks_between_hearts))
if (xxx.is_zoophile(pawn))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
else
ThrowMetaIcon(pawn.Position, pawn.Map, xxx.mote_noheart);
SexTick(pawn, Partner);
//no hitting wild animals, and getting rect by their Manhunter
/*
if (pawn.IsHashIntervalTick (ticks_between_hits))
roll_to_hit (pawn, Partner);
*/
SexUtility.reduce_rest(Partner, 1);
SexUtility.reduce_rest(pawn, 2);
};
SexToil.AddFinishAction(delegate
{
End();
});
yield return SexToil;
yield return new Toil
{
initAction = delegate
{
//ModLog.Message(" JobDriver_BestialityForMale::MakeNewToils() - creating aftersex toil");
SexUtility.ProcessSex(pawn, Partner, usedCondom: usedCondom, sextype: sexType);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
[SyncMethod]
private Toil TalkToAnimal(Pawn pawn, Pawn animal)
{
Toil toil = new Toil();
toil.initAction = delegate
{
pawn.interactions.TryInteractWith(animal, SexUtility.AnimalSexChat);
};
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
toil.defaultCompleteMode = ToilCompleteMode.Delay;
toil.defaultDuration = Rand.Range(120, 220);
return toil;
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_BestialityForMale.cs
|
C#
|
mit
| 6,344 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
using Multiplayer.API;
namespace rjw
{
/// <summary>
/// This is the driver for animals mounting breeders.
/// </summary>
public class JobDriver_Breeding : JobDriver_Rape
{
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return pawn.Reserve(Target, job, BreederHelper.max_animals_at_once, 0);
}
[SyncMethod]
protected override IEnumerable<Toil> MakeNewToils()
{
setup_ticks();
var PartnerJob = xxx.gettin_raped;
//--Log.Message("JobDriver_Breeding::MakeNewToils() - setting fail conditions");
this.FailOnDespawnedNullOrForbidden(iTarget);
this.FailOn(() => !pawn.CanReserve(Partner, BreederHelper.max_animals_at_once, 0)); // Fail if someone else reserves the target before the animal arrives.
this.FailOn(() => !pawn.CanReach(Partner, PathEndMode.Touch, Danger.Some)); // Fail if animal cannot reach target.
this.FailOn(() => pawn.Drafted);
// Path to target
yield return Toils_Goto.GotoThing(iTarget, PathEndMode.OnCell);
//if (!(pawn.IsDesignatedBreedingAnimal() && Partner.IsDesignatedBreeding()));
if (!(pawn.IsAnimal() && Partner.IsAnimal()))
SexUtility.RapeTargetAlert(pawn, Partner);
Toil StartPartnerJob = new Toil();
StartPartnerJob.defaultCompleteMode = ToilCompleteMode.Instant;
StartPartnerJob.socialMode = RandomSocialMode.Off;
StartPartnerJob.initAction = delegate
{
var dri = Partner.jobs.curDriver as JobDriver_SexBaseRecieverRaped;
if (dri == null)
{
Job gettin_raped = JobMaker.MakeJob(PartnerJob, pawn);
Building_Bed Bed = null;
if (Partner.GetPosture() == PawnPosture.LayingInBed)
Bed = Partner.CurrentBed();
Partner.jobs.StartJob(gettin_raped, JobCondition.InterruptForced, null, false, true, null);
if (Bed != null)
(Partner.jobs.curDriver as JobDriver_SexBaseRecieverRaped)?.Set_bed(Bed);
}
};
yield return StartPartnerJob;
// Breed target
var SexToil = new Toil();
SexToil.defaultCompleteMode = ToilCompleteMode.Delay;
SexToil.defaultDuration = duration;
SexToil.handlingFacing = true;
SexToil.FailOn(() => Partner.CurJob.def != PartnerJob);
SexToil.initAction = delegate
{
Partner.pather.StopDead();
Partner.jobs.curDriver.asleep = false;
Start();
};
SexToil.tickAction = delegate
{
if (pawn.IsHashIntervalTick(ticks_between_hearts))
if (xxx.is_zoophile(pawn) || xxx.is_animal(pawn))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
else
ThrowMetaIcon(pawn.Position, pawn.Map, xxx.mote_noheart);
if (pawn.IsHashIntervalTick(ticks_between_hits) && !xxx.is_zoophile(Partner))
Roll_to_hit(pawn, Partner);
SexTick(pawn, Partner);
if (!Partner.Dead)
SexUtility.reduce_rest(Partner, 1);
SexUtility.reduce_rest(pawn, 2);
};
SexToil.AddFinishAction(delegate
{
End();
});
yield return SexToil;
yield return new Toil
{
initAction = delegate
{
//Log.Message("JobDriver_Breeding::MakeNewToils() - Calling aftersex");
//// Trying to add some interactions and social logs
bool isRape = !(pawn.relations.DirectRelationExists(PawnRelationDefOf.Bond, Partner) ||
(xxx.is_animal(pawn) && (pawn.RaceProps.wildness - pawn.RaceProps.petness + 0.18f) > Rand.Range(0.36f, 1.8f)));
SexUtility.ProcessSex(pawn, Partner, usedCondom: usedCondom, rape: isRape, sextype: sexType);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_Breeding.cs
|
C#
|
mit
| 3,563 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
using Multiplayer.API;
namespace rjw
{
public class JobDriver_Masturbate : JobDriver_SexBaseInitiator
{
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return true; // No reservations needed.
}
public virtual IntVec3 cell => (IntVec3)job.GetTarget(iCell);
[SyncMethod]
new public void setup_ticks()
{
base.setup_ticks();
// Faster fapping when frustrated.
duration = (int)(xxx.is_frustrated(pawn) ? 2500.0f * Rand.Range(0.2f, 0.7f) : 2500.0f * Rand.Range(0.2f, 0.4f));
}
protected override IEnumerable<Toil> MakeNewToils()
{
setup_ticks();
//this.FailOn(() => PawnUtility.PlayerForcedJobNowOrSoon(pawn));
this.FailOn(() => pawn.health.Downed);
this.FailOn(() => pawn.IsBurning());
this.FailOn(() => pawn.IsFighting());
this.FailOn(() => pawn.Drafted);
Toil findfapspot = new Toil
{
initAction = delegate
{
pawn.pather.StartPath(cell, PathEndMode.OnCell);
},
defaultCompleteMode = ToilCompleteMode.PatherArrival
};
yield return findfapspot;
//ModLog.Message(" Making new toil for QuickFap.");
Toil SexToil = Toils_General.Wait(duration);
SexToil.handlingFacing = true;
SexToil.initAction = delegate
{
Start();
};
SexToil.tickAction = delegate
{
--duration;
if (pawn.IsHashIntervalTick(ticks_between_hearts))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
SexTick(pawn, null);
SexUtility.reduce_rest(pawn, 1);
if (duration <= 0)
ReadyForNextToil();
};
SexToil.AddFinishAction(delegate
{
End();
});
yield return SexToil;
yield return new Toil
{
initAction = delegate
{
SexUtility.Aftersex(pawn, xxx.rjwSextype.Masturbation);
if (!SexUtility.ConsiderCleaning(pawn)) return;
LocalTargetInfo own_cum = pawn.PositionHeld.GetFirstThing<Filth>(pawn.Map);
Job clean = JobMaker.MakeJob(JobDefOf.Clean);
clean.AddQueuedTarget(TargetIndex.A, own_cum);
pawn.jobs.jobQueue.EnqueueFirst(clean);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_Masturbate.cs
|
C#
|
mit
| 2,185 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
using Multiplayer.API;
namespace rjw
{
/// <summary>
/// This is the driver for animals mating.
/// </summary>
public class JobDriver_Mating : JobDriver_Rape
{
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return pawn.Reserve(Target, job, BreederHelper.max_animals_at_once, 0);
}
[SyncMethod]
protected override IEnumerable<Toil> MakeNewToils()
{
setup_ticks();
var PartnerJob = xxx.gettin_loved;
//--Log.Message("JobDriver_Mating::MakeNewToils() - setting fail conditions");
this.FailOnDespawnedNullOrForbidden(iTarget);
this.FailOn(() => !pawn.CanReserve(Partner, BreederHelper.max_animals_at_once, 0)); // Fail if someone else reserves the target before the animal arrives.
this.FailOn(() => !pawn.CanReach(Partner, PathEndMode.Touch, Danger.Some)); // Fail if animal cannot reach target.
this.FailOn(() => pawn.Drafted);
// Path to target
yield return Toils_Goto.GotoThing(iTarget, PathEndMode.OnCell);
Toil StartPartnerJob = new Toil();
StartPartnerJob.defaultCompleteMode = ToilCompleteMode.Instant;
StartPartnerJob.socialMode = RandomSocialMode.Off;
StartPartnerJob.initAction = delegate
{
var dri = Partner.jobs.curDriver as JobDriver_SexBaseRecieverLoved;
if (dri == null)
{
Job gettin_loved = JobMaker.MakeJob(PartnerJob, pawn);
Building_Bed Bed = null;
if (Partner.GetPosture() == PawnPosture.LayingInBed)
Bed = Partner.CurrentBed();
Partner.jobs.StartJob(gettin_loved, JobCondition.InterruptForced, null, false, true, null);
if (Bed != null)
(Partner.jobs.curDriver as JobDriver_SexBaseRecieverLoved)?.Set_bed(Bed);
}
};
yield return StartPartnerJob;
// Mate target
var SexToil = new Toil();
SexToil.defaultCompleteMode = ToilCompleteMode.Delay;
SexToil.defaultDuration = duration;
SexToil.handlingFacing = true;
SexToil.FailOn(() => Partner.CurJob.def != PartnerJob);
SexToil.initAction = delegate
{
Partner.pather.StopDead();
Partner.jobs.curDriver.asleep = false;
Start();
};
SexToil.tickAction = delegate
{
if (pawn.IsHashIntervalTick(ticks_between_hearts))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
SexTick(pawn, Partner);
if (!Partner.Dead)
SexUtility.reduce_rest(Partner, 1);
SexUtility.reduce_rest(pawn, 2);
};
SexToil.AddFinishAction(delegate
{
End();
});
yield return SexToil;
yield return new Toil
{
initAction = delegate
{
bool isRape = false;
SexUtility.ProcessSex(pawn, Partner, usedCondom: usedCondom, rape: isRape, sextype: sexType);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_Mating.cs
|
C#
|
mit
| 2,802 |
using System;
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
namespace rjw
{
public class JobDriver_Rape : JobDriver_SexBaseInitiator
{
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return pawn.Reserve(Target, job, xxx.max_rapists_per_prisoner, 0, null, errorOnFailed);
}
protected override IEnumerable<Toil> MakeNewToils()
{
if (RJWSettings.DebugRape) ModLog.Message("" + this.GetType().ToString() + "::MakeNewToils() called");
setup_ticks();
var PartnerJob = xxx.gettin_raped;
this.FailOnDespawnedNullOrForbidden(iTarget);
this.FailOn(() => !pawn.CanReserve(Partner, xxx.max_rapists_per_prisoner, 0)); // Fail if someone else reserves the prisoner before the pawn arrives
this.FailOn(() => pawn.IsFighting());
this.FailOn(() => Partner.IsFighting());
this.FailOn(() => pawn.Drafted);
yield return Toils_Goto.GotoThing(iTarget, PathEndMode.OnCell);
SexUtility.RapeTargetAlert(pawn, Partner);
Toil StartPartnerJob = new Toil();
StartPartnerJob.defaultCompleteMode = ToilCompleteMode.Instant;
StartPartnerJob.socialMode = RandomSocialMode.Off;
StartPartnerJob.initAction = delegate
{
var dri = Partner.jobs.curDriver as JobDriver_SexBaseRecieverRaped;
if (dri == null)
{
Job gettin_raped = JobMaker.MakeJob(PartnerJob, pawn);
Building_Bed Bed = null;
if (Partner.GetPosture() == PawnPosture.LayingInBed)
Bed = Partner.CurrentBed();
Partner.jobs.StartJob(gettin_raped, JobCondition.InterruptForced, null, false, true, null);
if (Bed != null)
(Partner.jobs.curDriver as JobDriver_SexBaseRecieverRaped)?.Set_bed(Bed);
}
};
yield return StartPartnerJob;
var SexToil = new Toil();
SexToil.defaultCompleteMode = ToilCompleteMode.Delay;
SexToil.defaultDuration = duration;
SexToil.handlingFacing = true;
SexToil.FailOn(() => Partner.CurJob.def != PartnerJob);
SexToil.initAction = delegate
{
Partner.pather.StopDead();
Partner.jobs.curDriver.asleep = false;
if (RJWSettings.rape_stripping && (Partner.IsColonist || pawn.IsColonist))
Partner.Strip();
Start();
};
SexToil.tickAction = delegate
{
if (pawn.IsHashIntervalTick(ticks_between_hearts))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
if (pawn.IsHashIntervalTick(ticks_between_hits))
Roll_to_hit(pawn, Partner);
SexTick(pawn, Partner);
SexUtility.reduce_rest(Partner, 1);
SexUtility.reduce_rest(pawn, 2);
};
SexToil.AddFinishAction(delegate
{
End();
});
yield return SexToil;
yield return new Toil
{
initAction = delegate
{
//// Trying to add some interactions and social logs
SexUtility.ProcessSex(pawn, Partner, usedCondom: usedCondom, rape: isRape, sextype: sexType);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_Rape.cs
|
C#
|
mit
| 2,916 |
using System;
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
namespace rjw
{
public class JobDriver_RapeComfortPawn : JobDriver_Rape
{
protected override IEnumerable<Toil> MakeNewToils()
{
if (RJWSettings.DebugRape) ModLog.Message("" + this.GetType().ToString() + "::MakeNewToils() called");
setup_ticks();
var PartnerJob = xxx.gettin_raped;
this.FailOnDespawnedNullOrForbidden(iTarget);
//this.FailOn(() => (!Partner.health.capacities.CanBeAwake) || (!comfort_prisoners.is_designated(Partner)));//this is wrong
this.FailOn(() => (!Partner.IsDesignatedComfort()));
this.FailOn(() => !pawn.CanReserve(Partner, xxx.max_rapists_per_prisoner, 0)); // Fail if someone else reserves the prisoner before the pawn arrives
this.FailOn(() => pawn.Drafted);
yield return Toils_Goto.GotoThing(iTarget, PathEndMode.OnCell);
SexUtility.RapeTargetAlert(pawn, Partner);
Toil StartPartnerJob = new Toil();
StartPartnerJob.defaultCompleteMode = ToilCompleteMode.Instant;
StartPartnerJob.socialMode = RandomSocialMode.Off;
StartPartnerJob.initAction = delegate
{
var dri = Partner.jobs.curDriver as JobDriver_SexBaseRecieverRaped;
if (dri == null)
{
Job gettin_raped = JobMaker.MakeJob(PartnerJob, pawn);
Building_Bed Bed = null;
if (Partner.GetPosture() == PawnPosture.LayingInBed)
Bed = Partner.CurrentBed();
Partner.jobs.StartJob(gettin_raped, JobCondition.InterruptForced, null, false, true, null);
if (Bed != null)
(Partner.jobs.curDriver as JobDriver_SexBaseRecieverRaped)?.Set_bed(Bed);
}
};
yield return StartPartnerJob;
Toil SexToil = new Toil();
SexToil.defaultCompleteMode = ToilCompleteMode.Delay;
SexToil.defaultDuration = duration;
SexToil.handlingFacing = true;
SexToil.FailOn(() => Partner.CurJob.def != PartnerJob);
SexToil.initAction = delegate
{
Partner.pather.StopDead();
Partner.jobs.curDriver.asleep = false;
// Unlike normal rape try use comfort prisoner condom
CondomUtility.GetCondomFromRoom(Partner);
usedCondom = CondomUtility.TryUseCondom(Partner);
if (RJWSettings.DebugRape) ModLog.Message("JobDriver_RapeComfortPawn::MakeNewToils() - reserving prisoner");
//pawn.Reserve(Partner, xxx.max_rapists_per_prisoner, 0);
Start();
};
SexToil.tickAction = delegate
{
if (pawn.IsHashIntervalTick(ticks_between_hearts))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
if (pawn.IsHashIntervalTick(ticks_between_hits))
Roll_to_hit(pawn, Partner);
SexTick(pawn, Partner);
SexUtility.reduce_rest(Partner, 1);
SexUtility.reduce_rest(pawn, 2);
};
SexToil.AddFinishAction(delegate
{
End();
});
yield return SexToil;
yield return new Toil
{
initAction = delegate
{
// Trying to add some interactions and social logs
SexUtility.ProcessSex(pawn, Partner, usedCondom: usedCondom, rape: isRape, sextype: sexType);
Partner.records.Increment(xxx.GetRapedAsComfortPawn);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_RapeComfortPawn.cs
|
C#
|
mit
| 3,134 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
using Verse.Sound;
namespace rjw
{
public class JobDriver_ViolateCorpse : JobDriver_Rape
{
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return pawn.Reserve(Target, job, 1, -1, null, errorOnFailed);
}
protected override IEnumerable<Toil> MakeNewToils()
{
if (RJWSettings.DebugRape) ModLog.Message(" JobDriver_ViolateCorpse::MakeNewToils() called");
setup_ticks();
this.FailOnDespawnedNullOrForbidden(iTarget);
this.FailOn(() => !pawn.CanReserve(Target, 1, 0)); // Fail if someone else reserves the prisoner before the pawn arrives
this.FailOn(() => pawn.IsFighting());
this.FailOn(() => pawn.Drafted);
this.FailOn(Target.IsBurning);
if (RJWSettings.DebugRape) ModLog.Message(" JobDriver_ViolateCorpse::MakeNewToils() - moving towards Target");
yield return Toils_Goto.GotoThing(iTarget, PathEndMode.OnCell);
var alert = RJWPreferenceSettings.rape_attempt_alert == RJWPreferenceSettings.RapeAlert.Disabled ?
MessageTypeDefOf.SilentInput : MessageTypeDefOf.NeutralEvent;
Messages.Message(xxx.get_pawnname(pawn) + " is trying to rape a corpse of " + xxx.get_pawnname(Partner), pawn, alert);
setup_ticks();// re-setup ticks on arrival
var SexToil = new Toil();
SexToil.defaultCompleteMode = ToilCompleteMode.Delay;
SexToil.defaultDuration = duration;
SexToil.handlingFacing = true;
SexToil.initAction = delegate
{
if (RJWSettings.DebugRape) ModLog.Message(" JobDriver_ViolateCorpse::MakeNewToils() - stripping Target");
(Target as Corpse).Strip();
Start();
};
SexToil.tickAction = delegate
{
if (pawn.IsHashIntervalTick(ticks_between_hearts))
if (xxx.is_necrophiliac(pawn))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
else
ThrowMetaIcon(pawn.Position, pawn.Map, xxx.mote_noheart);
//if (pawn.IsHashIntervalTick (ticks_between_hits))
// roll_to_hit (pawn, Target);
SexTick(pawn, Target);
SexUtility.reduce_rest(pawn, 2);
};
SexToil.AddFinishAction(delegate
{
End();
});
yield return SexToil;
yield return new Toil
{
initAction = delegate
{
if (RJWSettings.DebugRape) ModLog.Message(" JobDriver_ViolateCorpse::MakeNewToils() - creating aftersex toil");
SexUtility.ProcessSex(pawn, Partner, usedCondom: usedCondom, rape: isRape, sextype: sexType);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_RapeCorpse.cs
|
C#
|
mit
| 2,524 |
using System;
using System.Collections.Generic;
using System.Linq;
using RimWorld;
using Verse;
using Verse.AI;
using Multiplayer.API;
namespace rjw
{
internal class JobDef_RapeEnemy : JobDef
{
public List<string> TargetDefNames = new List<string>();
public int priority = 0;
protected JobDriver_RapeEnemy instance
{
get
{
if (_tmpInstance == null)
{
_tmpInstance = (JobDriver_RapeEnemy)Activator.CreateInstance(driverClass);
}
return _tmpInstance;
}
}
private JobDriver_RapeEnemy _tmpInstance;
public virtual bool CanUseThisJobForPawn(Pawn rapist)
{
if (rapist.CurJob != null && rapist.CurJob.def != JobDefOf.LayDown)
return false;
return instance.CanUseThisJobForPawn(rapist);// || TargetDefNames.Contains(rapist.def.defName);
}
public virtual Pawn FindVictim(Pawn rapist, Map m)
{
return instance.FindVictim(rapist, m);
}
}
public class JobDriver_RapeEnemy : JobDriver_Rape
{
private static readonly HediffDef is_submitting = HediffDef.Named("Hediff_Submitting");//used in find_victim
//override can_rape mechanics
protected bool requireCanRape = true;
public virtual bool CanUseThisJobForPawn(Pawn rapist)
{
return xxx.is_human(rapist);
}
// this is probably useseless, maybe there be something in future
public virtual bool considerStillAliveEnemies => true;
[SyncMethod]
public virtual Pawn FindVictim(Pawn rapist, Map m)
{
if (RJWSettings.DebugRape) ModLog.Message($"{this.GetType().ToString()}::TryGiveJob({xxx.get_pawnname(rapist)}) map {m?.ToString()}");
if (rapist == null || m == null) return null;
if (RJWSettings.DebugRape) ModLog.Message($"{this.GetType().ToString()}::TryGiveJob({xxx.get_pawnname(rapist)}) can rape = {xxx.can_rape(rapist)}");
if (requireCanRape && !xxx.can_rape(rapist)) return null;
List<Pawn> validTargets = new List<Pawn>();
float min_fuckability = 0.10f; // Don't rape pawns with <10% fuckability
float avg_fuckability = 0f; // Average targets fuckability, choose target higher than that
var valid_targets = new Dictionary<Pawn, float>(); // Valid pawns and their fuckability
Pawn chosentarget = null; // Final target pawn
IEnumerable<Pawn> targets = m.mapPawns.AllPawnsSpawned.Where(x
=> !x.IsForbidden(rapist) && x != rapist && x.HostileTo(rapist)
&& rapist.CanReserveAndReach(x, PathEndMode.Touch, Danger.Some, xxx.max_rapists_per_prisoner, 0)
&& IsValidTarget(rapist, x))
.ToList();
if (targets.Any(x => IsBlocking(rapist, x)))
{
return null;
}
foreach (var target in targets)
{
if (!xxx.can_path_to_target(rapist, target.Position))
continue;// too far
float fuc = GetFuckability(rapist, target);
if (fuc > min_fuckability)
valid_targets.Add(target, fuc);
}
if (valid_targets.Any())
{
avg_fuckability = valid_targets.Average(x => x.Value);
// choose pawns to fuck with above average fuckability
var valid_targetsFiltered = valid_targets.Where(x => x.Value >= avg_fuckability);
if (valid_targetsFiltered.Any())
chosentarget = valid_targetsFiltered.RandomElement().Key;
}
return chosentarget;
}
bool IsBlocking(Pawn rapist, Pawn target)
{
return considerStillAliveEnemies && !target.Downed && rapist.CanSee(target);
}
bool IsValidTarget(Pawn rapist, Pawn target)
{
if (!RJWSettings.bestiality_enabled)
{
if (xxx.is_animal(target) && xxx.is_human(rapist))
{
//bestiality disabled, skip.
return false;
}
if (xxx.is_animal(rapist) && xxx.is_human(target))
{
//bestiality disabled, skip.
return false;
}
}
if (!RJWSettings.animal_on_animal_enabled)
if ((xxx.is_animal(target) && xxx.is_animal(rapist)))
{
//animal_on_animal disabled, skip.
return false;
}
if (target.CurJob?.def == xxx.gettin_raped || target.CurJob?.def == xxx.gettin_loved)
{
//already having sex with someone, skip, give chance to other victims.
return false;
}
return Can_rape_Easily(target) &&
(xxx.is_human(target) || xxx.is_animal(target)) &&
rapist.CanReserveAndReach(target, PathEndMode.OnCell, Danger.Some, xxx.max_rapists_per_prisoner, 0);
}
public virtual float GetFuckability(Pawn rapist, Pawn target)
{
float fuckability = 0;
if (target.health.hediffSet.HasHediff(is_submitting)) // it's not about attractiveness anymore, it's about showing who's whos bitch
{
fuckability = 2 * SexAppraiser.would_fuck(rapist, target, invert_opinion: true, ignore_bleeding: true, ignore_gender: true);
}
else if (SexAppraiser.would_rape(rapist, target))
{
fuckability = SexAppraiser.would_fuck(rapist, target, invert_opinion: true, ignore_bleeding: true, ignore_gender: true);
}
if (RJWSettings.DebugRape) ModLog.Message($"JobDriver_RapeEnemy::GetFuckability({xxx.get_pawnname(rapist)}, {xxx.get_pawnname(target)})");
return fuckability;
}
protected bool Can_rape_Easily(Pawn pawn)
{
return xxx.can_get_raped(pawn) && !pawn.IsBurning();
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_RapeEnemy.cs
|
C#
|
mit
| 5,156 |
using RimWorld;
using Verse;
namespace rjw
{
internal class JobDriver_RapeEnemyByAnimal : JobDriver_RapeEnemy
{
public override bool CanUseThisJobForPawn(Pawn rapist)
{
if (rapist.CurJob != null && (rapist.CurJob.def != JobDefOf.LayDown || rapist.CurJob.def != JobDefOf.Wait_Wander || rapist.CurJob.def != JobDefOf.GotoWander))
return false;
return xxx.is_animal(rapist) && !xxx.is_insect(rapist);
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_RapeEnemyByAnimal.cs
|
C#
|
mit
| 424 |
using RimWorld;
using Verse;
namespace rjw
{
internal class JobDriver_RapeEnemyByHumanlike : JobDriver_RapeEnemy
{
public override bool CanUseThisJobForPawn(Pawn rapist)
{
if (rapist.CurJob != null && (rapist.CurJob.def != JobDefOf.LayDown || rapist.CurJob.def != JobDefOf.Wait_Wander || rapist.CurJob.def != JobDefOf.GotoWander))
return false;
return xxx.is_human(rapist);
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_RapeEnemyByHumanlike.cs
|
C#
|
mit
| 400 |
using System.Linq;
using RimWorld;
using Verse;
namespace rjw
{
internal class JobDriver_RapeEnemyByInsect : JobDriver_RapeEnemy
{
public override bool CanUseThisJobForPawn(Pawn rapist)
{
if (rapist.CurJob != null && (rapist.CurJob.def != JobDefOf.LayDown || rapist.CurJob.def != JobDefOf.Wait_Wander || rapist.CurJob.def != JobDefOf.GotoWander))
return false;
return xxx.is_insect(rapist);
}
public override float GetFuckability(Pawn rapist, Pawn target)
{
//Female plant Eggs to everyone.
if (rapist.gender == Gender.Female) //Genital_Helper.has_ovipositorF(rapist);
{
//only rape when target dont have eggs yet
//if ((from x in target.health.hediffSet.GetHediffs<Hediff_InsectEgg>() where (x.IsParent(rapist)) select x).Count() > 0)
{
return 1f;
}
}
//Male rape to everyone.
//Feritlize eggs to target with planted eggs.
else //Genital_Helper.has_ovipositorM(rapist);
{
//only rape target when can fertilize
//if ((from x in target.health.hediffSet.GetHediffs<Hediff_InsectEgg>() where (x.IsParent(rapist) && !x.fertilized) select x).Count() > 0)
if ((from x in target.health.hediffSet.GetHediffs<Hediff_InsectEgg>() where x.IsParent(rapist) select x).Count() > 0)
{
return 1f;
}
}
return 0f;
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_RapeEnemyByInsect.cs
|
C#
|
mit
| 1,305 |
using RimWorld;
using Verse;
namespace rjw
{
internal class JobDriver_RapeEnemyByMech : JobDriver_RapeEnemy
{
public override bool CanUseThisJobForPawn(Pawn rapist)
{
if (rapist.CurJob != null && (rapist.CurJob.def != JobDefOf.LayDown || rapist.CurJob.def != JobDefOf.Wait_Wander || rapist.CurJob.def != JobDefOf.GotoWander))
return false;
return xxx.is_mechanoid(rapist);
}
public override float GetFuckability(Pawn rapist, Pawn target)
{
//Plant stuff into humanlikes.
if (xxx.is_human(target))
return 1f;
else
return 0f;
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_RapeEnemyByMech.cs
|
C#
|
mit
| 578 |
using RimWorld;
using Verse;
namespace rjw
{
internal class JobDriver_RapeEnemyToParasite : JobDriver_RapeEnemy
{
//not implemented
public JobDriver_RapeEnemyToParasite()
{
this.requireCanRape = false;
}
public override bool CanUseThisJobForPawn(Pawn rapist)
{
if (rapist.CurJob != null && (rapist.CurJob.def != JobDefOf.LayDown || rapist.CurJob.def != JobDefOf.Wait_Wander || rapist.CurJob.def != JobDefOf.GotoWander))
return false;
return false;
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_RapeEnemyToParasite.cs
|
C#
|
mit
| 489 |
using System;
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
using Verse.Sound;
namespace rjw
{
public class JobDriver_RandomRape : JobDriver_Rape
{
//Add some stuff. planning became bersek when failed to rape.
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_RapeRandom.cs
|
C#
|
mit
| 256 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
using Verse.Sound;
using Multiplayer.API;
using System.Linq;
namespace rjw
{
public abstract class JobDriver_Sex : JobDriver
{
public readonly TargetIndex iTarget = TargetIndex.A; //pawn or corpse
public readonly TargetIndex iBed = TargetIndex.B; //bed(maybe some furniture in future?)
public readonly TargetIndex iCell = TargetIndex.C; //cell/location to have sex at(fapping)
public float satisfaction = 1.0f;
public bool shouldreserve = true;
public int stackCount = 0;
public int ticks_between_hearts = 60;
public int ticks_between_hits = 60;
public int ticks_between_thrusts = 60;
public int ticks_left = 1000;
public int duration = 5000;
public int ticks_remaining = 10;
public bool usedCondom = false;
public bool isRape = false;
public bool isWhoring = false;
public bool face2face = false;
public Thing Target // for reservation
{
get
{
return (Thing)job.GetTarget(TargetIndex.A);
}
}
public Pawn Partner
{
get
{
if (Target is Pawn)
return (Pawn)job.GetTarget(TargetIndex.A);
else if (Target is Corpse)
return ((Corpse)job.GetTarget(TargetIndex.A)).InnerPawn;
else
return null;
}
}
public Building_Bed Bed
{
get
{
if (pBed != null)
return pBed;
else if ((Thing)job.GetTarget(TargetIndex.B) is Building_Bed)
return (Building_Bed)job.GetTarget(TargetIndex.B);
else
return null;
}
}
//not bed; chair, maybe something else in future
public Building Building
{
get
{
if ((Thing)job.GetTarget(TargetIndex.B) is Building && !((Thing)job.GetTarget(TargetIndex.B) is Building_Bed))
return (Building)job.GetTarget(TargetIndex.B);
else
return null;
}
}
public Building_Bed pBed = null;
public SexProps Sexprops = null;
public xxx.rjwSextype sexType = xxx.rjwSextype.None;
[SyncMethod]
public void setup_ticks()
{
ticks_left = (int)(2000.0f * Rand.Range(0.50f, 0.90f));
ticks_between_hearts = Rand.RangeInclusive(70, 130);
ticks_between_hits = Rand.Range(xxx.config.min_ticks_between_hits, xxx.config.max_ticks_between_hits);
if (xxx.is_bloodlust(pawn))
ticks_between_hits = (int)(ticks_between_hits * 0.75);
if (xxx.is_brawler(pawn))
ticks_between_hits = (int)(ticks_between_hits * 0.90);
ticks_between_thrusts = 120;
duration = ticks_left;
}
public void increase_time(int min_ticks_remaining)
{
if (min_ticks_remaining > ticks_remaining)
ticks_remaining = min_ticks_remaining;
}
public void Set_bed(Building_Bed newBed)
{
pBed = newBed;
}
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref ticks_left, "ticks_left", 0, false);
Scribe_Values.Look(ref ticks_between_hearts, "ticks_between_hearts", 0, false);
Scribe_Values.Look(ref ticks_between_hits, "ticks_between_hits", 0, false);
Scribe_Values.Look(ref ticks_between_thrusts, "ticks_between_thrusts", 0, false);
Scribe_Values.Look(ref duration, "duration", 0, false);
Scribe_Values.Look(ref ticks_remaining, "ticks_remaining", 10, false);
Scribe_References.Look(ref pBed, "pBed");
//Scribe_Values.Look(ref props, "props");
Scribe_Values.Look(ref usedCondom, "usedCondom");
Scribe_Values.Look(ref isRape, "isRape");
Scribe_Values.Look(ref isWhoring, "isWhoring");
Scribe_Values.Look(ref sexType, "sexType");
Scribe_Values.Look(ref face2face, "face2face");
}
public void SexTick(Pawn pawn, Thing target, bool pawnnude = true, bool partnernude = true)
{
var partner = target as Pawn;
if (pawn.IsHashIntervalTick(ticks_between_thrusts))
{
ChangePsyfocus(pawn, partner);
Animate(pawn, partner);
PlaySexSound();
if (!isRape)
{
pawn.GainComfortFromCellIfPossible();
if (partner != null)
partner.GainComfortFromCellIfPossible();
}
}
//refresh DrawNude after beating and Notify_MeleeAttackOn
// Endytophiles prefer clothed sex, everyone else gets nude.
if (!xxx.has_quirk(pawn, "Endytophile"))
{
if (pawnnude)
{
SexUtility.DrawNude(pawn);
}
if (partner != null)
if (partnernude)
{
SexUtility.DrawNude(partner);
}
}
}
/// <summary>
/// simple rjw thrust animation
/// </summary>
public void Animate(Pawn pawn, Thing target)
{
RotatePawns(pawn, Partner);
//attack/ride 1x2 cell cocksleeve/dildo?
//if (Building != null)
// target = Building;
if (target != null)
{
pawn.Drawer.Notify_MeleeAttackOn(target);
var partner = target as Pawn;
if (partner != null && !isRape)
partner.Drawer.Notify_MeleeAttackOn(pawn);
}
}
/// <summary>
/// handle Psyfocus
/// </summary>
public void ChangePsyfocus(Pawn pawn, Thing target)
{
if (ModsConfig.RoyaltyActive)
{
if (pawn.jobs?.curDriver is JobDriver_ViolateCorpse)
if (xxx.is_necrophiliac(pawn) && MeditationFocusTypeAvailabilityCache.PawnCanUse(pawn, DefDatabase<MeditationFocusDef>.GetNamedSilentFail("Morbid")))
{
SexUtility.OffsetPsyfocus(pawn, 0.01f);
}
if (target != null)
{
var partner = target as Pawn;
if (partner != null)
{
if (xxx.is_nympho(pawn))
{
SexUtility.OffsetPsyfocus(pawn, 0.01f);
}
else if (xxx.is_zoophile(pawn) && xxx.is_animal(partner) && MeditationFocusTypeAvailabilityCache.PawnCanUse(pawn, MeditationFocusDefOf.Natural))
{
SexUtility.OffsetPsyfocus(pawn, 0.01f);
}
if (xxx.is_nympho(partner))
{
SexUtility.OffsetPsyfocus(partner, 0.01f);
}
else if (xxx.is_zoophile(partner) && xxx.is_animal(pawn) && MeditationFocusTypeAvailabilityCache.PawnCanUse(partner, MeditationFocusDefOf.Natural))
{
SexUtility.OffsetPsyfocus(partner, 0.01f);
}
if (xxx.RoMIsActive)
{
if (xxx.has_traits(pawn))
if (pawn.story.traits.HasTrait(xxx.Succubus))
{
SexUtility.OffsetPsyfocus(pawn, 0.01f);
}
if (xxx.has_traits(partner))
if (partner.story.traits.HasTrait(xxx.Succubus))
{
SexUtility.OffsetPsyfocus(partner, 0.01f);
}
}
if (xxx.NightmareIncarnationIsActive)
{
if (xxx.has_traits(pawn))
foreach (var x in pawn.AllComps?.Where(x => x?.props?.ToStringSafe() == "NightmareIncarnation.CompProperties_SuccubusRace"))
{
SexUtility.OffsetPsyfocus(pawn, 0.01f);
break;
}
if (xxx.has_traits(partner))
foreach (var x in partner.AllComps?.Where(x => x?.props?.ToStringSafe() == "NightmareIncarnation.CompProperties_SuccubusRace"))
{
SexUtility.OffsetPsyfocus(partner, 0.01f);
break;
}
}
}
}
}
}
/// <summary>
/// rotate pawns
/// </summary>
public void RotatePawns(Pawn pawn, Thing target)
{
if (Building != null)
{
if (face2face)
pawn.Rotation = Building.Rotation.Opposite;
else
pawn.Rotation = Building.Rotation;
return;
}
if (target == null) // solo
{
//pawn.Rotation = Rot4.South;
return;
}
var partner = target as Pawn;
if (partner == null || partner.Dead) // necro
{
pawn.rotationTracker.Face(target.DrawPos);
return;
}
if (partner.jobs?.curDriver is JobDriver_SexBaseReciever)
if (((JobDriver_SexBaseReciever)partner.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Count > 1) return;
//maybe could do a hand check for monster girls but w/e
//bool partnerHasHands = Receiver.health.hediffSet.GetNotMissingParts().Any(part => part.IsInGroup(BodyPartGroupDefOf.RightHand) || part.IsInGroup(BodyPartGroupDefOf.LeftHand));
// most of animal sex is likely doggystyle.
if (xxx.is_animal(pawn) && xxx.is_animal(partner))
{
if (sexType == xxx.rjwSextype.Anal || sexType == xxx.rjwSextype.Vaginal || sexType == xxx.rjwSextype.DoublePenetration)
{
//>>
//Log.Message("animal doggy");
pawn.rotationTracker.Face(partner.DrawPos);
partner.Rotation = pawn.Rotation;
}
else
{
//><
//Log.Message("animal non doggy");
pawn.rotationTracker.Face(target.DrawPos);
partner.rotationTracker.Face(pawn.DrawPos);
}
}
else
{
if (this is JobDriver_BestialityForFemale)
{
if (sexType == xxx.rjwSextype.Anal || sexType == xxx.rjwSextype.Vaginal || sexType == xxx.rjwSextype.DoublePenetration)
{
//<<
//Log.Message("bestialityFF doggy");
partner.rotationTracker.Face(pawn.DrawPos);
pawn.Rotation = partner.Rotation;
}
else
{
//><
//Log.Message("bestialityFF non doggy");
pawn.rotationTracker.Face(target.DrawPos);
partner.rotationTracker.Face(pawn.DrawPos);
}
}
else if (partner.GetPosture() == PawnPosture.LayingInBed)
{
//x^
//Log.Message("loving/casualsex in bed");
// this could use better handling for cowgirl/reverse cowgirl and who pen who, if such would be implemented
//until then...
if (!face2face && sexType == xxx.rjwSextype.Anal ||
sexType == xxx.rjwSextype.Vaginal ||
sexType == xxx.rjwSextype.DoublePenetration ||
sexType == xxx.rjwSextype.Fisting)
//if (xxx.is_female(pawn) && xxx.is_female(partner))
{
// in bed loving face down
pawn.Rotation = partner.CurrentBed().Rotation.Opposite;
}
//else if (!(xxx.is_male(pawn) && xxx.is_male(partner)))
//{
// // in bed loving face down
// pawn.Rotation = partner.CurrentBed().Rotation.Opposite;
//}
else
{
// in bed loving, face up
pawn.Rotation = partner.CurrentBed().Rotation;
}
}
// 30% chance of face-to-face regardless, for variety.
else if (!face2face && (sexType == xxx.rjwSextype.Anal ||
sexType == xxx.rjwSextype.Vaginal ||
sexType == xxx.rjwSextype.DoublePenetration ||
sexType == xxx.rjwSextype.Fisting))
{
//>>
//Log.Message("doggy");
pawn.rotationTracker.Face(target.DrawPos);
partner.Rotation = pawn.Rotation;
}
// non doggystyle, or face-to-face regardless
else
{
//><
//Log.Message("non doggy");
pawn.rotationTracker.Face(target.DrawPos);
partner.rotationTracker.Face(pawn.DrawPos);
}
}
}
[SyncMethod]
public void Rollface2face(float chance = 0.3f)
{
Setface2face(Rand.Chance(chance));
}
public void Setface2face(bool chance)
{
face2face = chance;
}
public static void Roll_to_hit(Pawn Pawn, Pawn Partner, bool isRape = true)
{
SexUtility.Sex_Beatings(Pawn, Partner, isRape);
}
public void ThrowMetaIcon(IntVec3 pos, Map map, ThingDef icon)
{
MoteMaker.ThrowMetaIcon(pos, map, icon);
}
public void PlaySexSound()
{
if (RJWSettings.sounds_enabled)
{
SoundInfo sound = new TargetInfo(pawn.Position, pawn.Map);
sound.volumeFactor = RJWSettings.sounds_sex_volume;
SoundDef.Named("Sex").PlayOneShot(sound);
}
}
public void PlayCumSound()
{
if (RJWSettings.sounds_enabled)
{
SoundInfo sound = new TargetInfo(pawn.Position, pawn.Map);
sound.volumeFactor = RJWSettings.sounds_cum_volume;
SoundDef.Named("Cum").PlayOneShot(sound);
}
}
public void PlaySexVoice()
{
//if (RJWSettings.sounds_enabled)
//{
// SoundInfo sound = new TargetInfo(pawn.Position, pawn.Map);
// sound.volumeFactor = RJWSettings.sounds_voice_volume;
// SoundDef.Named("Sex").PlayOneShot(sound);
//}
}
public void PlayOrgasmVoice()
{
//if (RJWSettings.sounds_enabled)
//{
// SoundInfo sound = new TargetInfo(pawn.Position, pawn.Map);
// sound.volumeFactor = RJWSettings.sounds_orgasm_volume;
// SoundDef.Named("Orgasm").PlayOneShot(sound);
//}
}
public void CalculateSatisfactionPerTick()
{
satisfaction = 1.0f;
}
public static bool IsInOrByBed(Building_Bed b, Pawn p)
{
for (int i = 0; i < b.SleepingSlotsCount; i++)
{
if (b.GetSleepingSlotPos(i).InHorDistOf(p.Position, 1f))
{
return true;
}
}
return false;
}
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return true; // No reservations needed.
}
protected override IEnumerable<Toil> MakeNewToils()
{
return null;
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_Sex.cs
|
C#
|
mit
| 12,403 |
using Verse;
using Verse.AI;
namespace rjw
{
public abstract class JobDriver_SexBaseInitiator : JobDriver_Sex
{
public void Start()
{
if (Partner == null) //TODO: solo sex descriptions
{
isRape = false;
isWhoring = false;
//Sexprops = SexUtility.SelectSextype(pawn, Partner, isRape, isWhoring, Partner);
//sexType = Sexprops.SexType;
//SexUtility.LogSextype(Sexprops.Giver, Sexprops.Reciever, Sexprops.RulePack, Sexprops.DictionaryKey);
}
else if (Partner.Dead)
{
isRape = true;
isWhoring = false;
if (Sexprops == null)
Sexprops = SexUtility.SelectSextype(pawn, Partner, isRape, isWhoring, Partner);
sexType = Sexprops.SexType;
SexUtility.LogSextype(Sexprops.Giver, Sexprops.Reciever, Sexprops.RulePack, Sexprops.DictionaryKey);
}
else if (Partner.jobs?.curDriver is JobDriver_SexBaseReciever)
{
(Partner.jobs.curDriver as JobDriver_SexBaseReciever).parteners.AddDistinct(pawn);
(Partner.jobs.curDriver as JobDriver_SexBaseReciever).increase_time(duration);
//prevent Receiver standing up and interrupting rape
if (Partner.health.hediffSet.HasHediff(HediffDef.Named("Hediff_Submitting")))
Partner.health.AddHediff(HediffDef.Named("Hediff_Submitting"));
//(Target.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Count; //TODO: add multipartner support so sex doesnt repeat, maybe, someday
isRape = Partner?.CurJob.def == xxx.gettin_raped;
isWhoring = pawn?.CurJob.def == xxx.whore_is_serving_visitors;
if (Sexprops == null)
Sexprops = SexUtility.SelectSextype(pawn, Partner, isRape, isWhoring, Partner);
sexType = Sexprops.SexType;
SexUtility.LogSextype(Sexprops.Giver, Sexprops.Reciever, Sexprops.RulePack, Sexprops.DictionaryKey);
}
//Log.Message("sexType: " + sexType.ToString());
//props = new SexProps(pawn, Partener, sexType, isRape);//maybe merge everything into this ?
}
//public void Change(xxx.rjwSextype sexType)
//{
// if (pawn.jobs?.curDriver is JobDriver_SexBaseInitiator)
// {
// (pawn.jobs.curDriver as JobDriver_SexBaseInitiator).increase_time(duration);
// Sexprops = SexUtility.SelectSextype(pawn, Partner, isRape, isWhoring, Partner);
// sexType = Sexprops.SexType;
// SexUtility.LogSextype(Sexprops.Giver, Sexprops.Reciever, Sexprops.RulePack, Sexprops.DictionaryKey);
// }
// if (Partner.jobs?.curDriver is JobDriver_SexBaseReciever)
// {
// (Partner.jobs.curDriver as JobDriver_SexBaseReciever).increase_time(duration);
// Sexprops = SexUtility.SelectSextype(pawn, Partner, isRape, isWhoring, Partner);
// sexType = Sexprops.SexType;
// SexUtility.LogSextype(Sexprops.Giver, Sexprops.Reciever, Sexprops.RulePack, Sexprops.DictionaryKey);
// }
// sexType = sexType
//}
public void End()
{
if (xxx.is_human(pawn))
pawn.Drawer.renderer.graphics.ResolveApparelGraphics();
if (Partner?.jobs?.curDriver is JobDriver_SexBaseReciever)
{
(Partner?.jobs.curDriver as JobDriver_SexBaseReciever).parteners.Remove(pawn);
}
}
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
ModLog.Message("shouldreserve " + shouldreserve);
if (shouldreserve && Target != null)
return pawn.Reserve(Target, job, xxx.max_rapists_per_prisoner, stackCount, null, errorOnFailed);
else if (shouldreserve && Bed != null)
return pawn.Reserve(Bed, job, Bed.SleepingSlotsCount, 0, null, errorOnFailed);
else
return true; // No reservations needed.
//return this.pawn.Reserve(this.Partner, this.job, 1, 0, null) && this.pawn.Reserve(this.Bed, this.job, 1, 0, null);
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_SexBaseInitiator.cs
|
C#
|
mit
| 3,630 |
using System.Collections.Generic;
using Verse;
namespace rjw
{
public class JobDriver_SexBaseReciever : JobDriver_Sex
{
//give this poor driver some love other than (Partner.jobs?.curDriver is JobDriver_SexBaseReciever)
public List<Pawn> parteners = new List<Pawn>();
public override void ExposeData()
{
base.ExposeData();
Scribe_Collections.Look(ref parteners, "parteners", LookMode.Reference);
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_SexBaseReciever.cs
|
C#
|
mit
| 422 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
using System;
namespace rjw
{
public class JobDriver_SexBaseRecieverLoved : JobDriver_SexBaseReciever
{
protected override IEnumerable<Toil> MakeNewToils()
{
setup_ticks();
parteners.Add(Partner);// add job starter, so this wont fail, before Initiator starts his job
//--ModLog.Message("JobDriver_GettinLoved::MakeNewToils is called");
//ModLog.Message("" + Partner.CurJob.def);
float partner_ability = xxx.get_sex_ability(Partner);
// More/less hearts based on partner ability.
if (partner_ability < 0.8f)
ticks_between_thrusts += 120;
else if (partner_ability > 2.0f)
ticks_between_thrusts -= 30;
// More/less hearts based on opinion.
if (pawn.relations.OpinionOf(Partner) < 0)
ticks_between_hearts += 50;
else if (pawn.relations.OpinionOf(Partner) > 60)
ticks_between_hearts -= 25;
this.FailOnDespawnedOrNull(iTarget);
this.FailOn(() => !Partner.health.capacities.CanBeAwake);
this.FailOn(() => pawn.Drafted);
this.FailOn(() => Partner.Drafted);
if (Partner.CurJob.def == xxx.casual_sex) // sex in bed
{
this.KeepLyingDown(iBed);
yield return Toils_Reserve.Reserve(iTarget, 1, 0);
yield return Toils_Reserve.Reserve(iBed, Bed.SleepingSlotsCount, 0);
var get_loved = MakeSexToil();
get_loved.FailOn(() => Partner.CurJob.def != xxx.casual_sex);
yield return get_loved;
}
else if (Partner.CurJob.def == xxx.quick_sex)
{
yield return Toils_Reserve.Reserve(iTarget, 1, 0);
var get_loved = MakeSexToil();
get_loved.handlingFacing = false;
yield return get_loved;
}
else if (Partner.CurJob.def == xxx.whore_is_serving_visitors)
{
this.FailOn(() => Partner.CurJob == null);
yield return Toils_Reserve.Reserve(iTarget, 1, 0);
var get_loved = MakeSexToil();
get_loved.FailOn(() => (Partner.CurJob.def != xxx.whore_is_serving_visitors));
yield return get_loved;
}
else if (Partner.CurJob.def == xxx.bestialityForFemale)
{
this.FailOn(() => Partner.CurJob == null);
yield return Toils_Reserve.Reserve(iTarget, 1, 0);
var get_loved = MakeSexToil();
get_loved.FailOn(() => (Partner.CurJob.def != xxx.bestialityForFemale));
yield return get_loved;
}
else if (Partner.CurJob.def == xxx.animalMate)
{
this.FailOn(() => Partner.CurJob == null);
yield return Toils_Reserve.Reserve(iTarget, 1, 0);
var get_loved = MakeSexToil();
get_loved.FailOn(() => (Partner.CurJob.def != xxx.animalMate));
yield return get_loved;
}
}
private Toil MakeSexToil()
{
Toil get_loved = new Toil();
if (Partner.CurJob.def == xxx.casual_sex) // sex in bed
get_loved = Toils_LayDown.LayDown(iBed, true, false, false, false);
get_loved.defaultCompleteMode = ToilCompleteMode.Never;
get_loved.socialMode = RandomSocialMode.Off;
get_loved.handlingFacing = true;
//get_loved.initAction = delegate
//{
//};
get_loved.tickAction = delegate
{
--ticks_remaining;
if (pawn.IsHashIntervalTick(ticks_between_hearts))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
};
get_loved.AddEndCondition(new Func<JobCondition>(() =>
{
if ((ticks_remaining <= 0) || (parteners.Count <= 0))
{
return JobCondition.Succeeded;
}
return JobCondition.Ongoing;
}));
get_loved.AddFinishAction(delegate
{
if (xxx.is_human(pawn))
pawn.Drawer.renderer.graphics.ResolveApparelGraphics();
});
get_loved.socialMode = RandomSocialMode.Off;
return get_loved;
}
}
public class JobDriver_SexBaseRecieverQuickie : JobDriver_SexBaseRecieverLoved
{
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_SexBaseRecieverLoved.cs
|
C#
|
mit
| 3,704 |
using System;
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
namespace rjw
{
public class JobDriver_SexBaseRecieverRaped : JobDriver_SexBaseReciever
{
protected override IEnumerable<Toil> MakeNewToils()
{
setup_ticks();
parteners.Add(Partner);// add job starter, so this wont fail, before Initiator starts his job
var get_raped = new Toil();
get_raped.defaultCompleteMode = ToilCompleteMode.Never;
get_raped.handlingFacing = true;
get_raped.initAction = delegate
{
pawn.pather.StopDead();
pawn.jobs.curDriver.asleep = false;
SexUtility.BeeingRapedAlert(Partner, pawn);
};
get_raped.tickAction = delegate
{
--ticks_remaining;
if ((parteners.Count > 0) && (pawn.IsHashIntervalTick(ticks_between_hearts / parteners.Count)))
if (pawn.IsHashIntervalTick(ticks_between_hearts))
if (xxx.is_masochist(pawn))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
else
ThrowMetaIcon(pawn.Position, pawn.Map, xxx.mote_noheart);
};
get_raped.AddEndCondition(new Func<JobCondition>(() =>
{
if ((ticks_remaining <= 0) || (parteners.Count <= 0))
{
return JobCondition.Succeeded;
}
return JobCondition.Ongoing;
}));
get_raped.AddFinishAction(delegate
{
if (xxx.is_human(pawn))
pawn.Drawer.renderer.graphics.ResolveApparelGraphics();
if (Bed != null && pawn.Downed)
{
Job tobed = JobMaker.MakeJob(JobDefOf.Rescue, pawn, Bed);
tobed.count = 1;
Partner.jobs.jobQueue.EnqueueFirst(tobed);
//Log.Message(xxx.get_pawnname(Initiator) + ": job tobed:" + tobed);
}
else if (pawn.HostileTo(Partner))
pawn.health.AddHediff(HediffDef.Named("Hediff_Submitting"));
else
pawn.stances.stunner.StunFor(600, pawn);
});
get_raped.socialMode = RandomSocialMode.Off;
yield return get_raped;
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_SexBaseRecieverRaped.cs
|
C#
|
mit
| 1,903 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
namespace rjw
{
public class JobDriver_JoinInBed : JobDriver_SexBaseInitiator
{
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return pawn.Reserve(Target, job, xxx.max_rapists_per_prisoner, 0, null, errorOnFailed);
}
protected override IEnumerable<Toil> MakeNewToils()
{
//ModLog.Message("" + this.GetType().ToString() + "::MakeNewToils() called");
setup_ticks();
this.FailOnDespawnedOrNull(iTarget);
this.FailOnDespawnedOrNull(iBed);
this.FailOn(() => !Partner.health.capacities.CanBeAwake);
this.FailOn(() => !(Partner.InBed() || xxx.in_same_bed(Partner, pawn)));
this.FailOn(() => pawn.Drafted);
yield return Toils_Reserve.Reserve(iTarget, xxx.max_rapists_per_prisoner, 0);
yield return Toils_Goto.GotoThing(iTarget, PathEndMode.OnCell);
Toil StartPartnerJob = new Toil();
StartPartnerJob.defaultCompleteMode = ToilCompleteMode.Instant;
StartPartnerJob.socialMode = RandomSocialMode.Off;
StartPartnerJob.initAction = delegate
{
Job gettin_loved = JobMaker.MakeJob(xxx.gettin_loved, pawn, Bed);
Partner.jobs.StartJob(gettin_loved, JobCondition.InterruptForced);
};
yield return StartPartnerJob;
Toil SexToil = new Toil();
SexToil.FailOn(() => Partner.CurJob.def != xxx.gettin_loved);
SexToil.defaultCompleteMode = ToilCompleteMode.Never;
SexToil.socialMode = RandomSocialMode.Off;
SexToil.handlingFacing = true;
SexToil.initAction = delegate
{
usedCondom = CondomUtility.TryUseCondom(pawn) || CondomUtility.TryUseCondom(Partner);
Start();
};
SexToil.AddPreTickAction(delegate
{
--ticks_left;
if (pawn.IsHashIntervalTick(ticks_between_hearts))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
SexTick(pawn, Partner);
SexUtility.reduce_rest(Partner, 1);
SexUtility.reduce_rest(pawn, 2);
if (ticks_left <= 0)
ReadyForNextToil();
});
SexToil.AddFinishAction(delegate
{
End();
});
yield return SexToil;
yield return new Toil
{
initAction = delegate
{
// Trying to add some interactions and social logs
SexUtility.ProcessSex(pawn, Partner, usedCondom: usedCondom, rape: isRape, whoring: isWhoring, sextype: sexType);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_SexCasual.cs
|
C#
|
mit
| 2,395 |
using System;
using System.Collections.Generic;
using System.Linq;
using Multiplayer.API;
using RimWorld;
using UnityEngine;
using Verse;
using Verse.AI;
namespace rjw
{
public class JobDriver_SexQuick : JobDriver_SexBaseInitiator
{
// List of jobs that can be interrupted by quickies.
public static readonly List<JobDef> quickieAllowedJobs = new List<JobDef> { null, JobDefOf.Wait_Wander, JobDefOf.GotoWander, JobDefOf.Clean, JobDefOf.ClearSnow,
JobDefOf.CutPlant, JobDefOf.HaulToCell, JobDefOf.Deconstruct, JobDefOf.LayDown, JobDefOf.Research, JobDefOf.SmoothFloor, JobDefOf.SmoothWall,
JobDefOf.SocialRelax, JobDefOf.StandAndBeSociallyActive, JobDefOf.RemoveApparel, JobDefOf.Strip, JobDefOf.Wait, JobDefOf.FillFermentingBarrel,
JobDefOf.Sow, JobDefOf.Shear, JobDefOf.DeliverFood, JobDefOf.Hunt, JobDefOf.Mine, JobDefOf.RearmTurret, JobDefOf.RemoveFloor, JobDefOf.RemoveRoof,
JobDefOf.Repair, JobDefOf.TakeBeerOutOfFermentingBarrel, JobDefOf.Uninstall, JobDefOf.Meditate, xxx.Masturbate};
private List<Pawn> all_pawns;
private FloatRange temperature;
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return pawn.Reserve(Target, job, xxx.max_rapists_per_prisoner, 0, null, errorOnFailed);
}
protected override IEnumerable<Toil> MakeNewToils()
{
//ModLog.Message("" + this.GetType().ToString() + "::MakeNewToils() called");
setup_ticks();
var PartnerJob = xxx.getting_quickie;
this.FailOnDespawnedNullOrForbidden(iTarget);
this.FailOn(() => !Partner.health.capacities.CanBeAwake);
this.FailOn(() => pawn.IsFighting());
this.FailOn(() => Partner.IsFighting());
this.FailOn(() => pawn.Drafted);
yield return Toils_Goto.GotoThing(iTarget, PathEndMode.OnCell);
Toil findQuickieSpot = new Toil();
findQuickieSpot.defaultCompleteMode = ToilCompleteMode.PatherArrival;
findQuickieSpot.initAction = delegate
{
//Needs this earlier to decide if current place is good enough
all_pawns = pawn.Map.mapPawns.AllPawnsSpawned.Where(x
=> x.Position.DistanceTo(pawn.Position) < 100
&& xxx.is_human(x)
&& x != pawn
&& x != Partner
).ToList();
temperature = pawn.ComfortableTemperatureRange();
float cellTemp = pawn.Position.GetTemperature(pawn.Map);
if (Partner.IsPrisonerInPrisonCell() || (!MightBeSeen(all_pawns,pawn.Position,pawn,Partner) && (cellTemp > temperature.min && cellTemp < temperature.max)))
{
ReadyForNextToil();
}
else
{
var spot = FindQuickieLocation(pawn, Partner);
pawn.pather.StartPath(spot, PathEndMode.OnCell);
Partner.jobs.StopAll();
Job job = JobMaker.MakeJob(JobDefOf.GotoMindControlled, spot);
Partner.jobs.StartJob(job, JobCondition.InterruptForced);
}
};
yield return findQuickieSpot;
Toil WaitForPartner = new Toil();
WaitForPartner.defaultCompleteMode = ToilCompleteMode.Delay;
WaitForPartner.initAction = delegate
{
ticksLeftThisToil = 5000;
};
WaitForPartner.tickAction = delegate
{
pawn.GainComfortFromCellIfPossible();
if (pawn.Position.DistanceTo(Partner.Position) <= 1f)
{
ReadyForNextToil();
}
};
yield return WaitForPartner;
Toil StartPartnerJob = new Toil();
StartPartnerJob.defaultCompleteMode = ToilCompleteMode.Instant;
StartPartnerJob.socialMode = RandomSocialMode.Off;
StartPartnerJob.initAction = delegate
{
Job gettingQuickie = JobMaker.MakeJob(PartnerJob, pawn, Partner);
Partner.jobs.StartJob(gettingQuickie, JobCondition.InterruptForced);
};
yield return StartPartnerJob;
Toil SexToil = new Toil();
SexToil.defaultCompleteMode = ToilCompleteMode.Never;
SexToil.socialMode = RandomSocialMode.Off;
SexToil.defaultDuration = duration;
SexToil.handlingFacing = true;
SexToil.FailOn(() => Partner.CurJob.def != PartnerJob);
SexToil.initAction = delegate
{
Partner.pather.StopDead();
Partner.jobs.curDriver.asleep = false;
usedCondom = CondomUtility.TryUseCondom(pawn) || CondomUtility.TryUseCondom(Partner);
Start();
};
SexToil.AddPreTickAction(delegate
{
--ticks_left;
if (pawn.IsHashIntervalTick(ticks_between_hearts))
ThrowMetaIcon(pawn.Position, pawn.Map, ThingDefOf.Mote_Heart);
SexTick(pawn, Partner);
SexUtility.reduce_rest(Partner, 1);
SexUtility.reduce_rest(pawn, 1);
if (ticks_left <= 0)
ReadyForNextToil();
});
SexToil.AddFinishAction(delegate
{
End();
});
yield return SexToil;
yield return new Toil
{
initAction = delegate
{
//// Trying to add some interactions and social logs
SexUtility.ProcessSex(pawn, Partner, usedCondom: usedCondom, rape: isRape, sextype: sexType);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
[SyncMethod]
public virtual IntVec3 FindQuickieLocation(Pawn pawn, Pawn partner)
{
IntVec3 position = pawn.Position;
int bestPosition = -100;
IntVec3 cell = pawn.Position;
int maxDistance = 40;
//bool is_somnophile = xxx.has_quirk(pawn, "Somnophile");
bool is_exhibitionist = xxx.has_quirk(pawn, "Exhibitionist");
//ModLog.Message(" Pawn is " + xxx.get_pawnname(pawn) + ", current cell is " + cell);
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
List<IntVec3> random_cells = new List<IntVec3>();
for (int loop = 0; loop < 50; ++loop)
{
random_cells.Add(position + IntVec3.FromVector3(Vector3Utility.HorizontalVectorFromAngle(Rand.Range(0, 360)) * Rand.RangeInclusive(1, maxDistance)));
}
random_cells = random_cells.Where(x
=> x.Standable(pawn.Map)
&& x.InAllowedArea(pawn)
&& x.GetDangerFor(pawn, pawn.Map) != Danger.Deadly
&& !x.ContainsTrap(pawn.Map)
&& !x.ContainsStaticFire(pawn.Map)
).Distinct().ToList();
//ModLog.Message(" Found " + random_cells.Count + " valid cells.");
foreach (IntVec3 random_cell in random_cells)
{
if (!xxx.can_path_to_target(pawn, random_cell))
continue;// too far
int score = 0;
Room room = random_cell.GetRoom(pawn.Map);
bool might_be_seen = MightBeSeen(all_pawns, random_cell, pawn, partner);
if (is_exhibitionist)
{
if (might_be_seen)
score += 5;
else
score -= 10;
}
else
{
if (might_be_seen)
score -= 30;
}
if (random_cell.GetTemperature(pawn.Map) > temperature.min && random_cell.GetTemperature(pawn.Map) < temperature.max)
score += 20;
else
score -= 20;
if (random_cell.Roofed(pawn.Map))
score += 5;
if (random_cell.HasEatSurface(pawn.Map))
score += 5; // Hide in vegetation.
if (random_cell.GetDangerFor(pawn, pawn.Map) == Danger.Some)
score -= 25;
else if (random_cell.GetDangerFor(pawn, pawn.Map) == Danger.None)
score += 5;
if (random_cell.GetTerrain(pawn.Map) == TerrainDefOf.WaterShallow ||
random_cell.GetTerrain(pawn.Map) == TerrainDefOf.WaterMovingShallow ||
random_cell.GetTerrain(pawn.Map) == TerrainDefOf.WaterOceanShallow)
score -= 20;
if (random_cell.GetThingList(pawn.Map).Any(x => x.def.IsWithinCategory(ThingCategoryDefOf.Corpses)) && !xxx.is_necrophiliac(pawn))
score -= 20;
if (random_cell.GetThingList(pawn.Map).Any(x => x.def.IsWithinCategory(ThingCategoryDefOf.Foods)))
score -= 10;
if (room == pawn.Position.GetRoom(pawn.MapHeld))
score -= 10;
if (room.PsychologicallyOutdoors)
score += 5;
if (room.isPrisonCell)
score += 5;
if (room.IsHuge)
score -= 5;
if (room.ContainedBeds.Any())
score += 5;
if (room.IsDoorway)
score -= 10;
if (!room.Owners.Any())
score += 10;
else if (room.Owners.Contains(pawn))
score += 20;
if (room.Role == RoomRoleDefOf.Bedroom || room.Role == RoomRoleDefOf.PrisonCell)
score += 10;
else if (room.Role == RoomRoleDefOf.Barracks || room.Role == RoomRoleDefOf.Laboratory || room.Role == RoomRoleDefOf.RecRoom)
score += 2;
else if (room.Role == RoomRoleDefOf.DiningRoom || room.Role == RoomRoleDefOf.Hospital || room.Role == RoomRoleDefOf.PrisonBarracks)
score -= 5;
if (room.GetStat(RoomStatDefOf.Cleanliness) < 0.01f)
score -= 5;
if (room.GetStat(RoomStatDefOf.GraveVisitingJoyGainFactor) > 0.1f)
score -= 5;
if (score <= bestPosition) continue;
bestPosition = score;
cell = random_cell;
}
return cell;
//ModLog.Message(" Best cell is " + cell);
}
private bool MightBeSeen(List<Pawn> otherPawns, IntVec3 cell, Pawn pawn, Pawn partner)
{
return otherPawns.Any(x
=> GenSight.LineOfSight(x.Position, cell, pawn.Map)
&& x.Position.DistanceTo(cell) < 50
&& x.Awake()
&& x != partner
);
}
}
}
|
TDarksword/rjw
|
Source/JobDrivers/JobDriver_SexQuick.cs
|
C#
|
mit
| 8,744 |
using System.Linq;
using RimWorld;
using Verse;
using Verse.AI;
using System.Collections.Generic;
using Multiplayer.API;
namespace rjw
{
//Rape to Prisoner of QuestPrisonerWillingToJoin
class JobGiver_AIRapePrisoner : ThinkNode_JobGiver
{
[SyncMethod]
public static Pawn find_victim(Pawn pawn, Map m)
{
float min_fuckability = 0.10f; // Don't rape pawns with <10% fuckability
float avg_fuckability = 0f; // Average targets fuckability, choose target higher than that
var valid_targets = new Dictionary<Pawn, float>(); // Valid pawns and their fuckability
Pawn chosentarget = null; // Final target pawn
IEnumerable<Pawn> targets = m.mapPawns.AllPawns.Where(x
=> x != pawn
&& IsPrisonerOf(x, pawn.Faction)
&& xxx.can_get_raped(x)
&& pawn.CanReserveAndReach(x, PathEndMode.Touch, Danger.Some, xxx.max_rapists_per_prisoner, 0)
&& !x.Position.IsForbidden(pawn)
);
foreach (Pawn target in targets)
{
if (!xxx.can_path_to_target(pawn, target.Position))
continue;// too far
float fuc = SexAppraiser.would_fuck(pawn, target, true, true);
if (fuc > min_fuckability)
valid_targets.Add(target, fuc);
}
if (valid_targets.Any())
{
avg_fuckability = valid_targets.Average(x => x.Value);
// choose pawns to fuck with above average fuckability
var valid_targetsFiltered = valid_targets.Where(x => x.Value >= avg_fuckability);
if (valid_targetsFiltered.Any())
chosentarget = valid_targetsFiltered.RandomElement().Key;
}
return chosentarget;
}
protected override Job TryGiveJob(Pawn pawn)
{
if (RJWSettings.DebugRape) ModLog.Message(" JobGiver_AIRapePrisoner::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) called ");
if (!xxx.can_rape(pawn)) return null;
if (SexUtility.ReadyForLovin(pawn) || xxx.is_hornyorfrustrated(pawn))
{
// don't allow pawns marked as comfort prisoners to rape others
if (xxx.is_healthy(pawn))
{
Pawn prisoner = find_victim(pawn, pawn.Map);
if (prisoner != null)
{
if (RJWSettings.DebugRape) ModLog.Message(" JobGiver_RandomRape::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) - found victim " + xxx.get_pawnname(prisoner));
return JobMaker.MakeJob(xxx.RapeRandom, prisoner);
}
}
}
return null;
}
protected static bool IsPrisonerOf(Pawn pawn,Faction faction)
{
if (pawn?.guest == null) return false;
return pawn.guest.HostFaction == faction && pawn.guest.IsPrisoner;
}
}
}
|
TDarksword/rjw
|
Source/JobGivers/JobGiver_AIRapePrisoner.cs
|
C#
|
mit
| 2,576 |
using RimWorld;
using Verse;
using Verse.AI;
namespace rjw
{
/// <summary>
/// Pawn tries to find animal to do loving/raping.
/// </summary>
public class JobGiver_Bestiality : ThinkNode_JobGiver
{
protected override Job TryGiveJob(Pawn pawn)
{
if (pawn.Drafted) return null;
// Most checks are now done in ThinkNode_ConditionalBestiality
if (!SexUtility.ReadyForLovin(pawn) && !xxx.is_frustrated(pawn))
return null;
Pawn target = BreederHelper.find_breeder_animal(pawn, pawn.Map);
if (target == null) return null;
if (xxx.can_rape(pawn))
{
return JobMaker.MakeJob(xxx.bestiality, target);
}
Building_Bed bed = pawn.ownership.OwnedBed;
if (!xxx.can_be_fucked(pawn) || bed == null || !target.CanReach(bed, PathEndMode.OnCell, Danger.Some) || target.Downed) return null;
// TODO: Should rename this to BestialityInBed or somesuch, since it's not limited to females.
return JobMaker.MakeJob(xxx.bestialityForFemale, target, bed);
}
}
}
|
TDarksword/rjw
|
Source/JobGivers/JobGiver_Bestiality.cs
|
C#
|
mit
| 1,000 |
using Verse;
using Verse.AI;
namespace rjw
{
/// <summary>
/// Attempts to give a breeding job to an eligible animal.
/// </summary>
public class JobGiver_Breed : ThinkNode_JobGiver
{
protected override Job TryGiveJob(Pawn animal)
{
//ModLog.Message(" JobGiver_Breed::TryGiveJob( " + xxx.get_pawnname(animal) + " ) called0" + (SexUtility.ReadyForLovin(animal)));
if (!SexUtility.ReadyForLovin(animal))
return null;
if(xxx.is_healthy(animal) && xxx.can_rape(animal))
{
//search for desiganted target to sex
if (animal.IsDesignatedBreedingAnimal())
{
Pawn designated_target = BreederHelper.find_designated_breeder(animal, animal.Map);
if (designated_target != null)
{
return JobMaker.MakeJob(xxx.animalBreed, designated_target);
}
}
}
return null;
}
}
}
|
TDarksword/rjw
|
Source/JobGivers/JobGiver_Breed.cs
|
C#
|
mit
| 830 |
using Verse;
using Verse.AI;
using RimWorld;
using System.Collections.Generic;
using System.Linq;
using Multiplayer.API;
namespace rjw
{
public class JobGiver_ComfortPrisonerRape : ThinkNode_JobGiver
{
[SyncMethod]
public static Pawn find_targetCP(Pawn pawn, Map m)
{
if (!DesignatorsData.rjwComfort.Any()) return null;
float min_fuckability = 0.10f; // Don't rape prisoners with <10% fuckability
float avg_fuckability = 0f; // Average targets fuckability, choose target higher than that
var valid_targets = new Dictionary<Pawn, float>(); // Valid pawns and their fuckability
Pawn chosentarget = null; // Final target pawn
string pawnName = xxx.get_pawnname(pawn);
if (RJWSettings.DebugRape) ModLog.Message($"FindComfortPrisoner({pawnName})");
IEnumerable<Pawn> targets = DesignatorsData.rjwComfort.Where(x
=> x != pawn
&& xxx.can_get_raped(x)
&& pawn.CanReserveAndReach(x, PathEndMode.Touch, Danger.Some, xxx.max_rapists_per_prisoner, 0)
&& !x.IsForbidden(pawn)
&& SexAppraiser.would_rape(pawn, x)
);
if (RJWSettings.DebugRape) ModLog.Message($"FindComfortPrisoner({pawnName}): found {targets.Count()}");
if (xxx.is_animal(pawn))
{
// Animals only consider targets they can see, instead of seeking them out.
targets = targets.Where(x => pawn.CanSee(x)).ToList();
}
foreach (Pawn target in targets)
{
if (!xxx.can_path_to_target(pawn, target.Position))
continue;// too far
float fuc = 0f;
if (xxx.is_animal(target))
fuc = SexAppraiser.would_fuck_animal(pawn, target, true);
else if (xxx.is_human(target))
fuc = SexAppraiser.would_fuck(pawn, target, true);
if (RJWSettings.DebugRape) ModLog.Message($"FindComfortPrisoner({pawnName}): {fuc} has to be over {min_fuckability}");
if (fuc > min_fuckability)
valid_targets.Add(target, fuc);
}
if (valid_targets.Any())
{
// avg_fuckability = valid_targets.Average(x => x.Value); // disabled for CP
// choose pawns to fuck with above average fuckability
var valid_targetsFiltered = valid_targets.Where(x => x.Value >= avg_fuckability);
if (valid_targetsFiltered.Any())
chosentarget = valid_targetsFiltered.RandomElement().Key;
}
return chosentarget;
}
protected override Job TryGiveJob(Pawn pawn)
{
if (RJWSettings.DebugRape) ModLog.Message($"JobGiver_ComfortPrisonerRape::TryGiveJob({xxx.get_pawnname(pawn)}) called");
if (!RJWSettings.WildMode)
{
// don't allow pawns marked as comfort prisoners to rape others
if (RJWSettings.DebugRape) ModLog.Message($"JobGiver_ComfortPrisonerRape::TryGiveJob({xxx.get_pawnname(pawn)}): is healthy = {xxx.is_healthy(pawn)}, is cp = {pawn.IsDesignatedComfort()}, is ready = {SexUtility.ReadyForLovin(pawn)}, is frustrated = {xxx.is_frustrated(pawn)}");
if (!xxx.is_healthy(pawn) || pawn.IsDesignatedComfort() || (!SexUtility.ReadyForLovin(pawn) && !xxx.is_frustrated(pawn))) return null;
}
if (RJWSettings.DebugRape) ModLog.Message($"FindComfortPrisoner({xxx.get_pawnname(pawn)}): can rape = {xxx.can_rape(pawn)}, is drafted = {pawn.Drafted}");
if (pawn.Drafted || !xxx.can_rape(pawn)) return null;
// It's unnecessary to include other job checks. Pawns seem to only look for new jobs when between jobs or laying down idle.
if (!(pawn.jobs.curJob == null || pawn.jobs.curJob.def == JobDefOf.LayDown))
{
if (RJWSettings.DebugRape) ModLog.Message($"FindComfortPrisoner({xxx.get_pawnname(pawn)}): I already have a job ({pawn.CurJobDef})");
return null;
}
// Faction check.
if (!(pawn.Faction?.IsPlayer ?? false) && !pawn.IsPrisonerOfColony)
{
if (RJWSettings.DebugRape) ModLog.Message($"FindComfortPrisoner({xxx.get_pawnname(pawn)}): player faction: {pawn.Faction?.IsPlayer}, prisoner: {pawn.IsPrisonerOfColony}");
return null;
}
Pawn target = find_targetCP(pawn, pawn.Map);
if (RJWSettings.DebugRape) ModLog.Message($"JobGiver_ComfortPrisonerRape::TryGiveJob({xxx.get_pawnname(pawn)}): (" + ((target == null) ? "no target found" : xxx.get_pawnname(target))+") is the prisoner");
if (target == null) return null;
if (RJWSettings.DebugRape) ModLog.Message($"JobGiver_ComfortPrisonerRape::TryGiveJob({xxx.get_pawnname(pawn)}) with target {xxx.get_pawnname(target)}");
if (xxx.is_animal(target))
return JobMaker.MakeJob(xxx.bestiality, target);
else
return JobMaker.MakeJob(xxx.RapeCP, target);
}
}
}
|
TDarksword/rjw
|
Source/JobGivers/JobGiver_ComfortPrisonerRape.cs
|
C#
|
mit
| 4,491 |
using System.Collections.Generic;
using System.Linq;
using RimWorld;
using Verse;
using Verse.AI;
using Multiplayer.API;
namespace rjw
{
public class JobGiver_DoQuickie : ThinkNode_JobGiver
{
private const int MaxDistanceSquaredToFuck = 10000;
private static bool CanFuck(Pawn target)
{
return xxx.can_fuck(target) || xxx.can_be_fucked(target);
}
[SyncMethod]
private static bool roll_to_skip(Pawn pawn, Pawn target, out float fuckability)
{
fuckability = SexAppraiser.would_fuck(pawn, target); // 0.0 to 1.0
if (fuckability < RJWHookupSettings.MinimumFuckabilityToHookup)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] roll_to_skip(I, {xxx.get_pawnname(pawn)} won't fuck {xxx.get_pawnname(target)}), ({fuckability})");
return false;
}
float reciprocity = xxx.is_animal(target) ? 1.0f : SexAppraiser.would_fuck(target, pawn);
if (reciprocity < RJWHookupSettings.MinimumFuckabilityToHookup)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] roll_to_skip({xxx.get_pawnname(target)} won't fuck me, {xxx.get_pawnname(pawn)}), ({reciprocity})");
return false;
}
float chance_to_skip = 0.9f - 0.7f * fuckability;
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
return Rand.Value < chance_to_skip;
}
[SyncMethod]
public static Pawn find_pawn_to_fuck(Pawn pawn, Map map)
{
string pawnName = xxx.get_pawnname(pawn);
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): starting.");
bool pawnIsNympho = xxx.is_nympho(pawn);
bool pawnCanPickAnyone = RJWSettings.WildMode || (pawnIsNympho && RJWHookupSettings.NymphosCanPickAnyone);
bool pawnCanPickAnimals = (pawnCanPickAnyone || xxx.is_zoophile(pawn)) && RJWSettings.bestiality_enabled;
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): nympho:{pawnIsNympho}, ignores rules:{pawnCanPickAnyone}, zoo:{pawnCanPickAnimals}");
if (!RJWHookupSettings.ColonistsCanHookup && pawn.IsFreeColonist && !pawnCanPickAnyone)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): is a colonist and colonist hookups are disabled in mod settings");
return null;
}
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
// Check AllPawns, not just colonists, to include guests.
List<Pawn> targets = map.mapPawns.AllPawns.Where(x
=> x != pawn
&& !x.InBed()
&& !x.IsForbidden(pawn)
&& xxx.IsTargetPawnOkay(x)
&& CanFuck(x)
&& x.Map == pawn.Map
&& !x.HostileTo(pawn)
//&& (pawnCanPickAnimals || !xxx.is_animal(x))
&& !xxx.is_animal(x)
).ToList();
if (!targets.Any())
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): no eligible targets");
return null;
}
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck quickie({pawnName}): considering {targets.Count} targets");
// find lover/partner on same map
List<Pawn> partners = targets.Where(x
=> pawn.relations.DirectRelationExists(PawnRelationDefOf.Lover, x)
|| pawn.relations.DirectRelationExists(PawnRelationDefOf.Fiance, x)
|| pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, x)
).ToList();
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): considering {partners.Count} partners");
if (partners.Any())
{
partners.Shuffle(); //Randomize order.
foreach (Pawn target in partners)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): checking lover {xxx.get_pawnname(target)}");
//interruptible jobs
if (target.jobs?.curJob !=null &&
(target.jobs.curJob.playerForced ||
!JobDriver_SexQuick.quickieAllowedJobs.Contains(target.jobs.curJob.def)
))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): lover has important job ({target.jobs.curJob.def}), skipping");
continue;
}
if (pawn.Position.DistanceToSquared(target.Position) < MaxDistanceSquaredToFuck
&& pawn.CanReserveAndReach(target, PathEndMode.OnCell, Danger.Some, 1, 0)
&& target.CanReserve(pawn, 1, 0)
&& SexAppraiser.would_fuck(pawn, target) > 0.1f
&& SexAppraiser.would_fuck(target, pawn) > 0.1f)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): banging lover {xxx.get_pawnname(target)}");
return target;
}
}
}
// No lovers around... see if the pawn fancies a hookup. Nymphos and frustrated pawns always do!
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): no partners available. checking canHookup");
bool canHookup = pawnIsNympho || pawnCanPickAnyone || xxx.is_frustrated(pawn) || (xxx.is_horny(pawn) && Rand.Value < RJWHookupSettings.HookupChanceForNonNymphos);
if (!canHookup)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): no hookup today");
return null;
}
// No cheating from casual hookups... would probably make colony relationship management too annoying
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): checking canHookupWithoutCheating");
bool hookupWouldBeCheating = xxx.HasNonPolyPartnerOnCurrentMap(pawn);
if (hookupWouldBeCheating)
{
if (RJWHookupSettings.NymphosCanCheat && pawnIsNympho && xxx.is_frustrated(pawn))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): I'm a nympho and I'm so frustrated that I'm going to cheat");
// No return here so they continue searching for hookup
}
else
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({pawnName}): I want to bang but that's cheating");
return null;
}
}
Pawn best_fuckee = FindBestPartner(pawn, targets, pawnCanPickAnyone, pawnIsNympho);
return best_fuckee;
}
/// <summary> Checks all of our potential partners to see if anyone's eligible, returning the most attractive and convenient one. </summary>
protected static Pawn FindBestPartner(Pawn pawn, List<Pawn> targets, bool pawnCanPickAnyone, bool pawnIsNympho)
{
string pawnName = xxx.get_pawnname(pawn);
Pawn best_fuckee = null;
float best_fuckability_score = 0;
foreach (Pawn targetPawn in targets)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): checking hookup {xxx.get_pawnname(targetPawn)}");
// Check to see if the mod settings for hookups allow this pairing
if (!pawnCanPickAnyone && !HookupAllowedViaSettings(pawn, targetPawn))
continue;
//interruptible jobs
if (targetPawn.jobs?.curJob != null &&
(targetPawn.jobs.curJob.playerForced ||
!JobDriver_SexQuick.quickieAllowedJobs.Contains(targetPawn.jobs.curJob.def)
))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): targetPawn has important job ({targetPawn.jobs.curJob.def}, playerForced: {targetPawn.jobs.curJob.playerForced}), skipping");
continue;
}
// Check for homewrecking (banging a pawn who's in a relationship)
if (!xxx.is_animal(targetPawn) &&
xxx.HasNonPolyPartnerOnCurrentMap(targetPawn))
{
if (RJWHookupSettings.NymphosCanHomewreck && pawnIsNympho && xxx.is_frustrated(pawn))
{
// Hookup allowed... rip colony mood
}
else if (RJWHookupSettings.NymphosCanHomewreckReverse && xxx.is_nympho(targetPawn) && xxx.is_frustrated(targetPawn))
{
// Hookup allowed... rip colony mood
}
else
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): not hooking up with {xxx.get_pawnname(targetPawn)} to avoid homewrecking");
continue;
}
}
// If the pawn has had sex recently and isn't horny right now, skip them.
if (!SexUtility.ReadyForLovin(targetPawn) && !xxx.is_hornyorfrustrated(targetPawn))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)} isn't ready for lovin'");
continue;
}
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)} is sufficiently single");
if (!xxx.is_animal(targetPawn))
{
float relations = pawn.relations.OpinionOf(targetPawn);
if (relations < RJWHookupSettings.MinimumRelationshipToHookup)
{
if (!(relations > 0 && xxx.is_nympho(pawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)}, i dont like them:({relations})");
continue;
}
}
relations = targetPawn.relations.OpinionOf(pawn);
if (relations < RJWHookupSettings.MinimumRelationshipToHookup)
{
if (!(relations > 0 && xxx.is_nympho(targetPawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)}, dont like me:({relations})");
continue;
}
}
float attraction = pawn.relations.SecondaryRomanceChanceFactor(targetPawn);
if (attraction < RJWHookupSettings.MinimumAttractivenessToHookup)
{
if (!(attraction > 0 && xxx.is_nympho(pawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)}, i dont find them attractive:({attraction})");
continue;
}
}
attraction = targetPawn.relations.SecondaryRomanceChanceFactor(pawn);
if (attraction < RJWHookupSettings.MinimumAttractivenessToHookup)
{
if (!(attraction > 0 && xxx.is_nympho(targetPawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)}, doesnt find me attractive:({attraction})");
continue;
}
}
}
// Check to see if the two pawns are willing to bang, and if so remember how much attractive we find them
float fuckability = 0f;
if (pawn.CanReserveAndReach(targetPawn, PathEndMode.OnCell, Danger.Some, 1, 0) &&
targetPawn.CanReserve(pawn, 1, 0) &&
roll_to_skip(pawn, targetPawn, out fuckability)) // do NOT check pawnIgnoresRules here - these checks, particularly roll_to_skip, are critical
{
int dis = pawn.Position.DistanceToSquared(targetPawn.Position);
if (dis <= 4)
{
// Right next to me (in my bed)? You'll do.
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)} is right next to me. we'll bang, ok?");
best_fuckability_score = 1.0e6f;
best_fuckee = targetPawn;
}
else if (dis > MaxDistanceSquaredToFuck)
{
// too far
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)} is too far... distance:{dis} max:{MaxDistanceSquaredToFuck}");
continue;
}
else
{
// scaling fuckability by distance may give us more varied results and give the less attractive folks a chance
float fuckability_score = fuckability / GenMath.Sqrt(GenMath.Sqrt(dis));
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)} is totally bangable. attraction: {fuckability}, score:{fuckability_score}");
if (fuckability_score > best_fuckability_score)
{
best_fuckee = targetPawn;
best_fuckability_score = fuckability_score;
}
}
}
}
if (best_fuckee == null)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): couldn't find anyone to bang");
}
else
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] FindBestPartner({pawnName}): found rando {xxx.get_pawnname(best_fuckee)} with score {best_fuckability_score}");
}
return best_fuckee;
}
/// <summary> Checks to see if the mod settings allow the two pawns to hookup. </summary>
protected static bool HookupAllowedViaSettings(Pawn pawn, Pawn targetPawn)
{
// Can prisoners hook up?
if (pawn.IsPrisonerOfColony || pawn.IsPrisoner || xxx.is_slave(pawn))
{
if (!RJWHookupSettings.PrisonersCanHookupWithNonPrisoner && !(targetPawn.IsPrisonerOfColony || targetPawn.IsPrisoner || xxx.is_slave(targetPawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting PrisonersCanHookupWithNonPrisoner");
return false;
}
if (!RJWHookupSettings.PrisonersCanHookupWithPrisoner && (targetPawn.IsPrisonerOfColony || targetPawn.IsPrisoner || xxx.is_slave(targetPawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting PrisonersCanHookupWithPrisoner");
return false;
}
}
else
{
// Can non prisoners hook up with prisoners?
if (!RJWHookupSettings.CanHookupWithPrisoner && (targetPawn.IsPrisonerOfColony || targetPawn.IsPrisoner || xxx.is_slave(targetPawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting CanHookupWithPrisoner");
return false;
}
}
// Can colonist hook up with visitors?
if (pawn.IsFreeColonist && !xxx.is_slave(pawn))
{
if (!RJWHookupSettings.ColonistsCanHookupWithVisitor && targetPawn.Faction != Faction.OfPlayer && !targetPawn.IsPrisonerOfColony)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting ColonistsCanHookupWithVisitor");
return false;
}
}
// Can visitors hook up?
if (pawn.Faction != Faction.OfPlayer && !pawn.IsPrisonerOfColony)
{
// visitors vs colonist
if (!RJWHookupSettings.VisitorsCanHookupWithColonists && targetPawn.IsColonist)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting VisitorsCanHookupWithColonists");
return false;
}
// visitors vs visitors
if (!RJWHookupSettings.VisitorsCanHookupWithVisitors && targetPawn.Faction != Faction.OfPlayer)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting VisitorsCanHookupWithVisitors");
return false;
}
}
// TODO: Not sure if this handles all the pawn-on-animal cases.
return true;
}
protected override Job TryGiveJob(Pawn pawn)
{
if (!RJWHookupSettings.HookupsEnabled || !RJWHookupSettings.QuickHookupsEnabled)
return null;
if (pawn.Drafted)
return null;
if (!SexUtility.ReadyForHookup(pawn))
return null;
// We increase the time right away to prevent the fairly expensive check from happening too frequently
SexUtility.IncreaseTicksToNextHookup(pawn);
// If the pawn is a whore, or recently had sex, skip the job unless they're really horny
if (!xxx.is_frustrated(pawn) && (xxx.is_whore(pawn) || !SexUtility.ReadyForLovin(pawn)))
return null;
// This check attempts to keep groups leaving the map, like guests or traders, from turning around to hook up
if (pawn.mindState?.duty?.def == DutyDefOf.TravelOrLeave)
{
// TODO: Some guest pawns keep the TravelOrLeave duty the whole time, I think the ones assigned to guard the pack animals.
// That's probably ok, though it wasn't the intention.
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"[RJWQ] Quickie.TryGiveJob:({xxx.get_pawnname(pawn)}): has TravelOrLeave, no time for lovin!");
return null;
}
if (pawn.CurJob == null)
{
//--Log.Message(" checking pawn and abilities");
if (xxx.can_fuck(pawn) || xxx.can_be_fucked(pawn))
{
//--Log.Message(" finding partner");
Pawn partner = find_pawn_to_fuck(pawn, pawn.Map);
//--Log.Message(" checking partner");
if (partner == null)
return null;
// Interrupt current job.
if (pawn.CurJob != null && pawn.jobs.curDriver != null)
pawn.jobs.curDriver.EndJobWith(JobCondition.InterruptForced);
//--Log.Message(" returning job");
return JobMaker.MakeJob(xxx.quick_sex, partner);
}
}
return null;
}
}
}
|
TDarksword/rjw
|
Source/JobGivers/JobGiver_DoQuickie.cs
|
C#
|
mit
| 17,023 |
using System.Collections.Generic;
using System.Linq;
using RimWorld;
using Verse;
using Verse.AI;
using Multiplayer.API;
namespace rjw
{
public class JobGiver_JoinInBed : ThinkNode_JobGiver
{
private const int MaxDistanceSquaredToFuck = 10000;
private static bool CanFuck(Pawn target)
{
return xxx.can_fuck(target) || xxx.can_be_fucked(target);
}
[SyncMethod]
private static bool roll_to_skip(Pawn pawn, Pawn target, out float fuckability)
{
fuckability = SexAppraiser.would_fuck(pawn, target); // 0.0 to 1.0
if (fuckability < RJWHookupSettings.MinimumFuckabilityToHookup)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"roll_to_skip(I, {xxx.get_pawnname(pawn)} won't fuck {xxx.get_pawnname(target)}), ({fuckability})");
return false;
}
float reciprocity = xxx.is_animal(target) ? 1.0f : SexAppraiser.would_fuck(target, pawn);
if (reciprocity < RJWHookupSettings.MinimumFuckabilityToHookup)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"roll_to_skip({xxx.get_pawnname(target)} won't fuck me, {xxx.get_pawnname(pawn)}), ({reciprocity})");
return false;
}
float chance_to_skip = 0.9f - 0.7f * fuckability;
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
return Rand.Value < chance_to_skip;
}
[SyncMethod]
public static Pawn find_pawn_to_fuck(Pawn pawn, Map map)
{
string pawnName = xxx.get_pawnname(pawn);
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): starting.");
bool pawnIsNympho = xxx.is_nympho(pawn);
bool pawnCanPickAnyone = RJWSettings.WildMode || (pawnIsNympho && RJWHookupSettings.NymphosCanPickAnyone);
bool pawnCanPickAnimals = (pawnCanPickAnyone || xxx.is_zoophile(pawn)) && RJWSettings.bestiality_enabled;
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): nympho:{pawnIsNympho}, ignores rules:{pawnCanPickAnyone}, zoo:{pawnCanPickAnimals}");
if (!RJWHookupSettings.ColonistsCanHookup && pawn.IsFreeColonist && !pawnCanPickAnyone)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): is a colonist and colonist hookups are disabled in mod settings");
return null;
}
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
// Check AllPawns, not just colonists, to include guests.
List<Pawn> targets = map.mapPawns.AllPawns.Where(x
=> x.InBed()
&& x != pawn
&& !x.Position.IsForbidden(pawn)
&& xxx.IsTargetPawnOkay(x)
&& CanFuck(x)
&& x.Map == pawn.Map
&& !x.HostileTo(pawn)
//&& (pawnCanPickAnimals || !xxx.is_animal(x))
&& !xxx.is_animal(x)
&& (xxx.is_laying_down_alone(x) || xxx.in_same_bed(x, pawn))
).ToList();
if (!targets.Any())
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): no eligible targets");
return null;
}
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): considering {targets.Count} targets");
// find lover/partner on same map
List<Pawn> partners = targets.Where(x
=> pawn.relations.DirectRelationExists(PawnRelationDefOf.Lover, x)
|| pawn.relations.DirectRelationExists(PawnRelationDefOf.Fiance, x)
|| pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, x)
).ToList();
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): considering {partners.Count} partners");
if (partners.Any())
{
partners.Shuffle(); //Randomize order.
foreach (Pawn target in partners)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): checking lover {xxx.get_pawnname(target)}");
if (pawn.Position.DistanceToSquared(target.Position) < MaxDistanceSquaredToFuck
&& pawn.CanReserveAndReach(target, PathEndMode.OnCell, Danger.Some, 1, 0)
&& target.CanReserve(pawn, 1, 0)
&& SexAppraiser.would_fuck(pawn, target) > 0.1f
&& SexAppraiser.would_fuck(target, pawn) > 0.1f)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): banging lover {xxx.get_pawnname(target)}");
return target;
}
}
}
// No lovers around... see if the pawn fancies a hookup. Nymphos and frustrated pawns always do!
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): no partners available. checking canHookup");
bool canHookup = pawnIsNympho || pawnCanPickAnyone || xxx.is_frustrated(pawn) || (xxx.is_horny(pawn) && Rand.Value < RJWHookupSettings.HookupChanceForNonNymphos);
if (!canHookup)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): no hookup today");
return null;
}
// No cheating from casual hookups... would probably make colony relationship management too annoying
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): checking canHookupWithoutCheating");
bool hookupWouldBeCheating = xxx.HasNonPolyPartnerOnCurrentMap(pawn);
if (hookupWouldBeCheating)
{
if (RJWHookupSettings.NymphosCanCheat && pawnIsNympho && xxx.is_frustrated(pawn))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): I'm a nympho and I'm so frustrated that I'm going to cheat");
// No return here so they continue searching for hookup
}
else
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({pawnName}): I want to bang but that's cheating");
return null;
}
}
Pawn best_fuckee = FindBestPartner(pawn, targets, pawnCanPickAnyone, pawnIsNympho);
return best_fuckee;
}
/// <summary> Checks all of our potential partners to see if anyone's eligible, returning the most attractive and convenient one. </summary>
protected static Pawn FindBestPartner(Pawn pawn, List<Pawn> targets, bool pawnCanPickAnyone, bool pawnIsNympho)
{
string pawnName = xxx.get_pawnname(pawn);
Pawn best_fuckee = null;
float best_fuckability_score = 0;
foreach (Pawn targetPawn in targets)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): checking hookup {xxx.get_pawnname(targetPawn)}");
// Check to see if the mod settings for hookups allow this pairing
if (!pawnCanPickAnyone && !HookupAllowedViaSettings(pawn, targetPawn))
continue;
// Check for homewrecking (banging a pawn who's in a relationship)
if (!xxx.is_animal(targetPawn) &&
xxx.HasNonPolyPartnerOnCurrentMap(targetPawn))
{
if (RJWHookupSettings.NymphosCanHomewreck && pawnIsNympho && xxx.is_frustrated(pawn))
{
// Hookup allowed... rip colony mood
}
else if (RJWHookupSettings.NymphosCanHomewreckReverse && xxx.is_nympho(targetPawn) && xxx.is_frustrated(targetPawn))
{
// Hookup allowed... rip colony mood
}
else
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): not hooking up with {xxx.get_pawnname(targetPawn)} to avoid homewrecking");
continue;
}
}
// If the pawn has had sex recently and isn't horny right now, skip them.
if (!SexUtility.ReadyForLovin(targetPawn) && !xxx.is_hornyorfrustrated(targetPawn))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)} isn't ready for lovin'");
continue;
}
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)} is sufficiently single");
if (!xxx.is_animal(targetPawn))
{
float relations = pawn.relations.OpinionOf(targetPawn);
if (relations < RJWHookupSettings.MinimumRelationshipToHookup)
{
if (!(relations > 0 && xxx.is_nympho(pawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)}, i dont like them:({relations})");
continue;
}
}
relations = targetPawn.relations.OpinionOf(pawn);
if (relations < RJWHookupSettings.MinimumRelationshipToHookup)
{
if (!(relations > 0 && xxx.is_nympho(targetPawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)}, dont like me:({relations})");
continue;
}
}
float attraction = pawn.relations.SecondaryRomanceChanceFactor(targetPawn);
if (attraction < RJWHookupSettings.MinimumAttractivenessToHookup)
{
if (!(attraction > 0 && xxx.is_nympho(pawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)}, i dont find them attractive:({attraction})");
continue;
}
}
attraction = targetPawn.relations.SecondaryRomanceChanceFactor(pawn);
if (attraction < RJWHookupSettings.MinimumAttractivenessToHookup)
{
if (!(attraction > 0 && xxx.is_nympho(targetPawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)}, doesnt find me attractive:({attraction})");
continue;
}
}
}
// Check to see if the two pawns are willing to bang, and if so remember how much attractive we find them
float fuckability = 0f;
if (pawn.CanReserveAndReach(targetPawn, PathEndMode.OnCell, Danger.Some, 1, 0) &&
targetPawn.CanReserve(pawn, 1, 0) &&
roll_to_skip(pawn, targetPawn, out fuckability)) // do NOT check pawnIgnoresRules here - these checks, particularly roll_to_skip, are critical
{
int dis = pawn.Position.DistanceToSquared(targetPawn.Position);
if (dis <= 4)
{
// Right next to me (in my bed)? You'll do.
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)} is right next to me. we'll bang, ok?");
best_fuckability_score = 1.0e6f;
best_fuckee = targetPawn;
}
else if (dis > MaxDistanceSquaredToFuck)
{
// too far
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)} is too far... distance:{dis} max:{MaxDistanceSquaredToFuck}");
continue;
}
else
{
// scaling fuckability by distance may give us more varied results and give the less attractive folks a chance
float fuckability_score = fuckability / GenMath.Sqrt(GenMath.Sqrt(dis));
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): hookup {xxx.get_pawnname(targetPawn)} is totally bangable. attraction: {fuckability}, score:{fuckability_score}");
if (fuckability_score > best_fuckability_score)
{
best_fuckee = targetPawn;
best_fuckability_score = fuckability_score;
}
}
}
}
if (best_fuckee == null)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): couldn't find anyone to bang");
}
else
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"FindBestPartner({pawnName}): found rando {xxx.get_pawnname(best_fuckee)} with score {best_fuckability_score}");
}
return best_fuckee;
}
/// <summary> Checks to see if the mod settings allow the two pawns to hookup. </summary>
protected static bool HookupAllowedViaSettings(Pawn pawn, Pawn targetPawn)
{
// Can prisoners hook up?
if (pawn.IsPrisonerOfColony || pawn.IsPrisoner || xxx.is_slave(pawn))
{
if (!RJWHookupSettings.PrisonersCanHookupWithNonPrisoner && !(targetPawn.IsPrisonerOfColony || targetPawn.IsPrisoner || xxx.is_slave(targetPawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting PrisonersCanHookupWithNonPrisoner");
return false;
}
if (!RJWHookupSettings.PrisonersCanHookupWithPrisoner && (targetPawn.IsPrisonerOfColony || targetPawn.IsPrisoner || xxx.is_slave(targetPawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting PrisonersCanHookupWithPrisoner");
return false;
}
}
else
{
// Can non prisoners hook up with prisoners?
if (!RJWHookupSettings.CanHookupWithPrisoner && (targetPawn.IsPrisonerOfColony || targetPawn.IsPrisoner || xxx.is_slave(targetPawn)))
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting CanHookupWithPrisoner");
return false;
}
}
// Can colonist hook up with visitors?
if (pawn.IsFreeColonist && !xxx.is_slave(pawn))
{
if (!RJWHookupSettings.ColonistsCanHookupWithVisitor && targetPawn.Faction != Faction.OfPlayer && !targetPawn.IsPrisonerOfColony)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting ColonistsCanHookupWithVisitor");
return false;
}
}
// Can visitors hook up?
if (pawn.Faction != Faction.OfPlayer && !pawn.IsPrisonerOfColony)
{
// visitors vs colonist
if (!RJWHookupSettings.VisitorsCanHookupWithColonists && targetPawn.IsColonist)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting VisitorsCanHookupWithColonists");
return false;
}
// visitors vs visitors
if (!RJWHookupSettings.VisitorsCanHookupWithVisitors && targetPawn.Faction != Faction.OfPlayer)
{
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"find_pawn_to_fuck({xxx.get_pawnname(pawn)}): not hooking up with {xxx.get_pawnname(targetPawn)} due to mod setting VisitorsCanHookupWithVisitors");
return false;
}
}
// TODO: Not sure if this handles all the pawn-on-animal cases.
return true;
}
protected override Job TryGiveJob(Pawn pawn)
{
if (!RJWHookupSettings.HookupsEnabled)
return null;
if (pawn.Drafted)
return null;
if (!SexUtility.ReadyForHookup(pawn))
return null;
// We increase the time right away to prevent the fairly expensive check from happening too frequently
SexUtility.IncreaseTicksToNextHookup(pawn);
// If the pawn is a whore, or recently had sex, skip the job unless they're really horny
if (!xxx.is_frustrated(pawn) && (xxx.is_whore(pawn) || !SexUtility.ReadyForLovin(pawn)))
return null;
// This check attempts to keep groups leaving the map, like guests or traders, from turning around to hook up
if (pawn.mindState?.duty?.def == DutyDefOf.TravelOrLeave)
{
// TODO: Some guest pawns keep the TravelOrLeave duty the whole time, I think the ones assigned to guard the pack animals.
// That's probably ok, though it wasn't the intention.
if (RJWSettings.DebugLogJoinInBed) ModLog.Message($"JoinInBed.TryGiveJob:({xxx.get_pawnname(pawn)}): has TravelOrLeave, no time for lovin!");
return null;
}
if (pawn.CurJob == null || pawn.CurJob.def == JobDefOf.LayDown)
{
//--Log.Message(" checking pawn and abilities");
if (xxx.can_fuck(pawn) || xxx.can_be_fucked(pawn))
{
//--Log.Message(" finding partner");
Pawn partner = find_pawn_to_fuck(pawn, pawn.Map);
//--Log.Message(" checking partner");
if (partner == null)
return null;
// Can never be null, since find checks for bed.
Building_Bed bed = partner.CurrentBed();
// Interrupt current job.
if (pawn.CurJob != null && pawn.jobs.curDriver != null)
pawn.jobs.curDriver.EndJobWith(JobCondition.InterruptForced);
//--Log.Message(" returning job");
return JobMaker.MakeJob(xxx.casual_sex, partner, bed);
}
}
return null;
}
}
}
|
TDarksword/rjw
|
Source/JobGivers/JobGiver_JoinInBed.cs
|
C#
|
mit
| 16,117 |
using RimWorld;
using Verse;
using Verse.AI;
using System.Collections.Generic;
using System.Linq;
using Multiplayer.API;
namespace rjw
{
public class JobGiver_Masturbate : ThinkNode_JobGiver
{
[SyncMethod]
public virtual IntVec3 FindFapLocation(Pawn pawn)
{
IntVec3 position = pawn.Position;
int bestPosition = -100;
IntVec3 cell = pawn.Position;
int maxDistance = 40;
FloatRange temperature = pawn.ComfortableTemperatureRange();
bool is_somnophile = xxx.has_quirk(pawn, "Somnophile");
bool is_exhibitionist = xxx.has_quirk(pawn, "Exhibitionist");
List<Pawn> all_pawns = pawn.Map.mapPawns.AllPawnsSpawned.Where(x
=> x.Position.DistanceTo(pawn.Position) < 100
&& xxx.is_human(x)
&& x != pawn
).ToList();
//ModLog.Message(" Pawn is " + xxx.get_pawnname(pawn) + ", current cell is " + cell);
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
List<IntVec3> random_cells = new List<IntVec3>();
for (int loop = 0; loop < 50; ++loop)
{
random_cells.Add(position + IntVec3.FromVector3(Vector3Utility.HorizontalVectorFromAngle(Rand.Range(0, 360)) * Rand.RangeInclusive(1, maxDistance)));
}
random_cells = random_cells.Where(x
=> x.Standable(pawn.Map)
&& x.InAllowedArea(pawn)
&& x.GetDangerFor(pawn, pawn.Map) != Danger.Deadly
&& !x.ContainsTrap(pawn.Map)
&& !x.ContainsStaticFire(pawn.Map)
).Distinct().ToList();
//ModLog.Message(" Found " + random_cells.Count + " valid cells.");
foreach (IntVec3 random_cell in random_cells)
{
if (!xxx.can_path_to_target(pawn, random_cell))
continue;// too far
int score = 0;
Room room = random_cell.GetRoom(pawn.Map);
bool might_be_seen = all_pawns.Any(x
=> GenSight.LineOfSight(x.Position, random_cell, pawn.Map)
&& x.Position.DistanceTo(random_cell) < 50
&& x.Awake()
);
if (is_exhibitionist)
{
if (might_be_seen)
score += 5;
else
score -= 10;
}
else
{
if (might_be_seen)
score -= 30;
}
if (is_somnophile) // Fap while Watching someone sleep. Not creepy at all!
{
if (all_pawns.Any(x
=> GenSight.LineOfSight(random_cell, x.Position, pawn.Map)
&& x.Position.DistanceTo(random_cell) < 6
&& !x.Awake()
))
score += 50;
}
if (random_cell.GetTemperature(pawn.Map) > temperature.min && random_cell.GetTemperature(pawn.Map) < temperature.max)
score += 20;
else
score -= 20;
if (random_cell.Roofed(pawn.Map))
score += 5;
if (random_cell.HasEatSurface(pawn.Map))
score += 5; // Hide in vegetation.
if (random_cell.GetDangerFor(pawn, pawn.Map) == Danger.Some)
score -= 25;
else if (random_cell.GetDangerFor(pawn, pawn.Map) == Danger.None)
score += 5;
if (random_cell.GetTerrain(pawn.Map) == TerrainDefOf.WaterShallow ||
random_cell.GetTerrain(pawn.Map) == TerrainDefOf.WaterMovingShallow ||
random_cell.GetTerrain(pawn.Map) == TerrainDefOf.WaterOceanShallow)
score -= 20;
if (random_cell.GetThingList(pawn.Map).Any(x => x.def.IsWithinCategory(ThingCategoryDefOf.Corpses)) && !xxx.is_necrophiliac(pawn))
score -= 20;
if (random_cell.GetThingList(pawn.Map).Any(x => x.def.IsWithinCategory(ThingCategoryDefOf.Foods)))
score -= 10;
if (room == pawn.Position.GetRoom(pawn.MapHeld))
score -= 10;
if (room.PsychologicallyOutdoors)
score += 5;
if (room.isPrisonCell)
score += 5;
if (room.IsHuge)
score -= 5;
if (room.ContainedBeds.Any())
score += 5;
if (room.IsDoorway)
score -= 10;
if (!room.Owners.Any())
score += 10;
else if (room.Owners.Contains(pawn))
score += 20;
if (room.Role == RoomRoleDefOf.Bedroom || room.Role == RoomRoleDefOf.PrisonCell)
score += 10;
else if (room.Role == RoomRoleDefOf.Barracks || room.Role == RoomRoleDefOf.Laboratory || room.Role == RoomRoleDefOf.RecRoom)
score += 2;
else if (room.Role == RoomRoleDefOf.DiningRoom || room.Role == RoomRoleDefOf.Hospital || room.Role == RoomRoleDefOf.PrisonBarracks)
score -= 5;
if (room.GetStat(RoomStatDefOf.Cleanliness) < 0.01f)
score -= 5;
if (room.GetStat(RoomStatDefOf.GraveVisitingJoyGainFactor) > 0.1f)
score -= 5;
if (score <= bestPosition) continue;
bestPosition = score;
cell = random_cell;
}
return cell;
//ModLog.Message(" Best cell is " + cell);
}
protected override Job TryGiveJob(Pawn pawn)
{
//--ModLog.Message(" JobGiver_Masturbate::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) called");
if (pawn.Drafted) return null;
if (!xxx.can_be_fucked(pawn) && !xxx.can_fuck(pawn)) return null;
// Whores only fap if frustrated, unless imprisoned.
if ((SexUtility.ReadyForLovin(pawn) && (!xxx.is_whore(pawn) || pawn.IsPrisoner || xxx.is_slave(pawn))) || xxx.is_frustrated(pawn))
{
if (RJWPreferenceSettings.FapInBed && pawn.jobs.curDriver is JobDriver_LayDown)
{
Building_Bed bed = ((JobDriver_LayDown)pawn.jobs.curDriver).Bed;
if (bed != null) return JobMaker.MakeJob(xxx.Masturbate, null, bed, bed.Position);
}
else if (RJWPreferenceSettings.FapEverywhere && (xxx.is_frustrated(pawn) || xxx.has_quirk(pawn, "Exhibitionist")))
{
return JobMaker.MakeJob(xxx.Masturbate, null, null, FindFapLocation(pawn));
}
}
return null;
}
}
}
|
TDarksword/rjw
|
Source/JobGivers/JobGiver_Masturbate.cs
|
C#
|
mit
| 5,424 |
using System.Linq;
using RimWorld;
using Verse;
using Verse.AI;
using System.Collections.Generic;
using Multiplayer.API;
namespace rjw
{
public class JobGiver_RandomRape : ThinkNode_JobGiver
{
[SyncMethod]
public Pawn find_victim(Pawn pawn, Map m)
{
float min_fuckability = 0.10f; // Don't rape pawns with <10% fuckability
float avg_fuckability = 0f; // Average targets fuckability, choose target higher than that
var valid_targets = new Dictionary<Pawn, float>(); // Valid pawns and their fuckability
Pawn chosentarget = null; // Final target pawn
// could be prisoner, colonist, or non-hostile outsider
IEnumerable<Pawn> targets = m.mapPawns.AllPawnsSpawned.Where(x
=> x != pawn
&& xxx.is_not_dying(x)
&& xxx.can_get_raped(x)
&& !x.Suspended
&& !x.Drafted
&& !x.IsForbidden(pawn)
&& pawn.CanReserveAndReach(x, PathEndMode.Touch, Danger.Some, xxx.max_rapists_per_prisoner, 0)
&& !x.HostileTo(pawn)
);
//Zoo rape Animal
if (xxx.is_zoophile(pawn) && RJWSettings.bestiality_enabled)
{
foreach (Pawn target in targets.Where(x => xxx.is_animal(x)))
{
if (!xxx.can_path_to_target(pawn, target.Position))
continue;// too far
float fuc = SexAppraiser.would_fuck(pawn, target, true, true);
if (fuc > min_fuckability)
valid_targets.Add(target, fuc);
}
if (valid_targets.Any())
{
avg_fuckability = valid_targets.Average(x => x.Value);
// choose pawns to fuck with above average fuckability
var valid_targetsFilteredAnimals = valid_targets.Where(x => x.Value >= avg_fuckability);
if (valid_targetsFilteredAnimals.Any())
chosentarget = valid_targetsFilteredAnimals.RandomElement().Key;
return chosentarget;
}
}
valid_targets = new Dictionary<Pawn, float>();
// rape Humanlike
foreach (Pawn target in targets.Where(x => !xxx.is_animal(x)))
{
if (!xxx.can_path_to_target(pawn, target.Position))
continue;// too far
float fuc = SexAppraiser.would_fuck(pawn, target, true, true);
if (fuc > min_fuckability)
valid_targets.Add(target, fuc);
}
if (valid_targets.Any())
{
avg_fuckability = valid_targets.Average(x => x.Value);
// choose pawns to fuck with above average fuckability
var valid_targetsFilteredAnimals = valid_targets.Where(x => x.Value >= avg_fuckability);
if (valid_targetsFilteredAnimals.Any())
chosentarget = valid_targetsFilteredAnimals.RandomElement().Key;
}
return chosentarget;
}
protected override Job TryGiveJob(Pawn pawn)
{
//ModLog.Message(" JobGiver_RandomRape::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) called");
if (!xxx.can_rape(pawn)) return null;
if (pawn.health.hediffSet.HasHediff(HediffDef.Named("Hediff_RapeEnemyCD"))) return null;
pawn.health.AddHediff(HediffDef.Named("Hediff_RapeEnemyCD"), null, null, null);
Pawn victim = find_victim(pawn, pawn.Map);
if (victim == null) return null;
//ModLog.Message(" JobGiver_RandomRape::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) - found victim " + xxx.get_pawnname(victim));
return JobMaker.MakeJob(xxx.RapeRandom, victim);
}
}
}
|
TDarksword/rjw
|
Source/JobGivers/JobGiver_RandomRape.cs
|
C#
|
mit
| 3,241 |
using Verse;
using Verse.AI;
using RimWorld;
namespace rjw
{
/// <summary>
/// Pawn try to find enemy to rape.
/// </summary>
public class JobGiver_RapeEnemy : ThinkNode_JobGiver
{
protected override Job TryGiveJob(Pawn pawn)
{
if (RJWSettings.DebugRape) ModLog.Message(" JobGiver_RapeEnemy::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) called0");
//ModLog.Message(" JobGiver_RapeEnemy::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) 0 " + SexUtility.ReadyForLovin(pawn));
//ModLog.Message(" JobGiver_RapeEnemy::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) 1 " + (xxx.need_some_sex(pawn) <= 1f));
//ModLog.Message(" JobGiver_RapeEnemy::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) 2 " + !(SexUtility.ReadyForLovin(pawn) || xxx.need_some_sex(pawn) <= 1f));
//ModLog.Message(" JobGiver_RapeEnemy::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) 1 " + Find.TickManager.TicksGame);
//ModLog.Message(" JobGiver_RapeEnemy::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) 2 " + pawn.mindState.canLovinTick);
if (pawn.Drafted) return null;
if (pawn.health.hediffSet.HasHediff(HediffDef.Named("Hediff_RapeEnemyCD")) || !pawn.health.capacities.CanBeAwake || !(SexUtility.ReadyForLovin(pawn) || xxx.need_some_sex(pawn) <= 1f))
//if (pawn.health.hediffSet.HasHediff(HediffDef.Named("Hediff_RapeEnemyCD")) || !pawn.health.capacities.CanBeAwake || (SexUtility.ReadyForLovin(pawn) || xxx.is_human(pawn) ? xxx.need_some_sex(pawn) <= 1f : false))
return null;
if (!xxx.can_rape(pawn)) return null;
if (RJWSettings.DebugRape) ModLog.Message(" JobGiver_RapeEnemy::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) can rape");
JobDef_RapeEnemy rapeEnemyJobDef = null;
int? highestPriority = null;
foreach (JobDef_RapeEnemy job in DefDatabase<JobDef_RapeEnemy>.AllDefs)
{
if (job.CanUseThisJobForPawn(pawn))
{
if (highestPriority == null)
{
rapeEnemyJobDef = job;
highestPriority = job.priority;
}
else if (job.priority > highestPriority)
{
rapeEnemyJobDef = job;
highestPriority = job.priority;
}
}
}
if (RJWSettings.DebugRape) ModLog.Message(" JobGiver_RapeEnemy::ChoosedJobDef( " + xxx.get_pawnname(pawn) + " ) - " + rapeEnemyJobDef.ToString() + " choosed");
Pawn victim = rapeEnemyJobDef?.FindVictim(pawn, pawn.Map);
if (RJWSettings.DebugRape) ModLog.Message(" JobGiver_RapeEnemy::FoundVictim( " + xxx.get_pawnname(victim) + " )");
//prevents 10 job stacks error, no idea whats the prob with JobDriver_Rape
//if (victim != null)
pawn.health.AddHediff(HediffDef.Named("Hediff_RapeEnemyCD"), null, null, null);
return victim != null ? JobMaker.MakeJob(rapeEnemyJobDef, victim) : null;
/*
else
{
if (RJWSettings.DebugRape) ModLog.Message("" + this.GetType().ToString() + "::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) - unable to find victim");
pawn.mindState.canLovinTick = Find.TickManager.TicksGame + Rand.Range(75, 150);
}
*/
//else { if (RJWSettings.DebugRape) ModLog.Message(" JobGiver_RapeEnemy::TryGiveJob( " + xxx.get_pawnname(pawn) + " ) - too fast to play next"); }
}
}
}
|
TDarksword/rjw
|
Source/JobGivers/JobGiver_RapeEnemy.cs
|
C#
|
mit
| 3,137 |
using RimWorld;
using Verse;
using Verse.AI;
using System.Collections.Generic;
using System.Linq;
namespace rjw
{
public class JobGiver_ViolateCorpse : ThinkNode_JobGiver
{
public static Corpse find_corpse(Pawn pawn, Map m)
{
float min_fuckability = 0.10f; // Don't rape pawns with <10% fuckability
float avg_fuckability = 0f; // Average targets fuckability, choose target higher than that
var valid_targets = new Dictionary<Corpse, float>(); // Valid pawns and their fuckability
Corpse chosentarget = null; // Final target pawn
IEnumerable<Thing> targets = m.spawnedThings.Where(x
=> x is Corpse
&& pawn.CanReserveAndReach(x, PathEndMode.OnCell, Danger.Some)
&& !x.IsForbidden(pawn)
);
foreach (Corpse target in targets)
{
if (!xxx.can_path_to_target(pawn, target.Position))
continue;// too far
// Filter out rotters if not necrophile.
if (!xxx.is_necrophiliac(pawn) && target.CurRotDrawMode != RotDrawMode.Fresh)
continue;
float fuc = SexAppraiser.would_fuck(pawn, target, false, false);
if (fuc > min_fuckability)
valid_targets.Add(target, fuc);
}
if (valid_targets.Any())
{
avg_fuckability = valid_targets.Average(x => x.Value);
// choose pawns to fuck with above average fuckability
var valid_targetsFilteredAnimals = valid_targets.Where(x => x.Value >= avg_fuckability);
if (valid_targetsFilteredAnimals.Any())
chosentarget = valid_targetsFilteredAnimals.RandomElement().Key;
}
return chosentarget;
}
protected override Job TryGiveJob(Pawn pawn)
{
// Most checks are done in ThinkNode_ConditionalNecro.
// filter out necro for nymphs
if (!RJWSettings.necrophilia_enabled) return null;
if (pawn.Drafted) return null;
//--ModLog.Message(" JobGiver_ViolateCorpse::TryGiveJob for ( " + xxx.get_pawnname(pawn) + " )");
if (SexUtility.ReadyForLovin(pawn) || xxx.is_hornyorfrustrated(pawn))
{
//--ModLog.Message(" JobGiver_ViolateCorpse::TryGiveJob, can love ");
if (!xxx.can_rape(pawn)) return null;
var target = find_corpse(pawn, pawn.Map);
//--ModLog.Message(" JobGiver_ViolateCorpse::TryGiveJob - target is " + (target == null ? "NULL" : "Found"));
if (target != null)
{
return JobMaker.MakeJob(xxx.RapeCorpse, target);
}
// Ticks should only be increased after successful sex.
}
return null;
}
}
}
|
TDarksword/rjw
|
Source/JobGivers/JobGiver_ViolateCorpse.cs
|
C#
|
mit
| 2,497 |
using System.Collections.Generic;
using System.Linq;
using System;
using Verse;
using RimWorld;
using RimWorld.Planet;
namespace rjw.MainTab
{
public class MainTabWindow_Brothel : MainTabWindow_PawnTable
{
private static PawnTableDef pawnTableDef;
protected override PawnTableDef PawnTableDef => pawnTableDef ?? (pawnTableDef = DefDatabase<PawnTableDef>.GetNamed("Brothel"));
protected override IEnumerable<Pawn> Pawns => Find.CurrentMap.mapPawns.AllPawns.Where(p => xxx.is_human(p) && (p.IsColonist || p.IsPrisonerOfColony));
public override void PostOpen()
{
base.PostOpen();
Find.World.renderer.wantedMode = WorldRenderMode.None;
}
}
}
|
TDarksword/rjw
|
Source/MainTab/MainTabWindow_Brothel.cs
|
C#
|
mit
| 667 |
using System;
using System.Collections.Generic;
using System.Linq;
using Verse;
using UnityEngine;
using RimWorld;
using Verse.Sound;
namespace rjw.MainTab
{
public abstract class PawnColumnCheckbox_Whore : PawnColumnWorker
{
public const int HorizontalPadding = 2;
public override void DoCell(Rect rect, Pawn pawn, PawnTable table)
{
if (!this.HasCheckbox(pawn))
{
return;
}
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);
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));
}
bool disabled = this.GetDisabled(pawn);
bool value;
if (disabled)
{
value = false;
}
else
{
value = this.GetValue(pawn);
}
bool flag = value;
Vector2 topLeft = vector;
WhoreCheckbox.Checkbox(topLeft, ref value, 24f, disabled, WhoreCheckbox.WhoreCheckboxOnTex, WhoreCheckbox.WhoreCheckboxOffTex, WhoreCheckbox.WhoreCheckboxDisabledTex);
if (Mouse.IsOver(rect2))
{
string tip = this.GetTip(pawn);
if (!tip.NullOrEmpty())
{
TooltipHandler.TipRegion(rect2, tip);
}
}
if (value != flag)
{
this.SetValue(pawn, value);
}
}
public override int GetMinWidth(PawnTable table)
{
return Mathf.Max(base.GetMinWidth(table), 28);
}
public override int GetMaxWidth(PawnTable table)
{
return Mathf.Min(base.GetMaxWidth(table), this.GetMinWidth(table));
}
public override int GetMinCellHeight(Pawn pawn)
{
return Mathf.Max(base.GetMinCellHeight(pawn), 24);
}
public override int Compare(Pawn a, Pawn b)
{
return this.GetValueToCompare(a).CompareTo(this.GetValueToCompare(b));
}
private int GetValueToCompare(Pawn pawn)
{
if (!this.HasCheckbox(pawn))
{
return 0;
}
if (!this.GetValue(pawn))
{
return 1;
}
return 2;
}
protected virtual string GetTip(Pawn pawn)
{
return null;
}
protected virtual bool HasCheckbox(Pawn pawn)
{
return true;
}
protected abstract bool GetValue(Pawn pawn);
protected abstract void SetValue(Pawn pawn, bool value);
protected abstract bool GetDisabled(Pawn pawn);
protected override void HeaderClicked(Rect headerRect, PawnTable table)
{
base.HeaderClicked(headerRect, table);
if (Event.current.shift)
{
List<Pawn> pawnsListForReading = table.PawnsListForReading;
for (int i = 0; i < pawnsListForReading.Count; i++)
{
if (this.HasCheckbox(pawnsListForReading[i]))
{
if (Event.current.button == 0)
{
if (!this.GetValue(pawnsListForReading[i]))
{
this.SetValue(pawnsListForReading[i], true);
}
}
else if (Event.current.button == 1 && this.GetValue(pawnsListForReading[i]))
{
this.SetValue(pawnsListForReading[i], false);
}
}
}
if (Event.current.button == 0)
{
SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera(null);
}
else if (Event.current.button == 1)
{
SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera(null);
}
}
}
protected override string GetHeaderTip(PawnTable table)
{
return base.GetHeaderTip(table) + "\n" + "CheckboxShiftClickTip".Translate();
}
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnColumnCheckbox_Whore.cs
|
C#
|
mit
| 3,626 |
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
namespace rjw.MainTab
{
[StaticConstructorOnStartup]
public class PawnColumnWorker_AverageMoneyByWhore : PawnColumnWorker_TextCenter
{
protected override string GetTextFor(Pawn pawn)
{
return ((int)GetValueToCompare(pawn)).ToString();
}
public override int Compare(Pawn a, Pawn b)
{
return GetValueToCompare(a).CompareTo(GetValueToCompare(b));
}
private float GetValueToCompare(Pawn pawn)
{
float total = pawn.records.GetValue(xxx.EarnedMoneyByWhore);
float count = pawn.records.GetValue(xxx.CountOfWhore);
if ((int)count == 0)
{
return 0;
}
return (total / count);
}
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnColumnWorker_AverageMoneyByWhore.cs
|
C#
|
mit
| 771 |
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
namespace rjw.MainTab
{
[StaticConstructorOnStartup]
public class PawnColumnWorker_CountOfWhore : PawnColumnWorker_TextCenter
{
protected override string GetTextFor(Pawn pawn)
{
return GetValueToCompare(pawn).ToString();
}
public override int Compare(Pawn a, Pawn b)
{
return GetValueToCompare(a).CompareTo(GetValueToCompare(b));
}
private int GetValueToCompare(Pawn pawn)
{
return pawn.records.GetAsInt(xxx.CountOfWhore);
}
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnColumnWorker_CountOfWhore.cs
|
C#
|
mit
| 609 |
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
namespace rjw.MainTab
{
[StaticConstructorOnStartup]
public class PawnColumnWorker_EarnedMoneyByWhore : PawnColumnWorker_TextCenter
{
protected override string GetTextFor(Pawn pawn)
{
return GetValueToCompare(pawn).ToString();
}
public override int Compare(Pawn a, Pawn b)
{
return GetValueToCompare(a).CompareTo(GetValueToCompare(b));
}
private int GetValueToCompare(Pawn pawn)
{
return pawn.records.GetAsInt(xxx.EarnedMoneyByWhore);
}
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnColumnWorker_EarnedMoneyByWhore.cs
|
C#
|
mit
| 621 |
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
namespace rjw.MainTab
{
[StaticConstructorOnStartup]
public class PawnColumnWorker_IsPrisoner : PawnColumnWorker_Icon
{
private static readonly Texture2D comfortOn = ContentFinder<Texture2D>.Get("UI/Tab/ComfortPrisoner_on");
private readonly Texture2D comfortOff = ContentFinder<Texture2D>.Get("UI/Tab/ComfortPrisoner_off");
protected override Texture2D GetIconFor(Pawn pawn)
{
return pawn.IsPrisonerOfColony || xxx.is_slave(pawn) ? comfortOn : null;
}
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnColumnWorker_IsPrisoner.cs
|
C#
|
mit
| 621 |
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
namespace rjw.MainTab
{
[StaticConstructorOnStartup]
public class PawnColumnWorker_IsWhore : PawnColumnCheckbox_Whore
{
protected override bool GetDisabled(Pawn pawn)
{
return !pawn.CanDesignateService();
}
protected override bool GetValue(Pawn pawn)
{
return pawn.IsDesignatedService() && xxx.is_human(pawn);
}
protected override void SetValue(Pawn pawn, bool value)
{
if (value == this.GetValue(pawn)) return;
pawn.ToggleService();
}
/*
private static readonly Texture2D serviceOn = ContentFinder<Texture2D>.Get("UI/Tab/Service_on");
private static readonly Texture2D serviceOff = ContentFinder<Texture2D>.Get("UI/Tab/Service_off");
protected override Texture2D GetIconFor(Pawn pawn)
{
return pawn.IsDesignatedService() ? serviceOn : null;
}*/
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnColumnWorker_IsWhore.cs
|
C#
|
mit
| 953 |
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
namespace rjw.MainTab
{
[StaticConstructorOnStartup]
public class PawnColumnWorker_Mood : PawnColumnWorker_TextCenter
{
protected override string GetTextFor(Pawn pawn)
{
return GetValueToCompare(pawn).ToStringPercent();
}
public override int Compare(Pawn a, Pawn b)
{
return GetValueToCompare(a).CompareTo(GetValueToCompare(b));
}
private float GetValueToCompare(Pawn pawn)
{
return pawn.needs.mood.CurLevelPercentage;
}
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnColumnWorker_Mood.cs
|
C#
|
mit
| 605 |
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
namespace rjw.MainTab
{
[StaticConstructorOnStartup]
public class PawnColumnWorker_PriceRangeOfWhore : PawnColumnWorker_TextCenter
{
protected internal int min;
protected internal int max;
protected override string GetTextFor(Pawn pawn)
{
min = WhoringHelper.WhoreMinPrice(pawn);
max = WhoringHelper.WhoreMaxPrice(pawn);
return string.Format("{0} - {1}", min, max);
}
public override int Compare(Pawn a, Pawn b)
{
return GetValueToCompare(a).CompareTo(GetValueToCompare(b));
}
protected override string GetTip(Pawn pawn)
{
string minPriceTip = string.Format(
" Base: {0}\n Traits: {1}",
WhoringHelper.baseMinPrice,
(WhoringHelper.WhoreTraitAdjustmentMin(pawn) -1f).ToStringPercent()
);
string maxPriceTip = string.Format(
" Base: {0}\n Traits: {1}",
WhoringHelper.baseMaxPrice,
(WhoringHelper.WhoreTraitAdjustmentMax(pawn) -1f).ToStringPercent()
);
string bothTip = string.Format(
" Gender: {0}\n Age: {1}\n Injuries: {2}\n Room: {3}",
(WhoringHelper.WhoreGenderAdjustment(pawn) - 1f).ToStringPercent(),
(WhoringHelper.WhoreAgeAdjustment(pawn) - 1f).ToStringPercent(),
(WhoringHelper.WhoreInjuryAdjustment(pawn) - 1f).ToStringPercent(),
(WhoringHelper.WhoreRoomAdjustment(pawn) - 1f).ToStringPercent()
);
return string.Format("Min:\n{0}\nMax:\n{1}\nBoth:\n{2}", minPriceTip, maxPriceTip, bothTip);
}
private int GetValueToCompare(Pawn pawn)
{
return min;
}
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnColumnWorker_PriceRangeOfWhore.cs
|
C#
|
mit
| 1,632 |
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
namespace rjw.MainTab
{
[StaticConstructorOnStartup]
public class PawnColumnWorker_RoomAdjustmentOfWhore : PawnColumnWorker_TextCenter
{
protected override string GetTextFor(Pawn pawn)
{
float score = GetValueToCompare(pawn);
Room ownedRoom = pawn.ownership.OwnedRoom;
int scoreStageIndex;
string scoreStageName;
if (ownedRoom == null)
{
scoreStageName = "No room";
scoreStageIndex = 0;
}
else
{
scoreStageName = RoomStatDefOf.Impressiveness.GetScoreStage(ownedRoom.GetStat(RoomStatDefOf.Impressiveness)).label;
scoreStageIndex = RoomStatDefOf.Impressiveness.GetScoreStageIndex(ownedRoom.GetStat(RoomStatDefOf.Impressiveness));
}
return string.Format("{0} ({1})", scoreStageName, score.ToStringPercent());
}
public override int Compare(Pawn a, Pawn b)
{
return GetValueToCompare(a).CompareTo(GetValueToCompare(b));
}
private float GetValueToCompare(Pawn pawn)
{
return WhoringHelper.WhoreRoomAdjustment(pawn);
}
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnColumnWorker_RoomAdjustmentOfWhore.cs
|
C#
|
mit
| 1,142 |
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);
}
}
}
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnColumnWorker_TextCenter.cs
|
C#
|
mit
| 803 |
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using RimWorld.Planet;
using UnityEngine;
using Verse;
namespace rjw.MainTab
{
[StaticConstructorOnStartup]
public class PawnColumnWorker_WhoreExperience : PawnColumnWorker_TextCenter
{
public static readonly HashSet<string> backstories = new HashSet<string>(DefDatabase<StringListDef>.GetNamed("WhoreBackstories").strings);
protected override string GetTextFor(Pawn pawn)
{
int b = backstories.Contains(pawn.story?.adulthood?.titleShort) ? 30 : 0;
int score = pawn.records.GetAsInt(xxx.CountOfWhore);
return (score + b).ToString();
}
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnColumnWorker_WhoreExperience.cs
|
C#
|
mit
| 653 |
using System;
using System.Collections.Generic;
using System.Linq;
using RimWorld;
using Verse;
namespace rjw.MainTab
{
public class PawnTable_Whores : PawnTable
{
public PawnTable_Whores(PawnTableDef def, Func<IEnumerable<Pawn>> pawnsGetter, int uiWidth, int uiHeight) : base(def, pawnsGetter, uiWidth, uiHeight) { }
protected override IEnumerable<Pawn> LabelSortFunction(IEnumerable<Pawn> input)
{
//return input.OrderBy(p => p.Name?.Numerical != false).ThenBy(p => (p.Name as NameSingle)?.Number ?? 0).ThenBy(p => p.def.label);
return input.OrderBy(p => xxx.get_pawnname(p));
}
protected override IEnumerable<Pawn> PrimarySortFunction(IEnumerable<Pawn> input)
{
///return input.OrderByDescending(p => p.Faction?.Name);
//return input.OrderBy(p => xxx.get_pawnname(p));
foreach (Pawn p in input)
p.UpdatePermissions();
return input.OrderByDescending(p => p.IsColonist);
}
}
}
|
TDarksword/rjw
|
Source/MainTab/PawnTable_Whores.cs
|
C#
|
mit
| 922 |
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 WhoreCheckbox
{
public static readonly Texture2D WhoreCheckboxOnTex = ContentFinder<Texture2D>.Get("UI/Commands/Service_on");
public static readonly Texture2D WhoreCheckboxOffTex = ContentFinder<Texture2D>.Get("UI/Commands/Service_off");
public static readonly Texture2D WhoreCheckboxDisabledTex = 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)
{
WhoreCheckbox.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);
WhoreCheckbox.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;
WhoreCheckbox.checkboxPainting = true;
WhoreCheckbox.checkboxPaintingState = checkOn;
}
if (Mouse.IsOver(rect) && WhoreCheckbox.checkboxPainting && Input.GetMouseButton(0) && checkOn != WhoreCheckbox.checkboxPaintingState)
{
checkOn = WhoreCheckbox.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)) ? WhoreCheckbox.WhoreCheckboxDisabledTex : texDisabled);
}
else if (active)
{
image = ((!(texChecked != null)) ? WhoreCheckbox.WhoreCheckboxOnTex : texChecked);
}
else
{
image = ((!(texUnchecked != null)) ? WhoreCheckbox.WhoreCheckboxOffTex : texUnchecked);
}
Rect position = new Rect(x, y, size, size);
GUI.DrawTexture(position, image);
}
}
}
|
TDarksword/rjw
|
Source/MainTab/WhoreCheckbox.cs
|
C#
|
mit
| 2,919 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using Verse.AI;
using Verse;
namespace rjw
{
public class MentalState_RandomRape : SexualMentalState
{
public override void PostStart(string reason)
{
base.PostStart(reason);
this.pawn.mindState.canLovinTick = -1;
}
public override bool ForceHostileTo(Thing t)
{
/*
//planning random raper hostile to other colonists. but now, injured raper wont rape.
if ((this.pawn.jobs != null) &&
(this.pawn.jobs.curDriver != null) &&
(this.pawn.jobs.curDriver as JobDriver_Rape != null))
{
return true;
}*/
return false;
}
public override bool ForceHostileTo(Faction f)
{
/*
if ((this.pawn.jobs != null) &&
(this.pawn.jobs.curDriver != null) &&
(this.pawn.jobs.curDriver as JobDriver_Rape != null))
{
return true;
}*/
return false;
}
public override RandomSocialMode SocialModeMax()
{
return RandomSocialMode.Off;
}
}
}
|
TDarksword/rjw
|
Source/MentalStates/MentalState_RandomRape.cs
|
C#
|
mit
| 1,007 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RimWorld;
using Verse.AI;
using Verse;
namespace rjw
{
public class SexualMentalState : MentalState
{
public override void MentalStateTick()
{
if (this.pawn.IsHashIntervalTick(150))
{
if (xxx.is_satisfied(pawn))
{
this.RecoverFromState();
return;
}
}
base.MentalStateTick();
}
}
public class SexualMentalStateWorker : MentalStateWorker
{
public override bool StateCanOccur(Pawn pawn)
{
if (base.StateCanOccur(pawn))
{
return xxx.is_human(pawn) && xxx.can_rape(pawn);
}
else
{
return false;
}
}
}
public class SexualMentalBreakWorker : MentalBreakWorker
{
public override float CommonalityFor(Pawn pawn, bool moodCaused = false)
{
if (xxx.is_human(pawn))
{
var need_sex = pawn.needs.TryGetNeed<Need_Sex>();
if (need_sex != null)
return base.CommonalityFor(pawn) * (def as SexualMentalBreakDef).commonalityMultiplierBySexNeed.Evaluate(need_sex.CurLevelPercentage * 100f);
else
return 0;
}
else
{
return 0;
}
}
}
public class SexualMentalStateDef : MentalStateDef
{
}
public class SexualMentalBreakDef : MentalBreakDef
{
public SimpleCurve commonalityMultiplierBySexNeed;
}
}
|
TDarksword/rjw
|
Source/MentalStates/SexualMentalState.cs
|
C#
|
mit
| 1,310 |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Verse;
namespace rjw
{
/// <summary>
/// Helper class for ChJees's Androids mod.
/// </summary>
[StaticConstructorOnStartup]
public static class AndroidsCompatibility
{
public static Type androidCompatType;
public static readonly string typeName = "Androids.SexualizeAndroidRJW";
private static bool foundType;
static AndroidsCompatibility()
{
try
{
androidCompatType = Type.GetType(typeName);
foundType = true;
//Log.Message("Found Type: Androids.SexualizeAndroidRJW");
}
catch
{
foundType = false;
//Log.Message("Did NOT find Type: Androids.SexualizeAndroidRJW");
}
}
/*private static bool TestPredicate(DefModExtension extension)
{
if (extension == null)
return false;
Log.Message($"Predicate: {extension} : {extension.GetType()?.FullName}");
return extension.GetType().FullName == typeName;
}*/
public static bool IsAndroid(ThingDef def)
{
if (def == null || !foundType)
{
return false;
}
return def.modExtensions != null && def.modExtensions.Any(extension => extension.GetType().FullName == typeName);
}
public static bool IsAndroid(Thing thing)
{
return IsAndroid(thing.def);
}
public static bool AndroidPenisFertility(Pawn pawn)
{
//androids only fertile with archotech parts
BodyPartRecord Part = Genital_Helper.get_genitalsBPR(pawn);
return (pawn.health.hediffSet.hediffs.Any((Hediff hed) =>
(hed.Part == Part) &&
(hed.def == Genital_Helper.archotech_penis)
));
}
public static bool AndroidVaginaFertility(Pawn pawn)
{
//androids only fertile with archotech parts
BodyPartRecord Part = Genital_Helper.get_genitalsBPR(pawn);
return (pawn.health.hediffSet.hediffs.Any((Hediff hed) =>
(hed.Part == Part) &&
(hed.def == Genital_Helper.archotech_vagina)
));
}
}
}
|
TDarksword/rjw
|
Source/Modules/Androids/AndroidsCompatibility.cs
|
C#
|
mit
| 1,934 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
// Adds options to the right-click menu for bondage gear to equip the gear on prisoners/downed pawns
namespace rjw
{
public class CompBondageGear : CompUsable
{
public override IEnumerable<FloatMenuOption> CompFloatMenuOptions(Pawn pawn)
{
if ((pawn.Map != null) && (pawn.Map == Find.CurrentMap))// && (pawn.Map.mapPawns.PrisonersOfColonyCount > 0)
{
if (!pawn.CanReserve(parent))
yield return new FloatMenuOption(FloatMenuOptionLabel(pawn) + " on (" + "Reserved".Translate() + ")", null, MenuOptionPriority.DisabledOption);
else if (pawn.CanReach(parent, PathEndMode.Touch, Danger.Some))
foreach (Pawn other in pawn.Map.mapPawns.AllPawns)
if ((other != pawn) && other.Spawned && (other.Downed || other.IsPrisonerOfColony || xxx.is_slave(other)))
yield return this.make_option(FloatMenuOptionLabel(pawn) + " on " + xxx.get_pawnname(other), pawn, other, (other.IsPrisonerOfColony || xxx.is_slave(other)) ? WorkTypeDefOf.Warden : null);
}
}
}
}
|
TDarksword/rjw
|
Source/Modules/Bondage/Comps/CompBondageGear.cs
|
C#
|
mit
| 1,074 |
using System;
using RimWorld;
using Verse;
using Multiplayer.API;
namespace rjw
{
public class CompCryptoStamped : ThingComp
{
public string name;
public string key;
[SyncMethod]
public string random_hex_byte()
{
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
var rv = Rand.RangeInclusive(0x00, 0xFF);
var padding = (rv < 0x10) ? "0" : "";
return padding + rv.ToString("X");
}
public override void Initialize(CompProperties pro)
{
name = NameGenerator.GenerateName(RulePackDef.Named("EngravedName"));
key = "";
for (int i = 0; i < 16; ++i)
key += random_hex_byte();
}
public override void PostExposeData()
{
base.PostExposeData();
Scribe_Values.Look<string>(ref name, "engraved_name");
Scribe_Values.Look<string>(ref key, "cryptostamp");
}
public override bool AllowStackWith(Thing t)
{
return false;
}
public override string CompInspectStringExtra()
{
var inspect_engraving = "Engraved with the name \"" + name + "\"";
var inspect_key = "Cryptostamp: " + key;
return base.CompInspectStringExtra() + inspect_engraving + "\n" + inspect_key;
}
public override string TransformLabel(string lab)
{
return lab + " \"" + name + "\"";
}
public bool matches(CompHoloCryptoStamped other)
{
return String.Equals(key, other.key);
}
public void copy_stamp_from(CompHoloCryptoStamped other)
{
name = other.name;
key = other.key;
}
}
public class CompProperties_CryptoStamped : CompProperties
{
public CompProperties_CryptoStamped()
{
compClass = typeof(CompHoloCryptoStamped);
}
}
}
|
TDarksword/rjw
|
Source/Modules/Bondage/Comps/CompCryptoStamped.cs
|
C#
|
mit
| 1,637 |
using RimWorld;
using Verse;
namespace rjw
{
public class CompGetBondageGear : CompUseEffect
{
public override float OrderPriority
{
get
{
return -79;
}
}
public override void DoEffect(Pawn p)
{
base.DoEffect(p);
var app = parent as Apparel;
if ((p.apparel != null) && (app != null))
p.apparel.Wear(app);
}
}
}
|
TDarksword/rjw
|
Source/Modules/Bondage/Comps/CompGetBondageGear.cs
|
C#
|
mit
| 356 |
using System;
using RimWorld;
using Verse;
using Multiplayer.API;
namespace rjw
{
public class CompHoloCryptoStamped : ThingComp
{
public string name;
public string key;
[SyncMethod]
public string random_hex_byte()
{
//Rand.PopState();
//Rand.PushState(RJW_Multiplayer.PredictableSeed());
var rv = Rand.RangeInclusive(0x00, 0xFF);
var padding = (rv < 0x10) ? "0" : "";
return padding + rv.ToString("X");
}
public override void Initialize(CompProperties pro)
{
name = NameGenerator.GenerateName(RulePackDef.Named("EngravedName"));
key = "";
for (int i = 0; i < 16; ++i)
key += random_hex_byte();
}
public override void PostExposeData()
{
base.PostExposeData();
Scribe_Values.Look<string>(ref name, "engraved_name");
Scribe_Values.Look<string>(ref key, "cryptostamp");
}
public override bool AllowStackWith(Thing t)
{
return false;
}
public override string CompInspectStringExtra()
{
var inspect_engraving = "Engraved with the name \"" + name + "\"";
var inspect_key = "Cryptostamp: " + key;
return base.CompInspectStringExtra() + inspect_engraving + "\n" + inspect_key;
}
public override string TransformLabel(string lab)
{
return lab + " \"" + name + "\"";
}
public bool matches(CompHoloCryptoStamped other)
{
return String.Equals(key, other.key);
}
public void copy_stamp_from(CompHoloCryptoStamped other)
{
name = other.name;
key = other.key;
}
}
public class CompProperties_HoloCryptoStamped : CompProperties
{
public CompProperties_HoloCryptoStamped()
{
compClass = typeof(CompHoloCryptoStamped);
}
}
}
|
TDarksword/rjw
|
Source/Modules/Bondage/Comps/CompHoloCryptoStamped.cs
|
C#
|
mit
| 1,649 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
// Adds unlock options to right-click menu for holokeys.
namespace rjw
{
public class CompStampedApparelKey : CompUsable
{
protected string make_label(Pawn pawn, Pawn other)
{
return FloatMenuOptionLabel(pawn) + " on " + ((other == null) ? "self" : xxx.get_pawnname(other));
}
public override IEnumerable<FloatMenuOption> CompFloatMenuOptions(Pawn pawn)
{
if (!pawn.CanReserve(parent))
yield return new FloatMenuOption(FloatMenuOptionLabel(pawn) + " (" + "Reserved".Translate() + ")", null, MenuOptionPriority.DisabledOption);
else if (pawn.CanReach(parent, PathEndMode.Touch, Danger.Some))
{
// Option for the pawn to use the key on themself
if (!pawn.is_wearing_locked_apparel())
yield return new FloatMenuOption("Not wearing locked apparel", null, MenuOptionPriority.DisabledOption);
else
yield return this.make_option(make_label(pawn, null), pawn, null, null);
if ((pawn.Map != null) && (pawn.Map == Find.CurrentMap))
{
// Options for use on colonists
foreach (var other in pawn.Map.mapPawns.FreeColonists)
if ((other != pawn) && other.is_wearing_locked_apparel())
yield return this.make_option(make_label(pawn, other), pawn, other, null);
// Options for use on prisoners
foreach (var prisoner in pawn.Map.mapPawns.PrisonersOfColony)
if (prisoner.is_wearing_locked_apparel())
yield return this.make_option(make_label(pawn, prisoner), pawn, prisoner, WorkTypeDefOf.Warden);
// Options for use on corpses
foreach (var q in pawn.Map.listerThings.ThingsInGroup(ThingRequestGroup.Corpse))
{
var corpse = q as Corpse;
if (corpse.InnerPawn.is_wearing_locked_apparel())
yield return this.make_option(make_label(pawn, corpse.InnerPawn), pawn, corpse, null);
}
}
}
}
}
}
|
TDarksword/rjw
|
Source/Modules/Bondage/Comps/CompStampedApparelKey.cs
|
C#
|
mit
| 1,904 |
using RimWorld;
using Verse;
namespace rjw
{
public class CompUnlockBondageGear : CompUseEffect
{
public override float OrderPriority
{
get
{
return -69;
}
}
public override void DoEffect(Pawn p)
{
base.DoEffect(p);
var key_stamp = parent.GetComp<CompHoloCryptoStamped>();
if ((key_stamp == null) || (p.MapHeld == null) || (p.apparel == null))
return;
Apparel locked_app = null;
var any_locked = false;
{
foreach (var app in p.apparel.WornApparel)
{
var app_stamp = app.GetComp<CompHoloCryptoStamped>();
if (app_stamp != null)
{
any_locked = true;
if (app_stamp.matches(key_stamp))
{
locked_app = app;
break;
}
}
}
}
if (locked_app != null)
{
//locked_app.Notify_Stripped (p); // TODO This was removed. Necessary?
p.apparel.Remove(locked_app);
Thing dropped = null;
GenThing.TryDropAndSetForbidden(locked_app, p.Position, p.MapHeld, ThingPlaceMode.Near, out dropped, false); //this will create a new key somehow.
if (dropped != null)
{
Messages.Message("Unlocked " + locked_app.def.label, p, MessageTypeDefOf.SilentInput);
IntVec3 keyPostition = parent.Position;
parent.Destroy();
}
else if (PawnUtility.ShouldSendNotificationAbout(p))
{
Messages.Message("Couldn't drop " + locked_app.def.label, p, MessageTypeDefOf.NegativeEvent);
}
}
else if (any_locked)
Messages.Message("The key doesn't fit!", p, MessageTypeDefOf.NegativeEvent);
}
}
}
|
TDarksword/rjw
|
Source/Modules/Bondage/Comps/CompUnlockBondageGear.cs
|
C#
|
mit
| 1,547 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
namespace rjw
{
public class JobDriver_StruggleInBondageGear : JobDriver
{
public Apparel target_gear
{
get
{
return (Apparel)TargetA.Thing;
}
}
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return this.pawn.Reserve(this.target_gear, this.job, 1, -1, null, errorOnFailed);
}
protected override IEnumerable<Toil> MakeNewToils()
{
yield return new Toil
{
initAction = delegate
{
pawn.pather.StopDead();
},
defaultCompleteMode = ToilCompleteMode.Delay,
defaultDuration = 60
};
yield return new Toil
{
initAction = delegate
{
if (PawnUtility.ShouldSendNotificationAbout(pawn))
{
var pro = (pawn.gender == Gender.Male) ? "his" : "her";
Messages.Message(xxx.get_pawnname(pawn) + " struggles to remove " + pro + " " + target_gear.def.label + ". It's no use!", pawn, MessageTypeDefOf.NegativeEvent);
}
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
}
}
|
TDarksword/rjw
|
Source/Modules/Bondage/JobDrivers/JobDriver_StruggleInBondageGear.cs
|
C#
|
mit
| 1,085 |
using System.Collections.Generic;
using RimWorld;
using Verse;
using Verse.AI;
namespace rjw
{
public class JobDriver_UseItemOn : JobDriver_UseItem
{
public static Toil pickup_item(Pawn p, Thing item)
{
return new Toil
{
initAction = delegate
{
p.carryTracker.TryStartCarry(item, 1);
if (item.Spawned) // If the item is still spawned that means the pawn failed to pick it up
p.jobs.curDriver.EndJobWith(JobCondition.Incompletable);
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
protected TargetIndex iitem = TargetIndex.A;
protected TargetIndex itar = TargetIndex.B;
protected Thing item
{
get
{
return base.job.GetTarget(iitem).Thing;
}
}
protected Thing tar
{
get
{
return base.job.GetTarget(itar).Thing;
}
}
protected override IEnumerable<Toil> MakeNewToils()
{
if (tar == null)
foreach (var toil in base.MakeNewToils())
yield return toil;
else
{
// Find the pawn to use the item on.
Pawn other;
{
var corpse = tar as Corpse;
other = (corpse == null) ? (Pawn)tar : corpse.InnerPawn;
}
this.FailOnDespawnedNullOrForbidden(itar);
if (!other.Dead)
this.FailOnAggroMentalState(itar);
yield return Toils_Reserve.Reserve(itar);
if ((pawn.inventory != null) && pawn.inventory.Contains(item))
{
yield return Toils_Misc.TakeItemFromInventoryToCarrier(pawn, iitem);
}
else
{
yield return Toils_Reserve.Reserve(iitem);
yield return Toils_Goto.GotoThing(iitem, PathEndMode.ClosestTouch).FailOnForbidden(iitem);
yield return pickup_item(pawn, item);
}
yield return Toils_Goto.GotoThing(itar, PathEndMode.Touch);
yield return new Toil
{
initAction = delegate
{
if (!other.Dead)
PawnUtility.ForceWait(other, 60);
},
defaultCompleteMode = ToilCompleteMode.Delay,
defaultDuration = 60
};
yield return new Toil
{
initAction = delegate
{
var effective_item = item;
// Drop the item if it's some kind of apparel. This is because ApparelTracker.Wear only works properly
// if the apparel to wear is spawned. (I'm just assuming that DoEffect for apparel wears it, which is
// true for bondage gear)
if ((effective_item as Apparel) != null)
{
Thing dropped_thing;
if (pawn.carryTracker.TryDropCarriedThing(pawn.Position, ThingPlaceMode.Near, out dropped_thing))
effective_item = dropped_thing as Apparel;
else
{
ModLog.Error("Unable to drop " + effective_item.Label + " for use on " + xxx.get_pawnname(other) + " (apparel must be dropped before use)");
effective_item = null;
}
}
if (effective_item != null)
{
var eff = effective_item.TryGetComp<CompUseEffect>();
if (eff != null)
eff.DoEffect(other);
else
ModLog.Error("Unable to get CompUseEffect for use of " + effective_item.Label + " on " + xxx.get_pawnname(other) + " by " + xxx.get_pawnname(pawn));
}
},
defaultCompleteMode = ToilCompleteMode.Instant
};
}
}
}
}
|
TDarksword/rjw
|
Source/Modules/Bondage/JobDrivers/JobDriver_UseItemOn.cs
|
C#
|
mit
| 3,171 |
using System.Collections.Generic;
using RimWorld;
using Verse;
namespace rjw
{
public class Recipe_InstallChastityBelt : Recipe_InstallImplant
{
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r)
{
return base.GetPartsToApplyOn(p, r);
}
}
public class Recipe_UnlockChastityBelt : Recipe_InstallImplant
{
public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn p, RecipeDef r)
{
return base.GetPartsToApplyOn(p, r);
}
}
}
|
TDarksword/rjw
|
Source/Modules/Bondage/Recipes/Recipe_ChastityBelt.cs
|
C#
|
mit
| 492 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.