Fractal Softworks Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

Starsector 0.9.1a is out! (05/10/19); Blog post: Skills and Story Points (07/08/19)

Author Topic: EveryFrameWeaponEffectPlugin - Refit Menu Check  (Read 1391 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: 832
    • 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: 832
    • View Profile
Re: EveryFrameWeaponEffectPlugin - Refit Menu Check
« Reply #3 on: August 29, 2014, 07:11:41 PM »

Well you were right  :)

Tecrys

  • Captain
  • ****
  • Posts: 478
  • Creator of Biomancy Genetic Engineering
    • 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
Bringing biological warfare to Stasector since 2014.
Let's say I'm the cave man type of a modder, I put the square through the triangle in kindergarten and even succeed.
Such a stupid thing to quote myself, oh well