CorsixTH Lua Documentation

Patient Class

A `Humanoid` who is in the hospital for diagnosis and/or treatment.

Declared on: line 21 of Lua/entities/humanoids/patient.lua.
Inheritance: Patient » Humanoid » Entity

Method Index

Member Index

(*) only used in superclass methods
function Patient:Patient(...)

Parameters:

NameTypeDescription
... ? ?

Declared on: line 27 of Lua/entities/humanoids/patient.lua.

function Patient:_calculateNausea(num_nearby_vomit)

Process a patient's exposure to vomit and calculate their level of nausea

Parameters:

NameTypeDescription
num_nearby_vomit ? ?

Declared on: line 723 of Lua/entities/humanoids/patient.lua.

function Patient:_checkIfCureRoom(room)

Checks if the room the patient is in is the final treatment room for their disease NB: Check diagnosed status as some illnesses use Psych for diagnosis and treatment

Parameters:

NameTypeDescription
room ? ?

Declared on: line 582 of Lua/entities/humanoids/patient.lua.

function Patient:_checkPatientIsStillQueueingForARoom()

where he/she is not in the queue anymore, but should be. If this is the case for

more than 2 ticks, go to reception.

Declared on: line 898 of Lua/entities/humanoids/patient.lua.

function Patient:_constructGetSodaAction(machine, lx, ly)

Take the necessary steps to let a patient to get a soda.

Parameters:

NameTypeDescription
machine object The drinks machine to target
lx int X usage coordinate of the drinks machine
ly int Y usage coordinate of the drinks machine

Declared on: line 813 of Lua/entities/humanoids/patient.lua.

function Patient:_dailyBowelChecks()

Process a patient's current state of toilet need, and action accordingly.

Declared on: line 739 of Lua/entities/humanoids/patient.lua.

function Patient:_dailyHealthChecks()

Handle processing of a patient's current health state and perform necessary actions

Declared on: line 650 of Lua/entities/humanoids/patient.lua.

function Patient:_dailyHealthHistoryRefresh()

Generate or refresh the patient's health chart

Declared on: line 706 of Lua/entities/humanoids/patient.lua.

function Patient:_dailyObjectHappinessEffects()

Process specific objects near the patient and their effect on happiness factors.

Declared on: line 778 of Lua/entities/humanoids/patient.lua.

function Patient:_dailyWaitChecks()

Handle processing of a patient waiting for something (like a room or player action)

Declared on: line 616 of Lua/entities/humanoids/patient.lua.

function Patient:_handleExcessThirst()

Handle a pateint who is very thirsty. They'll start getting unhappy and wanting to

look for a drink.

Declared on: line 861 of Lua/entities/humanoids/patient.lua.

function Patient:afterLoad(old, new)

Parameters:

NameTypeDescription
old ? ?
new ? ?

Overrides: Humanoid:afterLoad.
Declared on: line 1240 of Lua/entities/humanoids/patient.lua.

function Patient:agreesToPay(disease_id)

Returns true if patient agrees to pay for the given treatment.

Parameters:

NameTypeDescription
disease_id string : The id of the disease to test

Declared on: line 319 of Lua/entities/humanoids/patient.lua.

function Patient:atFullyEmptyTile(cur_action)

Test whether the current tile of the patient is useful for inserting an action that needs a fully empty tile in the hospital.

Parameters:

NameTypeDescription
cur_action ? Current action of the patient.

Declared on: line 397 of Lua/entities/humanoids/patient.lua.

function Patient:changeDisease(new_disease)

Parameters:

NameTypeDescription
new_disease ? ?

Declared on: line 138 of Lua/entities/humanoids/patient.lua.

function Patient:completeDiagnosticStep(room)

Updates the patients diagnostic progress based on the doctors skill called when they are done using a diagnosis room

Parameters:

NameTypeDescription
room ? ?

Declared on: line 195 of Lua/entities/humanoids/patient.lua.

function Patient:cure()

Change patient internal state to "cured".

Declared on: line 363 of Lua/entities/humanoids/patient.lua.

function Patient:despawn()

Despawns the patient and removes them from the hospital

Overrides: Humanoid:despawn.
Declared on: line 576 of Lua/entities/humanoids/patient.lua.

function Patient:die()

Patient died, process the event.

Declared on: line 370 of Lua/entities/humanoids/patient.lua.

function Patient:falling(player_init)

Falling animations for when there is an earth quake or the player is being very mean

Parameters:

NameTypeDescription
player_init bool if true, player triggered the fall

Declared on: line 413 of Lua/entities/humanoids/patient.lua.

function Patient:getPriceDistortion(casebook)

considers the bill to be under-priced. The bigger the value is, the more

the patient patient considers the bill to be over-priced.

Parameters:

NameTypeDescription
casebook table : casebook entry for the treatment.

Declared on: line 261 of Lua/entities/humanoids/patient.lua.

