[0.17.1541] Surgery failure: 80% death rate (xml)

Started by Rah, May 17, 2017, 01:41:24 PM

Previous topic - Next topic

Rah

When you create a XML file with a surgery recipe and set the "deathOnFailedSurgeryChance" to something very small like 0.01%, the patient will die like 80% of the time, IF the surgery fails. The doctor used is rested, healthy and lvl 15. The room is sterile and when you click on the bed it says 110% surgery success chance. Regular medicine is used. Surgery success is coded to 90%. The code will look something like this:

<surgerySuccessChanceFactor>0.9</surgerySuccessChanceFactor>
      <deathOnFailedSurgeryChance>0.1</deathOnFailedSurgeryChance>
      <recipeUsers>
         <li>Human</li>
      </recipeUsers>
   </RecipeDef>

This is a code snippet from my mod which seems to work fine in A16. If the surgery fails, isn't death supposed to be 1% here? And finally, decapitations seem to be very common in A17 with surgeries, traps and other things.

edit: this seems to be a thing in vanilla too, so it would be great if you could check that out.

ison

hmm, the code seems fine, it's just 1 line: if( Rand.Value < recipe.deathOnFailedSurgeryChance )

Tynan

It's because sometimes the non-deadly injuries still kill the patient.

This happens especially with any head surgery.

The difference from A16 is that now the random injuries are applied near the target part. In this case, a mistake on a jaw/eye surgery often leads to decapitation by damaging the head.

We should adjust the damage done to relate to the targeted part's HP. Ison or Zorba, please claim and address this. A successful fix would be: pawns don't die from surgery unless the deathOnFailedSurgeryChance is passed.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Rah

I've seen many deaths from torso cuts as well, which might be caused by a destroyed heart? Hope you'll be able to fix this, and good luck with the A17 release.

ison

Okay, this may be quite difficult. Because I guess we still want random failed surgery injuries to be able to completely destroy parts which are not required to live. So we'd have to be able to somehow tell if a pawn will die after we apply a given hediff.

Another option is to just make sure that random failed surgery injuries never destroy any body parts.

Rah

Quote from: ison on May 18, 2017, 09:50:04 AM
Okay, this may be quite difficult. Because I guess we still want random failed surgery injuries to be able to completely destroy parts which are not required to live. So we'd have to be able to somehow tell if a pawn will die after we apply a given hediff.

Another option is to just make sure that random failed surgery injuries never destroy any body parts.

Can't you just make the critical body parts immune to destruction? But I'm guessing that would have to include the entire head because of decapitation risk.

But yeah, maybe a check of some kind to see if the damage dealt is deadly. Then apply max damage instead, without actually killing the pawn.

ison

Okay, I think we'll just have to make sure that no vital parts are destroyed. I'll handle it.

ison

I've made sure that we try very hard not to kill the pawn when we add random surgery injuries. Theoretically the pawn can still die, but from what I've seen it only happens in less than 0,1% cases so it's fine. And it's difficult to avoid deaths completely without refactoring the whole health code.