GithubHelp home page GithubHelp logo

Comments (7)

sumghai avatar sumghai commented on August 25, 2024

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.

from medpod.

CodePanter avatar CodePanter commented on August 25, 2024

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

from medpod.

sumghai avatar sumghai commented on August 25, 2024

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?

from medpod.

sumghai avatar sumghai commented on August 25, 2024

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.

from medpod.

sumghai avatar sumghai commented on August 25, 2024

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

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

from medpod.

CodePanter avatar CodePanter commented on August 25, 2024

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!

from medpod.

sumghai avatar sumghai commented on August 25, 2024

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

Marking this one as done.

from medpod.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.