Jump to content

[1.12.x] FlightTracker - Library for tracking a Kerbals flight data - 3.0.0.3 (12/08/2021)


severedsolo

Recommended Posts

If you are not a modder, and this is not a dependency of a mod you use, this is probably not for you. This mod will do nothing unless another mod references it.

So basically, I wanted to make another mod that uses the same data Earn Your Stripes currently tracks. Rather than duplicating my code, or making this new mod a dependency of Earn Your Stripes I decided to split the tracker off into it's own mod.

What it does:

FlightTracker will track the following things for every kerbal in your roster:

  • How many flights a kerbal has completed
  • Total flight time accumulated by a kerbal
  • How many World Firsts a kerbal has accomplished (a Kerbal must achieve orbit before any world firsts will be counted)
  • A Vessels true Mission Elapsed Time (calculated from launch time)

Publically exposed methods:

  • Convert UTToString(double time) - will take a period of time in raw UT and convert it to the hours as a string (mainly designed to be used in UIs). If number of hours exceeds 1,000 it will truncate them, to avoid UI overflow (ie 1k instead of 1,000).
  • GetNumberOfFlights(string kerbalName) - returns the number of flights that a kerbal has successfully completed.
  • GetRecordedMissionTimeSeconds (string kerbalName) - returns the time a kerbal has logged in seconds (only updated on vessel recovery)
  • GetRecordedMissionTimeHours(string kerbalName) - as above, but returns it in hours instead.
  • GetLaunchTime(string kerbalName) - returns the time (in UT) that a kerbal last launched (updated when OnVesselRollout fires)
  • GetNumberOfWorldFirsts(string kerbalName) - returns the number of World Firsts a kerbal has accomplished after achieving orbit (updated in real time)
  • VesselRealMet(Vessel vessel) - returns the actual time since launch (in UT) - if Flight Tracker wasn't installed when the vessel was launched, will return Vessel.missionTime instead (so you are never worse off than you were)
  • VesselRealMet(Guid vesselId) - as above but you can pass it a Vessel.id instead of the actual vessel.

License: MIT

DOWNLOAD (GITHUB)

Source (Github)

Mods Currently Using FlightTracker:

 

Edited by severedsolo
Link to comment
Share on other sites

  • 1 month later...
5 hours ago, linuxgurugamer said:

If this mod is installed by itself, and later another such as Earn Your Stripes is added, will the new mod be able to see the history?

Yup, Flight Tracker does it's thing completely independently.

Link to comment
Share on other sites

  • 3 weeks later...
  • 6 months later...

Flight Tracker 2.0 Released

  • Recompiled against KSP 1.8 / .Net Framework 4.6.2
  • Kerbal Changelog is not bundled in this edition as it hasn't been updated for 1.8 yet.
  • Updated KSPAssembly version (this means that any mods that depend on Flight Tracker will need an update)
  • Kerbal Changelog is not bundled in this release as it hasn't been updated to 1.8 yet
Link to comment
Share on other sites

  • 1 month later...
  • 4 weeks later...
  • 2 weeks later...

Flight Tracker 3.0 Released

  • Put the API into it's own class, properly separated non API functions into separate classes (sorry I broke the API, all mods that depend on FlightTracker need an update).
  • Added new API function - VesselRealMet (you can pass it vessel.id or Vessel) - will tell you the ACTUAL MET of the vessel, not what KSP records. (Flight Tracker must be installed when vessel launches for this to work).
Edited by severedsolo
Link to comment
Share on other sites

@severedsolo I just noticed this in the in game log/console/debug whatever, while trying to figure out a problem with stage recovery, this is endlessly generating/looping while the KSC scene is active. I see flight tracker in there, so thought I'd report that, do you want logs? 

QUQqUpX.jpg

Edited by vardicd
Link to comment
Share on other sites

1 minute ago, vardicd said:

@severedsolo I just noticed this in the in game log/console/debug whatever, while trying to figure out a problem with stage recovery, this is endlessly generating/looping while the KSC scene is active. I see flight tracker in there, so thought I'd report that, do you want logs? QUQqUpX.jpg

You've forgotten to update one of your mods, or I've shipped the wrong dll for one of the dependant mods.

It's either going to be: Earn Your Stripes, Memorial Wall, or Bureaucracy. (If it's I've shipped wrong dll then yes I'll need a log, or at least the stacktrace of that exception from the log)

Edited by severedsolo
Link to comment
Share on other sites

Just now, severedsolo said:

You've forgotten to update one of your mods, or I've shipped the wrong dll for one of the dependant mods.

It's either going to be: Earn Your Stripes, Memorial Wall, or Bureaucracy.

I did just update both memorial wall and Bureaucracy, but haven't changed earn your stripes lately, i'll check my install and get back to you

10 minutes ago, severedsolo said:

You've forgotten to update one of your mods, or I've shipped the wrong dll for one of the dependant mods.

It's either going to be: Earn Your Stripes, Memorial Wall, or Bureaucracy. (If it's I've shipped wrong dll then yes I'll need a log, or at least the stacktrace of that exception from the log)

 

8 minutes ago, vardicd said:

I did just update both memorial wall and Bureaucracy, but haven't changed earn your stripes lately, i'll check my install and get back to you

Was earn your stripes, had forgotten that flight tracker was a dependency for that mod so when i updated it for Memorial Wall and Bureaucracy it broke earn your stripes, because i didn't realize it needed updated too. updated and all fixed.

