Hive Mind Genes - KonradHeinser/EBSGFramework GitHub Wiki

This extension allows you to make genes that make the carrier part of a hive. This works by having the pawn check for all other player pawns on the map that are in the same hive, then applying hediffs based on the lower and upper thresholds you set. For example, you can add a Core gene for a hive that has extreme debuffs when another core is in the hive, but provides bonuses when they are the only one. This Core can check for Drones in the hive, and apply hediffs based on how many are found.

Each gene can only add one hive role, but multiple genes can be added to the same pawn to make them perform multiple roles, or be part of multiple hives. This class and modExtension can be added to a gene with the following code:

        <geneClass>EBSGFramework.HiveMindGene</geneClass>

        <modExtensions>
	     <li Class="EBSGFramework.HiveMindExtension">
                <hiveKey>InsertHiveKeyHere</hiveKey>
	    </li>
	</modExtensions>

In this extension, you have the following options available:

  • hiveKey : Treat this like a defName. This is what allows the code to have multiple hives in the same colony without having every single role have a unique key. While you won't get errors if you forget to set it, you will have issues if another hive isn't set up properly.
  • key : This is the gene's role in the hive. If there is only one role, you don't need to add this.
  • hiveRolesToCheckFor : This is a list of all the role that this gene will check for. The example below will show how to set this up, but here are all the options available.
    • checkKey : This is the key of whatever role you're checking for. If you only have one role, this can be blank.
    • minCount : This is the minimum count required for the hediffWhenFew options
    • hediffWhenTooFew : If you only want to apply one hediff, you can use this
    • hediffsWhenTooFew : If you have a list of hediffs to add, use this
    • hediffWhenEnough : When above the min threshold and below the max, this is applied
    • hediffsWhenEnough : See above, but a list
    • maxCount : This is the minimum count required for the hediffWhenMany options
    • hediffWhenTooMany : If you only want to apply one hediff, you can use this
    • hediffsWhenTooMany : If you have a list of hediffs to add, use this

Part of an Example Hive made to demonstrate all the options.

    <GeneDef>
        <defName>EBSG_HiveCore</defName>
        <label>hive core</label>        
        <description>This is the core of the Expanded Biotech Style Genes Hive.</description>
        <geneClass>EBSGFramework.HiveMindGene</geneClass>
        <iconPath>UI/Icons/Genes/Gene_Coagulate</iconPath>
        <displayCategory>Miscellaneous</displayCategory>
        <modExtensions>
	     <li Class="EBSGFramework.HiveMindExtension">
                <key>Core</key>
                <hiveKey>EBSGExampleHive</hiveKey>
                <hiveRolesToCheckFor>
                    <li> <!--Only one core allowed-->
                        <checkKey>Core</checkKey>
                        <hediffWhenEnough>EBSG_EnoughCores</hediffWhenEnough>
                        <maxCount>1</maxCount>
                        <hediffWhenTooMany>EBSG_TooManyCores</hediffWhenTooMany>
                    </li>
                    <li> <!--Core expects at least 2 drones-->
                        <checkKey>Drone</checkKey>
                        <minCount>2</minCount>
                        <hediffWhenTooFew>EBSG_TooFewDrones</hediffWhenTooFew>
                        <hediffWhenEnough>EBSG_EnoughDrones</hediffWhenEnough>
                    </li>
                </hiveRolesToCheckFor>
	    </li>
	</modExtensions>
    </GeneDef>

Note: The current system only allows for 3 hediffs per checked role, but future versions may increase this to 5, 7, 9, etc.

⚠️ **GitHub.com Fallback** ⚠️