[Solved] Damage skin layer only?

Started by simonster99, June 12, 2022, 03:14:40 PM

Previous topic - Next topic

simonster99

Hi, I'm trying to make a flamethrower that deals burn damage to the outmost layer of a pawn.

The code I have for dealing damage looks like this:

BodyPartRecord part = null;
targetPawn.RaceProps.body.GetPartsWithDef(BodyPartDefOf.Body).TryRandomElement(out part);
DamageInfo dmgInfo = new DamageInfo(DamageDefOf.Burn, 1, 1, -1, this.launcher, part);
targetPawn.TakeDamage(dmgInfo);

The problem is that it will also damage internal organs such as heart or brain.

Is there some way to specify to damage only the outmost layer (i.e. torso, limbs, head)?