Give Hediffs to Non‐Allies - KonradHeinser/EBSGFramework GitHub Wiki
When I was making the Psionic Debuffer for Superhero Genes, I had an issue where the only options I had for giving hediffs within range were only to allies, or to everyone. My solution was to just make a comp that acted almost exactly the same, but only affected pawns that are enemies. All of the options reside in a comp like this:
<comps>
<li Class="EBSGFramework.HediffCompProperties_GiveHediffsToNonAlliesInRange">
<targetingParameters> <!--All your desired targets can be set here, these are just the ones usually used-->
<canTargetBuildings>false</canTargetBuildings>
<canTargetAnimals>True</canTargetAnimals>
<canTargetMechs>False</canTargetMechs>
</targetingParameters>
</li>
</comps>
These are all of the options available for the comp, other than the targetingParameters set above:
- duration : Default (10) : How many ticks the hediff will last. By default, the hediff is applied every 5 ticks and lasts for 10 ticks. If the target is within the area in an interval, the duration is refreshed
- interval : Default (5) : How many ticks between hediff application attempts. If this number is made lower, the pawn will end up checking all the pawns on the map more often, which may cause some issues later on
- successChance : A special item that dictates the chance of success. If you don't add this to the comp, then it will always work. This is only checked if the interval is changed from the default since checking stats too often may cause unexpected issues
- range : Default (1) : How close an enemy needs to be to be targeted
- rangeStat : Overrides range with the stat value
- hediff : The hediff to be applied
- mote : Adds a mote using the same code as what the normal hediffs in area does
- hideMoteWhenNotDrafted : Default (false) : Does what it says
- psychic : Default (true) : Causes the hediff to not be applied to psychically deaf pawns. Has no effect on other pawns unless the applied hediff specifies otherwise
- initialSeverity : Default (1) : Probably not very useful, but if the hediff is supposed to fall after being applied, this would have an effect
- onlyWhileDrafted : Default (true) : Does as stated. Saves on a bit of performance for situations like the debuffer, which can have several auras at the same time
Generic adapted version of the Psionic Debuffer hediff from Superhero Genes:
<comps>
<li Class="EBSGFramework.HediffCompProperties_GiveHediffsToNonAlliesInRange">
<range>15</range>
<rangeStat>SHG_Debuffer_Range</rangeStat>
<mote>Mote_SparkThrown</mote>
<hideMoteWhenNotDrafted>true</hideMoteWhenNotDrafted>
<targetingParameters>
<canTargetBuildings>false</canTargetBuildings>
<canTargetAnimals>True</canTargetAnimals>
<canTargetMechs>False</canTargetMechs>
</targetingParameters>
<hediff>SHG_Psionist_Debuffer_Debuff</hediff>
</li>
</comps>