Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.97a is out! (02/02/24); New blog post: Simulator Enhancements (03/13/24)

Author Topic: EveryFrameWeaponEffectPlugin - Refit Menu Check  (Read 1837 times)

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
EveryFrameWeaponEffectPlugin - Refit Menu Check
« on: August 29, 2014, 05:22:41 AM »

For future reference, when you get NPEs and other bugs in the refit menu with an EveryFrameWeaponEffectPlugin. You can check if weapon.getShip().getOriginalOwner() == -1

If this is true, then you're in the refit menu.

        if (weapon.getShip().getOriginalOwner() == -1){
            return;
        }
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: EveryFrameWeaponEffectPlugin - Refit Menu Check
« Reply #1 on: August 29, 2014, 12:51:26 PM »

Yes! This should allow me to fix a long-standing bug in my faction. Many thanks  :D
How'd you figure this out?

Debido

  • Admiral
  • *****
  • Posts: 1183
    • View Profile
Re: EveryFrameWeaponEffectPlugin - Refit Menu Check
« Reply #2 on: August 29, 2014, 06:20:44 PM »

I was getting a NPE in the refit menu. So I attached a NetBeans debugger to the crashing EveryFrameWeaponEffectPlugin, and was looking at the variables and noticed that value when looking for possible null values. I thought it could be useful to others experiencing similar issues.
Logged

Sundog

  • Admiral
  • *****
  • Posts: 1723
    • View Profile
Re: EveryFrameWeaponEffectPlugin - Refit Menu Check
« Reply #3 on: August 29, 2014, 07:11:41 PM »

Well you were right  :)

Tecrys

  • Admiral
  • *****
  • Posts: 592
  • repair that space elevator!
    • View Profile
Re: EveryFrameWeaponEffectPlugin - Refit Menu Check
« Reply #4 on: August 30, 2014, 01:05:59 PM »

It's great that you were able to find that out, now my edited version of the weapon mirroring script could be fixed and that would make left and right variants of my melee weapons obsolete.
Logged
Symbiotic Void Creatures 0.5.0-alpha for 0.97a is out
https://fractalsoftworks.com/forum/index.php?topic=28010.0