Pawn getting cirrhosis without drinking alcohol on a fresh liver

Started by bny, July 04, 2017, 05:42:34 PM

Previous topic - Next topic

bny

I'm sorry for wasting your time if this is intended behavior but I'm pretty sure it isn't

Circumstances:
I had an alcohol addicted colonist with cirrhosis and massive alcohol tolerance and decided to make him go trough a withdrawal. I made him a room with some joy related furniture, bed and tons of survival meals. He was walled of to prevent access to alcohol and i checked that he would not have any beer in his inventory. Just before walling him in I installed a fresh liver on him to get rid of the existing cirrhosis.

What happened:
Midway trough his withdrawal he got cirrhosis.

What I expected to happen:
Him not getting a cirrhosis in his fresh liver when not drinking any beer.

Edit: while at 100% withdrawal he developed a carcinoma..

Anvil_Pants

A design consideration rather than bug. Bug is code failing, and this is code working.

Specifically, your pawn got Cirrhosis and then Carcinoma simply for the fact that the pawn was currently in "alcohol tolerance". While alcohol tolerance condition is true the pawn has a recurring random chance to gain either or both of those ailments.

  <HediffDef ParentName="DrugToleranceBase">
    <defName>AlcoholTolerance</defName>
    <label>alcohol tolerance</label>
    <comps>
      <li Class="HediffCompProperties_SeverityPerDay">
        <severityPerDay>-0.015</severityPerDay>
      </li>
      <li Class="HediffCompProperties_DrugEffectFactor">
        <chemical>Alcohol</chemical>
      </li>
    </comps>
<hediffGivers>
<li Class="HediffGiver_RandomDrugEffect">
<hediff>Cirrhosis</hediff>
<minSeverity>0.50</minSeverity>
<baseMtbDays>60</baseMtbDays>
<partsToAffect>
<li>Liver</li>
</partsToAffect>
</li>
<li Class="HediffGiver_RandomDrugEffect">
<hediff>Carcinoma</hediff>
<minSeverity>0.50</minSeverity>
<baseMtbDays>180</baseMtbDays>
<partsToAffect>
<li>Liver</li>
</partsToAffect>
</li>
</hediffGivers>
  </HediffDef>


public class HediffGiver_RandomDrugEffect : HediffGiver
{
public float baseMtbDays;
public float minSeverity;
public override void OnIntervalPassed(Pawn pawn, Hediff cause)
{
if (cause.Severity < this.minSeverity)
{
return;
}
if (Rand.MTBEventOccurs(this.baseMtbDays, 60000f, 60f) && base.TryApply(pawn, null))
{
base.SendLetter(pawn, cause);
}
}
}


You got unlucky because your pawn passed the "interval" for it to roll dice to see if it gained the bad effect. Your pawn got unlucky on the dice roll.

It isn't technically inaccurate in medical terms, either. It's easily a matter of perspective. If we consider the "letter" notification of cirrhosis or carcinoma to be a diagnosis rather than the moment of disease/condition beginning, then nothing is wrong with the code as-is.

If you want to roleplay it away, then the donor was also sick.


ison

Looks like a bug indeed. Though I'm not sure if there's any easy solution. Currently we don't track beer consumptions per liver.

ison