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

Exiting the MedPod under certain conditions does not remove the coma. #9

Closed
CodePanter opened this issue Jul 7, 2020 · 7 comments
Closed
Labels

Comments

@CodePanter
Copy link

I can't be 100% sure of how this happened, as part of this was off-screen, but one of my colonists had just had surgery, was still 'woozy' from anesthetics, and got in the MedPod.
I'm not sure whether she took damage from something, the power went off for a second, or something different entirely happened, but the colonist was ejected from the MedPod, and was still in the coma from the MedPod.
She initially was carried over to a normal medical bed where I waited for quite a while, but nothing happened (not even after the wooziness was gone). I then un-assigned that bed as a hospital bed, and she was carried back to the MedPod, where her treatment was then finished, which resulted in the coma being removed.
I can imagine this being a big problem if a player for some reason loses their MedPod (due to reasonable game mechanics, or the other issue I filed) and then be stuck with a seemingly permanently comatose colonist.

@sumghai
Copy link
Owner

sumghai commented Jul 8, 2020

This sounds bizarre.

The MedPod is designed so that if it runs out of power, is destroyed or otherwise despawned while treating a patient, the patient should immediately be given an (improper) cortical stimulation to wake them up.

As for why the delta-wave induced coma is currently "permanent", this is because I needed a way to keep the patient lying in the MedPod for a whole treatment cycle, as usually with vanilla hospital beds it is possible that a patient partially recovers to the point of regaining the ability to walk, run off to deal with food/other needs, and (maybe) return later to fully recover.

I am thinking of possibly tweaking the delta-wave coma to expire after a period of time, although if it expires while there are still hediffs remaining to be treated, the treatment will get interrupted when the pawn runs off.

Since you mentioned that you're not "100% sure of how this happened, as part of this was off-screen", please go back and try to reproduce this situation in detail, so that I know to start investigating this issue.

@CodePanter
Copy link
Author

I removed a bionic part from a colonist, removed all other hospital beds so she was put in the medpod to recover. I then had a colonist turn the machine off, and carry her to a new hospital bed. She still had the coma after this. Gif of the mentioned steps here: https://imgur.com/a/Rj58cBw

@sumghai
Copy link
Owner

sumghai commented Jul 12, 2020

Bug confirmed - this looks like an extremely bizarre edge case.

Detailed Investigation

Setup

  • Dev mode
  • 6x8 cell single-walled wooden building
  • 1 Door, locked
  • 1 MedPod
  • 1 Battery, filled via Dev Mode
  • 2 pawns (Kensuke = doctor, Mari, patient)

Scenario 1

  • Mari damaged until downed via Dev mode
  • Kensuke hauls Mari to MedPod
  • Battery emptied via Dev Mode during diagnosis mode
  • Result: Mari falls off the depowered MedPod, with no additional hediffs applied

Scenario 2

  • Mari damaged until downed via Dev mode
  • Kensuke hauls Mari to MedPod
  • Battery emptied via Dev Mode during treatment mode
  • Result: Mari falls off the depowered MedPod, with the Cortical Stimulation (improper) hediff applied, which cancels out the Delta Wave Induced Coma hediff

Scenario 3

  • Mari damaged until downed via Dev mode
  • Kensuke hauls Mari to MedPod
  • MedPod destroyed via Dev Mode during diagnosis mode
  • Result: Mari falls off the non-existent MedPod, with no additional hediffs applied

Scenario 4

  • Mari damaged until downed via Dev mode
  • Kensuke hauls Mari to MedPod
  • MedPod destroyed via Dev Mode during treatment mode
  • Result: Mari falls off the non-existent MedPod, with the Cortical Stimulation (improper) hediff applied, which cancels out the Delta Wave Induced Coma hediff

Scenario 5

  • Mari damaged until downed via Dev mode
  • Kensuke hauls Mari to MedPod
  • Kensuke forced to switch off MedPod during diagnostic mode, via Designate Toggle Power gizmo and Float Menu
  • Result: Mari falls off the MedPod before it is fully depowered, with no additional hediffs applied

Scenario 6

  • Mari damaged until downed via Dev mode
  • Kensuke hauls Mari to MedPod
  • Kensuke forced to switch off MedPod during treatment mode, via Designate Toggle Power gizmo and Float Menu
  • Result: Mari falls off the MedPod before it is fully depowered, with the Delta Wave Induced Coma hediff still present

Basically, the current code correctly handles situations where the MedPod loses power or is destroyed, by waking the patient up and cancelling out the Delta Wave Induced Coma.

When the Designate Toggle Power gizmo is set to Off, the task for switching off the MedPod is actually given to the patient lying on it. Usually, no other pawn approaches the MedPod until it has finished treating the patient, then the (ex) patient gets off and switches off the MedPod themselves.

If, however, for some bizarre reason the player decides to forcefully tell another pawn to switch off a MedPod while in treatment mode, the patient loses their reservation on the MedPod, falls off and does not get their Delta Wave Induced Coma removed.

Some ways to solve this problem:

  • Have the Delta Wave Induced Coma eventually expire: This is a quick and dirty fix, but if the coma expires before treatment is completed, the patient may get off the MedPod without being fully healed (the coma was specifically designed to keep the patient still during treatment). This problem would be even more apparent with certain players modifying bootleg versions of the MedPod to have longer treatment times for [alleged] balance reasons.

  • Prevent the MedPod from being toggled off, period: Another quick and dirty fix, since it completely prevents the situation from happening in the first place. However, players may want the flexibility to power down MedPods to conserve power in emergency situations.

  • Prevent the MedPod from being toggled off, but only while it is running: This seems to be a particularly elegant solution, although I have yet to assess its robustness.

  • Apply the Cortical Stimulation (Improper) hediff to the patient the moment a pawn is forced to switch off the MedPod: This doesn't quite make sense from a Watsonian perspective. How could a MedPod have the prescience that it's about to get switched off, and thus respond by waking up and kicking off it's patient?

@sumghai
Copy link
Owner

sumghai commented Jul 12, 2020

Right, so I've found yet another edge case that triggers this bug:

  • A MedPod is operating in treatment mode, with Patient A under a Delta Wave Induced Coma
  • The player selects Patient B, right clicks on the MedPod and selected Rest Until Healed (with a warning that the MedPod is already occupied by Patient A)
  • Patient A gets kicked off the MedPod, and is stuck with the Delta Wave Induced Coma

This is a more plausible situation, because perhaps the player wants to perform triage by prioritizing a critically-wounded patient over someone with a hangnail who just happened to get on the MedPod first.

To handle this particular edge case, I will need to detect when the current patient is kicked off the MedPod, and apply the improper Cortical Stimulation hediff instead to wake them up.

@sumghai
Copy link
Owner

sumghai commented Jul 12, 2020

@CodePanter - Please try the following development build, and see if it fixes both edge cases:

https://github.com/sumghai/MedPod/archive/d1460a96aa99c86c87fa1f0a48c1f9d4d009afa9.zip

@CodePanter
Copy link
Author

I tried all situations I could come up with, including some you didn't mention like using a medpod on a prisoner, and then toggling the 'for prisoner' setting, and everything seems to work perfectly fine. Thank you for fixing this!

@sumghai
Copy link
Owner

sumghai commented Jul 12, 2020

Good catch on the prisoner toggle use cases as well, thanks!

Marking this one as done.

@sumghai sumghai closed this as completed Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants