Module CorsixTH.CorsixTH.Lua.hospital

Checks if a room has been discovered

Functions

Hospital:_fixBoiler () Boiler broke down and work is done to get it fixed.
Hospital:addHandymanTask (object, taskType, priority, x, y, call) Adds a handyman task
Hospital:addTileObject (object_category) Update tile object counts for adding an object.
Hospital:adviseBoilerBreakdown () Select a relevant message to be displayed to the user
Hospital:adviseCannotAffordPlot () Give visual warning that player doesn't have enough $ to build
Hospital:advisePlants () Give advice to the user about maintenance of plants.
Hospital:advisePriceLevelImpact (judgment, name) Tell the player, through the advisor, about the impact of casebook prices
Hospital:afterLoad (old, new) Update the loaded game with version 'old' to the version 'new'.
Hospital:announceRepair (room) Announces a machine needing repair
Hospital:announceStaffLeave (staff) Announce to the player that a staff member is leaving the hospital
Hospital:boilerBreakdown (broken_heat) Boiler should break down.
Hospital:canConcentrateResearch (disease) Function that returns true if concentrating research on the disease is possible.
Hospital:changeReputation (reason, disease, valueChange) Normally reputation is changed based on a reason, and the affected disease also has its own reputation meter.
Hospital:changeValue (changeValue) Change the hospital value by an amount independent of a cost being incurred
Hospital:checkDiseaseRequirements (disease) Checks if the requirements for the given disease are met in the hospital and returns the ones missing.
Hospital:checkEmergencyOver () Determine if all of the patients in the emergency have been cured or killed.
Hospital:computePriceLevelImpact (patient, casebook) Change patient happiness and hospital reputation based on price distortion.
Hospital:countFireExtinguishers () Get the number of fire extinguishers in the hospital.
Hospital:countGeneralObjects () Get the number of general objects in the hospital.
Hospital:countPatients (max_count) Count the number of patients in the hospital.
Hospital:countPlants () Get the number of plants in the hospital.
Hospital:countRadiators () Get the number of radiators in the hospital.
Hospital:countReceptionDesks () Get the number of reception desks in the hospital.
Hospital:countRoomOfType (type, max_count) Checks if the hospital has a room of a given type.
Hospital:countSittingStanding () Count number of sitting and standing patients in the hospital.
Hospital:countStaffOfCategory (category, max_count) Checks if the hospital employs staff of a given category.
Hospital:createVip () Makes the fax which may spawn a VIP
Hospital:daysUntilNextDisaster () Decide how many days the hospital functions within specification.
Hospital:findReceptionDesks () Collect the reception desks in the hospital.
Hospital:getAveragePatientAttribute (attribute, default_value) Compute average of an attribute for all patients in the hospital.
Hospital:getAverageStaffAttribute (attribute, default_value) Compute average of an attribute for all staff in the hospital.
Hospital:getCampaignData () Collect the hospital level settings relevant for the next hospital
Hospital:getHandymanTaskPriority (taskIndex, taskType) Queries the priority of an existing handyman task
Hospital:getHeliportPosition () Returns the heliport x and y coordinates or nil if none exist.
Hospital:getHeliportSpawnPosition () Returns the tile on which patients should spawn when getting out of the helicopter.
Hospital:getIndexOfTask (x, y, taskType, obj) Find a handyman task by task type, position, and possibly the used object.
Hospital:getRandomBusyRoom () Finds a random room with significantly long queues
Hospital:getReputationChangeLikelihood () Compute the likelihood for a reputation change to be effective.
Hospital:getTreatmentPrice (disease) Function to determine the price for a treatment, modified by reputation and percentage Treatment charge should never be less than the starting price if reputation falls below 500
Hospital:getWallsAround (x, y) Get the set of walls around a tile position.
Hospital:giveAdvice (msgs, rnd_frac, stay_up) Advises the player.
Hospital:hasStaffedDesk () Does the hospital have a working reception?
Hospital:humanoidDeath (patient) Humanoid has died, record the incident.
Hospital:initOwnedPlots () Afterload function to initialize the owned plots.
Hospital:initStaff () Initialize hospital staff from the level config.
Hospital:isPlayerHospital () Returns whether this hospital is controlled by a real person or not.
Hospital:isReputationChangeAllowed (amount) Decide whether a reputation change is effective or not.
Hospital:makeEmergencyEndFax (rescued_patients, total, max_bonus, earned) Makes the fax at the end of an emergency
Hospital:makeEmergencyStartFax () Makes the fax at the start of an emergency
Hospital:makeNoDiagnosisRoomFax (patient) Makes the fax requesting player action for the patient who needs a diagnosis room
Hospital:makeNoTreatmentRoomFax (patient) Makes the fax requesting player action for the patient who needs a diagnosis room
Hospital:makeRaiseRequest (amount, staff) Makes the raise request for a staff member
Hospital:makeVipEndFax (vip_rating, name, cash_reward, vip_message) Called when the vip is out of the hospital grounds
Hospital:msgCured () Give the user possibly a message about a cured patient.
Hospital:msgKilled () Give the user possibly a message about a dead patient.
Hospital:msgMultiReceptionDesks () Give advice about having more desks.
Hospital:msgNeedFirstReceptionDesk () Give advice to the user about the need to buy the first reception desk.
Hospital:msgReceptionDesk () Give advice to the user about having bought a reception desk.
Hospital:notifyOfStaffChange (staff) Notify patients of a change to hospital staff members
Hospital:objectPlaced (entity, id) A new object has been placed in the hospital.
Hospital:onEndYear () Called at the end of each year
Hospital:paySupplierForDrug (disease_id) Pay drug if drug has been purchased to treat a patient.
Hospital:removeMessage (humanoid) Remove any message (fax) relating to this humanoid
Hospital:removePatient (patient) Remove a patient from the hospital.
Hospital:removeRathole (hole) Remove the provided rathole.
Hospital:removeRatholeXY (x, y) Remove any rathole from the given position.
Hospital:removeRatholesAroundRoom (room) Remove the ratholes that use the walls of the provided room.
Hospital:removeStaff (staff) Remove a staff member from the hospital staff.
Hospital:removeTileObject (object_category) Update tile object counts for removing an object.
Hospital:roomNotYetResearched (disease) Function that returns true if the room for the given disease has not been researched yet.
Hospital:sellSodaToPatient (patient) Sell a soda to a patient.
Hospital:setCampaignData (campaign_data) Restore the hospital settings from the previous hospital
Hospital:showGatesToHell (entity) Show the 'Gates to hell' animation.
Hospital:tick () Called each tick, also called 'hours'.
Hospital:unconditionalChangeReputation (valueChange) Unconditionally change the reputation.
Hospital:updateCuredCounts (patient) Update the 'cured' counts of the hospital.
Hospital:updateNotCuredCounts (patient, reason) Update the 'not cured' counts of the hospital.


