Disliked in Faction - KonradHeinser/EBSGFramework GitHub Wiki
This thought worker class causes stages to become active when the pawn is disliked by spawned pawns on the same map in the same faction:
<workerClass>EBSGFramework.ThoughtWorker_DislikedInFaction</workerClass>
<modExtensions>
<li Class="EBSGFramework.EBSGThoughtExtension">
</li>
</modExtensions>
If you don't include the extension, the worker will still function. Without the things from the extension, it will make the thought active at the first stage if the pawn is disliked by anyone (opinion below, but not including, 0), and active at the second stage (if there is a second stage) if nobody dislikes them. If you do include the extension in your code, these are the options available:
- maxOpinion : Default (0) : The point where the faction pawn is deemed to be disliking the thought have. This check is value exclusive, meaning if you set it to -10, then any pawn with an opinion of -10 or higher will not be included in the count
- curve : A simple curve which uses the left point for the number of pawns that dislike the thought haver, and the right number for the stage that is active past that threshold. 0 means the thought is disabled, 1 the first item on the list, 2 the second item, etc.
- For example,
<li>(3,2)</li>means that once at least 3 pawns dislike the haver, the second stage on the list will be active, assuming there isn't a point after that which would be active - The code rounds the curve results where it can so you don't need to specify the stage where each count is active (i.e. having a (3,2) and a (5,3) means that if 4 pawns dislike the haver, the thought will use the second stage), but skipping stages or going backwards can result in unexpected results (i.e. (3,3) and (5,2) will use the second stage with 4 pawns disliking the haver unless you include a (4,3) in between them)
- For example,
For the purposes of these examples, this is the gene used. It doesn't have any sort of special code in it, but if you want to experiment with stuff you should copy and paste it into your code to make the process easier:
<GeneDef>
<defName>SocialObsession</defName>
<label>socially obsessed</label>
<description>This pawn is very happy when people at least tolerate them, but get sad when anyone dislikes them.</description>
<iconPath>UI/Icons/Genes/Gene_HairColor</iconPath>
<displayCategory>Mood</displayCategory>
</GeneDef>
This first example involves the least amount of stuff. If any spawned pawn on the same map and in the same faction as the gene carrier has an opinion below 0, the carrier receives -8 mood. Otherwise, they gain +10 mood. If the second stage is removed, the thought only becomes active when someone dislikes the pawn:
<ThoughtDef>
<defName>SocialObsession</defName>
<thoughtClass>Thought_Situational</thoughtClass>
<workerClass>EBSGFramework.ThoughtWorker_DislikedInFaction</workerClass>
<validWhileDespawned>true</validWhileDespawned>
<requiredGenes>
<li>SocialObsession</li>
</requiredGenes>
<stages>
<li>
<label>socially obsessed</label>
<description>Someone doesn't like me, and now I'm sad.</description>
<baseMoodEffect>-8</baseMoodEffect>
</li>
<li>
<label>socially obsessed</label>
<description>We are all a happy group here with no conflicts.</description>
<baseMoodEffect>10</baseMoodEffect>
</li>
</stages>
</ThoughtDef>
This example makes the pawn happier the more of the fellow spawned faction members on the map hate them. If at least 2 pawns have under -20 opinion of the pawn, they gain 2 mood. Once it reaches 5, the mood increases to 5, and at 20 it increases to 20. The thought is not active if there aren't at least 2 pawns with -20 opinion of the pawn:
<ThoughtDef>
<defName>SocialObsession</defName>
<thoughtClass>Thought_Situational</thoughtClass>
<workerClass>EBSGFramework.ThoughtWorker_DislikedInFaction</workerClass>
<validWhileDespawned>true</validWhileDespawned>
<requiredGenes>
<li>SocialObsession</li>
</requiredGenes>
<stages>
<li>
<label>socially obsessed</label>
<description>Their anger makes me happy in ways I can't quite explain.</description>
<baseMoodEffect>2</baseMoodEffect>
</li>
<li>
<label>socially obsessed</label>
<description>Anger leads to hate, hate leads to funny.</description>
<baseMoodEffect>5</baseMoodEffect>
</li>
<li>
<label>socially obsessed</label>
<description>Get rage baited idiots.</description>
<baseMoodEffect>20</baseMoodEffect>
</li>
</stages>
<modExtensions>
<li Class="EBSGFramework.EBSGThoughtExtension">
<maxOpinion>-20</maxOpinion>
<curve>
<points>
<li>(0,0)</li>
<li>(2,1)</li>
<li>(5,2)</li>
<li>(10,3)</li>
</points>
</curve>
</li>
</modExtensions>
</ThoughtDef>