Custom Cause Hediff AoE - Vanilla-Expanded/VanillaExpandedFramework GitHub Wiki

<- Back

CompProperties_CustomCauseHediff_AoE is roughly based off of CompProperties_CauseHediff_AoE, however it's changed to fit our needs, as well as making it possible to modify if further with subclasses

         public List<PawnCapacityDef> requiredCapacities;
         public HediffDef hediff;
         public bool mustBeAwake = false;

         public bool sameRoomOnly = true;
         public float range;

         public bool allowHumanlike = true;
         public bool allowInsects = false;
         public bool allowDryads = false;
         public bool allowAnimals = false;
         public bool allowMechanoids = false;
         public bool allowEntities = false;

         public bool worksInside = true;
         public bool worksOutside = true;

         public float startingSeverity = 1f;
         // Used in combination with HediffComp_Disappears.
         // For performance reasons, it shouldn't be too small.
         public int checkInterval = 100;
         // To be constant it should be longer by a few ticks than checkInterval.
         // Minimum of 15 ticks more than interval is recommended due to the way variable tick rate works.
         public int hediffDuration = 120;

         // In case someone wants to do weird stuff.
         protected virtual bool LogWorksBothInsideAndOutsideFieldAreFalse => true;

A PlaceWorker, PlaceWorker_CompCustomCauseHediff_AoE, will also handle showing the radius on placement.

How do I use this code?

It is a comp class, so you just add it in XML in the <comps> tag. For example, this is the air purifier in VE Furniture - Spacer:

<comps>
	 <li Class="VFECore.CompProperties_CustomCauseHediff_AoE">
                  <hediff>VFES_FreshAir</hediff>
                  <!-- If range is default (0) or negative, the range is infinite (unless limited by same room). -->
                  <checkInterval>300</checkInterval>
                  <hediffDuration>305</hediffDuration>
                  <worksOutside>false</worksOutside>
         </li>
</comps>

You will also need its PlaceWorker:

<placeWorkers>
      <li>VEF.Buildings.PlaceWorker_CompCustomCauseHediff_AoE</li>
</placeWorkers>
⚠️ **GitHub.com Fallback** ⚠️