Compare commits

...

3 commits

Author SHA1 Message Date
lutepickle
f1b9d77ef0 Have BleedOut use the pawn-appropriate blood def 2024-05-29 21:44:59 -07:00
lutepickle
cf6fd77ea8 Consolidate the three HashSet fillers into one function 2024-05-29 20:59:06 -07:00
lutepickle
4a41bb69f4 HAR gained a builtin property copier, so use that instead 2024-05-29 20:43:37 -07:00
5 changed files with 23 additions and 59 deletions

Binary file not shown.

View file

@ -16,19 +16,8 @@ namespace RJW_Menstruation
public static void CopyHARProperties(Pawn baby, Pawn original)
{
AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp<AlienPartGenerator.AlienComp>();
AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp<AlienPartGenerator.AlienComp>();
if (babyHARComp == null || originalHARComp == null) return;
babyHARComp.addonVariants = new List<int>(originalHARComp.addonVariants);
foreach (KeyValuePair<string, AlienPartGenerator.ExposableValueTuple<Color, Color>> channel in originalHARComp.ColorChannels)
{
babyHARComp.OverwriteColorChannel(channel.Key, channel.Value.first, channel.Value.second);
}
babyHARComp.headVariant = originalHARComp.headVariant;
babyHARComp.bodyVariant = originalHARComp.bodyVariant;
babyHARComp.headMaskVariant = originalHARComp.headMaskVariant;
babyHARComp.bodyMaskVariant = originalHARComp.bodyMaskVariant;
if (!baby.HasComp<AlienPartGenerator.AlienComp>() || !original.HasComp<AlienPartGenerator.AlienComp>()) return;
AlienPartGenerator.AlienComp.CopyAlienData(original, baby);
}
}
}

View file

@ -1517,7 +1517,7 @@ namespace RJW_Menstruation
{
// ~1.5 per hour times acceleration
float bledAmount = Utility.VariationRange(0.03f * Configurations.BleedingAmount * Configurations.CycleAcceleration * HoursBetweenSimulations, 0.5f);
CumIn(Pawn, bledAmount, Translations.Menstrual_Blood, -5.0f, Pawn.RaceProps?.BloodDef ?? ThingDefOf.Filth_Blood);
CumIn(Pawn, bledAmount, Translations.Menstrual_Blood, -5.0f, Utility.BloodDef(Pawn));
Cum blood = GetNotCum(Translations.Menstrual_Blood);
if (blood != null) blood.Color = BloodColor;
}

View file

@ -457,6 +457,7 @@ namespace RJW_Menstruation
return Color.white;
}
}
public static ThingDef BloodDef(Pawn pawn)
{
if (pawn == null) return ThingDefOf.Filth_Blood;

View file

@ -1,5 +1,6 @@
using RimWorld;
using rjw;
using System;
using System.Collections.Generic;
using System.Linq;
using Verse;
@ -74,26 +75,27 @@ namespace RJW_Menstruation
return allkinds;
}
}
private static HashSet<HediffDef> GetCompHashSet(Type type)
{
HashSet<HediffDef> set = new HashSet<HediffDef>();
foreach (HediffDef hediffDef in DefDatabase<HediffDef>.AllDefsListForReading)
{
if (hediffDef.comps.NullOrEmpty()) continue;
foreach (HediffCompProperties comp in hediffDef.comps)
if (comp.compClass == type || (comp.compClass?.IsSubclassOf(type) ?? false))
{
set.Add(hediffDef);
break;
}
}
return set;
}
public static HashSet<HediffDef> AllVaginas
{
get
{
if (allvaginas != null) return allvaginas;
allvaginas = new HashSet<HediffDef>();
foreach(HediffDef hediffDef in DefDatabase<HediffDef>.AllDefsListForReading)
{
if (hediffDef.comps.NullOrEmpty()) continue;
foreach (HediffCompProperties comp in hediffDef.comps)
{
if (comp.compClass == typeof(HediffComp_Menstruation) || (comp.compClass?.IsSubclassOf(typeof(HediffComp_Menstruation)) ?? false))
{
allvaginas.Add(hediffDef);
break;
}
}
}
allvaginas = GetCompHashSet(typeof(HediffComp_Menstruation));
return allvaginas;
}
}
@ -102,21 +104,7 @@ namespace RJW_Menstruation
get
{
if (allanuses != null) return allanuses;
allanuses = new HashSet<HediffDef>();
foreach (HediffDef hediffDef in DefDatabase<HediffDef>.AllDefsListForReading)
{
if (hediffDef.comps.NullOrEmpty()) continue;
foreach (HediffCompProperties comp in hediffDef.comps)
{
if (comp.compClass == typeof(HediffComp_Anus) || (comp.compClass?.IsSubclassOf(typeof(HediffComp_Anus)) ?? false))
{
allanuses.Add(hediffDef);
break;
}
}
}
allanuses = GetCompHashSet(typeof(HediffComp_Anus));
return allanuses;
}
}
@ -125,21 +113,7 @@ namespace RJW_Menstruation
get
{
if (allbreasts != null) return allbreasts;
allbreasts = new HashSet<HediffDef>();
foreach(HediffDef hediffDef in DefDatabase<HediffDef>.AllDefsListForReading)
{
if (hediffDef.comps.NullOrEmpty()) continue;
foreach(HediffCompProperties comp in hediffDef.comps)
{
if (comp.compClass == typeof(HediffComp_Breast) || (comp.compClass?.IsSubclassOf(typeof(HediffComp_Breast)) ?? false))
{
allbreasts.Add(hediffDef);
break;
}
}
}
allbreasts = GetCompHashSet(typeof(HediffComp_Breast));
return allbreasts;
}
}