Gene in Colony Mood Precept - KonradHeinser/EBSGFramework GitHub Wiki

This workerClass applies one of 3 stages.

  • In the first stage, the worker found no matches when it checked the relatedGenes
  • The second stage is used when at least one match was found, but the leader does not have any of the genes
  • The third one is active when the leader does meet the criteria

This extension is checked for the list of genes to check for. Pawns only ever need to have one of the genes on the list. When checkNotPresent (Default False) is set to True, then it checks to make sure none of the genes are present:

        <modExtensions>
            <li Class="EBSGFramework.EBSGThoughtExtension">
                <relatedGenes>
                    <li>DefNameHere</li>
                </relatedGenes>
                <checkNotPresent>False</checkNotPresent>
            </li>
        </modExtensions>

The thought and worker classes in question:

            <thoughtClass>Thought_Situational</thoughtClass>
            <workerClass>EBSGFramework.ThoughtWorker_Precept_RelatedGeneColonist</workerClass>

Adapted examples from Superhero Genes. The first one is the thought and precept that reveres supers, while the second one hates anyone who isn't a super or a slave:

    <!--Seeing if anyone has the gene-->
    <ThoughtDef>
        <defName>SHG_SuperColonist_Revered</defName>
        <thoughtClass>Thought_Situational</thoughtClass>
        <workerClass>EBSGFramework.ThoughtWorker_Precept_RelatedGeneColonist</workerClass>
        <nullifiedIfNotColonist>true</nullifiedIfNotColonist>
        <stages>
            <li>
                <label>no supers</label>
                <description>We don't have any supers here that can help us.</description>
                <baseMoodEffect>-5</baseMoodEffect>
            </li>
            <li>
                <label>no super leader</label>
                <description>Without a super leader, our colony feels incomplete and pointless. We should make a super our leader.</description>
                <baseMoodEffect>-3</baseMoodEffect>
            </li>
            <li>
                <label>super leader</label>
                <description>The super's presence is a great honor. May they live forever.</description>
                <baseMoodEffect>5</baseMoodEffect>
            </li>
        </stages>
        <modExtensions>
            <li Class="EBSGFramework.EBSGThoughtExtension">
                <relatedGenes>
                    <li>SuperHeroBase</li>
                </relatedGenes>
            </li>
        </modExtensions>
    </ThoughtDef>

    <PreceptDef>
        <defName>SHG_SupersRevered</defName>
        <issue>SHG_Supers</issue>
        <label>revered</label>
        <description>.</description>
        <impact>Medium</impact>
        <comps>
            <li Class="PreceptComp_SituationalThought">
                <thought>SHG_Supers_Revered_Opinion_Super</thought>
                <description>Super</description>
            </li>
            <li Class="PreceptComp_KnowsMemoryThought">
                <eventDef>SHG_SuperDied</eventDef>
                <thought>SHG_SuperDied_Revered</thought>
            </li>
            <li Class="PreceptComp_SituationalThought">
                <thought>SHG_Supers_ReveredSuper</thought>
                <description>Super self reverence</description>
            </li>
            <li Class="PreceptComp_SituationalThought">
                <thought>SHG_SuperColonist_Revered</thought>
                <description>Super among us</description>
                <thoughtStageDescriptions>
                    <li>No supers</li>
                    <li>No super leader</li>
                    <li>Super leader</li>
                </thoughtStageDescriptions>
            </li>
        </comps>
    </PreceptDef>

        <!--Seeing if the gene is not present on someone-->
        <ThoughtDef>
            <defName>SHG_SuperColonist_Supremacy</defName>
            <thoughtClass>Thought_Situational</thoughtClass>
            <workerClass>EBSGFramework.ThoughtWorker_Precept_RelatedGeneColonist</workerClass>
            <nullifiedIfNotColonist>true</nullifiedIfNotColonist>
            <stages>
                <li>
                    <label>no non-supers</label> <!--Nobody is missing the Superhero Gene-->
                    <description>We don't have any non-supers tainting our colony.</description>
                    <baseMoodEffect>10</baseMoodEffect>
                </li>
                <li>
                    <label>Non-supers</label> <!--At least one person is missing the Superhero Gene-->
                    <description>We have a non-super colonist in our midst. Maybe we should send them to the front lines.</description>
                    <baseMoodEffect>-10</baseMoodEffect>
                </li>
                <li>
                    <label>non-super leader</label> <!--The leader is missing the Superhero Gene-->
                    <description>A non-super leader!? This must be rectified by any means.</description>
                    <baseMoodEffect>-20</baseMoodEffect>
                </li>
            </stages>
            <modExtensions>
                <li Class="EBSGFramework.EBSGThoughtExtension">
                    <relatedGenes>
                        <li>SuperHeroBase</li>
                    </relatedGenes>
                    <checkNotPresent>True</checkNotPresent> <!--Only checks colonists. Slaves and Prisoners are ignored-->
                </li>                                       <!--Iguanas are ignored too-->
            </modExtensions>
        </ThoughtDef>
    
        <PreceptDef ParentName="RaidingBase">
            <defName>SHG_SupersSupremacy</defName>
            <issue>SHG_Supers</issue>
            <label>supremacy</label>
            <description>.</description>
            <impact>High</impact>
            <comps>
                <li Class="PreceptComp_SituationalThought">
                    <thought>SHG_Supers_Supremacy_Opinion_Super</thought>
                    <description>Super supremacy</description>
                </li>
                <li Class="PreceptComp_KnowsMemoryThought">
                    <eventDef>SHG_SuperDied</eventDef>
                    <thought>SHG_SuperDied_Supremacy</thought>
                </li>
                <li Class="PreceptComp_SituationalThought">
                    <thought>SHG_Supers_SupremacySuper</thought>
                    <description>Non-super self hatred</description>
                </li>
                <li Class="PreceptComp_SituationalThought">
                    <thought>SHG_SuperColonist_Supremacy</thought>
                    <description>non-super among us</description>
                    <thoughtStageDescriptions>
                        <li>No non-supers</li>
                        <li>Non-supers</li>
                        <li>A non-super leader</li>
                    </thoughtStageDescriptions>
                </li>
                <li Class="PreceptComp_SituationalThought">
                    <thought>SHG_RecentConquest_Supremacy</thought>
                    <thoughtStageDescriptions>
                        <li>Less than {DAYSSINCELASTRAIDTHRESHOLD} days since our last raid</li>
                        <li>More than {DAYSSINCELASTRAIDTHRESHOLD} days since our last raid</li>
                    </thoughtStageDescriptions>
                </li>
                <li Class="PreceptComp_SelfTookMemoryThought">
                    <thought>SHG_ParticipatedInRaid_Supremacy</thought>
                    <eventDef>Raided</eventDef>
                </li>
            </comps>
        </PreceptDef>```
⚠️ **GitHub.com Fallback** ⚠️