CompassTargetChanged doesn't work on entering new system
Moderators: winston, another_commander, Getafix
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
CompassTargetChanged doesn't work on entering new system
In 1.76 (has this been fixed in trunk already?) when entering a new system, the compass target is set to the planet, and compassTargetChanged fires if the compass is not in COMPASS_MODE_PLANET. But, if the compass is already in planet mode when you leave the previous system, compassTargetChanged does not fire. Hello? It's a different planet!
Re: CompassTargetChanged doesn't work on entering new system
Fixed in rev5359. In addition to that, the compass target will change to undefined just after willEnterWitchspace, if jumping away from a normal system.
Interstellar space and nova systems stop the compass from working, so nothing is going to happen there compass-wise...
For possible interest to oxp HUD makers, switching the compass off in flight (either by switching to a compass-free hud, or by making the compass depend on some breakable piece of equipment) now triggers yet another compassTargetChanged event, this time with target null; switching the compass on will trigger compassTargetChanged again (from null to the previous target).
It used to be possible to switch targets with the '\' button even if the advanced compass wasn't displayed, the switch itself taking place only after the compass was switched on again, but it's no longer the case. It's now possible to switch compass targets only if there's a compass displayed on screen (a transparent one, even).
Hope this helps.
Interstellar space and nova systems stop the compass from working, so nothing is going to happen there compass-wise...
For possible interest to oxp HUD makers, switching the compass off in flight (either by switching to a compass-free hud, or by making the compass depend on some breakable piece of equipment) now triggers yet another compassTargetChanged event, this time with target null; switching the compass on will trigger compassTargetChanged again (from null to the previous target).
It used to be possible to switch targets with the '\' button even if the advanced compass wasn't displayed, the switch itself taking place only after the compass was switched on again, but it's no longer the case. It's now possible to switch compass targets only if there's a compass displayed on screen (a transparent one, even).
Hope this helps.
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: CompassTargetChanged doesn't work on entering new system
Thanks. That is much better.Kaks wrote:It used to be possible to switch targets with the '\' button even if the advanced compass wasn't displayed, the switch itself taking place only after the compass was switched on again, but it's no longer the case. It's now possible to switch compass targets only if there's a compass displayed on screen (a transparent one, even). Hope this helps.
No thanks.Kaks wrote:For possible interest to oxp HUD makers, switching the compass off in flight (either by switching to a compass-free hud, or by making the compass depend on some breakable piece of equipment) now triggers yet another compassTargetChanged event, this time with target null; switching the compass on will trigger compassTargetChanged again (from null to the previous target).
How do I make the SVN repository thingy spit out the previous version of HeadUpDisplay.m - I forgot to make a back-up before I updated to r5359?
Re: CompassTargetChanged doesn't work on entering new system
if you use tortoiseSVN it's a piece of cake, just look at the revision you're interested in, double-click the file in question from the list in the bottom half of the screen, and you'll see the 'before' and 'after' versions side by side - ctrl-a + ctrl-c will do the rest!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: CompassTargetChanged doesn't work on entering new system
And if I don't?Kaks wrote:if you use tortoiseSVN it's a piece of cake...
Re: CompassTargetChanged doesn't work on entering new system
Either: copy and paste from the web interface: http://svn.berlios.de/wsvn/oolite-linux
Or:
Or:
svn up -r 5358
will revert your local repo to 5358, you can take a backup of the file, and then do svn up
to return to the latest version.Re: CompassTargetChanged doesn't work on entering new system
Cim was faster!
Still, if you're using windows I'd recommend tortoiseSVN ( or rabbitVCS if you're on linux), it does make using svn a lot easier... 'course, if you prefer using the command line there are always man pages...
Incidentally:
Step 1: mention which actual client you use.
Step 2: get the right advice for your client!
Still, if you're using windows I'd recommend tortoiseSVN ( or rabbitVCS if you're on linux), it does make using svn a lot easier... 'course, if you prefer using the command line there are always man pages...
Incidentally:
Step 1: mention which actual client you use.
Step 2: get the right advice for your client!
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Wildeblood
- ---- E L I T E ----
- Posts: 2453
- Joined: Sat Jun 11, 2011 6:07 am
- Location: Western Australia
- Contact:
Re: CompassTargetChanged doesn't work on entering new system
Your new COMPASS_MODE_INACTIVE value will only appear in player.ship.compassMode while the compass isn't drawn, but it will never be sent as the second parameter in compassTargetChanged, is that right?Kaks wrote:For possible interest to oxp HUD makers, switching the compass off in flight (either by switching to a compass-free hud, or by making the compass depend on some breakable piece of equipment) now triggers yet another compassTargetChanged event, this time with target null; switching the compass on will trigger compassTargetChanged again (from null to the previous target).
And, if I just comment out the last line of this, so it doesn't send the bogus compassTargetChanged, that shouldn't break anything else?
Code: Select all
if (EXPECT_NOT(!_compassUpdated && _compassActive && [self checkPlayerInSystemFlight])) // compass gone / broken / disabled ?
{
// trigger the targetChanged event with whom == null
_compassActive = NO;
[PLAYER doScriptEvent:OOJSID("compassTargetChanged") withArguments:[NSArray arrayWithObjects:[NSNull null], OOStringFromCompassMode([PLAYER compassMode]), nil]];
}
Re: CompassTargetChanged doesn't work on entering new system
That's right. It's used purely as an internal flag.Wildeblood wrote:Your new COMPASS_MODE_INACTIVE value will only appear in player.ship.compassMode while the compass isn't drawn, but it will never be sent as the second parameter in compassTargetChanged, is that right?
Probably not, though your private build might well break oxps relying on the new compassTargetChanged behaviour.Wildeblood wrote:And, if I just comment out the last line of this, so it doesn't send the bogus compassTargetChanged, that shouldn't break anything else?
If you want to filter out compassTargetChanged() events relating to the compass being switched off, a simpler - and suggested - alternative is to have
Code: Select all
this.compassTargetChanged(target,mode)
{
// I don't care about the compass being turned off!
if (target===null) return;
// 'bogus-free' stuff follows!
....
}
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)