zkxs / stationeers

Various stationeers notes and code
3 stars 1 forks source link

Pressure Increasing? #1

Open WriggleDev opened 11 months ago

WriggleDev commented 11 months ago

Running this in hardsuits on Mars... the pressure is slowly increasing?

zkxs commented 11 months ago

Hi, thanks for the issue. (It's much easier for me to track issues here vs on Steam Workshop, so I really do appreciate it!)

That behavior is actually by design. I talk about how hardsuits work at a high level in the hardsuit readme, but I'll go into some more detail about this specific quirk, and why it led to the suit behavior you're seeing. It's actually pretty interesting... in my opinion, at least. 😄

Your suit's filter only consumes durability and power when it's on, so it's a pretty big optimization to leave it off as much as possible. Every time it toggles it also makes a clicking sound, which at higher toggle frequencies turns out to be pretty annoying, so I decided to minimize that frequency. Finally, your character actually breathes more efficiently the closer he is to oxygen deprivation. 24 kPa is the baseline the game considers to be 100% normal oxygen partial pressure. Anything below that your guy actually consumes fewer moles of oxygen... but below the 16 kPa floor he'll start to suffocate. Also, if your lungs are damaged you need more than 16 kPa. For this reason I leave a little headroom and target 17.1 kPa.

So to reiterate my (self-inflicted) requirements:

How do I meet all these? As your character breathes, he "deletes" CO2 and replaces it with O2. This lowers the O2 pressure, so I need to add more O2. This is achieved by increasing the target pressure of the suit, which makes more "room" for O2 to fill it back up to the 17.1 kPa target. The final effect of this is the suit pressure will slowly climb as your guy fills it with more and more CO2 and the suit maintains 17.1 kPa of O2.

The final piece of the puzzle is when to stop filling the suit. While there isn't actually a hard limit on how much pressure I can put in, the suit will start beeping constantly at you above 607.95 kPa total pressure. So I arbitrarily stop 10 kPa before that limit and suck all the CO2 out of the suit. And then the cycle begins anew.

Lu5ck commented 4 months ago

So the high pressure is due to disabling CO2 filter, result of CO2 accumulating. How do I eat though? Do I have to remove the chip, flush the suit then can open the mask to eat?

zkxs commented 4 months ago

What's preventing you from eating? Is the chip locking your helmet closed? Or is it that you don't want to leak CO2 into your room?

The chip shouldn't be keeping the suit helmet locked unless it is pretty sure the outside environment is unsafe. I can't read external gas composition, but I can check if the external temperature or pressure are so extreme that they'd hurt you. So in most cases all you have to do is open the helmet and then eat, no need to yank the chip. If the chip is fighting you to keep the helmet closed then I guess yank it and take your emergency snack. Or alternatively just comment the line of MIPS that writes to the helmet lock state. The s d0 Lock r15 line. (don't delete it outright because it'd screw up a couple jump instructions)

If the concern is leaking a bunch of CO2 into your room, then maybe the weird trick this chip uses to save filter lifespan isn't compatible with your use-case. Although it shouldn't be too many moles of CO2, as the helmet is very low-volume.