Ludeon Forums

RimWorld => Support => Topic started by: skyarkhangel on December 16, 2016, 05:17:15 AM

Title: [a16] Can't get projectile through damageInfo
Post by: skyarkhangel on December 16, 2016, 05:17:15 AM
Hello all. While updating Combat Realism encountered with the problem that can't get dinfo.WeaponGear.projectile
It works on a15 and earlier.
Meanwhile dinfo.WeaponGear works fine and show weapon thingdef. But if add projectile goes to null.

CR using this redefinition to get instigator weapon ammoPenetration to calculate armor penetration:

ProjectilePropertiesCR projectileProps = dinfo.WeaponGear.projectile as ProjectilePropertiesCR;


I am trying to find the cause for a long time, to no avail. I suppose its Rimworld error. Need help.
Title: Re: [a16] Can't get projectile through damageInfo
Post by: skyarkhangel on December 16, 2016, 07:50:30 AM
Big thanks to Mrofa, found a solution:

ProjectilePropertiesCR projectileProps = dinfo.WeaponGear.Verbs.Find(s=>s.projectileDef!=null).projectileDef.projectile as ProjectilePropertiesCR;

It could help to anyone in future.