Skip to content

IngestionOutcomeDoer_ChangeHediffSeverity

Nathan edited this page Feb 4, 2021 · 3 revisions

This IngestionOutcomeDoer will alter the severity of a hediff if it is found on the ingesting pawn

hediffDef - the name of the HediffDef to affect

severity - the amount to alter the hediff severity by

isScalar - if set to true, the severity of the hediff will be multiplied by the severity value

toleranceChemical - (optional) if given the name of a ChemicalDef, tolerance to this chemical will reduce the effect

divideByBodySize - (optional) if set to true, the effect will be divided by the body size of the user

<li Class="CM_Custom_Tools.IngestionOutcomeDoers.IngestionOutcomeDoer_ChangeHediffSeverity">
  <hediffDef>AlcoholHigh</hediffDef>
  <divideByBodySize>true</divideByBodySize>
  <isScalar>false</isScalar>
  <severity>-0.10</severity>        
</li>

The following example creates a drug that reduces the users alcohol high every time it is taken:

  <ThingDef ParentName="MakeableDrugBase">
    <defName>CM_Custom_Tools_Examples_Sober_Leaf_Joint</defName>
    <label>soberleaf joint</label>
    <description>A non-addictive smokeleaf product that magically removes alcohol from your system.</description>
    <graphicData>
      <texPath>Things/Item/Drug/Joint</texPath>
      <graphicClass>Graphic_StackCount</graphicClass>
    </graphicData>
    <rotatable>false</rotatable>
    <statBases>
      <WorkToMake>450</WorkToMake>
      <MarketValue>11</MarketValue>
      <Mass>0.05</Mass>
      <DeteriorationRate>6</DeteriorationRate>
      <Flammability>1.3</Flammability>
    </statBases>
    <techLevel>Neolithic</techLevel>
    <ingestible>
      <foodType>Plant, Processed</foodType>
      <baseIngestTicks>720</baseIngestTicks>
      <nurseable>true</nurseable>
      <drugCategory>Social</drugCategory>
      <ingestSound>Ingest_Smoke</ingestSound>
      <ingestEffect>Smoke_Joint</ingestEffect>
      <ingestEffectEat>EatVegetarian</ingestEffectEat>
      <ingestHoldOffsetStanding>
        <northDefault>
          <offset>(0.27,0,0.08)</offset>
          <behind>true</behind>
        </northDefault>
        <east>
          <offset>(0.45,0,0.08)</offset>
        </east>
        <south>
          <offset>(0.27,0,0.08)</offset>
        </south>
        <west>
          <offset>(-0.50,0,0.08)</offset>
          <flip>true</flip>
        </west>
      </ingestHoldOffsetStanding>
      <ingestHoldUsesTable>false</ingestHoldUsesTable>
      <ingestCommandString>Smoke {0}</ingestCommandString>
      <ingestReportString>Smoking {0}.</ingestReportString>
      <ingestReportStringEat>Consuming {0}.</ingestReportStringEat>
      <useEatingSpeedStat>false</useEatingSpeedStat>
      <outcomeDoers>
        <li Class="IngestionOutcomeDoer_GiveHediff">
          <hediffDef>SmokeleafHigh</hediffDef>
          <severity>0.05</severity>
          <toleranceChemical>Smokeleaf</toleranceChemical>
        </li>
        <li Class="IngestionOutcomeDoer_OffsetNeed">
          <need>Rest</need>
          <offset>-0.01</offset>
        </li>
        <li Class="IngestionOutcomeDoer_GiveHediff">
          <hediffDef>SmokeleafTolerance</hediffDef>
          <severity>0.030</severity>
          <divideByBodySize>true</divideByBodySize>
        </li>
		<li Class="CM_Custom_Tools.IngestionOutcomeDoers.IngestionOutcomeDoer_ChangeHediffSeverity">
          <hediffDef>AlcoholHigh</hediffDef>
		  <divideByBodySize>true</divideByBodySize>
		  <isScalar>false</isScalar>
          <severity>-0.10</severity>         
        </li>
      </outcomeDoers>
    </ingestible>
    <recipeMaker>
      <recipeUsers>
        <li>DrugLab</li>
      </recipeUsers>
      <workSpeedStat>DrugCookingSpeed</workSpeedStat>
      <workSkill>Cooking</workSkill>
    </recipeMaker>
    <costList>
      <SmokeleafLeaves>4</SmokeleafLeaves>
    </costList>
	<comps>
      <li Class="CompProperties_Drug">
        <listOrder>1001</listOrder>
      </li>
    </comps>
  </ThingDef>

Clone this wiki locally