diff --git a/CorsixTH/Lua/entities/patient.lua b/CorsixTH/Lua/entities/patient.lua index 9abd435ccd..2e3900fb1e 100644 --- a/CorsixTH/Lua/entities/patient.lua +++ b/CorsixTH/Lua/entities/patient.lua @@ -1076,22 +1076,30 @@ end ]] function Patient:updateMessage(choice) if self.message and self.message.choices then + local message_choice local enabled = false - if choice == "research" then + + for _, c in ipairs(self.message.choices) do + if c.choice == choice then + message_choice = choice + end + end + + if choice == "research" and message_choice == choice then -- enable only if research department is built and a room in the treatment chain is undiscovered local req = self.hospital:checkDiseaseRequirements(self.disease.id) if req then local strings = _S.fax.disease_discovered_patient_choice enabled = self.hospital:hasRoomOfType("research") and self.hospital:hasStaffOfCategory("Researcher") local output_text = strings.can_not_cure - if #req.rooms > 0 then - local room_name, _, staff_name = self.world:getRoomNameAndRequiredStaffName(req.rooms[#req.rooms]) - if next(req.staff) then + if #req.rooms == 1 then + local room_name, required_staff, staff_name = self.world:getRoomNameAndRequiredStaffName(req.rooms[#req.rooms]) + if req.staff[required_staff] or 0 > 0 then output_text = strings.need_to_build_and_employ:format(room_name, staff_name) else output_text = strings.need_to_build:format(room_name) end - elseif next(req.staff) then + elseif #req.rooms == 0 and next(req.staff) then local staffclass_to_string = { Nurse = _S.staff_title.nurse, Doctor = _S.staff_title.doctor, @@ -1099,12 +1107,10 @@ function Patient:updateMessage(choice) Psychiatrist = _S.staff_title.psychiatrist, } output_text = strings.need_to_employ:format(staffclass_to_string[next(req.staff)]) - else - enabled = false end self.message[3].text = output_text else - --no requirements + -- no requirements missing enabled = false end else -- if choice == "guess_cure" then diff --git a/CorsixTH/Lua/humanoid_actions/seek_room.lua b/CorsixTH/Lua/humanoid_actions/seek_room.lua index d606b6bc84..4a6ea8725a 100644 --- a/CorsixTH/Lua/humanoid_actions/seek_room.lua +++ b/CorsixTH/Lua/humanoid_actions/seek_room.lua @@ -126,7 +126,6 @@ local function action_seek_room_no_treatment_room_found(room_type, humanoid) end -- Wait two months before going home anyway. humanoid.waiting = 60 - local strings = _S.fax.disease_discovered_patient_choice -- Can this room be built right now? What is then missing? local output_text = strings.can_not_cure @@ -134,20 +133,28 @@ local function action_seek_room_no_treatment_room_found(room_type, humanoid) --local room = assert(humanoid.world.available_rooms[room_type], "room " .. room_type .. " not available") local req = humanoid.hospital:checkDiseaseRequirements(humanoid.disease.id) - + local research_enabled = false if req then - local room_name, _, staff_name = humanoid.world:getRoomNameAndRequiredStaffName(room_type) - if #req.rooms > 0 then - if next(req.staff) then + local strings = _S.fax.disease_discovered_patient_choice + research_enabled = humanoid.hospital:hasRoomOfType("research") and humanoid.hospital:hasStaffOfCategory("Researcher") + if #req.rooms == 1 then + local room_name, required_staff, staff_name = humanoid.world:getRoomNameAndRequiredStaffName(req.rooms[1]) + if req.staff[required_staff] or 0 > 0 then output_text = strings.need_to_build_and_employ:format(room_name, staff_name) else output_text = strings.need_to_build:format(room_name) end - else - output_text = strings.need_to_employ:format(staff_name) + elseif #req.rooms == 0 and next(req.staff) then + local staffclass_to_string = { + Nurse = _S.staff_title.nurse, + Doctor = _S.staff_title.doctor, + Surgeon = _S.staff_title.surgeon, + Psychiatrist = _S.staff_title.psychiatrist, + } + output_text = strings.need_to_employ:format(staffclass_to_string[next(req.staff)]) end end - local research_enabled = humanoid.hospital:hasStaffOfCategory("Researcher") and humanoid.hospital:hasRoomOfType("research") + local message = { {text = strings.disease_name:format(humanoid.disease.name)}, {text = " "},