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

Experimental hab-cabin time implementation #317

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

arbsoup
Copy link

@arbsoup arbsoup commented Jul 6, 2024

In response to #199 I put together a (shaky, experimental) revamp of the habitation time system in such a way as to support almost everything that issue explains. Testing suggests everything works as intended, though I have not been totally rigorous with these.

The principle is that instead of resetting hab and home timers whenever a Kerbal switches vehicles or the like, each Kerbal has a personal cabin timer, which caps at the BaseHabTime in the settings panel, and a "how long have I been in space timer" of (now - LastAtHome) which is compared against whatever the current vessel's hab duration is. (That duration is calculated the same way as before, minus the BaseHabTime per seat times hab multiplier, which is going into the cabin time extension. Think of it a little like supply time vs. starving time now.)

A Kerbal only feels "comfortable" when their current vessel's hab duration is longer than they've spent in space so far. This means that when you put a Kerbal in a huge fancy LKO station and then send them on a trip to Eeloo in a tiny ship with one Hitchhiker, they'll only care about the tiny ship's habitation value for the journey. (Think of it as Kerbals getting harder to please the longer they've been away from home.)

Once a Kerbal no longer feels comfortable with current habitation, their cabin timer starts counting down; at 0 they take the homesickness penalty. This timer counts down slower if there are more empty seats in the vessel (this is where the BaseHabTime per seat went) or if the vessel has a HabMultiplier, and it gradually counts up (to the cap) if they're comfortable in hab space again, thus allowing you to send a Kerbal on multiple few-days-long expeditions out of a central large mothership.

This approach thus keeps the flexibility of the old home timer setup in allowing Kerbals to depart from motherships on short trips, while preventing abuse (or just confusing numbers on the monitor!) from, e.g., briefly taking Kerbals out of a large vessel to boost the others' home timers as if they were the only ones onboard.

Issues at the moment:

  • Kerbals in an unloaded vessel will not update their displayed cabin time until it's loaded again. (However, the catchup mechanic will correctly adjust for the amount of elapsed time at that point.)
  • EVA Kerbals whose cabin timer completely drained while unloaded will correctly take the homesickness effect when loaded again, but no message will display onscreen.

Non-revamp parts of this might also be useful: commit f9d3e57 fixes #316, commit 846dba1 fixes #307 (turns out you should use vessel.Die() on an EVA Kerbal), commit 5481815 fixes #239, and the rest of this fork also corrects a few small typos. As such I don't expect this whole thing to be merged, it's more of a personal testbed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant