erdelf / AlienRaces

Rimworld mod alien race framework
MIT License
103 stars 69 forks source link

Backstory body type fix plus options for nonstandard gendered defaults #98

Closed Aelanna closed 1 year ago

Aelanna commented 1 year ago

[Bug fix] Refactored GetBodyTypeForPostfix, GenerateBodyTypePostfix, and CheckBodyType to respect the vanilla-generated value in the former prefix, which is where body type specifications in backstories were checked. GetBodyTypeForPrefix was discarding the value of its __result field, which caused all backstory overrides to fail, including for humans.

[Addition] Added defaultMaleBodyType and defaultFemaleBodyType fields to , which are default-initialized to BodyTypeDefOf.Male and BodyTypeDefOf.Female in ThingDef_AlienRaces.ResolveReferences. This is then used by CheckBodyType to exclude gender-default body types instead of the hardcoded vanilla types.

Use case: This is desirable by races that are using entirely custom body types to specify gendered defaults without having to resort to backstory forced types, which necessarily restrict the entire pool down to only a single body type per race.