Ludeon Forums

Ludeon Forums

  • March 29, 2020, 05:47:03 PM
  • Welcome, Guest
Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: [a16] Can't get projectile through damageInfo  (Read 358 times)

skyarkhangel

  • Colonist
  • ***
  • Posts: 650
  • Skynet machine
    • View Profile
[a16] Can't get projectile through damageInfo
« 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:
Code: [Select]
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.
« Last Edit: December 16, 2016, 07:10:42 AM by skyarkhangel »
Logged

skyarkhangel

  • Colonist
  • ***
  • Posts: 650
  • Skynet machine
    • View Profile
Re: [a16] Can't get projectile through damageInfo
« Reply #1 on: December 16, 2016, 07:50:30 AM »

Big thanks to Mrofa, found a solution:

Code: [Select]
ProjectilePropertiesCR projectileProps = dinfo.WeaponGear.Verbs.Find(s=>s.projectileDef!=null).projectileDef.projectile as ProjectilePropertiesCR;
It could help to anyone in future.
Logged