Link to comment
Share on other sites

  • 5 weeks later...
  • 3 months later...
On 2/17/2020 at 7:21 AM, severedsolo said:

Flight Tracker 3.0.0.1 Released

  • Version Bump for KSP 1.9

Found this in my log related to Flight Tracker (I'm using Earn Your Stripes) - unsure which thread to post in or if it's meaningful, but here it is:

Quote

[LOG 21:31:20.395] [FlightTracker]: Processed Recovery of Halfield Kerman
[LOG 21:31:20.395] [FlightTracker]: Halfield Kerman - Flights: 1
[LOG 21:31:20.395] [FlightTracker]: Halfield Kerman - Time Logged: 883904
[LOG 21:31:20.395] [FlightTracker]: Halfield Kerman - World Firsts Achieved: 0
[ERR 21:31:20.396] Exception handling event onFlightTrackerUpdated in class EarnYourStripes:System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
  at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <ad04dee02e7e4a85a1299c7ee81c79f6>:0 
  at EarnYourStripes.EarnYourStripes.OnFlightTrackerUpdated (ProtoCrewMember p) [0x0000c] in <e6af5a078bbc4d33a40a8f6f5321df1c>:0 
  at EventData`1[T].Fire (T data) [0x000b0] in <55ba45dc3a43403382024deac8dcd0be>:0 

[EXC 21:31:20.396] KeyNotFoundException: The given key was not present in the dictionary.
    System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
    EarnYourStripes.EarnYourStripes.OnFlightTrackerUpdated (ProtoCrewMember p) (at <e6af5a078bbc4d33a40a8f6f5321df1c>:0)
    EventData`1[T].Fire (T data) (at <55ba45dc3a43403382024deac8dcd0be>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Debug:LogException(Exception)
    EventData`1:Fire(ProtoCrewMember)
    FlightTracker.KerbalTracker:ProcessKerbalRecovery(ProtoVessel)
    FlightTracker.EventListeners:OnVesselRecovered(ProtoVessel, Boolean)
    EventData`2:Fire(ProtoVessel, Boolean)
    VesselRetrieval:recoverVessel(Vessel)
    VesselRetrieval:recoverVessels()
    <OnLevelLoaded>d__5:MoveNext()
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
[LOG 21:31:20.396] [FlightTracker]: Processed Recovery of Surim Kerman

Log is here: https://www.dropbox.com/s/lnckeho5og1ofcq/KSPLog_FlightTrackerEXC.log?dl=0

There seem to be other issues going on in my save as well, trying to track down funky business...

Edited by AccidentalDisassembly
Link to comment
Share on other sites

2 hours ago, AccidentalDisassembly said:

There seem to be other issues going on in my save as well, trying to track down funky business...

I feel like those "other issues" might be the key here.

The error is being thrown by EarnYourStripes (but it's fine to post it here, the error does blame FlightTracker after all).

What are these other issues? Because AFAICT the only way that error could happen, is if the Kerbal in question was no longer part of your crew. I will go through your log though, it's entirely possible that EYS is dying earlier, and causing the issue.

@AccidentalDisassembly

Edit 2: I think I found the issue

Quote

Contract (Hold a space camp): This was a great success, we've got a new pilot (Halfield Kerman), engineer (Surim Kerman) and scientist (Isamin Kerman) ready for future missions!

Does this contract happen to turn tourists into crew?

Edited by severedsolo
Link to comment
Share on other sites

9 hours ago, severedsolo said:

I feel like those "other issues" might be the key here.

The error is being thrown by EarnYourStripes (but it's fine to post it here, the error does blame FlightTracker after all).

What are these other issues? Because AFAICT the only way that error could happen, is if the Kerbal in question was no longer part of your crew. I will go through your log though, it's entirely possible that EYS is dying earlier, and causing the issue.

@AccidentalDisassembly

Edit 2: I think I found the issue

Does this contract happen to turn tourists into crew?

Yes, exactly - it's a Space Camp contract where you get to keep a certain number of the tourists after the contract is successfully completed.

Link to comment
Share on other sites

Just now, AccidentalDisassembly said:

Yes, exactly - it's a Space Camp contract where you get to keep a certain number of the tourists after the contract is successfully completed.

Ah, in that case it isn't a problem for you.

EYS builds a list of crew when the scene starts, at the time that Kerbal wasn't crew, they were a tourist. I'd worry if that one falling over was stopping the others from being processed, but I can see from your log that's not the case, and next time the list was built, they were included.

It's a bit rubbish that they won't get the credit for that first flight, but I'm not going to start tracking every tourist, your save file would balloon.

Thank you for pointing it out though, I think there may be a problem with Rescue contracts if they have this same issue, which I will need to look into.

Link to comment
Share on other sites

Just my two cents, but considering other mods store entire hangars full of .craft data, in addition to KSP's own, in persistent.sfs, I wouldn't worry *too* much about including a few Kerbals' names.

Edited by Corax
Link to comment
Share on other sites

3 hours ago, Corax said:

Just my two cents, but considering other mods store entire hangars full of .craft data, in addition to KSP's own, in persistent.sfs, I wouldn't worry *too* much about including a few Kerbals' names.

It's not so much the size of the save files, as the memory needed to load those save files.

We all know that KSP is bad at memory management, I'm not keen to be creating new objects for Kerbals who are probably only going to be around for one mission anyway.

Link to comment
Share on other sites

  • 9 months later...
  • 5 months later...
This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...