Ludeon Forums

RimWorld => Mods => Help => Topic started by: simonster99 on June 12, 2022, 03:14:40 PM

Title: [Solved] Damage skin layer only?
Post by: simonster99 on June 12, 2022, 03:14:40 PM
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)?