Merge branch 'dev'

This commit is contained in:
lutepickle 2022-05-10 16:50:42 -07:00
commit 41628578bb
6 changed files with 23 additions and 9 deletions

Binary file not shown.

View file

@ -1199,7 +1199,7 @@ namespace RJW_Menstruation
if (!absorber.dirty) if (!absorber.dirty)
{ {
absorber.absorbedfluids += amount; absorber.absorbedfluids += amount;
if (absorber.absorbedfluids > absorbable) if (absorber.absorbedfluids > absorbable && !parent.pawn.apparel.IsLocked(absorber))
{ {
absorber.def = absorber.DirtyDef; absorber.def = absorber.DirtyDef;
//absorber.fluidColor = GetCumMixtureColor; //absorber.fluidColor = GetCumMixtureColor;
@ -1299,9 +1299,9 @@ namespace RJW_Menstruation
{ {
eggnum = 1 + eggstack; eggnum = 1 + eggstack;
} }
catch(ArgumentException) catch(ArgumentException e)
{ {
Log.Warning($"Invalid litterSizeCurve for {parent.pawn.RaceProps}"); Log.Warning($"Invalid litterSizeCurve for {parent.pawn.RaceProps}: {e}");
eggnum = 1 + eggstack; eggnum = 1 + eggstack;
} }
@ -1453,7 +1453,9 @@ namespace RJW_Menstruation
{ {
if (xxx.is_human(parent.pawn) && xxx.is_human(cummer)) if (xxx.is_human(parent.pawn) && xxx.is_human(cummer))
{ {
if (parent.pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0 || cummer.Has(Quirk.ImpregnationFetish) || cummer.Has(Quirk.Breeder)) if ((cummer.Has(Quirk.Teratophile) != (parent.pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)) ||
cummer.Has(Quirk.ImpregnationFetish) ||
cummer.Has(Quirk.Breeder))
{ {
if (cummer.relations.OpinionOf(parent.pawn) <= -25) if (cummer.relations.OpinionOf(parent.pawn) <= -25)
{ {

View file

@ -229,23 +229,30 @@ namespace RJW_Menstruation
private static readonly FieldInfo MinimumRelationshipToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumRelationshipToHookup)); private static readonly FieldInfo MinimumRelationshipToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumRelationshipToHookup));
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{ {
object pawn_index = null;
// Like in the last one, we're only interested in the first of each // Like in the last one, we're only interested in the first of each
bool found_first_attractiveness = false; bool found_first_attractiveness = false;
bool found_first_relationship = false; bool found_first_relationship = false;
foreach(CodeInstruction instruction in instructions) foreach(CodeInstruction instruction in instructions)
{ {
if (!found_first_attractiveness && instruction.LoadsField(MinimumAttractivenessToHookup)) // Get where the compiler decided to index the pawn at
if (pawn_index is null && instruction.opcode == OpCodes.Stloc_S) // the first stloc.s in the IL is the pawn being loaded out of the list
{ // a future RJW or compiler update might change this, or maybe another mod's patch
pawn_index = instruction.operand;
yield return instruction;
}
else if (!found_first_attractiveness && instruction.LoadsField(MinimumAttractivenessToHookup))
{ {
found_first_attractiveness = true; found_first_attractiveness = true;
yield return new CodeInstruction(OpCodes.Ldarg_0); yield return new CodeInstruction(OpCodes.Ldarg_0);
yield return new CodeInstruction(OpCodes.Ldarg_1); yield return new CodeInstruction(OpCodes.Ldloc_S, pawn_index);
yield return CodeInstruction.Call(typeof(FindBestPartner_Patch), nameof(AttractivenessThreshold)); yield return CodeInstruction.Call(typeof(FindBestPartner_Patch), nameof(AttractivenessThreshold));
} }
else if (!found_first_relationship && instruction.LoadsField(MinimumRelationshipToHookup)) else if (!found_first_relationship && instruction.LoadsField(MinimumRelationshipToHookup))
{ {
found_first_relationship = true; found_first_relationship = true;
yield return new CodeInstruction(OpCodes.Ldarg_0); yield return new CodeInstruction(OpCodes.Ldarg_0);
yield return new CodeInstruction(OpCodes.Ldarg_1); yield return new CodeInstruction(OpCodes.Ldloc_S, pawn_index);
yield return CodeInstruction.Call(typeof(FindBestPartner_Patch), nameof(RelationshipThreshold)); yield return CodeInstruction.Call(typeof(FindBestPartner_Patch), nameof(RelationshipThreshold));
} }
else yield return instruction; else yield return instruction;

View file

@ -256,7 +256,7 @@ namespace RJW_Menstruation
public override void DirtyEffect() public override void DirtyEffect()
{ {
if (wearhours > MinHrstoDirtyEffect && Rand.Chance(0.01f)) if (wearhours > MinHrstoDirtyEffect && Rand.Chance(0.01f) && !Wearer.apparel.IsLocked(this))
{ {
Wearer.health.AddHediff(HediffDefOf.WoundInfection, Genital_Helper.get_genitalsBPR(Wearer)); Wearer.health.AddHediff(HediffDefOf.WoundInfection, Genital_Helper.get_genitalsBPR(Wearer));
} }

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest> <Manifest>
<identifier>RJW Menstruation</identifier> <identifier>RJW Menstruation</identifier>
<version>1.0.6.1</version> <version>1.0.6.2</version>
<dependencies> <dependencies>
</dependencies> </dependencies>
<incompatibleWith /> <incompatibleWith />

View file

@ -1,3 +1,8 @@
Version 1.0.6.2
- Fix error/crash when a pawn in estrus (with hookup override enabled) looks for partners.
- Teratophiles get the "I came inside" mood buff for ugly partners instead of pretty ones.
- Locked absorbers (e.g. that guests have) won't get dirty or cause infections.
Version 1.0.6.1 Version 1.0.6.1
- Requires RJW 4.9.6 or later - Requires RJW 4.9.6 or later
- Fix errors when a hybrid refers to an invalid race. - Fix errors when a hybrid refers to an invalid race.