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:
- 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>