Functions

Hospital:_fixBoiler ()
Boiler broke down and work is done to get it fixed.
Hospital:addHandymanTask (object, taskType, priority, x, y, call)
Adds a handyman task

Parameters:

  • object The object needing attention
  • taskType The handyman task type: repairing, watering, cleaning
  • priority Task priority: 1 is low, 2 is high
  • x coordinate
  • y coordinate
  • call The call added to the dispatcher
Hospital:addTileObject (object_category)
Update tile object counts for adding an object. See also 'Hospital:removeTileObject'

Parameters:

  • object_category Category of the tile object.
Hospital:adviseBoilerBreakdown ()
Select a relevant message to be displayed to the user
Hospital:adviseCannotAffordPlot ()
Give visual warning that player doesn't have enough $ to build
Hospital:advisePlants ()
Give advice to the user about maintenance of plants.
Hospital:advisePriceLevelImpact (judgment, name)
Tell the player, through the advisor, about the impact of casebook prices

Parameters:

  • judgment
  • name
Hospital:afterLoad (old, new)
Update the loaded game with version 'old' to the version 'new'.

Parameters:

  • old Version of the loaded game.
  • new Version of the code being executed.
Hospital:announceRepair (room)
Announces a machine needing repair

Parameters:

  • room
Hospital:announceStaffLeave (staff)
Announce to the player that a staff member is leaving the hospital

