Skip to content

Bomb Hediff Comp

SmArtKar edited this page Feb 8, 2023 · 2 revisions

You can add a comp to your hediffs to create an explosion upon their removal(including when the body part that the hediff is attached to is destroyed) or pawn's death. Due to Ludeon's EULA ToxGas will require user to have Biotech DLC installed.

    public class HediffCompProperties_Bomb : HediffCompProperties
    {
        // Radius of the explosion
        public float radius;
        // Whenever the bomb will explode upon removal
        public bool explodeOnRemoval = true;
        // Whenever the bomb will explode upon owner's death
        public bool explodeOnDeath = true;
        // Damage type of the bomb
        public DamageDef damageDef = DamageDefOf.Flame;
        // When set to true,
        public bool gasExplosion = false;
        // You can set this to whatever type of gas you want. ToxGas will require user to have biotech installed.
        public GasType gasType;
        // Amount of damage dealt by the explosion
        public int damageAmount = -1;
        // Armor penetration of the explosion
        public float armorPenetration = -1f;
    }

Here's an example of a hediff that will create a cloud of tox gas upon attached body part being destroyed or owner's death

  <HediffDef>
    <defName>ToxBomb</defName>
    <label>toxic bomb</label>
    <description>This hediff will create a cloud of tox gas upon owner's death of attached part's destruction.</description>
    <hediffClass>HediffWithComps</hediffClass>
    <comps>
      <li Class="AthenaFramework.HediffCompProperties_Bomb">
        <radius>1.9</radius>
        <explodeOnRemoval>true</explodeOnRemoval>
        <explodeOnDeath>true</explodeOnDeath>
        <damageDef>ToxGas</damageDef>
        <gasExplosion>true</gasExplosion>
        <gasType>ToxGas</gasType>
      </li>
    </comps>
  </HediffDef>

Clone this wiki locally