sumghai / MedPod

Advanced regenerative medical beds for RimWorld
Other
14 stars 15 forks source link

Button to Interrupt Treatment #44

Closed techno156 closed 3 years ago

techno156 commented 3 years ago

Describe your idea: Sometimes the treatment process gets stuck, or you may need to interrupt medpod treatment, such as in the case of a raid, fire, or other emergency that might need a patient's treatment to be halted. A button could be placed on the UI of an active medpod, and can be used to interrupt treatment in such an emergency. In such a case, the patient would receive the "Cortical Stimulation (Improper)" hediff, and be kicked off immediately.

Why do you think your idea would be a good fit for MedPod?: Given instances of pawns using the medpod occasionally getting stuck in it, as partly seen in #39, #30, and #29, it would be useful to have a way to abort treatment. This could also be useful in the case of a fire, drop-pod raid, or in the case of triage, where it may become necessary to remove a pawn currently being treated in a medpod for a patient in more critical condition.

What alternatives/workarounds have you tried? Currently, the main ways that treatment can be interrupted are more indirect, either by setting the medpod (and all beds in the room) to prisoner-only, which may displace other patients in the room, or to connect the medpod to a power switch, and disconnect power to it when necessary, neither of which would be practical in an emergency, or if there are patients in critical condition that would be in greater need of the medpod.

Declaration

I hereby verify that:

sumghai commented 3 years ago

An abort button for raid/fire emergencies or triage purposes sounds like a great idea! I'll look into this for the next major update.

That being said, the abort button should not be regarded as the solution to the rare infinite treatment cycle bug:

techno156 commented 3 years ago

Understandable. I was using them as more of a stop-gap solution to such problems, rather than a permanent one, since the current solution for a 'stuck' medpod is just to remove the patient and try again later, if needed, and would therefore be no different, functionally.

sumghai commented 3 years ago

Hi @techno156, please try the following development build:

https://github.com/sumghai/MedPod/archive/6510c9e0e53f77ac62fc46413aa0bfde26f66259.zip

This adds an Abort gizmo to MedPods that interrupts the current treatment cycle, and if necessary, kick still-downed pawns off the MedPod to the side so that the bed is freed up for the next pawn.

Could you please check that the abort feature works during both diagnosis and treatment phases? It worked 100% of the time on my end, but I want to make sure I've nailed every single possible edge case (including one weird one that threw a Toil error).

techno156 commented 3 years ago

The abort feature seems to work during the diagnosis phase, but aborting during the treatment phase throws the toil error every time. Testing with vanilla + Royalty + Medpod. See trace: TestMedpod

sumghai commented 3 years ago

Dammit. That was a really annoying bug, and I thought I finally fixed it last night.

I'll take another look tonight, but if I can't fix it, then I probably can't implement this feature.

sumghai commented 3 years ago

@techno156 - I have not been able to reproduce that bug with only Harmony, Core and MedPod, for both existing and brand-new savegames.

I even did a WinMerge comparison between the DLL I gave you and my own local copy, and they are completely identical.

I assume your test save was also a new game?

techno156 commented 3 years ago

It is a new game/save, and does occur in reproducible fashion on the same save, but creating a new save and attempting the same does not seem to cause the error, so it might have just be a case of a cursed save.

sumghai commented 3 years ago

Could I trouble you to please also test this dev build on a few other savegames? (Both new and existing ones). I'd like to establish for certain whether the Toils error is indeed a fluke, or whether it's 50/50.

I've made a public call for additional testers on both Discord and Steam Workshop, although I haven't received any responses so far.

sumghai commented 3 years ago

No further feedback received from @techno156, Discord or Steam Workshop, so I'm going to assume the Toils error is unreproducible across saves.

Marking this one as done.

techno156 commented 3 years ago

Sorry, I've been having some internet problems over the past few days. You would be correct, though, in that the Toils error appears to not be reproducible. I've tested it out on a new and an existing modded (and former vanilla) save, and have not encountered the problem again, other than on that one problematic save.