Parameters:

  • staff
Hospital:boilerBreakdown (broken_heat)
Boiler should break down.

Parameters:

  • broken_heat (0 or 1) Amount of heat to output due to being broken.
Hospital:canConcentrateResearch (disease)
Function that returns true if concentrating research on the disease is possible.

Parameters:

  • disease (string): the disease to be checked.
Hospital:changeReputation (reason, disease, valueChange)
Normally reputation is changed based on a reason, and the affected disease also has its own reputation meter.

Parameters:

  • reason (string) The reason for changing reputation, for example "cured" or "death".
  • disease The disease, if any, that should be affected.
  • valueChange (integer) In some cases, for example at year end, the amount varies a lot. Then it is specified here.
Hospital:changeValue (changeValue)
Change the hospital value by an amount independent of a cost being incurred

Parameters:

  • changeValue (int) The amount the hospital value should change by
Hospital:checkDiseaseRequirements (disease)
Checks if the requirements for the given disease are met in the hospital and returns the ones missing.

Parameters:

  • disease (String) The disease to check the requirements for returns false if all requirements are met, else a table in the form { rooms = {[room1], [room2], ...}, staff = {[humanoid_class] = [amount_needed] or nil} } i.e. a list of rooms (ordered the same as disease.treatment_rooms), and a set of humanoid_classes with the needed amount of that class as the value
Hospital:checkEmergencyOver ()
Determine if all of the patients in the emergency have been cured or killed. If they have end the emergency timer.
Hospital:computePriceLevelImpact (patient, casebook)
Change patient happiness and hospital reputation based on price distortion. The patient happiness is adjusted proportionally. The hospital reputation can only be affected when the distortion level reaches some threshold.

Parameters:

  • patient (patient) The patient paying the bill. His/her happiness level is adjusted.
  • casebook (object) Disease casebook entry. It's used to display the localised disease name when Adviser tells the warning message.
Hospital:countFireExtinguishers ()
Get the number of fire extinguishers in the hospital.

Returns:

    (int) Number of fire extinguishers in the hospital.
Hospital:countGeneralObjects ()
Get the number of general objects in the hospital.

Returns:

    (int) Number of general objects in the hospital.
Hospital:countPatients (max_count)
Count the number of patients in the hospital.

Parameters:

  • max_count (optional integer) If provided, non-negative maximum count to return.

Returns:

    The number of patients in the hospital, at most max_count is returned if provided.
Hospital:countPlants ()
Get the number of plants in the hospital.

Returns:

    (int) Number of plants in the hospital.
Hospital:countRadiators ()
Get the number of radiators in the hospital.

Returns:

    (int) Number of radiators in the hospital.
Hospital:countReceptionDesks ()
Get the number of reception desks in the hospital.

Returns:

    (int) Number of reception desks in the hospital.
Hospital:countRoomOfType (type, max_count)
Checks if the hospital has a room of a given type.

Parameters:

  • type (string) A room_info.id, e.g. "ward".
  • max_count (optional integer) If provided, non-negative maximum count to return. Returns Number of that type found, at most max_count is returned if provided.
Hospital:countSittingStanding ()
Count number of sitting and standing patients in the hospital.

Returns:

    (integer, integer) Number of sitting and number of standing patient in the hospital.
Hospital:countStaffOfCategory (category, max_count)
Checks if the hospital employs staff of a given category.

Parameters:

  • category (string) A humanoid_class or one of the specialists, i.e. "Doctor", "Nurse", "Handyman", "Receptionist", "Psychiatrist", "Surgeon", "Researcher", "Junior" or "Consultant"
  • max_count (optional integer) If provided, non-negative maximum count to return. returns Number of that type employed, at most max_count is returned if provided.
Hospital:createVip ()
Makes the fax which may spawn a VIP
Hospital:daysUntilNextDisaster ()
Decide how many days the hospital functions within specification.

