RimWorld

RimWorld

38 ratings
Random Spawning Genes
   
Award
Favorite
Favorited
Unfavorite
Mod, 1.5, 1.6
File Size
Posted
Updated
265.025 KB
2 Mar @ 12:32pm
24 Jun @ 1:44pm
14 Change Notes ( view )
You need DLC to use this item.

Subscribe to download
Random Spawning Genes

Description
Random spawning genes!

So many mods add genes and only so many are on pawns. I wanted more variety on them and didn't like the current options available.

This mod will make all pawns spawn with an additional random assortment of genes.
In order to prevent a bunch of pawns spawning with extremely high or low metabolism, this uses a "super advanced AI logic" to try and get to the metabolism requested by the player.

Genes added can be a consistent amount (for example 4) or a random range between two numbers (from 0~64). There are options for where genes are placed, and what to do with genes that have prerequisites. The first gene given will be entirely random to throw some variation into the mix. Subsequent genes added will try to reach the ideal metabolism provided. When at or near this metabolism (±1), random single metabolism or zero metabolism (as set in the options) genes will be added.

You can provide a filter that will exclude any genes that contain the same defname as provided in the text box. There is an option to add in recomended exclusions. These are genes that would automatically down or otherwise incapacitate a pawn on spawn. A longer, more in-depth list is also provided in the about folder "PossibleExclusions.xml", containing the reason these genes are on this list.
Note these filters are case sensitive.
Babies - Babies can be given genes as well. However there is an option to turn this setting off.

Compatibility
For modders: There is a def included in this mod that you can patch to exclude your genes from appearing. This can be done through single genes, exclusionTags, or the intire mod itself. There are example patches included in the About folder.
Big and small framework: If a gene has prerequisites from using this framework, they will be taken into account with adding genes.
HAR: Genes should only be added if the race allows it. This works in both directions
VRE Insectors & VRE Androids: This will not use custom "genes" from these mods or any other mods that subclass Genedefs.
Androids will not be given genes.
Insectors can still receive genes.

Errors
I've tried testing this with a couple hundred gene mods. Sent some errors in compatibility of certain genes to their respective authors in the process as well. However I obviously can't guarantee every gene mod works with every other gene. There are options in the mod to turn on logging so you can determine what combination of genes are causing errors and report it to their mod authors. Additionally, be sure to check "PossibleExclusions.xml" located in the about folder for genes that may cause issue.
If there is an error with my mod specifically, please provide me a Hugs Log so I can fix the issue.

Credits
RimWorld discord for helping me learn how to make a UI and not just cry in a corner (thanks Telardo and Arquebus!).
Steve who made my code look less ugly.
Redmattis who let me steal the code he uses for big and small better prerequisites so I could write my compatibility with it.
53 Comments
Amnaa 29 Jun @ 8:55am 
@Halicade Huh, I just tried to prepare a log for you using debug commands and nothing suspicious happened with the genes. Maybe something got accidentally fixed recently? Anyway, if I ever notice something, I will reload and log it for you. Thank you for the mod anyway! I've always felt like pristine xenotypes are a little unnatural.
Halicade  [author] 29 Jun @ 8:37am 
@Amnaa I just tried it out with a couple babies. They had no extra genes at birth which was good. But they didn't gain genes after becoming children either. I'm going to need a log with my mods logging enabled to better see what happened.
Halicade  [author] 29 Jun @ 8:13am 
When they become children? What the heck? I'll check it out
Amnaa 29 Jun @ 7:49am 
When babies are born, they have no additional genes. However when they grow up into children, they do gain the genes. I do have the baby option turned off. Am I missing something else?
Halicade  [author] 24 Jun @ 1:45pm 
Should be fixed! Just had to update some references to big and small I had. Thanks for noticing!
csc001 23 Jun @ 10:34pm 
when use your mod with big&small mod collection,some thing wrong

[13:32:22] Error while generating pawn. Rethrowing. Exception: System.TypeLoadException: Could not resolve type with
[13:32:22] Error in WorldGenStep: System.TypeLoadException: Could not resolve type with token O10oo01a from typeref
[13:32:23] Error while generating pawn. Rethrowing. Exception: System.TypeLoadException: Could not resolve type with
[13:32:23] There was an exception thrown by the PawnGenerator during generating a starting pawn. Trying one more
[13:32:23] Eror while generating pawn. Rethrowing. Exception: System.TypeLoadException: Could not resolve type with
[13:32:23] Exception from asynchronous event: System.TypeLoadException: Could not resolve type with token 010oo01a
Halicade  [author] 8 Jun @ 8:32am 
Sorry, I might have forgot to clear some lists when I was creating them. New update should fix that.
Also added the ability to now exclude specific races and xenotypes from receiving genes.

For excluding those two genes, I just use the "defName (loose)" with "_Retromorphosis"
"_Metamorphosis" as the exclusion.
Aside from that, if "generate genes with prerequisites" isn't working I'm going to need to see a hugs log with whatever specific gene it is. Turn on the "log genes being generated through this mod" setting so I can see when it fails in the log.
Victor 8 Jun @ 7:28am 
I tried it, but even adding every metamorph and retromorph via defname couldn't stop it showing up. Also, the option to generate genes with their prerequisites isn't working with modded genes.
Halicade  [author] 1 Jun @ 5:15pm 
You should be able to use the "loose" category. Just copy paste the value I have in the about folder.

I wrote that list before I added the new category options, so everything there is based on defname (loose)
Victor 1 Jun @ 10:46am 
Actually I found a file in the mod folder that mentions them, with the great title of PossibleExclusionsForRandomStartingGenesIWantToMakeThisTagVeryLongForNoReason, but I couldn't find how to apply that.