Closed sumghai closed 2 months ago
I haven't meddled with medical stuff in Hospitality for a long time. My guess is that you should insert the ThinkNode in
<li Class="ThinkNode_Tagger">
<tagToGive>RestingForMedicalReasons</tagToGive>
<subNodes>
<li Class="JobGiver_PatientGoToBed" />
</subNodes>
</li>
Concerning RestUtility_Patch, I think you should patch IsValidBedFor (which you probably already have) and use Hospitality.GuestUtility.IsGuest(Pawn)
to determine if the pawn in question is a guest.
I'm not sure even that is needed, since you essentially want all pawns to use pods, regardless of if they're guests.
My guess is that you should insert the ThinkNode in
<li Class="ThinkNode_Tagger"> <tagToGive>RestingForMedicalReasons</tagToGive> <subNodes>
I probably mentioned this before, but inserting the ThinkNode under the RestingForMedicalReasons
means guests only use MedPods for acute medical emergencies, and not if they only have permanent scars or incurable chronic conditions.
Instead, I targeted Humanlike_PreMain
under Hospitality.ThinkNode_OnlyAllowed
, which seems to work better at getting guests to automatically prioritize using MedPods if they have anything that the MedPods are designed to treat. Apparently, Hospitality.GuestUtility.IsGuest(Pawn)
wasn't needed as you guessed.
However, I've now run into a new problem - guests who finish treatment on MedPods now lose their assigned Hospitality guest bed when they wake up, are forced to "re-join" the guest group, and subsequently complain that they don't have any money left to re-rent a guest bed. Essentially, they lose their Visitor duty.
My MedPod code currently applies a custom coma hediff to keep patients on MedPods, as in the past there have been issues where patients prematurely jump off MedPods without completing treatment. It seems that applying this hediff makes either the base game or Hospitality think the pawn has been Downed()
or made unconscious.
I tried caching the guest pawn's duty before treatment and restoring it after finishing treatment, but it seems that the very act of making guests on MedPods unconscious removes their Hospitality guest status.
Alternatively, when I disable the MedPod coma hediff, the guest pawn retains their guest status and duty but runs off halfway during treatment. I've tried various Harmony patches, job giver parameters to tell the pawn to stay until treatment is finished, but nothing seems to stick.
Do you think there's something you could tweak on your end to tell guests to retain their guest status/duty even when downed/unconscious?
Here's a link to my MedPod dev build with source code, if you want to try it out on your end - https://github.com/sumghai/MedPod/archive/refs/heads/guestmode_dev.zip
Test conditions:
It looks like I'll have to rewrite MedPod to not use its coma hediff, and instead rely on a different mechanism for keeping patients within MedPods so that lords and duties from mods like Hospitality aren't affected. As such, the ball's in my court.
I think this is a good place to wrap things up here. Thanks again, @OrionFive.
Sorry for the late response. The mechanism is that when guests are downed, they need to be medically handled, so they stop being guests, so medical stuff works as intended. However, when any pawn is rescued, they get flagged as rescued and subsequently become guests once recovered.
Keeping pawns from getting up and running off can probably be handled by hooking into the top of the Relax ThinkTree somewhere before other activities.
Maybe that helps.
What problem does your suggestion solve A number of players have reported that as of Hospitality v1.5.0.5 and MedPod v1.5.26, Hospitality guests with medical conditions do not automatically seek out treatment on MedPods, which are spacer/ultratech medical beds designed to rapidly heal nearly all hediffs at the cost of very high power consumption.
Describe the solution you propose I'd like to suggest a minor collaboration between myself (@sumghai) and @OrionFive, to make minor code changes to both our mods, so that Hospitality guests will automatically use MedPods within the designated guest area. (sumghai/MedPod#64)
Describe alternatives you've considered The sole alternative is to have guest only be able to use regular hospital beds only in emergencies, and be unable to treat incurable conditions. This is essentially current behaviour, but fails to address to requests of players who use both mods.