mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Just eliminate GetHARComp instead of messing with casting
This commit is contained in:
parent
1cbe557621
commit
5e788df794
1 changed files with 4 additions and 10 deletions
|
@ -14,16 +14,10 @@ namespace RJW_Menstruation
|
||||||
return pawn?.def is ThingDef_AlienRace;
|
return pawn?.def is ThingDef_AlienRace;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can't have it be a AlienPartGenerator.AlienComp due to the way the dev actions look for functions
|
|
||||||
public static ThingComp GetHARComp(this Pawn pawn)
|
|
||||||
{
|
|
||||||
return pawn?.TryGetComp<AlienPartGenerator.AlienComp>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CopyHARProperties(Pawn baby, Pawn original)
|
public static void CopyHARProperties(Pawn baby, Pawn original)
|
||||||
{
|
{
|
||||||
AlienPartGenerator.AlienComp babyHARComp = (AlienPartGenerator.AlienComp)baby.GetHARComp();
|
AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp<AlienPartGenerator.AlienComp>();
|
||||||
AlienPartGenerator.AlienComp originalHARComp = (AlienPartGenerator.AlienComp)original.GetHARComp();
|
AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp<AlienPartGenerator.AlienComp>();
|
||||||
if (babyHARComp == null || originalHARComp == null) return;
|
if (babyHARComp == null || originalHARComp == null) return;
|
||||||
babyHARComp.crownType = originalHARComp.crownType;
|
babyHARComp.crownType = originalHARComp.crownType;
|
||||||
|
|
||||||
|
@ -38,8 +32,8 @@ namespace RJW_Menstruation
|
||||||
// HAR doesn't populate variants until the graphics are called for, so this has to happen late
|
// HAR doesn't populate variants until the graphics are called for, so this has to happen late
|
||||||
public static void CopyHARPropertiesPostBirth(Pawn baby, Pawn original)
|
public static void CopyHARPropertiesPostBirth(Pawn baby, Pawn original)
|
||||||
{
|
{
|
||||||
AlienPartGenerator.AlienComp babyHARComp = (AlienPartGenerator.AlienComp)baby.GetHARComp();
|
AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp<AlienPartGenerator.AlienComp>();
|
||||||
AlienPartGenerator.AlienComp originalHARComp = (AlienPartGenerator.AlienComp)original.GetHARComp();
|
AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp<AlienPartGenerator.AlienComp>();
|
||||||
if (babyHARComp == null || originalHARComp == null) return;
|
if (babyHARComp == null || originalHARComp == null) return;
|
||||||
if (originalHARComp.addonVariants != null) // Testing has shown that the addons are valid by this point, but it's better to be safe
|
if (originalHARComp.addonVariants != null) // Testing has shown that the addons are valid by this point, but it's better to be safe
|
||||||
babyHARComp.addonVariants = new List<int>(originalHARComp.addonVariants);
|
babyHARComp.addonVariants = new List<int>(originalHARComp.addonVariants);
|
||||||
|
|
Loading…
Reference in a new issue