mirror of
https://gitgud.io/LonelyRain/rjw-quirks.git
synced 2024-08-15 00:03:31 +00:00
Initial upload
This commit is contained in:
parent
feb28b10a4
commit
7585da099c
106 changed files with 4860 additions and 0 deletions
18
RJW-Quirks/Core.cs
Normal file
18
RJW-Quirks/Core.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using HarmonyLib;
|
||||
using HugsLib;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks
|
||||
{
|
||||
public class Core : ModBase
|
||||
{
|
||||
// Originally did not use Hugslib, but due to RJW using hugslib I needed to in order for proper patching at correct times. could probably be done with priorities or something but this was easier
|
||||
/*public Core(ModContentPack pack)
|
||||
{
|
||||
//var harmony = new Harmony("rain.quirks");
|
||||
//harmony.PatchAll();
|
||||
}*/
|
||||
|
||||
public override string ModIdentifier => "quirk";
|
||||
}
|
||||
}
|
64
RJW-Quirks/Data/RaceTags.cs
Normal file
64
RJW-Quirks/Data/RaceTags.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Data
|
||||
{
|
||||
public class RaceTags
|
||||
{
|
||||
private readonly static Dictionary<string, RaceTags> tagDatabase = new Dictionary<string, RaceTags>();
|
||||
|
||||
// I only created tags for RaceGroupDef properties that seemed like keywords (like slime) rather than behavior (like oviPregnancy).
|
||||
public readonly static RaceTags Chitin = new RaceTags("Chitin");
|
||||
public readonly static RaceTags Demon = new RaceTags("Demon");
|
||||
public readonly static RaceTags Feathers = new RaceTags("Feathers");
|
||||
public readonly static RaceTags Fur = new RaceTags("Fur");
|
||||
public readonly static RaceTags Plant = new RaceTags("Plant");
|
||||
public readonly static RaceTags Robot = new RaceTags("Robot");
|
||||
public readonly static RaceTags Scales = new RaceTags("Scales");
|
||||
public readonly static RaceTags Skin = new RaceTags("Skin");
|
||||
public readonly static RaceTags Slime = new RaceTags("Slime");
|
||||
|
||||
|
||||
public string Key { get; }
|
||||
|
||||
private RaceTags(string key)
|
||||
{
|
||||
Key = key;
|
||||
tagDatabase.Add(key, this);
|
||||
}
|
||||
|
||||
public static bool TryParse(string key, out RaceTags raceTag)
|
||||
{
|
||||
return tagDatabase.TryGetValue(key, out raceTag);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// For backwards compatability only. Shouldn't add more special cases here.
|
||||
/// </summary>
|
||||
public bool DefaultWhenNoRaceGroupDef(Pawn pawn)
|
||||
{
|
||||
if (this == Demon)
|
||||
{
|
||||
return xxx.is_demon(pawn);
|
||||
}
|
||||
else if (this == Slime)
|
||||
{
|
||||
return xxx.is_slime(pawn);
|
||||
}
|
||||
else if (this == Skin)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
74
RJW-Quirks/HarmonyPatches/Patch_CasualSex_Helper.cs
Normal file
74
RJW-Quirks/HarmonyPatches/Patch_CasualSex_Helper.cs
Normal file
|
@ -0,0 +1,74 @@
|
|||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using rjwquirks.Modules.Quirks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(CasualSex_Helper), nameof(CasualSex_Helper.GetScore))]
|
||||
public class Patch_CasualSex_Helper
|
||||
{
|
||||
// Edits the "score" of a cell for a pawn to fuck in
|
||||
public static void Postfix(Pawn pawn, IntVec3 cell, Pawn partner, ref int __result)
|
||||
{
|
||||
QuirkSet quirks = pawn.GetQuirks();
|
||||
|
||||
if (quirks.AllQuirks.EnumerableNullOrEmpty())
|
||||
return;
|
||||
|
||||
List<Pawn> all_pawns = pawn.Map.mapPawns.AllPawnsSpawned.Where(x
|
||||
=> x.Position.DistanceTo(pawn.Position) < 100
|
||||
&& xxx.is_human(x)
|
||||
&& x != pawn
|
||||
&& x != partner
|
||||
).ToList();
|
||||
|
||||
// Somnophile code
|
||||
if (partner != null && quirks.Contains(QuirkDefOf.Somnophile))
|
||||
{
|
||||
if (all_pawns.Any(x
|
||||
=> !x.Awake()
|
||||
&& x.Position.DistanceTo(cell) < 6
|
||||
&& GenSight.LineOfSight(cell, x.Position, pawn.Map)
|
||||
))
|
||||
__result += 50;
|
||||
}
|
||||
|
||||
// Exhibitionist code
|
||||
if (quirks.Contains(QuirkDefOf.Exhibitionist))
|
||||
{
|
||||
bool might_be_seen = CasualSex_Helper.MightBeSeen(all_pawns, cell, pawn, partner);
|
||||
Room room = cell.GetRoom(pawn.Map);
|
||||
|
||||
// Readd the 30 score removed in regular RJW
|
||||
__result += 30;
|
||||
// Readd the 100 score taken from being in a doorway in regular RJW
|
||||
__result += 100;
|
||||
|
||||
if (might_be_seen)
|
||||
__result += 5;
|
||||
else
|
||||
__result -= 10;
|
||||
|
||||
if (room.Role == RoomRoleDefOf.Barracks || room.Role == RoomRoleDefOf.PrisonBarracks || room.Role == RoomRoleDefOf.PrisonCell
|
||||
|| room.Role == RoomRoleDefOf.Laboratory || room.Role == RoomRoleDefOf.RecRoom
|
||||
|| room.Role == RoomRoleDefOf.DiningRoom || room.Role == RoomRoleDefOf.Hospital
|
||||
)
|
||||
__result += 15; // Add 15 instead of 10 to counteract the -5 in regular RJW
|
||||
|
||||
Dictionary<int, int> cell_doors = new Dictionary<int, int>();
|
||||
|
||||
var doors = cell_doors.TryGetValue(room.ID);
|
||||
|
||||
if (doors > 1)
|
||||
__result += 7 * doors; // Multiply by 7 instead of 2 to counteract the negative in regular RJW
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
RJW-Quirks/HarmonyPatches/Patch_CondomUtility.cs
Normal file
37
RJW-Quirks/HarmonyPatches/Patch_CondomUtility.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using rjwquirks.Modules.Quirks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
// Skips condom code entirely if they have pregnation fetish or similar. RJW used to do this with the same quirk.
|
||||
[HarmonyPatch(typeof(CondomUtility))]
|
||||
public class Patch_CondomUtility
|
||||
{
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(CondomUtility.TryUseCondom))]
|
||||
public static bool UseCondomPrefix(Pawn pawn)
|
||||
{
|
||||
if (xxx.is_human(pawn) && pawn.HasQuirk(QuirkDefOf.ImpregnationFetish))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(nameof(CondomUtility.GetCondomFromRoom))]
|
||||
public static bool GetCondomPrefix(Pawn pawn)
|
||||
{
|
||||
if (xxx.is_human(pawn) && pawn.HasQuirk(QuirkDefOf.ImpregnationFetish))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
131
RJW-Quirks/HarmonyPatches/Patch_Dialog_Sexcard.cs
Normal file
131
RJW-Quirks/HarmonyPatches/Patch_Dialog_Sexcard.cs
Normal file
|
@ -0,0 +1,131 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using rjwquirks.Modules.Quirks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(Dialog_Sexcard), "SexualityCard")]
|
||||
public static class Patch_Dialog_Sexcard
|
||||
{
|
||||
static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
MethodInfo InsertQuirks = AccessTools.Method(typeof(Patch_Dialog_Sexcard), nameof(DrawQuirks));
|
||||
MethodInfo DrawSexuality = AccessTools.Method(typeof(Dialog_Sexcard), "DrawSexuality");
|
||||
bool found = false;
|
||||
|
||||
// When RJW calls draw sexuality we inject our quirk drawing.
|
||||
foreach (CodeInstruction i in instructions)
|
||||
{
|
||||
if (i.opcode == OpCodes.Call && i.operand as MethodInfo == DrawSexuality)
|
||||
found = true;
|
||||
|
||||
if (found)
|
||||
{
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_2);
|
||||
yield return new CodeInstruction(OpCodes.Ldloc_3);
|
||||
yield return new CodeInstruction(OpCodes.Call, InsertQuirks);
|
||||
found = false;
|
||||
}
|
||||
|
||||
yield return i;
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawQuirks(Pawn pawn, Rect rect)
|
||||
{
|
||||
QuirkSet quirks = pawn.GetQuirks();
|
||||
rect.y += 24;
|
||||
|
||||
if (quirks == null)
|
||||
return;
|
||||
|
||||
var quirkString = quirks.AllQuirks
|
||||
.Select(quirk => quirk.Label)
|
||||
.OrderBy(Label => Label)
|
||||
.ToCommaList();
|
||||
|
||||
if ((Current.ProgramState == ProgramState.Playing &&
|
||||
pawn.IsDesignatedHero() && pawn.IsHeroOwner() || Prefs.DevMode) ||
|
||||
Current.ProgramState == ProgramState.Entry)
|
||||
{
|
||||
if (Widgets.ButtonText(rect, "Quirks".Translate() + quirkString, false))
|
||||
DrawQuirkEditMenu(pawn, quirks);
|
||||
}
|
||||
else
|
||||
Widgets.Label(rect, "Quirks".Translate() + quirkString);
|
||||
|
||||
if (!Mouse.IsOver(rect)) return;
|
||||
|
||||
Widgets.DrawHighlight(rect);
|
||||
|
||||
TooltipHandler.TipRegion(rect, quirks.TipString());
|
||||
}
|
||||
|
||||
static void DrawQuirkEditMenu(Pawn pawn, QuirkSet quirks)
|
||||
{
|
||||
var quirkDefsAll = DefDatabase<QuirkDef>.AllDefs.OrderBy(def => def.GetLabelFor(pawn));
|
||||
|
||||
var menuOptions = new List<FloatMenuOption>();
|
||||
|
||||
if (RJWSettings.DevMode)
|
||||
menuOptions.Add(new FloatMenuOption("[DEV] Forced Reset", () => quirks.Clear(true)));
|
||||
|
||||
menuOptions.Add(new FloatMenuOption("Reset", () => quirks.Clear()));
|
||||
|
||||
foreach (QuirkDef quirkDef in quirkDefsAll)
|
||||
{
|
||||
if (quirkDef.hidden && !RJWSettings.DevMode && !quirks.Contains(quirkDef))
|
||||
continue;
|
||||
|
||||
Quirk quirk = quirks.GetQuirk(quirkDef);
|
||||
FloatMenuOption option;
|
||||
|
||||
if (quirk == null)
|
||||
{
|
||||
AcceptanceReport report = quirks.CanBeAdded(quirkDef);
|
||||
if (report.Accepted)
|
||||
{
|
||||
option = new FloatMenuOption(
|
||||
quirkDef.GetLabelFor(pawn),
|
||||
() => quirks.AddQuirk(quirkDef),
|
||||
mouseoverGuiAction: (Rect rect) => TooltipHandler.TipRegion(rect, quirkDef.GetDescriptionFor(pawn))
|
||||
);
|
||||
}
|
||||
else if (RJWSettings.DevMode)
|
||||
option = new FloatMenuOption($"[DEV]{quirkDef.GetLabelFor(pawn)}: {report.Reason}", () => quirks.AddQuirk(quirkDef, true));
|
||||
else
|
||||
// Game does not call mouseoverGuiAction for the disabled entries
|
||||
option = new FloatMenuOption($"{quirkDef.GetLabelFor(pawn)}: {report.Reason}", null);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcceptanceReport report = quirks.CanBeRemoved(quirkDef);
|
||||
if (report.Accepted)
|
||||
{
|
||||
option = new FloatMenuOption(
|
||||
"- " + quirk.Label,
|
||||
() => quirks.RemoveQuirk(quirk),
|
||||
mouseoverGuiAction: (Rect rect) => TooltipHandler.TipRegion(rect, quirk.Description)
|
||||
);
|
||||
}
|
||||
else if (RJWSettings.DevMode)
|
||||
option = new FloatMenuOption($"- {quirk.Label}: {report.Reason}", () => quirks.RemoveQuirk(quirk, true));
|
||||
else
|
||||
option = new FloatMenuOption($"- {quirk.Label}: {report.Reason}", null);
|
||||
}
|
||||
|
||||
menuOptions.Add(option);
|
||||
}
|
||||
Find.WindowStack.Add(new FloatMenu(menuOptions));
|
||||
}
|
||||
}
|
||||
}
|
24
RJW-Quirks/HarmonyPatches/Patch_DrawNude.cs
Normal file
24
RJW-Quirks/HarmonyPatches/Patch_DrawNude.cs
Normal file
|
@ -0,0 +1,24 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using rjwquirks.Modules.Quirks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(SexUtility), nameof(SexUtility.DrawNude))]
|
||||
public class Patch_DrawNude
|
||||
{
|
||||
public static bool Prefix(Pawn pawn)
|
||||
{
|
||||
if (pawn.HasQuirk(QuirkDefOf.Endytophile))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
35
RJW-Quirks/HarmonyPatches/Patch_Hediff_BasePregnancy.cs
Normal file
35
RJW-Quirks/HarmonyPatches/Patch_Hediff_BasePregnancy.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
/*[HarmonyPatch(typeof(Hediff_BasePregnancy))]
|
||||
public class Patch_Hediff_BasePregnancy
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch("GenerateBabies")]
|
||||
public static IEnumerable<CodeInstruction> AdjustMaxLitterSize(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
foreach (CodeInstruction i in instructions)
|
||||
{
|
||||
if (i.opcode == OpCodes.Ldc_R4 && i.operand as string == "0.33333334")
|
||||
found = true;
|
||||
|
||||
if (found && i.opcode == OpCodes.Stloc_S)
|
||||
Log.Warning(i.operand as string);
|
||||
|
||||
|
||||
yield return i;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
43
RJW-Quirks/HarmonyPatches/Patch_Hediff_PartBaseArtifical.cs
Normal file
43
RJW-Quirks/HarmonyPatches/Patch_Hediff_PartBaseArtifical.cs
Normal file
|
@ -0,0 +1,43 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(Hediff_PartBaseArtifical))]
|
||||
public class Patch_Hediff_PartBaseArtifical
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(nameof(Hediff_PartBaseArtifical.Tick))]
|
||||
public static IEnumerable<CodeInstruction> ChangeMaxEggsSize(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
FieldInfo Pawn = AccessTools.Field(typeof(Hediff_PartBaseArtifical), nameof(Hediff_PartBaseArtifical.pawn));
|
||||
MethodInfo EggSize = AccessTools.Method(typeof(Patch_Hediff_PartBaseArtifical), nameof(EditMaxEggsSize));
|
||||
|
||||
foreach (CodeInstruction i in instructions)
|
||||
{
|
||||
if (i.opcode == OpCodes.Ldc_R4 && i.operand as string == "0.0")
|
||||
{
|
||||
yield return new CodeInstruction(OpCodes.Ldfld, Pawn);
|
||||
yield return new CodeInstruction(OpCodes.Ldloc_3);
|
||||
yield return new CodeInstruction(OpCodes.Call, EggSize);
|
||||
}
|
||||
|
||||
yield return i;
|
||||
}
|
||||
}
|
||||
|
||||
public static void EditMaxEggsSize(Pawn pawn, float eggsSize)
|
||||
{
|
||||
if (pawn.GetQuirks() != null)
|
||||
pawn.GetQuirks().ApplyValueModifiers("maxEggsSize", ref eggsSize);
|
||||
}
|
||||
}
|
||||
}
|
47
RJW-Quirks/HarmonyPatches/Patch_Hediff_PartBaseNatural.cs
Normal file
47
RJW-Quirks/HarmonyPatches/Patch_Hediff_PartBaseNatural.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(Hediff_PartBaseNatural))]
|
||||
public class Patch_Hediff_PartBaseNatural
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(nameof(Hediff_PartBaseNatural.Tick))]
|
||||
public static IEnumerable<CodeInstruction> ChangeMaxEggsSize(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
FieldInfo Pawn = AccessTools.Field(typeof(Hediff_PartBaseNatural), nameof(Hediff_PartBaseNatural.pawn));
|
||||
MethodInfo EggSize = AccessTools.Method(typeof(Patch_Hediff_PartBaseNatural), nameof(EditMaxEggsSize));
|
||||
bool found = false;
|
||||
|
||||
foreach (CodeInstruction i in instructions)
|
||||
{
|
||||
if (i.opcode == OpCodes.Ldc_R4 && i.operand as string == "0.0" && found)
|
||||
{
|
||||
yield return new CodeInstruction(OpCodes.Ldfld, Pawn);
|
||||
yield return new CodeInstruction(OpCodes.Ldloc_3);
|
||||
yield return new CodeInstruction(OpCodes.Call, EggSize);
|
||||
}
|
||||
|
||||
if (i.opcode == OpCodes.Ldc_R4 && i.operand as string == "0.0")
|
||||
found = true;
|
||||
|
||||
yield return i;
|
||||
}
|
||||
}
|
||||
|
||||
public static void EditMaxEggsSize(Pawn pawn, float eggsSize)
|
||||
{
|
||||
if (pawn.GetQuirks() != null)
|
||||
pawn.GetQuirks().ApplyValueModifiers("maxEggsSize", ref eggsSize);
|
||||
}
|
||||
}
|
||||
}
|
59
RJW-Quirks/HarmonyPatches/Patch_JobGiver_Masturbate.cs
Normal file
59
RJW-Quirks/HarmonyPatches/Patch_JobGiver_Masturbate.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.Emit;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using rjwquirks.Modules.Quirks;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
/*[HarmonyPatch(typeof(JobGiver_Masturbate))]
|
||||
public class Patch_JobGiver_Masturbate
|
||||
{
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch("TryGiveJob")]
|
||||
public static IEnumerable<CodeInstruction> ApplyQuirkToMasturbate(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
MethodInfo Frustrated = AccessTools.Method(typeof(xxx), nameof(xxx.is_frustrated));
|
||||
MethodInfo Apply = AccessTools.Method(typeof(Patch_JobGiver_Masturbate), nameof(ApplyQuirk));
|
||||
var labels = instructions.ElementAt(0).labels.ListFullCopy<Label>();
|
||||
Log.Warning(labels.Count.ToString());
|
||||
bool found = false;
|
||||
|
||||
foreach (CodeInstruction i in instructions)
|
||||
{
|
||||
if (i.opcode == OpCodes.Call && i.operand as MethodInfo == Frustrated)
|
||||
{
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_1);
|
||||
yield return new CodeInstruction(OpCodes.Call, Apply);
|
||||
yield return new CodeInstruction(OpCodes.Brtrue_S, labels[4]);
|
||||
found = true;
|
||||
}
|
||||
|
||||
if (found && i.opcode == OpCodes.Call && i.operand as MethodInfo == Frustrated)
|
||||
{
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_1);
|
||||
yield return new CodeInstruction(OpCodes.Call, Apply);
|
||||
yield return new CodeInstruction(OpCodes.Brtrue_S, labels[5]);
|
||||
found = false;
|
||||
}
|
||||
|
||||
|
||||
yield return i;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ApplyQuirk(Pawn pawn)
|
||||
{
|
||||
if (pawn.GetQuirks() != null)
|
||||
return pawn.HasQuirk(QuirkDefOf.Exhibitionist);
|
||||
|
||||
return false;
|
||||
}
|
||||
}*/
|
||||
}
|
28
RJW-Quirks/HarmonyPatches/Patch_QuirkPartPreference.cs
Normal file
28
RJW-Quirks/HarmonyPatches/Patch_QuirkPartPreference.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using HarmonyLib;
|
||||
using rjw.Modules.Interactions.Contexts;
|
||||
using rjw.Modules.Interactions.Internals.Implementation;
|
||||
using rjw.Modules.Interactions.Rules.PartKindUsageRules;
|
||||
using rjwquirks.Modules.Interactions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(PartPreferenceDetectorService), nameof(PartPreferenceDetectorService.DetectPartPreferences))]
|
||||
public class Patch_QuirkPartPreference
|
||||
{
|
||||
public static void Prefix(InteractionContext context, IList<IPartPreferenceRule> ____partKindUsageRules)
|
||||
{
|
||||
if (____partKindUsageRules.Any(x => x.GetType() == typeof(QuirksPartKindUsageRule)) || (context.Internals.Submissive.Pawn.GetQuirks() == null || context.Internals.Dominant.Pawn.GetQuirks() == null))
|
||||
return;
|
||||
|
||||
Log.Warning(____partKindUsageRules.Count().ToString());
|
||||
____partKindUsageRules.Add(new QuirksPartKindUsageRule());
|
||||
Log.Warning(____partKindUsageRules.Count().ToString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using rjwquirks.Modules.Shared.Events;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
/// <summary>
|
||||
/// Patch to generate events on record changes
|
||||
/// </summary>
|
||||
[HarmonyPatch(typeof(Pawn_RecordsTracker))]
|
||||
public static class Patch_RecordsTracker_NotifyRecordChanged
|
||||
{
|
||||
[HarmonyPatch(nameof(Pawn_RecordsTracker.Increment))]
|
||||
[HarmonyPostfix]
|
||||
public static void IncrementPostfix(Pawn_RecordsTracker __instance, RecordDef def)
|
||||
{
|
||||
NotifyEvent(__instance.pawn, def);
|
||||
}
|
||||
|
||||
[HarmonyPatch(nameof(Pawn_RecordsTracker.AddTo))]
|
||||
[HarmonyPostfix]
|
||||
public static void AddToPostfix(Pawn_RecordsTracker __instance, RecordDef def)
|
||||
{
|
||||
NotifyEvent(__instance.pawn, def);
|
||||
}
|
||||
|
||||
private static void NotifyEvent(Pawn pawn, RecordDef def) => RjwEventManager.NotifyEvent(new RjwEvent(RjwEventDefOf.RecordChanged, pawn.Named(RjwEventArgNames.Pawn), def.Named(RjwEventArgNames.Record)));
|
||||
}
|
||||
}
|
64
RJW-Quirks/HarmonyPatches/Patch_SexAppraiser.cs
Normal file
64
RJW-Quirks/HarmonyPatches/Patch_SexAppraiser.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using rjwquirks.Modules.Quirks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(SexAppraiser))]
|
||||
public class Patch_SexAppraiser
|
||||
{
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(SexAppraiser.GetMinSizePreference))]
|
||||
public static void AdjustMinSize(Pawn pawn, ref float __result)
|
||||
{
|
||||
if (pawn.GetQuirks() != null)
|
||||
pawn.GetQuirks().ApplyValueModifiers("wouldFuckAnimalBodySizeMin", ref __result);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(SexAppraiser.GetMaxSizePreference))]
|
||||
public static void AdjustMaxSize(Pawn pawn, ref float __result)
|
||||
{
|
||||
if (pawn.GetQuirks() != null)
|
||||
pawn.GetQuirks().ApplyValueModifiers("wouldFuckAnimalBodySizeMax", ref __result);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(SexAppraiser.GetMinSizePreference))]
|
||||
public static void AdjustWildnessModifier(Pawn pawn, ref float __result)
|
||||
{
|
||||
if (pawn.GetQuirks() != null)
|
||||
pawn.GetQuirks().ApplyValueModifiers("wouldFuckAnimalWildnessModifier", ref __result);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("GetOpinionFactor")]
|
||||
public static void AdjustOpinionFactor(Pawn fucker, Pawn fucked, ref float __result)
|
||||
{
|
||||
if (fucker.GetQuirks() != null)
|
||||
fucker.GetQuirks().ApplySexAppraisalModifiers(fucked, "opinionFactor", ref __result);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("GetBodyFactor")]
|
||||
public static void AdjustBodyFactor(Pawn fucker, Pawn fucked, ref float __result)
|
||||
{
|
||||
if (fucker.GetQuirks() != null)
|
||||
fucker.GetQuirks().ApplySexAppraisalModifiers(fucked, "bodyFactor", ref __result);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch("GetAgeFactor")]
|
||||
public static void AdjustAgeFactor(Pawn fucker, Pawn fucked, int p_age, ref float __result)
|
||||
{
|
||||
if (fucker.GetQuirks() != null)
|
||||
fucker.GetQuirks().ApplySexAppraisalModifiers(fucked, "ageFactor", ref __result);
|
||||
}
|
||||
}
|
||||
}
|
146
RJW-Quirks/HarmonyPatches/Patch_SexUtility.cs
Normal file
146
RJW-Quirks/HarmonyPatches/Patch_SexUtility.cs
Normal file
|
@ -0,0 +1,146 @@
|
|||
using HarmonyLib;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using rjwquirks.Modules.Quirks;
|
||||
using rjwquirks.Modules.Shared.Events;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.HarmonyPatches
|
||||
{
|
||||
[HarmonyPatch(typeof(SexUtility))]
|
||||
public class Patch_SexUtility
|
||||
{
|
||||
// Increases cum filth generated by pawn
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(SexUtility.CumOutputModifier))]
|
||||
public static void FilthAdder(Pawn pawn, ref float __result)
|
||||
{
|
||||
if(pawn.GetQuirks() != null)
|
||||
pawn.GetQuirks().ApplyValueModifiers("cumFilthAmount", ref __result);
|
||||
}
|
||||
|
||||
// Change how much the pawn wants to clean post sex
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(nameof(SexUtility.ConsiderCleaning))]
|
||||
static IEnumerable<CodeInstruction> ConsiderCleanup(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
FieldInfo PawnNeeds = AccessTools.Field(typeof(Pawn), nameof(Pawn.needs));
|
||||
MethodInfo Cleanup = AccessTools.Method(typeof(Patch_SexUtility), nameof(CleanupChanceAdjuster));
|
||||
|
||||
bool found = false;
|
||||
|
||||
foreach (CodeInstruction i in instructions)
|
||||
{
|
||||
if (found)
|
||||
{
|
||||
yield return i;
|
||||
yield return new CodeInstruction(OpCodes.Ldloc_0);
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_0);
|
||||
yield return new CodeInstruction(OpCodes.Call, Cleanup);
|
||||
found = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i.opcode == OpCodes.Ldfld && i.operand as FieldInfo == PawnNeeds)
|
||||
found = true;
|
||||
|
||||
yield return i;
|
||||
}
|
||||
}
|
||||
|
||||
public static void CleanupChanceAdjuster(float chance, Pawn pawn)
|
||||
{
|
||||
pawn.GetQuirks().ApplyValueModifiers("cleanAfterFapChance", ref chance);
|
||||
}
|
||||
|
||||
// Change satisfaction from sex
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(nameof(SexUtility.GetExtraSatisfaction))]
|
||||
public static void Satisfaction(SexProps props, ref float __result)
|
||||
{
|
||||
var quirkCount = props.pawn.GetQuirks().GetSatisfiedBySex(props).Count();
|
||||
|
||||
if (quirkCount > 0)
|
||||
{
|
||||
__result += props.pawn.GetQuirks().GetSatisfiedBySex(props).Count() * 0.20f;
|
||||
RjwEventManager.NotifyEvent(new RjwEvent(RjwEventDefOf.Orgasm, props.Named(RjwEventArgNames.SexProps), __result.Named(RjwEventArgNames.Satisfaction)));
|
||||
}
|
||||
}
|
||||
|
||||
// Change ticks to next lovin
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(nameof(SexUtility.GenerateMinTicksToNextLovin))]
|
||||
public static IEnumerable<CodeInstruction> ChangeTicksToNextLovin(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
MethodInfo SexDrive = AccessTools.Method(typeof(xxx), nameof(xxx.get_sex_drive));
|
||||
MethodInfo AdjustTicks = AccessTools.Method(typeof(Patch_SexUtility), nameof(AdjustTicksToNextLovin));
|
||||
bool found = false;
|
||||
|
||||
foreach (var i in instructions)
|
||||
{
|
||||
if (found)
|
||||
{
|
||||
yield return i;
|
||||
yield return new CodeInstruction(OpCodes.Ldloc_0);
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_0);
|
||||
yield return new CodeInstruction(OpCodes.Call, AdjustTicks);
|
||||
found = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i.opcode == OpCodes.Call && i.operand as MethodInfo == SexDrive)
|
||||
found = true;
|
||||
|
||||
yield return i;
|
||||
}
|
||||
}
|
||||
|
||||
public static void AdjustTicksToNextLovin(float ticks, Pawn pawn)
|
||||
{
|
||||
if (pawn.GetQuirks() != null)
|
||||
{
|
||||
pawn.GetQuirks().ApplyValueModifiers("ticksToNextLovin", ref ticks);
|
||||
}
|
||||
}
|
||||
|
||||
// Rest adjustments
|
||||
[HarmonyTranspiler]
|
||||
[HarmonyPatch(nameof(SexUtility.reduce_rest))]
|
||||
public static IEnumerable<CodeInstruction> AdjustRest(IEnumerable<CodeInstruction> instructions)
|
||||
{
|
||||
MethodInfo Adjustment = AccessTools.Method(typeof(Patch_SexUtility), nameof(AdjustRestFromQuirk));
|
||||
bool found = false;
|
||||
bool completed = false;
|
||||
|
||||
foreach (CodeInstruction i in instructions)
|
||||
{
|
||||
if (found && !completed)
|
||||
{
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_0);
|
||||
yield return new CodeInstruction(OpCodes.Ldarg_1);
|
||||
yield return new CodeInstruction(OpCodes.Call, Adjustment);
|
||||
completed = true;
|
||||
found = false;
|
||||
}
|
||||
|
||||
if (i.opcode == OpCodes.Dup)
|
||||
found = true;
|
||||
|
||||
yield return i;
|
||||
}
|
||||
}
|
||||
|
||||
public static void AdjustRestFromQuirk(Pawn pawn, float x)
|
||||
{
|
||||
if(pawn.GetQuirks() != null)
|
||||
pawn.GetQuirks().ApplyValueModifiers("reduceRest", ref x);
|
||||
}
|
||||
}
|
||||
}
|
71
RJW-Quirks/Modules/Interactions/QuirksPartKindUsageRule.cs
Normal file
71
RJW-Quirks/Modules/Interactions/QuirksPartKindUsageRule.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
using rjw.Modules.Interactions.Contexts;
|
||||
using rjw.Modules.Interactions.Enums;
|
||||
using rjw.Modules.Interactions.Objects;
|
||||
using rjw.Modules.Interactions.Rules.PartKindUsageRules;
|
||||
using rjw.Modules.Shared;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Interactions
|
||||
{
|
||||
public class QuirksPartKindUsageRule : IPartPreferenceRule
|
||||
{
|
||||
public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context)
|
||||
{
|
||||
return Enumerable.Concat(
|
||||
ModifierFromPawnQuirks(context.Internals.Dominant, context.Internals.Submissive),
|
||||
ModifierFromPartnerQuirks(context.Internals.Submissive, context.Internals.Dominant)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context)
|
||||
{
|
||||
return Enumerable.Concat(
|
||||
ModifierFromPawnQuirks(context.Internals.Submissive, context.Internals.Dominant),
|
||||
ModifierFromPartnerQuirks(context.Internals.Dominant, context.Internals.Submissive)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What pawn wants to use because of quirks
|
||||
/// </summary>
|
||||
private IEnumerable<Weighted<LewdablePartKind>> ModifierFromPawnQuirks(InteractionPawn quirkOwner, InteractionPawn partner)
|
||||
{
|
||||
foreach (var comp in GetQuirkComps(quirkOwner.Pawn))
|
||||
{
|
||||
foreach (var rule in comp.GetModifiersForPawn(quirkOwner, partner))
|
||||
{
|
||||
yield return rule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// What pawn want from partner because of pawn's quirks
|
||||
/// </summary>
|
||||
private IEnumerable<Weighted<LewdablePartKind>> ModifierFromPartnerQuirks(InteractionPawn quirkOwner, InteractionPawn partner)
|
||||
{
|
||||
foreach (var comp in GetQuirkComps(quirkOwner.Pawn))
|
||||
{
|
||||
foreach (var rule in comp.GetModifiersForPartner(quirkOwner, partner))
|
||||
{
|
||||
yield return rule;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<Quirks.Comps.PartKindUsageRules> GetQuirkComps(Pawn pawn)
|
||||
{
|
||||
foreach (var comp in pawn.GetQuirks().AllQuirks.SelectMany(quirk => quirk.def.GetComps<Quirks.Comps.PartKindUsageRules>()))
|
||||
{
|
||||
yield return comp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
17
RJW-Quirks/Modules/Quirks/CompProperties_QuirkSet.cs
Normal file
17
RJW-Quirks/Modules/Quirks/CompProperties_QuirkSet.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks
|
||||
{
|
||||
public class CompProperties_QuirkSet : CompProperties
|
||||
{
|
||||
public CompProperties_QuirkSet()
|
||||
{
|
||||
compClass = typeof(QuirkSet);
|
||||
}
|
||||
}
|
||||
}
|
53
RJW-Quirks/Modules/Quirks/Comps/Adder.cs
Normal file
53
RJW-Quirks/Modules/Quirks/Comps/Adder.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for the comps that add quirks to the pawns
|
||||
/// </summary>
|
||||
public abstract class Adder : QuirkComp
|
||||
{
|
||||
/// <summary>
|
||||
/// For def load only. Use <see cref="GetMessageFor"/>
|
||||
/// </summary>
|
||||
public string message;
|
||||
public MessageTypeDef messageType;
|
||||
|
||||
protected string MessageTemplate => message ?? parent.description;
|
||||
|
||||
public MessageTypeDef MessageType => messageType ?? MessageTypeDefOf.NeutralEvent;
|
||||
|
||||
/// <summary>
|
||||
/// Get adjusted message text to be shown to the user when adding a quirk
|
||||
/// </summary>
|
||||
public string GetMessageFor(Pawn pawn) => MessageTemplate.Formatted(pawn.Named("pawn")).AdjustedFor(pawn).Resolve();
|
||||
|
||||
/// <summary>
|
||||
/// Add quirk of comp parent def to the pawn
|
||||
/// </summary>
|
||||
protected void AddQuirkTo(Pawn pawn)
|
||||
{
|
||||
Quirk addedQuirk = pawn.GetQuirks().AddQuirk(parent);
|
||||
|
||||
if (addedQuirk != null)
|
||||
{
|
||||
Messages.Message(GetMessageFor(pawn), pawn, MessageType);
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (eventDef == null)
|
||||
{
|
||||
yield return "<eventDef> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
52
RJW-Quirks/Modules/Quirks/Comps/Adder_OnRecordExceeding.cs
Normal file
52
RJW-Quirks/Modules/Quirks/Comps/Adder_OnRecordExceeding.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using rjwquirks;
|
||||
using rjwquirks.Modules.Shared.Events;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
/// <summary>
|
||||
/// Comp to add a quirk when <see cref="record"/> crosses <see cref="value"/>
|
||||
/// </summary>
|
||||
public class Adder_OnRecordExceeding : Adder
|
||||
{
|
||||
public RecordDef record;
|
||||
public float value;
|
||||
|
||||
protected override void HandleEvent(RjwEvent ev)
|
||||
{
|
||||
if (!ev.args.TryGetArg(RjwEventArgNames.Pawn, out Pawn pawn))
|
||||
{
|
||||
ModLog.Error($"{GetType()}.HandleEvent: No pawn in the event");
|
||||
return;
|
||||
}
|
||||
|
||||
float recordValue = pawn.records?.GetValue(record) ?? 0f;
|
||||
|
||||
if (recordValue >= value && !pawn.HasQuirk(parent))
|
||||
{
|
||||
AddQuirkTo(pawn);
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (record == null)
|
||||
{
|
||||
yield return "<record> is empty";
|
||||
}
|
||||
|
||||
if (value == 0f)
|
||||
{
|
||||
yield return "<value> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
RJW-Quirks/Modules/Quirks/Comps/CompAdder.cs
Normal file
25
RJW-Quirks/Modules/Quirks/Comps/CompAdder.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
// Adds quirk comp to all races
|
||||
[StaticConstructorOnStartup]
|
||||
public static class CompAdder
|
||||
{
|
||||
static CompAdder()
|
||||
{
|
||||
foreach (ThingDef thingDef in DefDatabase<ThingDef>.AllDefs.Where(thingDef =>
|
||||
thingDef.race != null && !thingDef.race.Animal ))
|
||||
{
|
||||
thingDef.comps.Add(new CompProperties_QuirkSet());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
44
RJW-Quirks/Modules/Quirks/Comps/HediffAdder.cs
Normal file
44
RJW-Quirks/Modules/Quirks/Comps/HediffAdder.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using rjw;
|
||||
using rjwquirks.Modules.Shared.Events;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
/// <summary>
|
||||
/// Comp to add an <see cref="hediff"/> to the pawn on RJW event
|
||||
/// </summary>
|
||||
public class HediffAdder : QuirkComp
|
||||
{
|
||||
public HediffDef hediff;
|
||||
|
||||
protected override void HandleEvent(RjwEvent ev)
|
||||
{
|
||||
if (!ev.args.TryGetArg(RjwEventArgNames.Pawn, out Pawn pawn))
|
||||
{
|
||||
ModLog.Error($"{GetType()}.HandleEvent: No pawn in the event");
|
||||
return;
|
||||
}
|
||||
|
||||
pawn.health?.AddHediff(hediff);
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (hediff == null)
|
||||
{
|
||||
yield return "<hediff> is empty";
|
||||
}
|
||||
|
||||
if (eventDef == null)
|
||||
{
|
||||
yield return "<eventDef> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
48
RJW-Quirks/Modules/Quirks/Comps/HediffRemover.cs
Normal file
48
RJW-Quirks/Modules/Quirks/Comps/HediffRemover.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
using rjw;
|
||||
using rjwquirks.Modules.Shared.Events;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
/// <summary>
|
||||
/// Comp to remove an <see cref="hediff"/> to the pawn on RJW event
|
||||
/// </summary>
|
||||
public class HediffRemover : QuirkComp
|
||||
{
|
||||
public HediffDef hediff;
|
||||
|
||||
protected override void HandleEvent(RjwEvent ev)
|
||||
{
|
||||
if (!ev.args.TryGetArg(RjwEventArgNames.Pawn, out Pawn pawn))
|
||||
{
|
||||
ModLog.Error($"{GetType()}.HandleEvent: No pawn in the event");
|
||||
return;
|
||||
}
|
||||
|
||||
Hediff existingHediff = pawn.health?.hediffSet?.GetFirstHediffOfDef(hediff);
|
||||
if (existingHediff != null)
|
||||
{
|
||||
pawn.health.RemoveHediff(existingHediff);
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (hediff == null)
|
||||
{
|
||||
yield return "<hediff> is empty";
|
||||
}
|
||||
|
||||
if (eventDef == null)
|
||||
{
|
||||
yield return "<eventDef> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
27
RJW-Quirks/Modules/Quirks/Comps/PartKindUsageRules.cs
Normal file
27
RJW-Quirks/Modules/Quirks/Comps/PartKindUsageRules.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using rjw.Modules.Interactions.Enums;
|
||||
using rjw.Modules.Interactions.Objects;
|
||||
using rjw.Modules.Shared;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
/// <summary>
|
||||
/// QuirkComp to affect body part selection when choosing sex interaction
|
||||
/// </summary>
|
||||
public abstract class PartKindUsageRules : QuirkComp
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns body parts that pawn prefers because of the quirk
|
||||
/// </summary>
|
||||
/// <param name="pawn">Quirk owner</param>
|
||||
/// <param name="partner">Quirk owner's sex partner</param>
|
||||
public abstract IEnumerable<Weighted<LewdablePartKind>> GetModifiersForPawn(InteractionPawn quirkOwner, InteractionPawn partner);
|
||||
|
||||
/// <summary>
|
||||
/// Returns body parts that pawn wants partner to use
|
||||
/// </summary>
|
||||
/// <param name="pawn">Quirk owner</param>
|
||||
/// <param name="partner">Quirk owner's sex partner</param>
|
||||
public abstract IEnumerable<Weighted<LewdablePartKind>> GetModifiersForPartner(InteractionPawn quirkOwner, InteractionPawn partner);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
using rjw.Modules.Interactions.Enums;
|
||||
using rjw.Modules.Interactions.Objects;
|
||||
using rjw.Modules.Shared;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
public class PartKindUsageRules_ImpregnationFetish : PartKindUsageRules
|
||||
{
|
||||
/// <summary>
|
||||
/// Add desire to use penis if partner has vagina and vise-verse.
|
||||
/// Check of partner's parts is to avoid boosting vagina on futa when partner is female.
|
||||
/// No check of pawn's parts because interaction framework will filter it anyway
|
||||
/// </summary>
|
||||
public override IEnumerable<Weighted<LewdablePartKind>> GetModifiersForPawn(InteractionPawn quirkOwner, InteractionPawn partner)
|
||||
{
|
||||
if (!partner.BlockedParts.Contains(LewdablePartKind.Vagina))
|
||||
{
|
||||
yield return new Weighted<LewdablePartKind>(Multipliers.Doubled, LewdablePartKind.Penis);
|
||||
}
|
||||
if (!partner.BlockedParts.Contains(LewdablePartKind.Penis))
|
||||
{
|
||||
yield return new Weighted<LewdablePartKind>(Multipliers.Doubled, LewdablePartKind.Vagina);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ask partner to use penis if quirk owner has vagina and provide vagina if owner has penis.
|
||||
/// </summary>
|
||||
public override IEnumerable<Weighted<LewdablePartKind>> GetModifiersForPartner(InteractionPawn quirkOwner, InteractionPawn partner)
|
||||
{
|
||||
if (!quirkOwner.BlockedParts.Contains(LewdablePartKind.Vagina))
|
||||
{
|
||||
yield return new Weighted<LewdablePartKind>(Multipliers.Doubled, LewdablePartKind.Penis);
|
||||
}
|
||||
if (!quirkOwner.BlockedParts.Contains(LewdablePartKind.Penis))
|
||||
{
|
||||
yield return new Weighted<LewdablePartKind>(Multipliers.Doubled, LewdablePartKind.Vagina);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
45
RJW-Quirks/Modules/Quirks/Comps/PartKindUsageRules_Static.cs
Normal file
45
RJW-Quirks/Modules/Quirks/Comps/PartKindUsageRules_Static.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using rjw.Modules.Interactions.Enums;
|
||||
using rjw.Modules.Interactions.Objects;
|
||||
using rjw.Modules.Shared;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
public class PartKindUsageRules_Static : PartKindUsageRules
|
||||
{
|
||||
// rjw.Modules.Shared can't be loaded directly because it uses properties.
|
||||
// Probably should change that, but it'll cause more ripples then I'm willing to handle rn
|
||||
public class WeightedDef
|
||||
{
|
||||
public LewdablePartKind partKind;
|
||||
public float weightMultiplier;
|
||||
}
|
||||
|
||||
public List<WeightedDef> self = new List<WeightedDef>();
|
||||
public List<WeightedDef> partner = new List<WeightedDef>();
|
||||
|
||||
public override IEnumerable<Weighted<LewdablePartKind>> GetModifiersForPawn(InteractionPawn quirkOwner, InteractionPawn partner)
|
||||
{
|
||||
return self.ConvertAll(ruleDef => new Weighted<LewdablePartKind>(ruleDef.weightMultiplier, ruleDef.partKind));
|
||||
}
|
||||
|
||||
public override IEnumerable<Weighted<LewdablePartKind>> GetModifiersForPartner(InteractionPawn quirkOwner, InteractionPawn partner)
|
||||
{
|
||||
return this.partner.ConvertAll(ruleDef => new Weighted<LewdablePartKind>(ruleDef.weightMultiplier, ruleDef.partKind));
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (self.NullOrEmpty() && partner.NullOrEmpty())
|
||||
{
|
||||
yield return "Both <self> and <partner> can not be empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
32
RJW-Quirks/Modules/Quirks/Comps/QuirkComp.cs
Normal file
32
RJW-Quirks/Modules/Quirks/Comps/QuirkComp.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using rjwquirks.Modules.Shared.Events;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
public abstract class QuirkComp
|
||||
{
|
||||
public QuirkDef parent;
|
||||
public RjwEventDef eventDef;
|
||||
|
||||
/// <summary>
|
||||
/// Notify quirk comp about the RJW event
|
||||
/// </summary>
|
||||
public void NotifyEvent(RjwEvent ev)
|
||||
{
|
||||
if (eventDef != null && ev.def == eventDef)
|
||||
{
|
||||
HandleEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle an RJW event. This method called only for events of <see cref="eventDef"/>
|
||||
/// </summary>
|
||||
protected virtual void HandleEvent(RjwEvent ev) { }
|
||||
|
||||
public virtual IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
41
RJW-Quirks/Modules/Quirks/Comps/SexAppraisalModifier.cs
Normal file
41
RJW-Quirks/Modules/Quirks/Comps/SexAppraisalModifier.cs
Normal file
|
@ -0,0 +1,41 @@
|
|||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
public abstract class SexAppraisalModifier : QuirkComp
|
||||
{
|
||||
public string factorName;
|
||||
public QuirkModifierPriority priority = QuirkModifierPriority.Normal;
|
||||
|
||||
public void TryModifyValue(Pawn quirkOwner, Pawn partner, string factorName, ref float value)
|
||||
{
|
||||
if (this.factorName != factorName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (parent.partnerPreference?.PartnerSatisfies(quirkOwner, partner) != true)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ModifyValue(quirkOwner, partner, ref value);
|
||||
}
|
||||
|
||||
public abstract void ModifyValue(Pawn quirkOwner, Pawn partner, ref float value);
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (factorName.NullOrEmpty())
|
||||
{
|
||||
yield return "<factorName> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
public class SexAppraisalModifier_ApplyMultiplier : SexAppraisalModifier
|
||||
{
|
||||
public float multiplier = 1f;
|
||||
|
||||
public override void ModifyValue(Pawn quirkOwner, Pawn partner, ref float value)
|
||||
{
|
||||
value *= multiplier;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (multiplier == 1f)
|
||||
{
|
||||
yield return "<multiplier> is empty or is 1";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
public class SexAppraisalModifier_SetValue : SexAppraisalModifier
|
||||
{
|
||||
public float value;
|
||||
|
||||
public override void ModifyValue(Pawn quirkOwner, Pawn partner, ref float value)
|
||||
{
|
||||
value = this.value;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (value <= 0f)
|
||||
{
|
||||
yield return "<value> must be > 0";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
37
RJW-Quirks/Modules/Quirks/Comps/ThoughtAdder.cs
Normal file
37
RJW-Quirks/Modules/Quirks/Comps/ThoughtAdder.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for the comps that add thoughts to the pawn
|
||||
/// </summary>
|
||||
public abstract class ThoughtAdder : QuirkComp
|
||||
{
|
||||
public ThoughtDef thought;
|
||||
|
||||
/// <summary>
|
||||
/// Add <see cref="thought"/> to the <paramref name="pawn"/>
|
||||
/// </summary>
|
||||
public void ApplyThought(Pawn pawn, Pawn partner) => pawn.needs?.mood?.thoughts?.memories?.TryGainMemory(thought, partner);
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (thought == null)
|
||||
{
|
||||
yield return "<thought> is empty";
|
||||
}
|
||||
|
||||
if (eventDef == null)
|
||||
{
|
||||
yield return "<eventDef> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
30
RJW-Quirks/Modules/Quirks/Comps/ThoughtAdder_OnSexEvent.cs
Normal file
30
RJW-Quirks/Modules/Quirks/Comps/ThoughtAdder_OnSexEvent.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using rjw;
|
||||
using rjwquirks.Modules.Shared.Events;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
/// <summary>
|
||||
/// Base class for the comps that add thoughts on RJW event with SexProps argument
|
||||
/// </summary>
|
||||
public abstract class ThoughtAdder_OnSexEvent : ThoughtAdder
|
||||
{
|
||||
/// <summary>
|
||||
/// Check if thought should be applied
|
||||
/// </summary>
|
||||
public abstract bool ShouldApplyThought(SexProps props);
|
||||
|
||||
protected override void HandleEvent(RjwEvent ev)
|
||||
{
|
||||
if (!ev.args.TryGetArg(RjwEventArgNames.SexProps, out SexProps props))
|
||||
{
|
||||
ModLog.Error($"{GetType()}.HandleEvent: No SexProps in the event");
|
||||
return;
|
||||
}
|
||||
|
||||
if (ShouldApplyThought(props))
|
||||
{
|
||||
ApplyThought(props.pawn, props.partner);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
public class ThoughtAdder_OnSexEvent_NonPreferred : ThoughtAdder_OnSexEvent
|
||||
{
|
||||
public override bool ShouldApplyThought(SexProps props) => !parent.IsSatisfiedBySex(props);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
public class ThoughtAdder_OnSexEvent_Preferred : ThoughtAdder_OnSexEvent
|
||||
{
|
||||
public override bool ShouldApplyThought(SexProps props) => parent.IsSatisfiedBySex(props);
|
||||
}
|
||||
}
|
36
RJW-Quirks/Modules/Quirks/Comps/ValueModifier.cs
Normal file
36
RJW-Quirks/Modules/Quirks/Comps/ValueModifier.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
public abstract class ValueModifier : QuirkComp
|
||||
{
|
||||
public string valueName;
|
||||
public QuirkModifierPriority priority = QuirkModifierPriority.Normal;
|
||||
|
||||
public void TryModifyValue(string valueName, ref float value)
|
||||
{
|
||||
if (this.valueName != valueName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ModifyValue(ref value);
|
||||
}
|
||||
|
||||
public abstract void ModifyValue(ref float value);
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (valueName.NullOrEmpty())
|
||||
{
|
||||
yield return "<valueName> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
public class ValueModifier_ApplyMultiplier : ValueModifier
|
||||
{
|
||||
public float multiplier = 1f;
|
||||
|
||||
public override void ModifyValue(ref float value)
|
||||
{
|
||||
value *= multiplier;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (multiplier == 1f)
|
||||
{
|
||||
yield return "<multiplier> is empty or is 1";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
27
RJW-Quirks/Modules/Quirks/Comps/ValueModifier_ApplyOffset.cs
Normal file
27
RJW-Quirks/Modules/Quirks/Comps/ValueModifier_ApplyOffset.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.Comps
|
||||
{
|
||||
public class ValueModifier_ApplyOffset : ValueModifier
|
||||
{
|
||||
public float offset;
|
||||
|
||||
public override void ModifyValue(ref float value)
|
||||
{
|
||||
value += offset;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors(QuirkDef parent)
|
||||
{
|
||||
foreach (string error in base.ConfigErrors(parent))
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (offset == 0f)
|
||||
{
|
||||
yield return "<offset> is empty or is 0";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
111
RJW-Quirks/Modules/Quirks/EventHandlers/QuirkGenerator.cs
Normal file
111
RJW-Quirks/Modules/Quirks/EventHandlers/QuirkGenerator.cs
Normal file
|
@ -0,0 +1,111 @@
|
|||
using rjw;
|
||||
using rjwquirks.Modules.Shared.Events;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.EventHandlers
|
||||
{
|
||||
public class QuirkGenerator : RjwEventHandler
|
||||
{
|
||||
public override void HandleEvent(RjwEvent ev)
|
||||
{
|
||||
if (!ev.args.TryGetArg(RjwEventArgNames.Pawn, out Pawn pawn))
|
||||
{
|
||||
ModLog.Error($"QuirkGenerator recieved {ev.def}, but event has no '{RjwEventArgNames.Pawn}' argument");
|
||||
return;
|
||||
}
|
||||
|
||||
Generate(pawn);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generate quirks for the pawn.
|
||||
/// Caution: Does not clears existing quirks
|
||||
/// </summary>
|
||||
public static void Generate(Pawn pawn)
|
||||
{
|
||||
if (!pawn.RaceHasSexNeed() || (pawn.kindDef.race.defName.ToLower().Contains("droid") && !AndroidsCompatibility.IsAndroid(pawn)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QuirkSet quirks = pawn.GetQuirks();
|
||||
|
||||
if (pawn.IsAnimal())
|
||||
{
|
||||
GenerateForAnimal(quirks);
|
||||
}
|
||||
else
|
||||
{
|
||||
GenerateForHumanlike(quirks);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rolls an X number between 0 and max quirks setting.
|
||||
/// Tries to add random quirks to the QuirkSet until X are added or out of available quirks.
|
||||
/// </summary>
|
||||
static void GenerateForHumanlike(QuirkSet quirks)
|
||||
{
|
||||
var count = Rand.RangeInclusive(0, RJWPreferenceSettings.MaxQuirks);
|
||||
var availableQuirks = DefDatabase<QuirkDef>.AllDefsListForReading
|
||||
.Where(def => def.rarity != QuirkRarity.ForcedOnly) // Have to earn these
|
||||
.ToArray(); // ToArray to get a shuffleable copy
|
||||
availableQuirks.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.
|
||||
foreach (var quirkDef in availableQuirks)
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!quirks.CanBeAdded(quirkDef))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
count--;
|
||||
quirks.AddQuirk(quirkDef);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Original method rolled 10% chance on 3 hardcoded animal quirks.
|
||||
/// This implementation takes MaxQuirks (3 by default) number of quirks from
|
||||
/// available for animals and rolls 10% chance for each
|
||||
/// </summary>
|
||||
static void GenerateForAnimal(QuirkSet quirks)
|
||||
{
|
||||
int count = RJWPreferenceSettings.MaxQuirks;
|
||||
var availableQuirks = DefDatabase<QuirkDef>.AllDefsListForReading
|
||||
.Where(def => def.rarity != QuirkRarity.ForcedOnly)
|
||||
.ToArray();
|
||||
availableQuirks.Shuffle();
|
||||
|
||||
foreach (var quirkDef in availableQuirks)
|
||||
{
|
||||
if (count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
if (!quirks.CanBeAdded(quirkDef))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
count--;
|
||||
|
||||
if (Rand.Chance(0.1f))
|
||||
{
|
||||
quirks.AddQuirk(quirkDef);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using rjw;
|
||||
using rjwquirks.Modules.Shared.Events;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.EventHandlers
|
||||
{
|
||||
/// <summary>
|
||||
/// Handler that passes RJW events to a single quirk
|
||||
/// </summary>
|
||||
public class QuirkRjwEventHandler : RjwEventHandler
|
||||
{
|
||||
public override void HandleEvent(RjwEvent ev)
|
||||
{
|
||||
if (!ev.args.TryGetArg(RjwEventArgNames.Quirk, out Quirk quirk))
|
||||
{
|
||||
ModLog.Error($"QuirkRjwEventHandler recieved {ev.def}, but event has no '{RjwEventArgNames.Quirk}' argument");
|
||||
return;
|
||||
}
|
||||
|
||||
quirk.NotifyEvent(ev);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
using rjw;
|
||||
using rjwquirks.Modules.Shared.Events;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.EventHandlers
|
||||
{
|
||||
/// <summary>
|
||||
/// Handler that passes RJW events to all quirks of a pawn
|
||||
/// </summary>
|
||||
public class QuirkSetRjwEventHandler : RjwEventHandler
|
||||
{
|
||||
public override void HandleEvent(RjwEvent ev)
|
||||
{
|
||||
ev.args.TryGetArg(RjwEventArgNames.Pawn, out Pawn pawn);
|
||||
|
||||
if (pawn == null && ev.args.TryGetArg(RjwEventArgNames.SexProps, out SexProps props))
|
||||
{
|
||||
pawn = props.pawn;
|
||||
}
|
||||
|
||||
if (pawn == null)
|
||||
{
|
||||
ModLog.Error($"QuirkSetRjwEventHandler recieved {ev.def}, but event has neither '{RjwEventArgNames.Pawn}' or '{RjwEventArgNames.SexProps}' argument");
|
||||
return;
|
||||
}
|
||||
|
||||
pawn.GetQuirks().NotifyEvent(ev);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using rjwquirks.Modules.Shared.Events;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.EventHandlers
|
||||
{
|
||||
/// <summary>
|
||||
/// Handler that passes RJW events a particular comps of an unassigned QuirkDef
|
||||
/// </summary>
|
||||
public class RecordChangedRjwEventHandler : RjwEventHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Records that have associated quirk adder def comps.
|
||||
/// Used to quickly filter out updates of irrelevant records.
|
||||
/// </summary>
|
||||
private static Dictionary<RecordDef, List<Comps.Adder_OnRecordExceeding>> _recordsWithAdder;
|
||||
|
||||
public override void HandleEvent(RjwEvent ev)
|
||||
{
|
||||
if (ev.def != RjwEventDefOf.RecordChanged)
|
||||
{
|
||||
ModLog.Warning($"RecordChangedRjwEventHandler recieved {ev.def}, but it only handles RecordChanged event");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_recordsWithAdder == null)
|
||||
{
|
||||
BuildAdderCache();
|
||||
}
|
||||
|
||||
if (!ev.args.TryGetArg(RjwEventArgNames.Record, out RecordDef recordDef))
|
||||
{
|
||||
ModLog.Error($"RecordChangedRjwEventHandler recieved {ev.def}, but event has no '{RjwEventArgNames.Record}' argument");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_recordsWithAdder.TryGetValue(recordDef, out var comps))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var comp in comps)
|
||||
{
|
||||
// Send message to the def comps directly because the quirk is not assigned to a pawn yet
|
||||
comp.NotifyEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds _recordsWithAdder dictionary
|
||||
/// </summary>
|
||||
private static void BuildAdderCache()
|
||||
{
|
||||
_recordsWithAdder = new Dictionary<RecordDef, List<Comps.Adder_OnRecordExceeding>>();
|
||||
|
||||
foreach (var comp in DefDatabase<QuirkDef>.AllDefs.SelectMany(def => def.GetComps<Comps.Adder_OnRecordExceeding>()))
|
||||
{
|
||||
if (_recordsWithAdder.TryGetValue(comp.record, out var comps))
|
||||
{
|
||||
comps.Add(comp);
|
||||
}
|
||||
else
|
||||
{
|
||||
_recordsWithAdder[comp.record] = new List<Comps.Adder_OnRecordExceeding>() { comp };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
58
RJW-Quirks/Modules/Quirks/OwnerRequirement.cs
Normal file
58
RJW-Quirks/Modules/Quirks/OwnerRequirement.cs
Normal file
|
@ -0,0 +1,58 @@
|
|||
using rjwquirks.Modules.Shared.PawnSelectors;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks
|
||||
{
|
||||
/// <summary>
|
||||
/// Class to check if quirk can be assigned to a pawn
|
||||
/// </summary>
|
||||
public class OwnerRequirement
|
||||
{
|
||||
/// <summary>
|
||||
/// Requirement conditions
|
||||
/// </summary>
|
||||
public IPawnSelector pawnSelector;
|
||||
|
||||
/// <summary>
|
||||
/// Translation key for a displayed reason why quirk can't be assigned to a pawn
|
||||
/// </summary>
|
||||
[NoTranslate]
|
||||
public string rejectionReason;
|
||||
|
||||
/// <summary>
|
||||
/// Check if pawn satisfies requirement conditions
|
||||
/// </summary>
|
||||
public AcceptanceReport CheckBeforeAdd(Pawn pawn)
|
||||
{
|
||||
if (pawnSelector?.PawnSatisfies(pawn) == true)
|
||||
{
|
||||
return AcceptanceReport.WasAccepted;
|
||||
}
|
||||
else
|
||||
{
|
||||
return new AcceptanceReport(rejectionReason.Translate());
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
if (pawnSelector == null)
|
||||
{
|
||||
yield return "<pawnSelector> is empty";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (string error in pawnSelector.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
}
|
||||
|
||||
if (rejectionReason.NullOrEmpty())
|
||||
{
|
||||
yield return "<rejectionReason> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
71
RJW-Quirks/Modules/Quirks/Quirk.cs
Normal file
71
RJW-Quirks/Modules/Quirks/Quirk.cs
Normal file
|
@ -0,0 +1,71 @@
|
|||
using rjwquirks.Modules.Shared.Events;
|
||||
using System.Text;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks
|
||||
{
|
||||
public class Quirk : IExposable
|
||||
{
|
||||
public QuirkDef def;
|
||||
public Pawn pawn;
|
||||
|
||||
/// <summary>
|
||||
/// Adjusted for the owner and cached quirk description
|
||||
/// </summary>
|
||||
public string Description
|
||||
{
|
||||
get
|
||||
{
|
||||
if (descriptionCache == null)
|
||||
{
|
||||
// Description bulding is a fairly pricy operation
|
||||
descriptionCache = def.GetDescriptionFor(pawn);
|
||||
}
|
||||
return descriptionCache;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gender specific quirk label
|
||||
/// </summary>
|
||||
public string Label => def.GetLabelFor(pawn);
|
||||
|
||||
protected string descriptionCache;
|
||||
|
||||
/// <summary>
|
||||
/// For save loading only
|
||||
/// </summary>
|
||||
public Quirk() { }
|
||||
|
||||
public Quirk(QuirkDef def, Pawn pawn)
|
||||
{
|
||||
this.def = def;
|
||||
this.pawn = pawn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pass RJW event to all comps of this quirk's def
|
||||
/// </summary>
|
||||
public void NotifyEvent(RjwEvent ev) => def.comps.ForEach(comp => comp.NotifyEvent(ev));
|
||||
|
||||
public string TipString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.AppendLine(Label.Colorize(UnityEngine.Color.yellow));
|
||||
stringBuilder.Append(Description);
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
public void ExposeData()
|
||||
{
|
||||
Scribe_Defs.Look(ref def, "def");
|
||||
|
||||
if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs && def == null)
|
||||
{
|
||||
def = DefDatabase<QuirkDef>.GetRandom();
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() => $"Quirk({def})";
|
||||
}
|
||||
}
|
147
RJW-Quirks/Modules/Quirks/QuirkDef.cs
Normal file
147
RJW-Quirks/Modules/Quirks/QuirkDef.cs
Normal file
|
@ -0,0 +1,147 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using rjwquirks.Modules.Quirks.Comps;
|
||||
using rjwquirks.Modules.Quirks.SexSelectors;
|
||||
using rjwquirks.Modules.Shared.PawnSelectors;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks
|
||||
{
|
||||
public class QuirkDef : Def
|
||||
{
|
||||
[MustTranslate]
|
||||
public string labelMale;
|
||||
[MustTranslate]
|
||||
public string labelFemale;
|
||||
public QuirkRarity rarity = QuirkRarity.Common;
|
||||
public bool hidden;
|
||||
public IPartnerSelector partnerPreference;
|
||||
public ISexSelector sexPreference;
|
||||
public List<OwnerRequirement> ownerRequirements = new List<OwnerRequirement>();
|
||||
public List<QuirkComp> comps = new List<QuirkComp>();
|
||||
public List<QuirkDef> conflictingQuirks = new List<QuirkDef>();
|
||||
public List<TraitDef> conflictingTraits = new List<TraitDef>();
|
||||
public List<string> exclusionTags = new List<string>();
|
||||
|
||||
public string GetLabelFor(Gender gender)
|
||||
{
|
||||
if (gender == Gender.Male && !labelMale.NullOrEmpty())
|
||||
{
|
||||
return labelMale;
|
||||
}
|
||||
|
||||
if (gender == Gender.Female && !labelFemale.NullOrEmpty())
|
||||
{
|
||||
return labelFemale;
|
||||
}
|
||||
|
||||
return label;
|
||||
}
|
||||
|
||||
public string GetLabelFor(Pawn pawn) => GetLabelFor(pawn?.gender ?? Gender.None);
|
||||
|
||||
public IEnumerable<T> GetComps<T>() where T : QuirkComp
|
||||
{
|
||||
for (int i = 0; i < comps.Count; i++)
|
||||
{
|
||||
if (comps[i] is T compT)
|
||||
yield return compT;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsSatisfiedBySex(SexProps props) => sexPreference?.SexSatisfies(props) == true;
|
||||
|
||||
public bool ConflictsWith(QuirkDef other)
|
||||
{
|
||||
if (other.conflictingQuirks?.Contains(this) == true || conflictingQuirks?.Contains(other) == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (exclusionTags != null && other.exclusionTags != null)
|
||||
{
|
||||
for (int i = 0; i < exclusionTags.Count; i++)
|
||||
{
|
||||
if (other.exclusionTags.Contains(exclusionTags[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool ConflictsWith(TraitDef traitDef)
|
||||
{
|
||||
if (/*traitDef.conflictingQuirks?.Contains(this) == true || */conflictingTraits?.Contains(traitDef) == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (exclusionTags != null && traitDef.exclusionTags != null)
|
||||
{
|
||||
for (int i = 0; i < exclusionTags.Count; i++)
|
||||
{
|
||||
if (traitDef.exclusionTags.Contains(exclusionTags[i]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public string GetDescriptionFor(Pawn pawn) => description.Formatted(pawn.Named("pawn")).AdjustedFor(pawn).Resolve();
|
||||
|
||||
public override void PostLoad()
|
||||
{
|
||||
base.PostLoad();
|
||||
|
||||
foreach (QuirkComp comp in comps)
|
||||
{
|
||||
comp.parent = this;
|
||||
}
|
||||
|
||||
sexPreference?.SetParent(this);
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (partnerPreference != null)
|
||||
{
|
||||
foreach (string error in partnerPreference.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
}
|
||||
|
||||
if (sexPreference != null)
|
||||
{
|
||||
foreach (string error in sexPreference.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (OwnerRequirement req in ownerRequirements)
|
||||
{
|
||||
foreach (string error in req.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (QuirkComp comp in comps)
|
||||
{
|
||||
foreach (string error in comp.ConfigErrors(this))
|
||||
{
|
||||
yield return $"{comp.GetType()}: {error}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
15
RJW-Quirks/Modules/Quirks/QuirkDefOf.cs
Normal file
15
RJW-Quirks/Modules/Quirks/QuirkDefOf.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using RimWorld;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks
|
||||
{
|
||||
[DefOf]
|
||||
public static class QuirkDefOf
|
||||
{
|
||||
public static readonly QuirkDef Breeder;
|
||||
public static readonly QuirkDef Endytophile;
|
||||
public static readonly QuirkDef Exhibitionist;
|
||||
public static readonly QuirkDef ImpregnationFetish;
|
||||
public static readonly QuirkDef Incubator;
|
||||
public static readonly QuirkDef Somnophile;
|
||||
}
|
||||
}
|
11
RJW-Quirks/Modules/Quirks/QuirkModifierPriority.cs
Normal file
11
RJW-Quirks/Modules/Quirks/QuirkModifierPriority.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace rjwquirks.Modules.Quirks
|
||||
{
|
||||
public enum QuirkModifierPriority
|
||||
{
|
||||
First,
|
||||
High,
|
||||
Normal,
|
||||
Low,
|
||||
Last
|
||||
}
|
||||
}
|
8
RJW-Quirks/Modules/Quirks/QuirkRarity.cs
Normal file
8
RJW-Quirks/Modules/Quirks/QuirkRarity.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace rjwquirks.Modules.Quirks
|
||||
{
|
||||
public enum QuirkRarity
|
||||
{
|
||||
ForcedOnly,
|
||||
Common
|
||||
}
|
||||
}
|
339
RJW-Quirks/Modules/Quirks/QuirkSet.cs
Normal file
339
RJW-Quirks/Modules/Quirks/QuirkSet.cs
Normal file
|
@ -0,0 +1,339 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using rjwquirks.Modules.Shared.Events;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks
|
||||
{
|
||||
/// <summary>
|
||||
/// A collection/tracker of pawn's quirks
|
||||
/// </summary>
|
||||
public class QuirkSet : ThingComp
|
||||
{
|
||||
protected Pawn pawn;
|
||||
protected List<Quirk> quirks = new List<Quirk>();
|
||||
|
||||
public QuirkSet() { }
|
||||
|
||||
public override void PostSpawnSetup(bool respawningAfterLoad)
|
||||
{
|
||||
base.PostSpawnSetup(respawningAfterLoad);
|
||||
|
||||
pawn = parent as Pawn;
|
||||
|
||||
/*if (pawn.kindDef.race.defName.Contains("AIRobot") // No genitalia/sexuality for roombas.
|
||||
|| pawn.kindDef.race.defName.Contains("AIPawn") // ...nor MAI.
|
||||
|| pawn.kindDef.race.defName.Contains("RPP_Bot")
|
||||
|| pawn.kindDef.race.defName.Contains("PRFDrone") // Project RimFactory Revived drones
|
||||
) return;*/
|
||||
|
||||
if (Scribe.mode == LoadSaveMode.LoadingVars && quirks == null)
|
||||
{
|
||||
// Try to restore quirks from old save
|
||||
string quirksave = string.Empty;
|
||||
Scribe_Values.Look(ref quirksave, "RJW_Quirks");
|
||||
if (!quirksave.NullOrEmpty()) // May be pawn really has no quirks
|
||||
{
|
||||
ParseQuirkSave(quirksave);
|
||||
}
|
||||
}
|
||||
else if (quirks.NullOrEmpty())
|
||||
{
|
||||
//add random quirk gen and shit later/last
|
||||
AddQuirk(QuirkDefOf.Incubator);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// QuirkSet owner
|
||||
/// </summary>
|
||||
public Pawn Pawn => pawn;
|
||||
/// <summary>
|
||||
/// Read-only collection of pawn quirks
|
||||
/// </summary>
|
||||
public IReadOnlyCollection<Quirk> AllQuirks => quirks.AsReadOnly();
|
||||
|
||||
/// <summary>
|
||||
/// Try to add a quirk of <paramref name="quirkDef"/> to the pawn
|
||||
/// </summary>
|
||||
/// <param name="quirkDef">Def of quirk to add</param>
|
||||
/// <param name="ignoreChecks">Ignore all restrictions and "just do it"</param>
|
||||
/// <returns>Added quirk or null if addiction failed</returns>
|
||||
public Quirk AddQuirk(QuirkDef quirkDef, bool ignoreChecks = false)
|
||||
{
|
||||
Quirk quirk = new Quirk(quirkDef, pawn);
|
||||
|
||||
if (AddQuirk(quirk, ignoreChecks).Accepted)
|
||||
{
|
||||
return quirk;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to add the <paramref name="quirk"/> to the pawn
|
||||
/// </summary>
|
||||
/// <param name="quirk">Quirk to add</param>
|
||||
/// <param name="ignoreChecks">Ignore all restrictions and "just do it"</param>
|
||||
/// <returns>AcceptanceReport</returns>
|
||||
protected AcceptanceReport AddQuirk(Quirk quirk, bool ignoreChecks = false)
|
||||
{
|
||||
if (!ignoreChecks)
|
||||
{
|
||||
AcceptanceReport report = CanBeAdded(quirk.def);
|
||||
if (!report.Accepted)
|
||||
{
|
||||
return report;
|
||||
}
|
||||
}
|
||||
|
||||
quirks.Add(quirk);
|
||||
RjwEventManager.NotifyEvent(new RjwEvent(RjwEventDefOf.QuirkAddedTo, pawn.Named(RjwEventArgNames.Pawn), quirk.Named(RjwEventArgNames.Quirk)));
|
||||
return AcceptanceReport.WasAccepted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to remove the <paramref name="quirk"/> from the pawn
|
||||
/// </summary>
|
||||
/// <param name="quirk">Quirk to remove</param>
|
||||
/// <param name="ignoreChecks">Ignore all restrictions and "just do it"</param>
|
||||
/// <returns>AcceptanceReport</returns>
|
||||
public AcceptanceReport RemoveQuirk(Quirk quirk, bool ignoreChecks = false)
|
||||
{
|
||||
if (!ignoreChecks)
|
||||
{
|
||||
AcceptanceReport report = CanBeRemoved(quirk.def);
|
||||
if (!report.Accepted)
|
||||
{
|
||||
return report;
|
||||
}
|
||||
}
|
||||
|
||||
bool result = quirks.Remove(quirk);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
if (quirks.Contains(quirk))
|
||||
{
|
||||
ModLog.Warning($"Tried to remove {quirk.Label} quirk from {pawn} but failed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
ModLog.Warning($"Trying to remove {quirk.Label} quirk but {pawn} doesn't have it.");
|
||||
}
|
||||
return AcceptanceReport.WasRejected;
|
||||
}
|
||||
|
||||
RjwEventManager.NotifyEvent(new RjwEvent(RjwEventDefOf.QuirkRemovedFrom, pawn.Named(RjwEventArgNames.Pawn), quirk.Named(RjwEventArgNames.Quirk)));
|
||||
return AcceptanceReport.WasAccepted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a quirk of <paramref name="quirkDef"/> can be added to the pawn
|
||||
/// </summary>
|
||||
public AcceptanceReport CanBeAdded(QuirkDef quirkDef)
|
||||
{
|
||||
if (Contains(quirkDef))
|
||||
{
|
||||
return AcceptanceReport.WasRejected;
|
||||
}
|
||||
|
||||
foreach (OwnerRequirement req in quirkDef.ownerRequirements)
|
||||
{
|
||||
AcceptanceReport report = req.CheckBeforeAdd(pawn);
|
||||
if (!report.Accepted)
|
||||
{
|
||||
return report;
|
||||
}
|
||||
}
|
||||
|
||||
if (quirks.Find(quirk => quirk.def.ConflictsWith(quirkDef)) is Quirk quirked)
|
||||
{
|
||||
return new AcceptanceReport("ConflictsWithQuirk".Translate(quirked.Label));
|
||||
}
|
||||
|
||||
if (Pawn?.story?.traits?.allTraits is List<Trait> traits)
|
||||
{
|
||||
foreach (Trait trait in traits)
|
||||
{
|
||||
if (quirks.Find(quirk => quirk.def.ConflictsWith(trait.def)) != null)
|
||||
{
|
||||
return new AcceptanceReport("ConflictsWithTrait".Translate(trait.LabelCap));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return AcceptanceReport.WasAccepted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if a quirk of <paramref name="quirkDef"/> can be removed from the pawn
|
||||
/// </summary>
|
||||
public AcceptanceReport CanBeRemoved(QuirkDef quirkDef)
|
||||
{
|
||||
if (!Contains(quirkDef))
|
||||
{
|
||||
return AcceptanceReport.WasRejected;
|
||||
}
|
||||
|
||||
if (quirkDef.rarity == QuirkRarity.ForcedOnly)
|
||||
{
|
||||
return new AcceptanceReport("CannotRemoveForced".Translate());
|
||||
}
|
||||
|
||||
return AcceptanceReport.WasAccepted;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the pawn has a quirk of <paramref name="quirkDef"/>
|
||||
/// </summary>
|
||||
public bool Contains(QuirkDef quirkDef)
|
||||
{
|
||||
for (int i = 0; i < quirks.Count; i++)
|
||||
{
|
||||
if (quirks[i].def == quirkDef)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a quirk of <paramref name="quirkDef"/>
|
||||
/// </summary>
|
||||
public Quirk GetQuirk(QuirkDef quirkDef)
|
||||
{
|
||||
for (int i = 0; i < quirks.Count; i++)
|
||||
{
|
||||
if (quirks[i].def == quirkDef)
|
||||
{
|
||||
return quirks[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove all quirks from the pawn
|
||||
/// </summary>
|
||||
/// <param name="ignoreChecks">even quirks that can't be removed normaly</param>
|
||||
public void Clear(bool ignoreChecks = false) => new List<Quirk>(quirks).ForEach(quirk => RemoveQuirk(quirk, ignoreChecks));
|
||||
|
||||
/// <summary>
|
||||
/// Get a collection of quirks that are satified by a particular sex act
|
||||
/// </summary>
|
||||
public IEnumerable<Quirk> GetSatisfiedBySex(SexProps props) => quirks.Where(quirk => quirk.def.IsSatisfiedBySex(props));
|
||||
|
||||
/// <summary>
|
||||
/// Pass the RJW event to every quirk of the pawn
|
||||
/// </summary>
|
||||
public void NotifyEvent(RjwEvent ev) => quirks.ForEach(quirk => quirk.NotifyEvent(ev));
|
||||
|
||||
public void ApplySexAppraisalModifiers(Pawn partner, string factorName, ref float value)
|
||||
{
|
||||
foreach (var comp in quirks.SelectMany(quirk => quirk.def.GetComps<Comps.SexAppraisalModifier>())
|
||||
.Where(comp => comp.factorName == factorName)
|
||||
.OrderBy(comp => comp.priority))
|
||||
{
|
||||
comp.TryModifyValue(pawn, partner, factorName, ref value);
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyValueModifiers(string valueName, ref float value)
|
||||
{
|
||||
foreach (var comp in quirks.SelectMany(quirk => quirk.def.GetComps<Comps.ValueModifier>())
|
||||
.Where(comp => comp.valueName == valueName)
|
||||
.OrderBy(comp => comp.priority))
|
||||
{
|
||||
comp.TryModifyValue(valueName, ref value);
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyValueModifiers(string valueName, ref int value)
|
||||
{
|
||||
float valueF = value;
|
||||
ApplyValueModifiers(valueName, ref valueF);
|
||||
value = (int)valueF;
|
||||
}
|
||||
|
||||
public override void PostExposeData()
|
||||
{
|
||||
base.PostExposeData();
|
||||
|
||||
Scribe_Collections.Look(ref quirks, "allQuirks", LookMode.Deep);
|
||||
|
||||
if (Scribe.mode == LoadSaveMode.LoadingVars)
|
||||
{
|
||||
if (quirks.RemoveAll((x) => x == null) != 0)
|
||||
{
|
||||
Log.Error("Some quirks were null after loading.");
|
||||
}
|
||||
if (quirks.RemoveAll((x) => x.def == null) != 0)
|
||||
{
|
||||
Log.Error("Some quirks had null def after loading.");
|
||||
}
|
||||
for (int i = 0; i < quirks.Count; i++)
|
||||
{
|
||||
quirks[i].pawn = pawn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string TipString()
|
||||
{
|
||||
if (quirks.Count == 0)
|
||||
{
|
||||
return "NoQuirks".Translate();
|
||||
}
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
foreach (var quirk in quirks.OrderBy(q => q.Label))
|
||||
{
|
||||
stringBuilder.AppendLine(quirk.TipString());
|
||||
stringBuilder.AppendLine("");
|
||||
}
|
||||
|
||||
return stringBuilder.ToString().TrimEndNewlines();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fill the QuirkSet from a legacy save string
|
||||
/// </summary>
|
||||
public void ParseQuirkSave(string quirksave)
|
||||
{
|
||||
if (quirksave == "None")
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (string name in quirksave.Split(','))
|
||||
{
|
||||
if (name.NullOrEmpty())
|
||||
continue;
|
||||
|
||||
string defName = name.Trim();
|
||||
|
||||
// Old keys doubled as labels. But we can't rely on that becaule def.label can be localized
|
||||
if (defName.Contains(" "))
|
||||
{
|
||||
// To PascalCase
|
||||
defName = defName.Split(' ').Select(part => part.CapitalizeFirst()).Aggregate((x, y) => x + y);
|
||||
}
|
||||
|
||||
QuirkDef def = DefDatabase<QuirkDef>.GetNamed(defName);
|
||||
|
||||
if (def == null)
|
||||
continue;
|
||||
|
||||
quirks.Add(new Quirk(def, pawn));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
RJW-Quirks/Modules/Quirks/SexSelectors/BySextype.cs
Normal file
25
RJW-Quirks/Modules/Quirks/SexSelectors/BySextype.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class BySextype : SexSelector
|
||||
{
|
||||
public xxx.rjwSextype sextype = xxx.rjwSextype.None;
|
||||
|
||||
public override bool SexSatisfies(SexProps sexProps) => sexProps.hasPartner() && sexProps.sexType == sextype;
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (sextype == xxx.rjwSextype.None)
|
||||
{
|
||||
yield return "<sextype> is not filled or has value \"None\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class CanBeImpregnated : SexSelector
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps) => sexProps.hasPartner() && PregnancyHelper.CanImpregnate(sexProps.partner, sexProps.pawn, sexProps.sexType);
|
||||
}
|
||||
}
|
9
RJW-Quirks/Modules/Quirks/SexSelectors/CanImpregnate.cs
Normal file
9
RJW-Quirks/Modules/Quirks/SexSelectors/CanImpregnate.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class CanImpregnate : SexSelector
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps) => sexProps.hasPartner() && PregnancyHelper.CanImpregnate(sexProps.pawn, sexProps.partner, sexProps.sexType);
|
||||
}
|
||||
}
|
9
RJW-Quirks/Modules/Quirks/SexSelectors/Clothed.cs
Normal file
9
RJW-Quirks/Modules/Quirks/SexSelectors/Clothed.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class Clothed : SexSelector
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps) => !sexProps.pawn.apparel.PsychologicallyNude;
|
||||
}
|
||||
}
|
10
RJW-Quirks/Modules/Quirks/SexSelectors/ISexSelector.cs
Normal file
10
RJW-Quirks/Modules/Quirks/SexSelectors/ISexSelector.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public interface ISexSelector : Shared.IDefPart
|
||||
{
|
||||
void SetParent(QuirkDef quirkDef);
|
||||
bool SexSatisfies(SexProps sexProps);
|
||||
}
|
||||
}
|
20
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalAnd.cs
Normal file
20
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalAnd.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class LogicalAnd : LogicalMultipart
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps)
|
||||
{
|
||||
for (int i = 0; i < parts.Count; i++)
|
||||
{
|
||||
if (!parts[i].SexSatisfies(sexProps))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
36
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalMultipart.cs
Normal file
36
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalMultipart.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public abstract class LogicalMultipart : SexSelector
|
||||
{
|
||||
public List<ISexSelector> parts = new List<ISexSelector>();
|
||||
|
||||
public override void SetParent(QuirkDef quirkDef)
|
||||
{
|
||||
base.SetParent(quirkDef);
|
||||
parts.ForEach(selector => selector.SetParent(quirkDef));
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (parts.Count < 2)
|
||||
{
|
||||
yield return "<parts> should have at least 2 elements";
|
||||
}
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
foreach (string error in part.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
39
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalNot.cs
Normal file
39
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalNot.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class LogicalNot : SexSelector
|
||||
{
|
||||
public ISexSelector negated;
|
||||
|
||||
public override bool SexSatisfies(SexProps sexProps) => !negated.SexSatisfies(sexProps);
|
||||
|
||||
public override void SetParent(QuirkDef quirkDef)
|
||||
{
|
||||
base.SetParent(quirkDef);
|
||||
negated.SetParent(quirkDef);
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (negated == null)
|
||||
{
|
||||
yield return "<negated> is empty";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (string error in negated.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalOr.cs
Normal file
20
RJW-Quirks/Modules/Quirks/SexSelectors/LogicalOr.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class LogicalOr : LogicalMultipart
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps)
|
||||
{
|
||||
for (int i = 0; i < parts.Count; i++)
|
||||
{
|
||||
if (parts[i].SexSatisfies(sexProps))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
23
RJW-Quirks/Modules/Quirks/SexSelectors/Seen.cs
Normal file
23
RJW-Quirks/Modules/Quirks/SexSelectors/Seen.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using rjw;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class Seen : SexSelector
|
||||
{
|
||||
// Current implementation works only if somebody sees pawn exactly at the moment quirks are evaluated
|
||||
public override bool SexSatisfies(SexProps sexProps) => sexProps.hasPartner() && SexSeen(sexProps);
|
||||
|
||||
public static bool SexSeen(SexProps sexProps)
|
||||
{
|
||||
bool isZoophile = xxx.is_zoophile(sexProps.pawn);
|
||||
return sexProps.pawn.Map.mapPawns.AllPawnsSpawned.Any(x =>
|
||||
x != sexProps.pawn
|
||||
&& x != sexProps.partner
|
||||
&& !x.Dead
|
||||
&& (isZoophile || !xxx.is_animal(x))
|
||||
&& x.CanSee(sexProps.pawn));
|
||||
}
|
||||
}
|
||||
}
|
19
RJW-Quirks/Modules/Quirks/SexSelectors/SexSelector.cs
Normal file
19
RJW-Quirks/Modules/Quirks/SexSelectors/SexSelector.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public abstract class SexSelector : ISexSelector
|
||||
{
|
||||
protected QuirkDef parentDef;
|
||||
|
||||
public abstract bool SexSatisfies(SexProps sexProps);
|
||||
|
||||
public virtual void SetParent(QuirkDef quirkDef) => parentDef = quirkDef;
|
||||
|
||||
public virtual IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
using rjw;
|
||||
|
||||
namespace rjwquirks.Modules.Quirks.SexSelectors
|
||||
{
|
||||
public class WithPreferedPartner : SexSelector
|
||||
{
|
||||
public override bool SexSatisfies(SexProps sexProps) => sexProps.hasPartner() && parentDef.partnerPreference?.PartnerSatisfies(sexProps.pawn, sexProps.partner) == true;
|
||||
}
|
||||
}
|
21
RJW-Quirks/Modules/Shared/Events/RjwEvent.cs
Normal file
21
RJW-Quirks/Modules/Shared/Events/RjwEvent.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.Events
|
||||
{
|
||||
/// <summary>
|
||||
/// Copy of the HistoryEvent.
|
||||
/// Made it it's own thing because it use cases are different
|
||||
/// </summary>
|
||||
public struct RjwEvent
|
||||
{
|
||||
public RjwEventDef def;
|
||||
public SignalArgs args;
|
||||
|
||||
public RjwEvent(RjwEventDef def, params NamedArgument[] args)
|
||||
{
|
||||
this.def = def;
|
||||
this.args = new SignalArgs(args);
|
||||
}
|
||||
}
|
||||
}
|
11
RJW-Quirks/Modules/Shared/Events/RjwEventArgNames.cs
Normal file
11
RJW-Quirks/Modules/Shared/Events/RjwEventArgNames.cs
Normal file
|
@ -0,0 +1,11 @@
|
|||
namespace rjwquirks.Modules.Shared.Events
|
||||
{
|
||||
public static class RjwEventArgNames
|
||||
{
|
||||
public static readonly string Pawn = "Pawn";
|
||||
public static readonly string SexProps = "SexProps";
|
||||
public static readonly string Quirk = "Quirk";
|
||||
public static readonly string Record = "Record";
|
||||
public static readonly string Satisfaction = "Satisfaction";
|
||||
}
|
||||
}
|
10
RJW-Quirks/Modules/Shared/Events/RjwEventDef.cs
Normal file
10
RJW-Quirks/Modules/Shared/Events/RjwEventDef.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.Events
|
||||
{
|
||||
public class RjwEventDef : Def
|
||||
{
|
||||
public List<string> obligatoryArgs;
|
||||
}
|
||||
}
|
14
RJW-Quirks/Modules/Shared/Events/RjwEventDefOf.cs
Normal file
14
RJW-Quirks/Modules/Shared/Events/RjwEventDefOf.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using RimWorld;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.Events
|
||||
{
|
||||
[DefOf]
|
||||
public static class RjwEventDefOf
|
||||
{
|
||||
public static readonly RjwEventDef QuirkAddedTo;
|
||||
public static readonly RjwEventDef QuirkRemovedFrom;
|
||||
public static readonly RjwEventDef Orgasm;
|
||||
public static readonly RjwEventDef RecordChanged;
|
||||
public static readonly RjwEventDef PawnSexualized;
|
||||
}
|
||||
}
|
8
RJW-Quirks/Modules/Shared/Events/RjwEventHandler.cs
Normal file
8
RJW-Quirks/Modules/Shared/Events/RjwEventHandler.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
namespace rjwquirks.Modules.Shared.Events
|
||||
{
|
||||
public abstract class RjwEventHandler
|
||||
{
|
||||
public RjwEventHandlerDef def;
|
||||
public abstract void HandleEvent(RjwEvent ev);
|
||||
}
|
||||
}
|
45
RJW-Quirks/Modules/Shared/Events/RjwEventHandlerDef.cs
Normal file
45
RJW-Quirks/Modules/Shared/Events/RjwEventHandlerDef.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.Events
|
||||
{
|
||||
public class RjwEventHandlerDef : Def
|
||||
{
|
||||
public Type workerClass;
|
||||
public List<RjwEventDef> handlesEvents;
|
||||
|
||||
private RjwEventHandler _worker;
|
||||
|
||||
public RjwEventHandler Worker
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_worker == null)
|
||||
{
|
||||
_worker = (RjwEventHandler)Activator.CreateInstance(workerClass);
|
||||
_worker.def = this;
|
||||
}
|
||||
return _worker;
|
||||
}
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (workerClass == null)
|
||||
{
|
||||
yield return "<workerClass> is empty";
|
||||
}
|
||||
|
||||
if (handlesEvents == null || handlesEvents.Count == 0)
|
||||
{
|
||||
yield return "<handlesEvents> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
97
RJW-Quirks/Modules/Shared/Events/RjwEventManager.cs
Normal file
97
RJW-Quirks/Modules/Shared/Events/RjwEventManager.cs
Normal file
|
@ -0,0 +1,97 @@
|
|||
using RimWorld;
|
||||
using rjw.Modules.Shared.Logs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.Events
|
||||
{
|
||||
public static class RjwEventManager
|
||||
{
|
||||
private static readonly Dictionary<RjwEventDef, List<RjwEventHandler>> _handlers = BuildHandlerDictionary();
|
||||
private static readonly ILog _logger = LogManager.GetLogger("RjwEventManager");
|
||||
|
||||
/// <summary>
|
||||
/// Routes RJW events to the relevant event handlers based on the def subscriptions
|
||||
/// </summary>
|
||||
public static void NotifyEvent(RjwEvent ev)
|
||||
{
|
||||
//implement own settings later
|
||||
if (Prefs.DevMode)
|
||||
{
|
||||
_logger.Message($"RJW Event {ev.def}{SignalArgsToString(ev.args)}");
|
||||
}
|
||||
|
||||
if (!_handlers.TryGetValue(ev.def, out List<RjwEventHandler> eventHandlers))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Prefs.DevMode)
|
||||
{
|
||||
// Since event args are filled in C#, no reason to waste time checking them outside of the actual mod developement
|
||||
CheckObligatoryArgs(ev);
|
||||
}
|
||||
|
||||
foreach (RjwEventHandler handler in eventHandlers)
|
||||
{
|
||||
try
|
||||
{
|
||||
handler.HandleEvent(ev);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
// suppress exceptions so one bad mod wouldn't break everything
|
||||
_logger.Error($"Handler exception when handling {ev.def}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Dictionary<RjwEventDef, List<RjwEventHandler>> BuildHandlerDictionary()
|
||||
{
|
||||
Dictionary<RjwEventDef, List<RjwEventHandler>> handlers = new Dictionary<RjwEventDef, List<RjwEventHandler>>();
|
||||
|
||||
foreach (RjwEventHandlerDef handlerDef in DefDatabase<RjwEventHandlerDef>.AllDefsListForReading)
|
||||
{
|
||||
foreach (RjwEventDef eventDef in handlerDef.handlesEvents)
|
||||
{
|
||||
if (handlers.ContainsKey(eventDef))
|
||||
{
|
||||
handlers[eventDef].Add(handlerDef.Worker);
|
||||
}
|
||||
else
|
||||
{
|
||||
handlers[eventDef] = new List<RjwEventHandler> { handlerDef.Worker };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return handlers;
|
||||
}
|
||||
|
||||
private static void CheckObligatoryArgs(RjwEvent ev)
|
||||
{
|
||||
foreach (string argName in ev.def.obligatoryArgs)
|
||||
{
|
||||
if (!ev.args.TryGetArg(argName, out _))
|
||||
{
|
||||
_logger.Error($"Got a {ev.def} event without the obligatory argument '{argName}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static string SignalArgsToString(SignalArgs args)
|
||||
{
|
||||
StringBuilder message = new StringBuilder();
|
||||
|
||||
foreach (var arg in args.Args)
|
||||
{
|
||||
message.Append(", ");
|
||||
message.Append(arg);
|
||||
}
|
||||
|
||||
return message.ToString();
|
||||
}
|
||||
}
|
||||
}
|
16
RJW-Quirks/Modules/Shared/IDefPart.cs
Normal file
16
RJW-Quirks/Modules/Shared/IDefPart.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Shared
|
||||
{
|
||||
/// <summary>
|
||||
/// This interface designates that a class is ment to be included in a def and
|
||||
/// instantiated by the Rimworld when the def is loaded
|
||||
/// </summary>
|
||||
public interface IDefPart
|
||||
{
|
||||
/// <summary>
|
||||
/// Needed to be called explicidly in the def's ConfigErrors()
|
||||
/// </summary>
|
||||
IEnumerable<string> ConfigErrors();
|
||||
}
|
||||
}
|
16
RJW-Quirks/Modules/Shared/Selectors/IPartnerSelector.cs
Normal file
16
RJW-Quirks/Modules/Shared/Selectors/IPartnerSelector.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
/// <summary>
|
||||
/// Partner selectors are similar to the pawn selectors, but can define relations between two pawns.
|
||||
/// </summary>
|
||||
public interface IPartnerSelector : IDefPart
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if the partner satisfies all XML-defined conditions in relation to the pawn.
|
||||
/// Non-commutative
|
||||
/// </summary>
|
||||
bool PartnerSatisfies(Pawn pawn, Pawn partner);
|
||||
}
|
||||
}
|
15
RJW-Quirks/Modules/Shared/Selectors/IPawnSelector.cs
Normal file
15
RJW-Quirks/Modules/Shared/Selectors/IPawnSelector.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
/// <summary>
|
||||
/// Pawn selectors are designed to provide a flexible way to define pawn requirements in the defs
|
||||
/// </summary>
|
||||
public interface IPawnSelector : IDefPart
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns true if pawn satisfies all XML-defined conditions
|
||||
/// </summary>
|
||||
bool PawnSatisfies(Pawn pawn);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using rjw;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PartnerSelectors
|
||||
{
|
||||
public class CanBeImpregnatedBy : PartnerSelector
|
||||
{
|
||||
public override bool PartnerSatisfies(Pawn pawn, Pawn partner) => PregnancyHelper.CanImpregnate(partner, pawn);
|
||||
}
|
||||
}
|
10
RJW-Quirks/Modules/Shared/Selectors/Partner/CanImpregnate.cs
Normal file
10
RJW-Quirks/Modules/Shared/Selectors/Partner/CanImpregnate.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using rjw;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PartnerSelectors
|
||||
{
|
||||
public class CanImpregnate : PartnerSelector
|
||||
{
|
||||
public override bool PartnerSatisfies(Pawn pawn, Pawn partner) => PregnancyHelper.CanImpregnate(pawn, partner);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PartnerSelectors
|
||||
{
|
||||
public class HasOneOfRelations : PartnerSelector
|
||||
{
|
||||
public List<PawnRelationDef> relations;
|
||||
|
||||
private HashSet<PawnRelationDef> relationsHashSet;
|
||||
|
||||
public override bool PartnerSatisfies(Pawn pawn, Pawn partner)
|
||||
{
|
||||
if (relationsHashSet == null)
|
||||
{
|
||||
relationsHashSet = new HashSet<PawnRelationDef>(relations);
|
||||
}
|
||||
|
||||
IEnumerable<PawnRelationDef> pawnRelations = pawn.GetRelations(partner);
|
||||
|
||||
if (pawnRelations.EnumerableNullOrEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!relationsHashSet.Overlaps(pawnRelations))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (relations.NullOrEmpty())
|
||||
{
|
||||
yield return "<relations> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
23
RJW-Quirks/Modules/Shared/Selectors/Partner/LogicalAnd.cs
Normal file
23
RJW-Quirks/Modules/Shared/Selectors/Partner/LogicalAnd.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PartnerSelectors
|
||||
{
|
||||
public class LogicalAnd : LogicalMultipart
|
||||
{
|
||||
public override bool PartnerSatisfies(Pawn pawn, Pawn partner)
|
||||
{
|
||||
if (partner == null)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < parts.Count; i++)
|
||||
{
|
||||
if (!parts[i].PartnerSatisfies(pawn, partner))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
using rjwquirks.Modules.Shared.PawnSelectors;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PartnerSelectors
|
||||
{
|
||||
public abstract class LogicalMultipart : PartnerSelector
|
||||
{
|
||||
public List<IPartnerSelector> parts = new List<IPartnerSelector>();
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (parts.Count < 2)
|
||||
{
|
||||
yield return "<parts> should have at least 2 elements";
|
||||
}
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
foreach (string error in part.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
34
RJW-Quirks/Modules/Shared/Selectors/Partner/LogicalNot.cs
Normal file
34
RJW-Quirks/Modules/Shared/Selectors/Partner/LogicalNot.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
using rjwquirks.Modules.Shared.PawnSelectors;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PartnerSelectors
|
||||
{
|
||||
public class LogicalNot : PartnerSelector
|
||||
{
|
||||
public IPartnerSelector negated;
|
||||
|
||||
public override bool PartnerSatisfies(Pawn pawn, Pawn partner) => !negated.PartnerSatisfies(pawn, partner);
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (negated == null)
|
||||
{
|
||||
yield return "<negated> is empty";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (string error in negated.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
23
RJW-Quirks/Modules/Shared/Selectors/Partner/LogicalOr.cs
Normal file
23
RJW-Quirks/Modules/Shared/Selectors/Partner/LogicalOr.cs
Normal file
|
@ -0,0 +1,23 @@
|
|||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PartnerSelectors
|
||||
{
|
||||
public class LogicalOr : LogicalMultipart
|
||||
{
|
||||
public override bool PartnerSatisfies(Pawn pawn, Pawn partner)
|
||||
{
|
||||
if (partner == null)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < parts.Count; i++)
|
||||
{
|
||||
if (parts[i].PartnerSatisfies(pawn, partner))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using rjwquirks.Modules.Shared.PawnSelectors;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PartnerSelectors
|
||||
{
|
||||
public abstract class PartnerSelector : IPartnerSelector
|
||||
{
|
||||
public abstract bool PartnerSatisfies(Pawn pawn, Pawn partner);
|
||||
|
||||
public virtual IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
26
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasBodyType.cs
Normal file
26
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasBodyType.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class HasBodyType : PawnSelector
|
||||
{
|
||||
public BodyTypeDef bodyType;
|
||||
|
||||
public override bool PawnSatisfies(Pawn pawn) => pawn.story?.bodyType == bodyType;
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (bodyType == null)
|
||||
{
|
||||
yield return "<bodyType> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
31
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasDegreeOfTrait.cs
Normal file
31
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasDegreeOfTrait.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class HasDegreeOfTrait : PawnSelector
|
||||
{
|
||||
public TraitDef trait;
|
||||
public int degree = 0;
|
||||
|
||||
public override bool PawnSatisfies(Pawn pawn) => pawn.story?.traits?.HasTrait(trait, degree) == true;
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (trait == null)
|
||||
{
|
||||
yield return "<trait> is empty";
|
||||
}
|
||||
else if (trait.degreeDatas.Find(d => d.degree == degree) == null)
|
||||
{
|
||||
yield return $"{trait.defName} has no data for a degree {degree}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasFertility.cs
Normal file
10
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasFertility.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using rjw;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class HasFertility : PawnSelector
|
||||
{
|
||||
public override bool PawnSatisfies(Pawn pawn) => pawn.RaceHasFertility();
|
||||
}
|
||||
}
|
25
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasGender.cs
Normal file
25
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasGender.cs
Normal file
|
@ -0,0 +1,25 @@
|
|||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class HasGender : PawnSelector
|
||||
{
|
||||
public Gender gender = Gender.None;
|
||||
|
||||
public override bool PawnSatisfies(Pawn pawn) => pawn.gender == gender;
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (gender == Gender.None)
|
||||
{
|
||||
yield return "<gender> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
31
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasHumanScaleAge.cs
Normal file
31
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasHumanScaleAge.cs
Normal file
|
@ -0,0 +1,31 @@
|
|||
using rjw;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class HasHumanScaleAge : PawnSelector
|
||||
{
|
||||
public int min = 0;
|
||||
public int max = 1000;
|
||||
|
||||
public override bool PawnSatisfies(Pawn pawn)
|
||||
{
|
||||
int humanScaleAge = SexUtility.ScaleToHumanAge(pawn);
|
||||
return min <= humanScaleAge && humanScaleAge <= max;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (min == 0 && max == 1000)
|
||||
{
|
||||
yield return "<min> and/or <max> should be filled";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
44
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasRaceTag.cs
Normal file
44
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasRaceTag.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using rjw;
|
||||
using rjwquirks.Data;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class HasRaceTag : PawnSelector
|
||||
{
|
||||
/// <summary>
|
||||
/// For def load only. Use RaceTag property
|
||||
/// </summary>
|
||||
public string raceTag;
|
||||
|
||||
public RaceTags RaceTag
|
||||
{
|
||||
get
|
||||
{
|
||||
if (RaceTags.TryParse(raceTag, out RaceTags tag))
|
||||
return tag;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool PawnSatisfies(Pawn pawn) => pawn.HasRaceTag(RaceTag);
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (raceTag.NullOrEmpty())
|
||||
{
|
||||
yield return "<raceTag> is empty";
|
||||
}
|
||||
else if (!RaceTags.TryParse(raceTag, out _))
|
||||
{
|
||||
yield return $"\"{raceTag}\" is not a valid RaceTag";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasSkillLevel.cs
Normal file
36
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasSkillLevel.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class HasSkillLevel : PawnSelector
|
||||
{
|
||||
public SkillDef skill;
|
||||
public int minLevel = 0;
|
||||
public int maxLevel = 200; // mods can unlock levels past 20
|
||||
|
||||
public override bool PawnSatisfies(Pawn pawn)
|
||||
{
|
||||
int skillLevel = pawn.skills?.GetSkill(skill)?.levelInt ?? -1;
|
||||
return minLevel <= skillLevel && skillLevel <= maxLevel;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (skill == null)
|
||||
{
|
||||
yield return "<skill> is empty";
|
||||
}
|
||||
if (minLevel == 0 && maxLevel == 200)
|
||||
{
|
||||
yield return "<minLevel> and/or <maxLevel> should be filled";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
36
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasStatValue.cs
Normal file
36
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasStatValue.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class HasStatValue : PawnSelector
|
||||
{
|
||||
public StatDef stat;
|
||||
public float minValue = float.MinValue;
|
||||
public float maxValue = float.MaxValue;
|
||||
|
||||
public override bool PawnSatisfies(Pawn pawn)
|
||||
{
|
||||
float statValue = pawn.GetStatValue(stat);
|
||||
return minValue <= statValue && statValue <= maxValue;
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (stat == null)
|
||||
{
|
||||
yield return "<stat> is empty";
|
||||
}
|
||||
if (minValue == float.MinValue && maxValue == float.MaxValue)
|
||||
{
|
||||
yield return "<minValue> and/or <maxValue> should be filled";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
26
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasTrait.cs
Normal file
26
RJW-Quirks/Modules/Shared/Selectors/Pawn/HasTrait.cs
Normal file
|
@ -0,0 +1,26 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class HasTrait : PawnSelector
|
||||
{
|
||||
public TraitDef trait;
|
||||
|
||||
public override bool PawnSatisfies(Pawn pawn) => pawn.story?.traits?.HasTrait(trait) == true;
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (trait == null)
|
||||
{
|
||||
yield return "<trait> is empty";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
10
RJW-Quirks/Modules/Shared/Selectors/Pawn/IsDisfigured.cs
Normal file
10
RJW-Quirks/Modules/Shared/Selectors/Pawn/IsDisfigured.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class IsDisfigured : PawnSelector
|
||||
{
|
||||
public override bool PawnSatisfies(Pawn pawn) => RelationsUtility.IsDisfigured(pawn);
|
||||
}
|
||||
}
|
9
RJW-Quirks/Modules/Shared/Selectors/Pawn/IsHumanlike.cs
Normal file
9
RJW-Quirks/Modules/Shared/Selectors/Pawn/IsHumanlike.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class IsHumanlike : PawnSelector
|
||||
{
|
||||
public override bool PawnSatisfies(Pawn pawn) => pawn?.RaceProps?.Humanlike == true;
|
||||
}
|
||||
}
|
10
RJW-Quirks/Modules/Shared/Selectors/Pawn/IsSleeping.cs
Normal file
10
RJW-Quirks/Modules/Shared/Selectors/Pawn/IsSleeping.cs
Normal file
|
@ -0,0 +1,10 @@
|
|||
using RimWorld;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class IsSleeping : PawnSelector
|
||||
{
|
||||
public override bool PawnSatisfies(Pawn pawn) => !pawn.Awake();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using rjw;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class IsVisiblyPregnant : PawnSelector
|
||||
{
|
||||
public override bool PawnSatisfies(Pawn pawn) => pawn.IsVisiblyPregnant();
|
||||
}
|
||||
}
|
20
RJW-Quirks/Modules/Shared/Selectors/Pawn/LogicalAnd.cs
Normal file
20
RJW-Quirks/Modules/Shared/Selectors/Pawn/LogicalAnd.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class LogicalAnd : LogicalMultipart
|
||||
{
|
||||
public override bool PawnSatisfies(Pawn pawn)
|
||||
{
|
||||
for (int i = 0; i < parts.Count; i++)
|
||||
{
|
||||
if (!parts[i].PawnSatisfies(pawn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
30
RJW-Quirks/Modules/Shared/Selectors/Pawn/LogicalMultipart.cs
Normal file
30
RJW-Quirks/Modules/Shared/Selectors/Pawn/LogicalMultipart.cs
Normal file
|
@ -0,0 +1,30 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public abstract class LogicalMultipart : PawnSelector
|
||||
{
|
||||
public List<IPawnSelector> parts = new List<IPawnSelector>();
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (parts.Count < 2)
|
||||
{
|
||||
yield return "<parts> should have at least 2 elements";
|
||||
}
|
||||
|
||||
foreach (var part in parts)
|
||||
{
|
||||
foreach (string error in part.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
33
RJW-Quirks/Modules/Shared/Selectors/Pawn/LogicalNot.cs
Normal file
33
RJW-Quirks/Modules/Shared/Selectors/Pawn/LogicalNot.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class LogicalNot : PawnSelector
|
||||
{
|
||||
public IPawnSelector negated;
|
||||
|
||||
public override bool PawnSatisfies(Pawn pawn) => !negated.PawnSatisfies(pawn);
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
if (negated == null)
|
||||
{
|
||||
yield return "<negated> is empty";
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (string error in negated.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
20
RJW-Quirks/Modules/Shared/Selectors/Pawn/LogicalOr.cs
Normal file
20
RJW-Quirks/Modules/Shared/Selectors/Pawn/LogicalOr.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public class LogicalOr : LogicalMultipart
|
||||
{
|
||||
public override bool PawnSatisfies(Pawn pawn)
|
||||
{
|
||||
for (int i = 0; i < parts.Count; i++)
|
||||
{
|
||||
if (parts[i].PawnSatisfies(pawn))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
17
RJW-Quirks/Modules/Shared/Selectors/Pawn/PawnSelector.cs
Normal file
17
RJW-Quirks/Modules/Shared/Selectors/Pawn/PawnSelector.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System.Collections.Generic;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks.Modules.Shared.PawnSelectors
|
||||
{
|
||||
public abstract class PawnSelector : IPawnSelector, IPartnerSelector
|
||||
{
|
||||
public abstract bool PawnSatisfies(Pawn pawn);
|
||||
|
||||
public bool PartnerSatisfies(Pawn pawn, Pawn partner) => PawnSatisfies(partner);
|
||||
|
||||
public virtual IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
}
|
32
RJW-Quirks/PawnExtensions.cs
Normal file
32
RJW-Quirks/PawnExtensions.cs
Normal file
|
@ -0,0 +1,32 @@
|
|||
using rjw;
|
||||
using rjwquirks.Data;
|
||||
using rjwquirks.Modules.Quirks;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace rjwquirks
|
||||
{
|
||||
public static class PawnExtensions
|
||||
{
|
||||
public static bool HasQuirk(this Pawn pawn, QuirkDef quirk)
|
||||
{
|
||||
return xxx.is_human(pawn) && pawn.GetQuirks().Contains(quirk);
|
||||
}
|
||||
|
||||
public static QuirkSet GetQuirks(this Pawn pawn)
|
||||
{
|
||||
return pawn.GetComp<QuirkSet>();
|
||||
}
|
||||
|
||||
public static bool HasRaceTag(this Pawn pawn, RaceTags tag)
|
||||
{
|
||||
if (RaceGroupDef_Helper.TryGetRaceGroupDef(pawn, out var raceGroupDef))
|
||||
{
|
||||
return raceGroupDef.tags != null && raceGroupDef.tags.Contains(tag.Key);
|
||||
} else
|
||||
{
|
||||
return tag.DefaultWhenNoRaceGroupDef(pawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
35
RJW-Quirks/Properties/AssemblyInfo.cs
Normal file
35
RJW-Quirks/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("RJW-Quirks")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("RJW-Quirks")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("e8ad47f9-dc4f-4e36-8e03-c148c7cea9e2")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
171
RJW-Quirks/RJW-Quirks.csproj
Normal file
171
RJW-Quirks/RJW-Quirks.csproj
Normal file
|
@ -0,0 +1,171 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E8AD47F9-DC4F-4E36-8E03-C148C7CEA9E2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>rjwquirks</RootNamespace>
|
||||
<AssemblyName>RJW-Quirks</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\1.4\Assemblies\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="0Harmony">
|
||||
<HintPath>G:\SteamLibrary\steamapps\workshop\content\294100\2009463077\Current\Assemblies\0Harmony.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>G:\SteamLibrary\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="HugsLib">
|
||||
<HintPath>G:\SteamLibrary\steamapps\workshop\content\294100\818773962\v1.4\Assemblies\HugsLib.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="RJW">
|
||||
<HintPath>G:\SteamLibrary\steamapps\common\RimWorld\Mods\rjwrepository\1.4\Assemblies\RJW.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>G:\SteamLibrary\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.IMGUIModule">
|
||||
<HintPath>G:\SteamLibrary\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TextRenderingModule">
|
||||
<HintPath>G:\SteamLibrary\steamapps\common\RimWorld\RimWorldWin64_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Core.cs" />
|
||||
<Compile Include="Data\RaceTags.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_CasualSex_Helper.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_CondomUtility.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_Dialog_Sexcard.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_DrawNude.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_Hediff_BasePregnancy.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_Hediff_PartBaseArtifical.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_Hediff_PartBaseNatural.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_JobGiver_Masturbate.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_QuirkPartPreference.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_RecordsTracker_NotifyRecordChanged.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_SexAppraiser.cs" />
|
||||
<Compile Include="HarmonyPatches\Patch_SexUtility.cs" />
|
||||
<Compile Include="Modules\Interactions\QuirksPartKindUsageRule.cs" />
|
||||
<Compile Include="Modules\Quirks\CompProperties_QuirkSet.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\CompAdder.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Partner\HasOneOfRelations.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\Adder.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\Adder_OnRecordExceeding.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\HediffAdder.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\HediffRemover.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\PartKindUsageRules.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\PartKindUsageRules_ImpregnationFetish.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\PartKindUsageRules_Static.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\QuirkComp.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\SexAppraisalModifier.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\SexAppraisalModifier_ApplyMultiplier.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\SexAppraisalModifier_SetValue.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\ThoughtAdder.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\ThoughtAdder_OnSexEvent.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\ThoughtAdder_OnSexEvent_NonPreferred.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\ThoughtAdder_OnSexEvent_Preferred.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\ValueModifier.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\ValueModifier_ApplyMultiplier.cs" />
|
||||
<Compile Include="Modules\Quirks\Comps\ValueModifier_ApplyOffset.cs" />
|
||||
<Compile Include="Modules\Quirks\EventHandlers\QuirkGenerator.cs" />
|
||||
<Compile Include="Modules\Quirks\EventHandlers\QuirkRjwEventHandler.cs" />
|
||||
<Compile Include="Modules\Quirks\EventHandlers\QuirkSetRjwEventHandler.cs" />
|
||||
<Compile Include="Modules\Quirks\EventHandlers\RecordChangedRjwEventHandler.cs" />
|
||||
<Compile Include="Modules\Quirks\OwnerRequirement.cs" />
|
||||
<Compile Include="Modules\Quirks\Quirk.cs" />
|
||||
<Compile Include="Modules\Quirks\QuirkDef.cs" />
|
||||
<Compile Include="Modules\Quirks\QuirkDefOf.cs" />
|
||||
<Compile Include="Modules\Quirks\QuirkModifierPriority.cs" />
|
||||
<Compile Include="Modules\Quirks\QuirkRarity.cs" />
|
||||
<Compile Include="Modules\Quirks\QuirkSet.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\BySextype.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\CanBeImpregnated.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\CanImpregnate.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\Clothed.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\ISexSelector.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\LogicalAnd.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\LogicalMultipart.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\LogicalNot.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\LogicalOr.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\Seen.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\SexSelector.cs" />
|
||||
<Compile Include="Modules\Quirks\SexSelectors\WithPreferedPartner.cs" />
|
||||
<Compile Include="Modules\Shared\Events\RjwEvent.cs" />
|
||||
<Compile Include="Modules\Shared\Events\RjwEventArgNames.cs" />
|
||||
<Compile Include="Modules\Shared\Events\RjwEventDef.cs" />
|
||||
<Compile Include="Modules\Shared\Events\RjwEventDefOf.cs" />
|
||||
<Compile Include="Modules\Shared\Events\RjwEventHandler.cs" />
|
||||
<Compile Include="Modules\Shared\Events\RjwEventHandlerDef.cs" />
|
||||
<Compile Include="Modules\Shared\Events\RjwEventManager.cs" />
|
||||
<Compile Include="Modules\Shared\IDefPart.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\IPartnerSelector.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\IPawnSelector.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Partner\CanBeImpregnatedBy.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Partner\CanImpregnate.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Partner\LogicalAnd.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Partner\LogicalMultipart.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Partner\LogicalNot.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Partner\LogicalOr.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Partner\PartnerSelector.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\HasBodyType.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\HasDegreeOfTrait.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\HasFertility.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\HasGender.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\HasHumanScaleAge.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\HasRaceTag.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\HasSkillLevel.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\HasStatValue.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\HasTrait.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\IsDisfigured.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\IsHumanlike.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\IsSleeping.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\IsVisiblyPregnant.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\LogicalAnd.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\LogicalMultipart.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\LogicalNot.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\LogicalOr.cs" />
|
||||
<Compile Include="Modules\Shared\Selectors\Pawn\PawnSelector.cs" />
|
||||
<Compile Include="PawnExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
25
RJW-Quirks/RJW-Quirks.sln
Normal file
25
RJW-Quirks/RJW-Quirks.sln
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.32929.386
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RJW-Quirks", "RJW-Quirks.csproj", "{E8AD47F9-DC4F-4E36-8E03-C148C7CEA9E2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{E8AD47F9-DC4F-4E36-8E03-C148C7CEA9E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E8AD47F9-DC4F-4E36-8E03-C148C7CEA9E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E8AD47F9-DC4F-4E36-8E03-C148C7CEA9E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E8AD47F9-DC4F-4E36-8E03-C148C7CEA9E2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {0521884B-2E20-4DD8-BBE6-9FA3CB026E97}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Loading…
Add table
Add a link
Reference in a new issue