Returns:

    (int) Number of disaster-free days in the hospital.
Hospital:findReceptionDesks ()
Collect the reception desks in the hospital.

Returns:

    (list) The reception desks in the hospital.
Hospital:getAveragePatientAttribute (attribute, default_value)
Compute average of an attribute for all patients in the hospital.

Parameters:

  • attribute (str) Name of the attribute.
  • default_value Value to return if there are no patients.

Returns:

    Average value of the attribute for all hospital patients, or the default value.
Hospital:getAverageStaffAttribute (attribute, default_value)
Compute average of an attribute for all staff in the hospital.

Parameters:

  • attribute (str) Name of the attribute.
  • default_value Value to return if there is no staff.

Returns:

    Average value of the attribute for all staff, or the default value.
Hospital:getCampaignData ()
Collect the hospital level settings relevant for the next hospital

Returns:

    campaign_data (table) Hospital campaign data
Hospital:getHandymanTaskPriority (taskIndex, taskType)
Queries the priority of an existing handyman task

Parameters:

  • taskIndex (integer) Number of task
  • taskType The handyman task type: repairing, watering, cleaning

Returns:

    Priority of task
Hospital:getHeliportPosition ()
Returns the heliport x and y coordinates or nil if none exist.

Returns:

    (pair of integers, or nil) The x,y position of the tile with the heliport, if it exists.
Hospital:getHeliportSpawnPosition ()
Returns the tile on which patients should spawn when getting out of the helicopter.

Returns:

    (pair of integers, or nil) The x,y position to use for spawning emergency patients from the heliport, if available.
Hospital:getIndexOfTask (x, y, taskType, obj)
Find a handyman task by task type, position, and possibly the used object.

Parameters:

  • x (int) The X coordinate of the position.
  • y (int) The Y coordinate of the position.
  • taskType Type of the task.
  • obj (Object) If specified, the object used for doing the task. Since multiple litter objects may exist at the same tile, the object must be given when cleaning.
Hospital:getRandomBusyRoom ()
Finds a random room with significantly long queues

Returns:

    room or nil The chosen room in the hospital or nil for no room busy enough
Hospital:getReputationChangeLikelihood ()
Compute the likelihood for a reputation change to be effective. Likelihood gets smaller as hospital reputation gets closer to extreme values.

Returns:

    (float) Likelihood of a reputation change.
Hospital:getTreatmentPrice (disease)
Function to determine the price for a treatment, modified by reputation and percentage Treatment charge should never be less than the starting price if reputation falls below 500

Parameters:

  • disease
Hospital:getWallsAround (x, y)
Get the set of walls around a tile position.

Parameters:

  • x (int) X position of the queried tile.
  • y (int) Y position of the queried tile.

Returns:

    (table {wall, parcel}) The walls around the given position.
Hospital:giveAdvice (msgs, rnd_frac, stay_up)
Advises the player.

Parameters:

  • msgs
  • rnd_frac
  • stay_up
Hospital:hasStaffedDesk ()
Does the hospital have a working reception?

Returns:

    (bool) Whether there is a working reception in the hospital.
Hospital:humanoidDeath (patient)
Humanoid has died, record the incident.

Parameters:

  • patient The deceased.
Hospital:initOwnedPlots ()
Afterload function to initialize the owned plots.
Hospital:initStaff ()
Initialize hospital staff from the level config.
Hospital:isPlayerHospital ()
Returns whether this hospital is controlled by a real person or not.
Hospital:isReputationChangeAllowed (amount)
Decide whether a reputation change is effective or not. As we approach 1000, a gain is less likely. As we approach 0, a loss is less likely. Under 500, a gain is always effective. Over 500, a loss is always effective.

Parameters:

  • amount (int): The amount of reputation change.
Hospital:makeEmergencyEndFax (rescued_patients, total, max_bonus, earned)
Makes the fax at the end of an emergency

Parameters:

  • rescued_patients
  • total
  • max_bonus
  • earned
Hospital:makeEmergencyStartFax ()
Makes the fax at the start of an emergency
Hospital:makeNoDiagnosisRoomFax (patient)
Makes the fax requesting player action for the patient who needs a diagnosis room

