sumghai / MedPod

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

Guestmode #64

Closed FGRemastered closed 2 weeks ago

FGRemastered commented 2 years ago

Describe your idea:

A button to allow visitors to use certain MedPods by themselves. (Maybe for a price with Orion's Hospitality in mind?)

Why do you think your idea would be a good fit for MedPod?: You can already force your pawns to carry downed guests to the MedPod, so why not offer them as a service to them? (And make some money on the side perhaps?)

What alternatives/workarounds have you tried? Forcing pawns to carry guests to the MedPod.

Declaration

I hereby verify that:

sumghai commented 2 years ago

Oooh, this sounds interesting.

You can already force your pawns to carry downed guests to the MedPod

I haven't dealt much with guest/visitors myself, but I assume this is just with the base game? (And not the Hospitality mod?)

If so, I could potentially look into patching guest ThinkTrees to include a MedPod.JobGiver_PatientGoToMedPod node, and possibly add a gizmo that would allow individual MedPods to be allow/prohibit guests from using them.

As for integration with Hospitality's payment system, I'm not sure how this would work thematically. While MedPods are free for public use on GlitterWorlds, they would be very valuable/coveted resources on RimWorlds, so players should charge really high prices for MedPod treatment.

I could add a new MedPod computer building that is mainly used to manage payment via a slider gizmo ($0 to $100~1000), but I'm not sure what would happen if the guest doesn't have that much silver on them.

FGRemastered commented 2 years ago

I haven't dealt much with guest/visitors myself, but I assume this is just with the base game? (And not the Hospitality mod?)

Correct, as described in the other open issue, it would also be nice for pawns that hold another to have an interaction with the MedPod to transfer the held pawn onto it, btw.

Hospitality has an extra library mod of sorts, called Orion's Cash Register, that handles the payment part, so you'd only need to add another tab to its ui instead of writing a new building. It also determines what happens if they don't have the money - They can't use it. Maybe add a dialogue for them to ask for a one-time cost decrease if they can't afford it, but are in pain, for example?

Now that I think about it, there could also be room for a new kind of beggars quest that came with ideology: Normally beggars ask you for medicine, drugs or money, but what if they asked for a chance to use the fancy heal-all building instead?

sumghai commented 2 years ago

We'll worry about stretch goals later - if I do tackle this, my first priorities are to allow guests to use the MedPods on their own accord, and to allow players to specify which MedPods are available to guests.

Astr0Jack commented 1 year ago

my colonists forcefully shove guests into the medpod even if they are not downed, and i dont want my guests to be happy

techno156 commented 7 months ago

I could add a new MedPod computer building that is mainly used to manage payment via a slider gizmo ($0 to $100~1000), but I'm not sure what would happen if the guest doesn't have that much silver on them.

Maybe something like Replimat, which could work for pawns voluntarily going to get treated, but not if they're moved there because they're downed, etc.

Now that I think about it, there could also be room for a new kind of beggars quest that came with ideology: Normally beggars ask you for medicine, drugs or money, but what if they asked for a chance to use the fancy heal-all building instead?

This might make more sense as a separate mod, where you have beggars that come asking to have a medical condition treated, rather than something that is part of Medpod. That way, it also opens up the possibility of treating a beggar without having to use the medpod (maybe for medical training?).

sumghai commented 3 weeks ago

I found some time recently to revisit this idea.

My current WIP implementation adds an "Allow guests" gizmo to MedPods, logic changes to mark MedPods with the correct guest flag state as usable by friendly non-colony visitors from the base game, and a ThinkTree patch that tells visitors to seek MedPod treatment if required.

However, this results in the following problems:

Allowing free treatment for NPC visitors at the cost of immediately preventing players from trading with them sounds like a pretty terrible outcome.

I now have two options:

  1. Somehow figure out how to not trigger the leave signal for NPC pawns after MedPod treatment, and additionally retain/restore the trader pawn's job
  2. Limit this guest mode feature to the Hospitality and Hospital mods (which would handle the ThinkTree patch on their end)

Thoughts?

sumghai commented 3 weeks ago

I've decided to remove the thinktree patch for base game traders and visitors, as allowing them to use MedPods would cause them to automatically leave.

Instead, I'll focus my attention on possible guest mode compatibility with the Hospital and Hospitality mods.

sumghai commented 3 weeks ago

WIP notes for MedPod compatibility with Hospital mod (https://github.com/tomvd/Hospital/)

sumghai commented 3 weeks ago

WIP notes for MedPod compatibility with Hospitality mod (https://github.com/OrionFive/Hospitality/)

sumghai commented 3 weeks ago

The code I committed so far allows Hospitality guests to use MedPods within Hospitality's allowed guest area and with the Allow Guests gizmo enabled. However, guests that complete MedPod treatment lose their Hospitality guest duty and assigned guest bed due to being "downed" by the MedPod's delta wave coma hediff, forcing them to rejoin the existing visitor group afterwards and then complain about running out of money to re-reserve a bed.

This is pretty much the same as what happened to base game traders and visitor groups, as mentioned in prior comments.

Removing the delta wave coma and cortical stimulation hediffs ensures that existing lords and duties are retained, but pawns tend to run off towards the end of treatment, such that the WakePatient() method with all the pawn needs, traits and worktypes cleanup calls are never run. It seems that there is an end condition being triggered:

6119573 Pree: JobDriver_PatientGoToMedPod ends current job PatientGoToMedPod (Job_265106) A = Thing_MedPodStandard263597 Giver = JobGiver_PatientGoToMedPod [workGiverDef: null] because of toil LayDown at toils[2].endConditions[0]

I'll need to figure out how to modify this end condition to not fail until MedPod treatment is fully complete and WakePatient() has been run.

sumghai commented 3 weeks ago

I think I've revised the treatment cycle to not use the delta-wave induced coma hediffs, and run DischargePatient() (formerly WakePatient()) when the resting job is terminated for any reason. Probably needs a bit more playtesting to confirm that the new logic is reliable, though.

sumghai commented 2 weeks ago

Save for some minor unrelated bugs that still need to be addressed, this added gizmo and logic rewrite now supports Allowing/Disallowing non-colony Guests from vanilla and the Hospitality mod.

The Hospital mod is now also technically supported, but additional patches are recommended to tie the MedPod's guest status better with the Hospital mod's own Hospital bed gizmo. I'll most likely have to discuss this with @tomvd some other time.