Skip to content

CompIncreaseUserHediffSeverityWhenHurt

Nathan edited this page Feb 4, 2021 · 7 revisions

This comp will increase the severity of a specified hediff on the wearer/equipper of an item every time they get hurt. If the hediff is not present, it will be added.

hediffDef is the name of the hediff def to give/alter.

severityToHealthFactor is multiplied by the total health lost by the pawn to get the amount to alter the hediff's severity by.

<li Class="CM_Custom_Tools.Comps.CompProperties_IncreaseUserHediffSeverityWhenHurt">
  <hediffDef>AlcoholHigh</hediffDef>
  <severityToHealthFactor>1.0</severityToHealthFactor>
</li>

The following example creates a weapon that gets the user more drunk every time they get hit while it is equipped:

  <ThingDef ParentName="BaseMeleeWeapon_Blunt">
    <defName>CM_Custom_Addons_Examples_Drunken_Master_Bottle</defName>
    <label>bottle of the drunken master</label>
    <description>An enchanted bottle that imbues its wielder with the power of a drunken master.</description>
    <graphicData>
      <texPath>Things/Item/Drug/Beer</texPath>
      <graphicClass>Graphic_StackCount</graphicClass>
    </graphicData>
    <uiIconScale>1.1</uiIconScale>
    <techLevel>Neolithic</techLevel>
    <weaponTags>
      <li>NeolithicMeleeBasic</li>
    </weaponTags>
    <costStuffCount>40</costStuffCount>
    <statBases>
      <WorkToMake>1200</WorkToMake>
      <Mass>2</Mass>
    </statBases>
    <equippedAngleOffset>-150</equippedAngleOffset>
	<rotatable>false</rotatable>
    <stuffCategories>
      <li>Metallic</li>
      <li>Woody</li>
      <li>Stony</li>
    </stuffCategories>
    <recipeMaker>
      <recipeUsers>
        <li>CraftingSpot</li>
      </recipeUsers>
    </recipeMaker>
    <tools>
      <li>
        <label>bottle</label>
        <capacities>
          <li>Blunt</li>
        </capacities>
        <power>9</power>
        <cooldownTime>2</cooldownTime>
      </li>
      <li>
        <label>neck</label>
        <capacities>
          <li>Poke</li>
        </capacities>
        <power>9</power>
        <cooldownTime>2</cooldownTime>
      </li>
    </tools>
	<comps>
      <li Class="CM_Custom_Tools.Comps.CompProperties_IncreaseUserHediffSeverityWhenHurt">
        <hediffDef>AlcoholHigh</hediffDef>
        <severityToHealthFactor>1.0</severityToHealthFactor>
      </li>
    </comps>
  </ThingDef>

It works with apparel as well, the next example creates a war mask that gets the wearer more stoned when they are hit:

  <ThingDef ParentName="HatMakeableBase">
    <defName>CM_Custom_Addons_Examples_Stoned_Mask</defName>
    <label>stoned mask</label>
    <description>A magical green war mask with a skunky aroma.</description>
    <techLevel>Neolithic</techLevel>
    <graphicData>
      <texPath>Things/Pawn/Humanlike/Apparel/WarMask/WarMask</texPath>
      <graphicClass>Graphic_Single</graphicClass>
      <drawSize>0.80</drawSize>
    </graphicData>
    <uiIconScale>1.15</uiIconScale>
    <stuffCategories>
      <li>Stony</li>
    </stuffCategories>
    <costStuffCount>25</costStuffCount>
    <statBases>
      <WorkToMake>3000</WorkToMake>
      <MaxHitPoints>80</MaxHitPoints>
      <Mass>1.4</Mass>
      <StuffEffectMultiplierArmor>0.3</StuffEffectMultiplierArmor>
      <StuffEffectMultiplierInsulation_Cold>0.05</StuffEffectMultiplierInsulation_Cold>
      <StuffEffectMultiplierInsulation_Heat>0.05</StuffEffectMultiplierInsulation_Heat>
      <EquipDelay>1.5</EquipDelay>
    </statBases>
    <equippedStatOffsets>
      <PainShockThreshold>0.10</PainShockThreshold>
    </equippedStatOffsets>
    <apparel>
      <bodyPartGroups>
        <li>FullHead</li>
      </bodyPartGroups>
      <wornGraphicPath>Things/Pawn/Humanlike/Apparel/WarMask/WarMask</wornGraphicPath>
      <hatRenderedFrontOfFace>true</hatRenderedFrontOfFace>
      <layers>
        <li>Overhead</li>
      </layers>
      <defaultOutfitTags>
        <li>Soldier</li>
      </defaultOutfitTags>
    </apparel>
	  <colorGenerator Class="ColorGenerator_Options">
      <options>
        <li>
          <weight>10</weight>
          <only>(0.33,1.0,0.33,1)</only>
        </li>
      </options>
    </colorGenerator>
    <recipeMaker>
      <workSpeedStat>GeneralLaborSpeed</workSpeedStat>
      <workSkill>Crafting</workSkill>
      <effectWorking>Sculpt</effectWorking>
      <soundWorking>Recipe_Sculpt</soundWorking>
      <recipeUsers>
        <li>CraftingSpot</li>
      </recipeUsers>
      <unfinishedThingDef>UnfinishedSculpture</unfinishedThingDef>
      <factionPrerequisiteTags>
        <li>Tribal</li>
      </factionPrerequisiteTags>
    </recipeMaker>
	<comps>
      <li Class="CM_Custom_Tools.Comps.CompProperties_IncreaseUserHediffSeverityWhenHurt">
        <hediffDef>SmokeleafHigh</hediffDef>
        <severityToHealthFactor>1.0</severityToHealthFactor>
      </li>
    </comps>
  </ThingDef>

Clone this wiki locally