linuxgurugamer / CrewRandR

(KSP Mod) Crew Rotation and Variety
MIT License
4 stars 5 forks source link

Track mission time by kerbal, not by vessel #10

Closed Wyzard256 closed 5 years ago

Wyzard256 commented 6 years ago

When a kerbal goes on R&R, the length of their vacation is based on how long they were away on their mission. Until now, the recovered vessel's mission elapsed time was used to compute the vacation time for the kerbals inside, but that can be incorrect if a kerbal leaves Kerbin in one vessel but returns in another, or if the vessel's MET gets reset by docking. To avoid that problem, I've changed it to keep track of mission durations for the kerbals themselves. When the player places a vessel on the launchpad/runway, the current time gets recorded in the mission data for each kerbal inside. When the kerbals are recovered later, that starting time is used to calculate how long they were away.

When the player installs this new version, they may have kerbals who are already out on missions and whose mission start time wasn't recorded. Those kerbals will be considered to have started their missions at the moment when the player first enters the flight scene after installing. This can cause the kerbals to get shorter vacations than they "ought" to, but only because there's no way to determine the real mission duration in that case. Newly-launched missions will track the kerbals' mission times correctly going forward.

This fixes #7.