Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crew members after the first are instantly homesick on vessel status refresh #316

Open
arbsoup opened this issue Jul 5, 2024 · 0 comments · May be fixed by #317
Open

Crew members after the first are instantly homesick on vessel status refresh #316

arbsoup opened this issue Jul 5, 2024 · 0 comments · May be fixed by #317

Comments

@arbsoup
Copy link

arbsoup commented Jul 5, 2024

Setup:

  1. Enable some sort of homesickness penalty.
  2. Build a craft with a two-man command pod and a Hitchhiker (plus a lot of supplies and EC, or disable those). Put two (non-scout, if it matters) Kerbals in the pod and none in the Hitchhiker.
  3. Put the craft in orbit and turn on the Hitchhiker's habitat module. Wait a decently long time (longer than the craft would be habitable without the module on, any more than 22 days should work).
  4. Turn off the Hitchhiker's habitat module.

Expected result:
Each crew member's hab timer drops to ~22 days, the hab limit for the updated craft without the module active.

Actual result:
Only the first crew member's hab timer drops to that value, and everyone else instantly takes a homesickness effect when the craft's status refreshes.

Cause:

if (_isStatusRefreshRequired)
{
trackedKerbal.TimeEnteredVessel = now;
_isStatusRefreshRequired = false;
LifeSupportManager.Instance.TrackKerbal(trackedKerbal);
}

This only updates TimeEnteredVessel for the first crew member in the for loop; after that, _isStatusRefreshRequired is false and nobody else's TimeEnteredVessel changes — meaning that each other crew member then looks at their timer and finds the second condition true:

return (now > trackedKerbal.MaxOffKerbinTime || (now - trackedKerbal.TimeEnteredVessel) > habTime);

Presumably _isStatusRefreshRequired should only be set to false after the for loop through the crew.

@arbsoup arbsoup linked a pull request Jul 6, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant