Project Hospital
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Go down
avatar
juraj.horvath
specialist
Posts : 146
Reputation : 8
Join date : 2018-08-07
Age : 45
Location : Bratislava, Slovak Republic

[MODDING] Patient waiting eventhough there are free doctors on clinic Empty [MODDING] Patient waiting eventhough there are free doctors on clinic

Wed Jun 17, 2020 7:17 pm
Message reputation : 100% (1 vote)
Description
Patient (Susan Barkley from save game, red circle in screenshot) is waiting in waiting room eventhough there are several free doctors on clinic (5 free/idle dcotors).

Repro steps
Use save game.

Attached

  • save games


Proposal of change
Maybe it is not a bug, but I think that free doctor can be assigned to patient instead of waiting. I dig with dnSpy into code and track down problem into Lopital.BehaviorPatient.FindDoctorOrLabSpecialist(bool onlyAssignSpecialist = false) method. I found out that this part of code
Code:
if (this.m_state.m_doctor != null && this.m_state.m_labSpecialist == null && this.m_state.m_doctor.GetEntity().GetComponent<BehaviorDoctor>().IsFree(this.m_entity) && this.m_state.m_waitingRoom.GetEntity().IsCharactersTurn(this.m_entity))
{
    GameDBRoomType entry = Database.Instance.GetEntry<GameDBRoomType>("ROOM_TYPE_COMMON_ROOM");
    if (this.m_state.m_doctor.GetEntity().GetComponent<EmployeeComponent>().m_state.m_homeRoom.GetEntity().m_roomPersistentData.m_roomType == entry)
    {
        Debug.LogWarning("Wrong doctor seleced for walk-in patient (from common room)!");
    }
    this.GetCalled(this.m_state.m_doctor.GetEntity());
    return;
}
is not activated, because doctor John Martinez is not free. So, I tried to change the code to:
Code:
if (this.m_state.m_doctor != null && this.m_state.m_labSpecialist == null && this.m_state.m_waitingRoom.GetEntity().IsCharactersTurn(this.m_entity))
{
    EntityIDPointer<Entity> previousDoctor = this.m_state.m_doctor;
    if (!this.m_state.m_doctor.GetEntity().GetComponent<BehaviorDoctor>().IsFree(this.m_entity))
    {
        this.FindClinicDoctor();
        if (this.m_state.m_doctor == null || !this.m_state.m_doctor.GetEntity().GetComponent<BehaviorDoctor>().IsFree(this.m_entity))
        {
            this.m_state.m_doctor = previousDoctor;
        }
    }
    if (this.m_state.m_doctor.GetEntity().GetComponent<BehaviorDoctor>().IsFree(this.m_entity))
    {
        GameDBRoomType entry = Database.Instance.GetEntry<GameDBRoomType>("ROOM_TYPE_COMMON_ROOM");
        if (this.m_state.m_doctor.GetEntity().GetComponent<EmployeeComponent>().m_state.m_homeRoom.GetEntity().m_roomPersistentData.m_roomType == entry)
        {
            Debug.LogWarning("Wrong doctor seleced for walk-in patient (from common room)!");
        }
        this.GetCalled(this.m_state.m_doctor.GetEntity());
        return;
    }
}
In short: try to find new doctor, if doctor is free then get called to doctor, otherwise don't change already set doctor.

After this change, patient (Susan Barkley) is called to new doctor. I tried to run game with this change longer time, I didn't noticed any negative effects of this change. There is also similar code on end of method, maybe this part should be also changed.

[MODDING] Patient waiting eventhough there are free doctors on clinic Queue_10


Last edited by jan.oxymoron on Mon Jun 22, 2020 4:26 pm; edited 2 times in total (Reason for editing : null check)

DocDesastro likes this post

jan.oxymoron
jan.oxymoron
developer
Posts : 2309
Reputation : 336
Join date : 2018-03-23

[MODDING] Patient waiting eventhough there are free doctors on clinic Empty Re: [MODDING] Patient waiting eventhough there are free doctors on clinic

Mon Jun 22, 2020 4:26 pm
Hi, thanks for the analysis and the proposed change! Smile

Technically this is just an exception from the usual rules, patients that have been already diagnosed try to return to their original doctor to get treatments prescribed. I'll have a chat with the designers if we actually still want this behavior (there have been quite a few changes that prioritize even distribution of patients between doctors).

Btw -  the easiest change would be to remove the check for m_diagnosedMedicalCondition in this block in FindDoctorOrLabSpecialist().

Code:

            else if(m_state.m_medicalCondition.m_diagnosedMedicalCondition == null &&
                    (m_state.m_doctor == null || !m_state.m_doctorAssignedByPlayer))
            {
                FindClinicDoctor();
            }
avatar
juraj.horvath
specialist
Posts : 146
Reputation : 8
Join date : 2018-08-07
Age : 45
Location : Bratislava, Slovak Republic

[MODDING] Patient waiting eventhough there are free doctors on clinic Empty Re: [MODDING] Patient waiting eventhough there are free doctors on clinic

Mon Jun 22, 2020 4:49 pm
Hi, I thought that reason for such behavior are usual rules, that patient should return to original doctor. In such case it is not bug, but feature Smile Maybe it could be a game option and players decide what they want. Anyway, I think that your proposed solution with removing m_state.m_medicalCondition.m_diagnosedMedicalCondition == null from condition will not work in all cases. Patient don't have to be diagnosed, he/she can return from examination (X-ray, CT, MRI, USG, laboratories, etc..) without already known diagnose. Now I see that my solution is also not good - I forgot about doctor assigning.
jan.oxymoron
jan.oxymoron
developer
Posts : 2309
Reputation : 336
Join date : 2018-03-23

[MODDING] Patient waiting eventhough there are free doctors on clinic Empty Re: [MODDING] Patient waiting eventhough there are free doctors on clinic

Thu Jun 25, 2020 9:42 am
Hi - just one more quick update, we'll be making the change on our side in the next patch (and let me double-check the second case you mentioned, I think it worked as expected in the test scenario).
Sponsored content

[MODDING] Patient waiting eventhough there are free doctors on clinic Empty Re: [MODDING] Patient waiting eventhough there are free doctors on clinic

Back to top
Permissions in this forum:
You cannot reply to topics in this forum