CorsixTH Lua Documentation

Room Class

Declared on: line 21 of Lua/room.lua.
Subclasses: BloodMachineRoom, CardiogramRoom, DNAFixerRoom, DecontaminationRoom, ElectrolysisRoom, FractureRoom, GPRoom, GeneralDiagRoom, HairRestorationRoom, InflationRoom, JellyVatRoom, OperatingTheatreRoom, PharmacyRoom, PsychRoom, ResearchRoom, ScannerRoom, SlackTongueRoom, StaffRoom, ToiletRoom, TrainingRoom, UltrascanRoom, WardRoom, XRayRoom

Method Index

Member Index

function Room:Room(x, y, w, h, id, room_info, world, hospital, door, door2)

Percentage cost recovery of destroyed room items

Parameters:

NameTypeDescription
x ? ?
y ? ?
w ? ?
h ? ?
id ? ?
room_info ? ?
world ? ?
hospital ? ?
door ? ?
door2 ? ?

Declared on: line 26 of Lua/room.lua.

function Room:_arePatientsWantingToEnter()

Private function to check for any patients outside the door queueing,

or about to come in

Declared on: line 744 of Lua/room.lua.

function Room:_checkWaitToggleValidTarget()

Check the target room for a staff wait toggle is not staff room/training/toilets,

and the front humanoid is a patient.

Declared on: line 533 of Lua/room.lua.

function Room:_staffWaitToggle(activate)

Activates and deactivates the staff waiting for patient mood icon and dynamic info text

Parameters:

NameTypeDescription
activate bool - true to activate, false or nil to deactivate

Declared on: line 504 of Lua/room.lua.

function Room:afterLoad(old, new)

Stub to be extended in subclasses, if needed.

Parameters:

NameTypeDescription
old ? ?
new ? ?

Declared on: line 1055 of Lua/room.lua.

function Room:calculateHappinessFactor()

Calculate the effect the room has on humanoid happiness

Declared on: line 1189 of Lua/room.lua.

function Room:canHumanoidEnter(humanoid)

Parameters:

NameTypeDescription
humanoid ? ?

Declared on: line 697 of Lua/room.lua.

function Room:commandEnteringPatient(humanoid)

Handle the patient coming into the room

To be extended in derived classes.

Parameters:

NameTypeDescription
humanoid ? The patient entering

Declared on: line 540 of Lua/room.lua.

function Room:commandEnteringStaff(staff, already_initialized)

When a valid member of staff enters the room this function is called. Can be extended in derived classes.

Parameters:

NameTypeDescription
staff object The staff in question
already_initialized bool If true, this means that the staff has already got order what to do.

Declared on: line 485 of Lua/room.lua.

function Room:countWindows()

Count the number of windows in the room

Declared on: line 1158 of Lua/room.lua.

function Room:crashRoom()

Explode the room.

Declared on: line 857 of Lua/room.lua.

function Room:createEnterAction(humanoid_entering, callback)

Parameters:

NameTypeDescription
humanoid_entering ? ?
callback ? ?

Declared on: line 114 of Lua/room.lua.

function Room:createLeaveAction()

Construct an 'walk' action to the tile next to the door, just outside the room.

Declared on: line 107 of Lua/room.lua.

function Room:deactivate()

Deactivate the room from the world.

Declared on: line 1012 of Lua/room.lua.

function Room:dealtWithPatient(patient)

Parameters:

NameTypeDescription
patient ? ?

Declared on: line 192 of Lua/room.lua.

function Room:getEntranceXY(inside)

Get the tile next to the door.

Parameters:

NameTypeDescription
inside bool If set, get the tile inside the room, else get the tile outside.

Declared on: line 91 of Lua/room.lua.

function Room:getMaximumStaffCriteria()

Constant denoting 'no staff at all' in a room.

Get the type and number of maximum staff for the room.

Declared on: line 301 of Lua/room.lua.

function Room:getMissingStaff(criteria)

Given any type of staff criteria (required/maximum), subtract the staff in the room and return the result

Parameters:

NameTypeDescription
criteria ? ?

Declared on: line 246 of Lua/room.lua.

function Room:getPatient()

Get any patient in the room.

Declared on: line 162 of Lua/room.lua.

function Room:getPatientCount()

Count the number of patients in the room.

Declared on: line 172 of Lua/room.lua.

function Room:getPatients()

A room usually only has one patient, however in the ward can have multiple

patients at once.

Declared on: line 146 of Lua/room.lua.

function Room:getRequiredStaffCriteria()

Get the type and number of required staff for the room.

Declared on: line 311 of Lua/room.lua.

function Room:getRoomMachine()

Get this room machine, if it there