Parameters:

  • patient
Hospital:makeNoTreatmentRoomFax (patient)
Makes the fax requesting player action for the patient who needs a diagnosis room

Parameters:

  • patient
Hospital:makeRaiseRequest (amount, staff)
Makes the raise request for a staff member

Parameters:

  • amount
  • staff
Hospital:makeVipEndFax (vip_rating, name, cash_reward, vip_message)
Called when the vip is out of the hospital grounds

Parameters:

  • vip_rating
  • name
  • cash_reward
  • vip_message
Hospital:msgCured ()
Give the user possibly a message about a cured patient.
Hospital:msgKilled ()
Give the user possibly a message about a dead patient.
Hospital:msgMultiReceptionDesks ()
Give advice about having more desks.
Hospital:msgNeedFirstReceptionDesk ()
Give advice to the user about the need to buy the first reception desk.
Hospital:msgReceptionDesk ()
Give advice to the user about having bought a reception desk.
Hospital:notifyOfStaffChange (staff)
Notify patients of a change to hospital staff members

Parameters:

  • staff (Staff) Changed staff member subject of notification
Hospital:objectPlaced (entity, id)
A new object has been placed in the hospital.

Parameters:

  • entity (Entity) The entity that was just placed.
  • id (string) That entity's id.
Hospital:onEndYear ()
Called at the end of each year
Hospital:paySupplierForDrug (disease_id)
Pay drug if drug has been purchased to treat a patient.

Parameters:

  • disease_id Disease that was treated.
Hospital:removeMessage (humanoid)
Remove any message (fax) relating to this humanoid

Parameters:

  • humanoid
Hospital:removePatient (patient)
Remove a patient from the hospital.

Parameters:

  • patient (Patient) Patient to remove.
Hospital:removeRathole (hole)
Remove the provided rathole.

Parameters:

  • hole (table{x, y, wall, optional object}) Hole to remove.
Hospital:removeRatholeXY (x, y)
Remove any rathole from the given position.

Parameters:

  • x X position of the tile that should not have ratholes.
  • y Y position of the tile that should not have ratholes.
Hospital:removeRatholesAroundRoom (room)
Remove the ratholes that use the walls of the provided room.

Parameters:

  • room (Room) Room being de-activated.
Hospital:removeStaff (staff)
Remove a staff member from the hospital staff.

Parameters:

  • staff (Staff) Staff member to remove.
Hospital:removeTileObject (object_category)
Update tile object counts for removing an object. See also 'Hospital:addTileObject'

Parameters:

  • object_category Category of the tile object.
Hospital:roomNotYetResearched (disease)
Function that returns true if the room for the given disease has not been researched yet.

Parameters:

  • disease (string): the disease to be checked.
Hospital:sellSodaToPatient (patient)
Sell a soda to a patient.

Parameters:

  • patient (patient) The patient buying the soda.
Hospital:setCampaignData (campaign_data)
Restore the hospital settings from the previous hospital

Parameters:

  • campaign_data (table) Hospital campaign data
Hospital:showGatesToHell (entity)
Show the 'Gates to hell' animation.

Parameters:

  • entity
Hospital:tick ()
Called each tick, also called 'hours'. Check hours_per_day in date.lua to see how many times per day this is.
Hospital:unconditionalChangeReputation (valueChange)
Unconditionally change the reputation. In most cases, the better entry point for changing reputation is 'Hospital:changeReputation'.

Parameters:

  • valueChange (integer) Amount of change.
Hospital:updateCuredCounts (patient)
Update the 'cured' counts of the hospital.

Parameters:

  • patient Patient that was cured.
Hospital:updateNotCuredCounts (patient, reason)
Update the 'not cured' counts of the hospital.

Parameters:

  • patient Patient that was not cured.
  • reason (string) the reason why the patient is not cured. -"kicked": Patient goes home early (manually sent, no treatment room, etc). -"over_priced": Patient considers the price too high.
generated by LDoc TESTING Last updated 2015-01-01 12:00:00