[a16] Can't get projectile through damageInfo

Started by skyarkhangel, December 16, 2016, 05:17:15 AM

Previous topic - Next topic

skyarkhangel

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.

skyarkhangel

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.