Declared on: line 1212 of Lua/room.lua.

function Room:getStaffMember()

Get the current staff member. In multi-occupancy rooms this returns the staff member with the minimum service quality

Declared on: line 439 of Lua/room.lua.

function Room:getStaffServiceQuality()

Get the average service quality of the staff members in the room.

Declared on: line 1134 of Lua/room.lua.

function Room:getUsageScore()

how many tiles further are we willing to walk if the room has all the required staff

Score function to decide how desirable a room is for a patient.

Declared on: line 679 of Lua/room.lua.

function Room:initRoom(x, y, w, h, door, door2)

Initialises primary components of the room. Additionally, if there is already a room, e.g. it is being moved, we can just reinit it by calling this, not make a new one.

Parameters:

NameTypeDescription
x coordinate starting tile
y coordinate starting tile
w num width of room
h num height of room
door object primary door for room
door2 object optional secondary door (e.g. swing doors)

Declared on: line 43 of Lua/room.lua.

function Room:isDiagnosisRoomForPatient(patient)

Is the room one of the diagnosis rooms for the patient? -- This used for epidemics when the disease and therefore the diagnosis -- rooms of a patient may change. -- @param patient (Patient) patient to verify if treatment room

@return result (boolean) true if is suitable diagnosis room, false otherwise

Parameters:

NameTypeDescription
patient ? ?

Declared on: line 1108 of Lua/room.lua.

function Room:isRoomInDemand()

A room is deemed in demand should any patient be in a state of using, or

wanting to use the room.

Declared on: line 754 of Lua/room.lua.

function Room:isRoomStaffMember(humanoid)

Function to check is the humanoid is attached as the serving patients in the room.

Parameters:

NameTypeDescription
humanoid Humanoid humanoid to check.

Declared on: line 1126 of Lua/room.lua.

function Room:lockRoomOnRepair()

Locks the room to prevent patient from entering due to repair in room.

Declared on: line 1223 of Lua/room.lua.

function Room:makeHumanoidDressIfNecessaryAndThenLeave(humanoid)

Parameters:

NameTypeDescription
humanoid ? ?

Declared on: line 971 of Lua/room.lua.

function Room:makeHumanoidLeave(patient)

Tells a humanoid in the room to leave it. This can be overridden for special handling, e.g. if the humanoid needs to change before leaving the room.

Parameters:

NameTypeDescription
patient ? ?

Declared on: line 964 of Lua/room.lua.

function Room:onHumanoidEnter(humanoid)

Parameters:

NameTypeDescription
humanoid ? ?

Declared on: line 317 of Lua/room.lua.

function Room:onHumanoidLeave(humanoid)

Handles the departure of a humanoid from the room

Parameters:

NameTypeDescription
humanoid ? The subject entity

Declared on: line 568 of Lua/room.lua.

function Room:roomFinished()

Function stub for rooms to implement. Called when the final confirm button has been pressed when building/editing a room.

Declared on: line 715 of Lua/room.lua.

function Room:setStaffMember(staff)

Set the current staff member.

Parameters:

NameTypeDescription
staff staff Staff member to denote as current staff.

Declared on: line 456 of Lua/room.lua.

function Room:setStaffMembersAttribute(attribute, value)

function that sets a given attribute to a given value for all staff members. Should be overridden for rooms that have more than one staff member.

Parameters:

NameTypeDescription
attribute ? ?
value ? ?

Declared on: line 184 of Lua/room.lua.

function Room:shouldHavePatientReenter(patient)

Parameters:

NameTypeDescription
patient ? ?

Declared on: line 674 of Lua/room.lua.

function Room:staffFitsInRoom(staff)

Does the given staff member fit in the room? Returns false if the room is already full of staff or if the given member of staff cannot help out. Otherwise returns true.

Parameters:

NameTypeDescription
staff ? ?

Declared on: line 462 of Lua/room.lua.

function Room:staffMeetsRoomRequirements(humanoid)

Returns true if the humanoid meets (one of) the required staff criteria of the room

Parameters:

NameTypeDescription
humanoid ? ?

Declared on: line 474 of Lua/room.lua.

function Room:testStaffCriteria(criteria, extra_humanoid)

Parameters:

NameTypeDescription
criteria ? ?
extra_humanoid ? ?

Declared on: line 271 of Lua/room.lua.

function Room:tryToFindNearbyPatients()

Try to find new patients for this room by 'stealing' them from other rooms nearby.

Declared on: line 834 of Lua/room.lua.

function Room:unlockRoomOnRepair()

Unlocks the room so repair no longer prevents patients from enter the room.

Declared on: line 1228 of Lua/room.lua.