function Patient:getTreatmentDiseaseId()

Decide the ID of the disease or treatment that the patient is paying for.

not be decided.

Declared on: line 243 of Lua/entities/humanoids/patient.lua.

function Patient:giveVaccinationCandidateStatus()

Show patient selected vaccination candidate status

Declared on: line 1208 of Lua/entities/humanoids/patient.lua.

function Patient:goHome(reason, disease_id)

the last treatment is over-priced. param disease_id (string): When the reason is "over_priced" this is the

id of the disease/diagnosis that the patient considered over_priced

Parameters:

NameTypeDescription
reason string : the reason why the patient is sent home, which could be:
disease_id ? ?

Overrides: Humanoid:goHome.
Declared on: line 498 of Lua/entities/humanoids/patient.lua.

function Patient:handleToiletNeed()

Process a patient's sudden need for the toilet.

We will either do it on the floor (40% chance, daily), or seek out a toilet.

Declared on: line 754 of Lua/entities/humanoids/patient.lua.

function Patient:interruptAndRequeueAction(current_action, queue_pos, meander_before_resume)

Interrupt a patients current action and resumes it after

Parameters:

NameTypeDescription
current_action string Action being interrupted
queue_pos int Position to insert resumed action in queue
meander_before_resume bool Indicator to insert an additional action before resuming.

Declared on: line 1328 of Lua/entities/humanoids/patient.lua.

function Patient:isTreatmentEffective()

Either the patient is cured, or he/she dies.

Declared on: line 341 of Lua/entities/humanoids/patient.lua.

function Patient:modifyDiagnosisProgress(incrementValue)

Modifies the diagnosis progress of a patient. incrementValue can be either positive or negative.

Parameters:

NameTypeDescription
incrementValue ? ?

Declared on: line 182 of Lua/entities/humanoids/patient.lua.

function Patient:notifyNewObject(id)

As of now each time a bench is placed the world notifies all patients in the vicinity through this function.

Parameters:

NameTypeDescription
id ? ?

Overrides: Entity:notifyNewObject.
Declared on: line 1050 of Lua/entities/humanoids/patient.lua.

function Patient:notifyNewRoom(room)

Parameters:

NameTypeDescription
room ? ?

Overrides: Humanoid:notifyNewRoom.
Declared on: line 1004 of Lua/entities/humanoids/patient.lua.

function Patient:onClick(ui, button)

Parameters:

NameTypeDescription
ui ? ?
button ? ?

Overrides: Humanoid:onClick.
Declared on: line 75 of Lua/entities/humanoids/patient.lua.

function Patient:removeVaccinationCandidateStatus()

Remove the vaccination candidate icon and status from the patient

Declared on: line 1215 of Lua/entities/humanoids/patient.lua.

function Patient:setDisease(disease)

Parameters:

NameTypeDescription
disease ? ?

Declared on: line 111 of Lua/entities/humanoids/patient.lua.

function Patient:setDynamicInfoText(action_string)

Sets the dynamic text currently in use by the patient

Parameters:

NameTypeDescription
action_string string What text to say in dynamic text

Declared on: line 1085 of Lua/entities/humanoids/patient.lua.

function Patient:setHospital(hospital)

Sets the hospital for the patient - additionally removing them from a hospital if they already belong to one. For player hospitals, patients who are not debug or emergency patients are made to seek a reception desk.

Parameters:

NameTypeDescription
hospital Hospital : hospital to assign to patient

Overrides: Humanoid:setHospital.
Declared on: line 228 of Lua/entities/humanoids/patient.lua.

function Patient:setTile(x, y)

Called each time the patient moves to a new tile.

Parameters:

NameTypeDescription
x ? ?
y ? ?

Overrides: Entity:setTile.
Declared on: line 1011 of Lua/entities/humanoids/patient.lua.

function Patient:setVaccinatedStatus()

Show vaccinated status for vaccinated patient

Declared on: line 1224 of Lua/entities/humanoids/patient.lua.

function Patient:tickDay()

This function handles changing of the different attributes of the patient. For example if thirst gets over a certain level (now: 0.7), the patient tries to find a drinks machine nearby.

Overrides: Humanoid:tickDay.
Declared on: line 928 of Lua/entities/humanoids/patient.lua.

function Patient:treatDisease()

will die. The patient may or may not agree to pay for the treatment

depending on whether they consider the price reasonable.

Declared on: line 290 of Lua/entities/humanoids/patient.lua.

function Patient:updateDynamicInfo()

Updates a patient's dynamic info

Can be called direct to refresh only

Declared on: line 1092 of Lua/entities/humanoids/patient.lua.

function Patient:updateMessage(choice)

Update availability of a choice in message owned by this patient, if any

Parameters:

NameTypeDescription
choice string The choice that needs updating (currently "research" or "guess_cure").

Declared on: line 1138 of Lua/entities/humanoids/patient.lua.