extends Control #DeskAssets @onready var patient_file = $LowerHalf/Computer/Margin/ComputerScreen/ComputerTabs/FileContainer/PatientFile @onready var patient_file_title = $LowerHalf/Computer/Margin/ComputerScreen/ComputerTabs/FileContainer/PatientFileTitle @onready var patient_recording = $LowerHalf/Computer/Margin/ComputerScreen/ComputerTabs/Recording @onready var patient = $UpperHalf/ControlGlass/Patient @onready var supervisor = $UpperHalf/ControlGlass/Supervisor @onready var next_patient = $LowerHalf/Computer/Margin/NextPatient @onready var end_day = $LowerHalf/Computer/Margin/EndDay @onready var green_button = $LowerHalf/GreenButton @onready var red_button = $LowerHalf/RedButton @onready var journal = $LowerHalf/Journal/JournalButton @onready var journal_layer = UI.journal_layer @onready var release = $LowerHalf/DecisionScreen/MarginContainer/HBoxContainer/Release @onready var terminate = $LowerHalf/DecisionScreen/MarginContainer/HBoxContainer/Terminate @onready var patient_color: Color @onready var computer_tabs = $LowerHalf/Computer/Margin/ComputerScreen/ComputerTabs @onready var computer_screen = $LowerHalf/Computer/Margin/ComputerScreen2 @onready var tab_patient_file = $LowerHalf/Computer/Margin/ComputerScreen/Tabs/PatientFile @onready var tab_rules = $LowerHalf/Computer/Margin/ComputerScreen/Tabs/Rules @onready var tab_recording = $LowerHalf/Computer/Margin/ComputerScreen/Tabs/Recording @onready var middle_screen = $LowerHalf/MiddleScreen/MarginContainer/MiddleInfo @onready var console_screen = $LowerHalf/ConsoleScreen/Margin/ConsoleText #RoomAssets @onready var shutter_top = $RoomAssets/ShutterTop @onready var shutter_bot = $RoomAssets/ShutterBot @onready var shutters_animation = $RoomAssets/ShuttersAnimation @onready var backroom = $RoomAssets/Backroom @onready var backwall_animation = $RoomAssets/Backwall/BackwallAnimation #DialogueAssets @onready var patient_dialogue_resource: Resource @onready var balloon: Node @onready var patient_emotions : Dictionary @onready var message_array: Array[String] var main: Node var accurate_diagnoses = 0 func _ready() -> void: #Referencing main node main = get_parent() #Connecting signals next_patient.get_node("CallNextPatient").pressed.connect(self._on_call_next_patient_pressed) green_button.pressed.connect(self._on_green_button_pressed) red_button.pressed.connect(self._on_red_button_pressed) journal.pressed.connect(self._on_journal_pressed) journal_layer.get_node("JournalOpen/JournalMargin/PageArea/LeftPage/CloseManual").pressed.connect(self._on_close_manual_pressed) tab_patient_file.pressed.connect(self._on_tab_patient_file_pressed) tab_rules.pressed.connect(self._on_tab_rules_pressed) tab_recording.pressed.connect(self._on_tab_recording_pressed) Globals.console_message.connect(self.console_display) Globals.response_chosen.connect(self._on_response_chosen) Globals.clear_patient.connect(self._on_clear_patient) Globals.color_change.connect(self._on_color_change) #Hiding RoomAssets for room_asset in [shutter_top, shutter_bot, backroom]: room_asset.hide() #Hiding ComputerScreen, DialogueText and JournalOpen var nodes_to_hide = [next_patient, end_day, computer_screen, console_screen, journal_layer] + computer_tabs.get_children() for node in nodes_to_hide: node.hide() #Setting up Decision screen release.text = Globals.colorize("RELEASE", "web_gray") terminate.text = Globals.colorize("TERMINATE", "web_gray") for tab_button in [tab_patient_file, tab_rules, tab_recording]: #Hiding Tabs tab_button.hide() for button in [green_button, red_button]: #Disabling Buttons button.set_disabled(true) patient.hide() #Hiding Patient self.hide() #Hiding ScreeningDesk message_array.resize(3) #Setting up message array func new_patient(): Patient.new_patient(Patient.generate_patient_id()) patient_file.text = Patient.file_text patient_file_title.text = Patient.file_title patient_recording.text = "" patient.texture = Patient.image #Setting up UI next_patient.show() console_display(Globals.directives) func _on_call_next_patient_pressed(): #Brings in next patient and sets up the desk controls #Hiding the next_patient button and shows transition messages on computer and console var scenes_to_hide = [next_patient, supervisor] for scenes in scenes_to_hide: scenes.hide() var message : String message = "TARGET ID : " + Globals.colorize("#" + Globals.patient_id, "orange_red") + "\n\n" + "COMPUTING CELL TRANSLATION..." computer_display(message) message = Globals.colorize("- BRINGING IN NEXT PATIENT -", "dark_orange") console_display(message) #ShuttersIncoming shutters_animation.play("incoming") shutter_top.show() shutter_bot.show() await shutters_animation.animation_finished #Showing the Patient and the Backroom var scenes_to_show = [patient, backroom] for scene in scenes_to_show: scene.show() #Opening Shutters shutters_animation.play("open") await shutters_animation.animation_finished #Activating Buttons green_button.set_disabled(false) red_button.set_disabled(false) #Coloring Release and Terminate release.text = Globals.colorize("RELEASE", "dark_green") terminate.text = Globals.colorize("TERMINATE", "dark_red") #Starting Dialogue and hiding console screen computer_screen.hide() console_screen.hide() main.start_balloon("screening", "patient", Patient.dialogue_resource, "start") #Showing Computer Tabs and showing Patient File by default for node in [tab_patient_file, tab_rules, tab_recording]: node.show() node.set_mouse_filter(Control.MOUSE_FILTER_STOP) computer_tabs.get_node("FileContainer").show() func _recording_text(dialogue_line): #Records the dialogues var line = dialogue_line.text var character = dialogue_line.character patient_recording.append_text("\n\n") patient_recording.append_text("[color=red]" + character + "[/color]" + "\n") patient_recording.append_text(line) func _on_response_chosen(response): #Adds protagonist responses to the recording tab patient_recording.append_text("\n\n") patient_recording.append_text("[color=green]You[/color]" + "\n") patient_recording.append_text(response.text) func _on_tab_patient_file_pressed(): #Shows the patient file tab #Highlighting pressed tab button and unpressing the others tab_patient_file.set_pressed(true) tab_patient_file.set_mouse_filter(Control.MOUSE_FILTER_IGNORE) for tab_button in [tab_rules, tab_recording]: tab_button.set_pressed(false) tab_button.set_mouse_filter(Control.MOUSE_FILTER_STOP) #Showing desired tab and hiding the others for node in computer_tabs.get_children(): node.hide() computer_tabs.get_node("FileContainer").show() func _on_tab_rules_pressed(): #Shows the rules tab #Highlighting pressed tab button and unpressing the others tab_rules.set_pressed(true) tab_rules.set_mouse_filter(Control.MOUSE_FILTER_IGNORE) for tab_button in [tab_patient_file, tab_recording]: tab_button.set_pressed(false) tab_button.set_mouse_filter(Control.MOUSE_FILTER_STOP) #Showing desired tab and hiding the others for node in computer_tabs.get_children(): node.hide() computer_tabs.get_node("Rules").show() func _on_tab_recording_pressed(): #Shows the recording tab #Highlighting pressed tab button and unpressing the others tab_recording.set_pressed(true) tab_recording.set_mouse_filter(Control.MOUSE_FILTER_IGNORE) for tab_button in [tab_patient_file, tab_rules]: tab_button.set_pressed(false) tab_button.set_mouse_filter(Control.MOUSE_FILTER_STOP) #Showing desired tab and hiding the others for node in computer_tabs.get_children(): node.hide() computer_tabs.get_node("Recording").show() func _on_green_button_pressed(): #Releases the patient decision_made("release") func _on_red_button_pressed(): #Terminates the patient decision_made("terminate") func decision_made(choice: String): #Hiding computer tabs screen for node in [tab_patient_file, tab_rules, tab_recording] + computer_tabs.get_children(): node.hide() #Setting up console and computer displays if choice == "release": release.text = Globals.colorize("RELEASE", "green") #Highlighting the decision message_array = Globals.release_messages elif choice == "terminate": terminate.text = Globals.colorize("TERMINATE", "red") #Highlighting the decision message_array = Globals.terminate_messages console_display(message_array[0]) computer_display(message_array[2]) #Disabling Buttons green_button.set_mouse_filter(Control.MOUSE_FILTER_IGNORE) red_button.set_mouse_filter(Control.MOUSE_FILTER_IGNORE) #Final Patient Dialogue main.start_balloon("screening", "patient", Patient.dialogue_resource, choice) func _on_journal_pressed(): #Shows the journal journal_layer.show() func _on_close_manual_pressed(): #Hides the journal journal_layer.hide() func _on_clear_patient(choice:String): #Clears patient and transitions towards next patient or end of day # Updating middle screen info and accurate_diagnoses value if (Patient.abnormal == true and choice == "terminate") or (Patient.abnormal == false and choice == "release"): accurate_diagnoses += 1 else: accurate_diagnoses = 0 # Resetting to 0 if the player makes a wrong diagnosis update_middle_screen(Globals.day_count, Globals.floor_count, accurate_diagnoses, Globals.diagnoses_quota) #Showing second console message console_display(message_array[1]) #Closing Shutters shutters_animation.play("close") await shutters_animation.animation_finished #Hiding the cell and restoring the backroom and patient's original colors for scene in [patient, backroom]: scene.hide() patient.modulate = Patient.original_color backroom.modulate = Patient.original_color #Hiding Computer screen and resetting Console screen once the animation is done shutters_animation.play(choice) await shutters_animation.animation_finished computer_screen.hide() console_screen.hide() #Reenabling mouse filter and resetting buttons for button in [green_button, red_button]: button.set_mouse_filter(Control.MOUSE_FILTER_STOP) button.set_pressed(false) button.set_disabled(true) #Resetting decision screen release.text = Globals.colorize("RELEASE", "web_gray") terminate.text = Globals.colorize("TERMINATE", "web_gray") #Descending Floor if diagnoses_quota reached if accurate_diagnoses == Globals.diagnoses_quota: descend_floor() else: new_patient() func _on_color_change(color: String): #Modulating backroom and patient colors var new_color: Color match color: "red": new_color = Color(1,0.1,0.1,1) "green": new_color = Color(0.5,1,0.5,1) patient.modulate = new_color backroom.modulate = new_color print("Color changed to: " + str(new_color)) func console_display(message): #Displays a message on the console screen var text = message text = text.replace("\\n", "\n") #Replaces litteral backslashes by actual newlines (necessary because of Dialogue Manager) console_screen.text = text console_screen.show() func computer_display(message): #Displays a message on the computer screen var text = message text = text.replace("\\n", "\n") #Replaces litteral backslashes by actual newlines (necessary because of Dialogue Manager) computer_screen.text = text computer_screen.show() func update_middle_screen(day_count, floor_count, diagnoses_count, diagnoses_quota): #Updates Middle Screen Info var day = Globals.colorize(str(day_count), "dark_orange") var floor = Globals.colorize(str(floor_count), "dark_orange") var diagnoses = Globals.colorize(str(diagnoses_count) + "/" + str(diagnoses_quota), "dark_orange") var text = "DAY: " + day + "\n\nFLOOR: " + floor + "\n\nACCURATE DIAGNOSES: " + diagnoses middle_screen.text = text func descend_floor(): #Descends to next floor #Displaying information on screens var message : String message = Globals.colorize("DIAGNOSES QUOTA REACHED", "green_yellow") + "\n\n" + "SECURITY CLEARANCE UPDATED" + "\n\n" + Globals.colorize("ACCESS TO NEXT FLOOR AUTHORIZED", "green") computer_display(message) message = Globals.colorize("- DESCENT PROTOCOL INITIATED -\n\n- TRANSLATING TO NEXT FLOOR -", "dark_orange") console_display(message) #Descending animation backwall_animation.play("going_down_1") await backwall_animation.animation_finished backwall_animation.play("going_down_2") await backwall_animation.animation_finished #Updating middle screen info Globals.floor_count -= 1 accurate_diagnoses = 0 Globals.diagnoses_quota += 1 update_middle_screen(Globals.day_count, Globals.floor_count, accurate_diagnoses, Globals.diagnoses_quota) #Updating journal symptoms UI.update_journal(Globals.floor_count) #Hiding screen messages computer_screen.hide() console_screen.hide() #Interfloor dialogue supervisor.dialogue("interfloor_" + str(-Globals.floor_count-1)) await supervisor.dialogue_finished #Setting up new patient new_patient()