Room Class
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
- _arePatientsWantingToEnter()
- _checkWaitToggleValidTarget()
- _staffWaitToggle(activate)
- afterLoad(old, new)
- calculateHappinessFactor()
- calculateRemovalCost()
- canHumanoidEnter(humanoid)
- commandEnteringPatient(humanoid)
- commandEnteringStaff(staff, already_initialized)
- countWindows()
- crashRoom()
- createEnterAction(humanoid_entering, callback)
- createLeaveAction()
- deactivate()
- dealtWithPatient(patient)
- enterEditMode()
- getEntranceXY(inside)
- getMaximumStaffCriteria()
- getMissingStaff(criteria)
- getPatient()
- getPatientCount()
- getPatients()
- getRequiredStaffCriteria()
- getRoomMachine()
- getStaffMember()
- getStaffServiceQuality()
- getUsageScore()
- hasQueueDialog()
- initRoom(x, y, w, h, door, door2)
- isDiagnosisRoomForPatient(patient)
- isRoomInDemand()
- isRoomStaffMember(humanoid)
- lockRoomOnRepair()
- makeHumanoidDressIfNecessaryAndThenLeave(humanoid)
- makeHumanoidLeave(patient)
- onHumanoidEnter(humanoid)
- onHumanoidLeave(humanoid)
- roomFinished()
- setStaffMember(staff)
- setStaffMembersAttribute(attribute, value)
- shouldHavePatientReenter(patient)
- staffFitsInRoom(staff)
- staffMeetsRoomRequirements(humanoid)
- testStaffCriteria(criteria, extra_humanoid)
- tryAdvanceQueue()
- tryToEdit()
- tryToFindNearbyPatients()
- unlockRoomOnRepair()
Member Index
- active
- built
- crashed
- dealt_patient_callback
- door
- door2
- happiness_factor
- height
- hospital
- humanoids
- humanoids_enroute
- id
- is_active
- manual_repair
- maximum_patients
- needs_repair
- objects
- room_info
- sound_played
- staff_member
- staff_member_set
- waiting_staff_member
- width
- world
- x
- y
function Room:Room(x, y, w, h, id, room_info, world, hospital, door, door2)
Percentage cost recovery of destroyed room items
Parameters:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:calculateRemovalCost()
Get the removal cost
Declared on: line 1172 of Lua/room.lua.
function Room:canHumanoidEnter(humanoid)
Parameters:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| patient | ? | ? |
Declared on: line 192 of Lua/room.lua.
function Room:enterEditMode()
Declared on: line 661 of Lua/room.lua.
function Room:getEntranceXY(inside)
Get the tile next to the door.
Parameters:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:hasQueueDialog()
Declared on: line 1051 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| patient | ? | ? |
Declared on: line 964 of Lua/room.lua.
function Room:onHumanoidEnter(humanoid)
Parameters:
| Name | Type | Description |
|---|---|---|
| humanoid | ? | ? |
Declared on: line 317 of Lua/room.lua.
function Room:onHumanoidLeave(humanoid)
Handles the departure of a humanoid from the room
Parameters:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| attribute | ? | ? |
| value | ? | ? |
Declared on: line 184 of Lua/room.lua.
function Room:shouldHavePatientReenter(patient)
Parameters:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| 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:
| Name | Type | Description |
|---|---|---|
| humanoid | ? | ? |
Declared on: line 474 of Lua/room.lua.
function Room:testStaffCriteria(criteria, extra_humanoid)
Parameters:
| Name | Type | Description |
|---|---|---|
| criteria | ? | ? |
| extra_humanoid | ? | ? |
Declared on: line 271 of Lua/room.lua.
function Room:tryAdvanceQueue()
Declared on: line 550 of Lua/room.lua.
function Room:tryToEdit()
Declared on: line 1025 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.