Envoi sur GitHub du projet updated

This commit is contained in:
Maurane
2026-01-07 12:47:48 +01:00
parent 34e887afd2
commit 3f1863f0c1
434 changed files with 16021 additions and 5685 deletions
+261 -180
View File
@@ -1,249 +1,330 @@
extends Control
@onready var panel_container = $Background/HBoxContainer/MarginContainer/VBoxContainer/FaceMarginContainer/PanelContainer
@onready var margin_container = $Background/HBoxContainer/MarginContainer/VBoxContainer/FaceMarginContainer/PanelContainer/MarginContainer
@onready var patient_file = $Background/HBoxContainer/MarginContainer/VBoxContainer/FaceMarginContainer/PanelContainer/MarginContainer/FileContainer/PatientFile
@onready var patient_file_title = $Background/HBoxContainer/MarginContainer/VBoxContainer/FaceMarginContainer/PanelContainer/MarginContainer/FileContainer/HBoxContainer/PatientFileTitle
@onready var patient_recording = $Background/HBoxContainer/MarginContainer/VBoxContainer/FaceMarginContainer/PanelContainer/MarginContainer/RecordingContainer/Recording
@onready var patient_recording_title = $Background/HBoxContainer/MarginContainer/VBoxContainer/FaceMarginContainer/PanelContainer/MarginContainer/RecordingContainer/HBoxContainer/RecordTitle
@onready var face_zoom = $Background/HBoxContainer/MarginContainer/VBoxContainer/FaceMarginContainer/FaceZoom
@onready var alone_controls = $Background/HBoxContainer/MarginContainer/VBoxContainer/ControlsMarginContainer/Alone
@onready var patient_controls = $Background/HBoxContainer/MarginContainer/VBoxContainer/ControlsMarginContainer/Patient
@onready var end_of_day_controls = $Background/HBoxContainer/MarginContainer/VBoxContainer/ControlsMarginContainer/EndOfDay
@onready var patient_texture = $Background/HBoxContainer/Desk/PatientTextureRect
#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 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 = $LowerHalf/JournalLayer
@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 red_backroom = $RoomAssets/RedBackroom
@onready var green_backroom = $RoomAssets/GreenBackroom
#DialogueAssets
@onready var patient_dialogue_resource: Resource
@onready var end_of_day_dialogue_resource = load("res://Dialogues/end_of_day.dialogue")
@onready var balloon: Node
@onready var patient_emotions : Dictionary
signal recovery_pressed
var main: Node
var accurate_diagnoses = 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
#Referencing main node
main = get_parent()
#Connecting signals
alone_controls.get_node("PatientFile").pressed.connect(self._on_patient_file_pressed)
alone_controls.get_node("Guidebook").pressed.connect(self._on_guidebook_pressed)
alone_controls.get_node("CallNextPatient").pressed.connect(self._on_call_next_patient_pressed)
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)
patient_controls.get_node("PatientFile").pressed.connect(self._on_patient_file_pressed)
patient_controls.get_node("Guidebook").pressed.connect(self._on_guidebook_pressed)
patient_controls.get_node("PatientRecording").pressed.connect(self._on_patient_recording_pressed)
patient_controls.get_node("Examine").pressed.connect(self._on_examine_pressed)
patient_controls.get_node("Containment").pressed.connect(self._on_containment_pressed)
patient_controls.get_node("PsychWard").pressed.connect(self._on_psych_ward_pressed)
#Hiding RoomAssets
for room_asset in [shutter_top, shutter_bot, backroom, red_backroom, green_backroom]:
room_asset.hide()
end_of_day_controls.get_node("Recovery").pressed.connect(self._on_recovery_pressed)
#Hiding everything
self.hide()
#Hiding Top Right Panel
panel_container.hide()
for node in margin_container.get_children():
#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()
face_zoom.hide()
#Hiding Bottom Right Panel
alone_controls.hide()
patient_controls.hide()
end_of_day_controls.hide()
#Hiding Patient
patient_texture.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
#Sets Up New Patient
func new_patient(patient_id):
#Loading Patient Files
var file_path: String = "res://Dialogues/Patients/patient_" + patient_id + "_file.txt"
var file = FileAccess.open(file_path, FileAccess.READ)
var file_content = file.get_as_text()
patient_file.text = file_content
patient_file_title.text = "\nPATIENT FILE #" + patient_id
file.close()
#Loading Patient Recording
func new_patient():
Patient.new_patient()
patient_file.text = Patient.file_text
patient_file_title.text = Patient.file_title
patient_recording.text = ""
patient_recording_title.text = "\nPATIENT RECORDING #" + patient_id
patient.texture = Patient.image
func _on_call_next_patient_pressed(): #Brings in next patient and sets up the desk controls
#Loading Patient Texture
file_path = "res://Art/Patients/patient_" + patient_id + "/patient_" + patient_id + "_full.png"
patient_texture.texture = load(file_path)
#Hiding the computer screen
var scenes_to_hide = [next_patient]
for scenes in scenes_to_hide:
scenes.hide()
#Loading Face Emotions
var face: Resource
var emotion_branch: Dictionary
#ShuttersIncoming
shutters_animation.play("incoming")
shutter_top.show()
shutter_bot.show()
await shutters_animation.animation_finished
for emotion in ["neutral", "smiling", "angry", "scared", "sad"]:
file_path = "res://Art/Patients/patient_" + patient_id + "/patient_" + patient_id + "_" + emotion + ".png"
face = load(file_path)
if face != null:
emotion_branch = {emotion: face}
patient_emotions.merge(emotion_branch)
#Showing the Patient and the Backroom
var scenes_to_show = [patient, backroom]
for scene in scenes_to_show:
scene.show()
#Loading Default Face
face_zoom.texture = patient_emotions["neutral"]
#Opening Shutters
shutters_animation.play("open")
await shutters_animation.animation_finished
#Loading Dialogue Resource
var dialogue_resource_path = "res://Dialogues/Patients/patient_" + patient_id + ".dialogue"
patient_dialogue_resource = load(dialogue_resource_path)
#Show patient file
func _on_patient_file_pressed():
#Activating Buttons
green_button.set_disabled(false)
red_button.set_disabled(false)
for node in margin_container.get_children():
node.hide()
panel_container.show()
face_zoom.hide()
margin_container.get_node("FileContainer").show()
#Show guidebook
func _on_guidebook_pressed():
#Coloring Release and Terminate
release.text = Globals.colorize("RELEASE", "dark_green")
terminate.text = Globals.colorize("TERMINATE", "dark_red")
for node in margin_container.get_children():
node.hide()
panel_container.show()
face_zoom.hide()
margin_container.get_node("Rules").show()
#Brings in next patient
func _on_call_next_patient_pressed():
#Starting Dialogue and hiding console screen
console_screen.hide()
main.start_balloon("test", Patient.dialogue_resource, "start")
#Hiding and Showing appropriate scenes
var scenes_to_hide = [alone_controls, panel_container] + margin_container.get_children()
var scenes_to_show = [patient_controls,patient_texture,face_zoom]
TransitionScreen.transition("big", scenes_to_hide, scenes_to_show)
await TransitionScreen.transition_finished
#Starting Dialogue
main.start_balloon("small", 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()
#Shows patient recording
func _on_patient_recording_pressed():
for node in margin_container.get_children():
node.hide()
panel_container.show()
face_zoom.hide()
margin_container.get_node("RecordingContainer").show()
#Records the dialogues
func _recording_text(dialogue_line):
func _recording_text(dialogue_line): #Records the dialogues
var line = dialogue_line.text
var character = dialogue_line.character
var character_colour : String
patient_recording.append_text("\n\n")
#Adjusting Character Colour
if character != "":
if character == "You":
character_colour = "[color=darkgreen]"
else :
character_colour = "[color=darkred]"
patient_recording.append_text(character_colour + character + "[/color]\n")
patient_recording.append_text("[color=red]" + character + "[/color]" + "\n")
patient_recording.append_text(line)
#Show face zoom
func _on_examine_pressed():
func _on_response_chosen(response): #Adds protagonist responses to the recording tab
for node in margin_container.get_children():
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()
panel_container.hide()
face_zoom.show()
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()
#Change emotions following dialogue tags
func _change_emotion(dialogue_line) -> void:
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 _change_emotion(dialogue_line) -> void: #Change emotions following dialogue tags
var line_tag = dialogue_line.tags
if line_tag.is_empty() == false:
var new_emotion = line_tag[0]
patient.texture = Patient.emotions[String(new_emotion)]
print("Emotion changed to ", new_emotion)
face_zoom.texture = patient_emotions[new_emotion]
func _on_containment_pressed():
func _on_green_button_pressed(): #Releases the patient
#Ask for confirmation
var lambda = func(): clear_patient("containment")
var choice_text = "[center]Do you really want to send this patient to [color=darkred]Containment[/color] ?[/center]"
release.text = Globals.colorize("RELEASE", "green") #Highlighting the decision
UI.ask_confirmation(lambda, Callable(), choice_text)
func _on_psych_ward_pressed():
#Greening the vibe
green_backroom.show()
patient.modulate = Color(0.4,1,0.4,1)
#Ask for confirmation
var lambda = func(): clear_patient("psych_ward")
var choice_text = "[center]Do you really want to send this patient to the [color=darkgreen]Psych Ward[/color] ?[/center]"
UI.ask_confirmation(lambda, Callable(), choice_text)
clear_patient("release") #Clearing the patient
func _on_red_button_pressed(): #Terminates the patient
terminate.text = Globals.colorize("TERMINATE", "red") #Highlighting the decision
#Redding the vibe
red_backroom.show()
patient.modulate = Color(1,0,0,1)
clear_patient("terminate") #Clearing the patient
#Clears patient and transitions towards next patient or end of day
func clear_patient(choice:String):
func _on_journal_pressed(): #Shows the journal
journal_layer.show()
func _on_close_manual_pressed(): #Hides the journal
journal_layer.hide()
func clear_patient(choice:String): #Clears patient and transitions towards next patient or end of day
#Hiding Patient Controls and showing Patient Face
patient_controls.hide()
_on_examine_pressed()
#Hiding computer tabs screen and console screen
for node in [tab_patient_file, tab_rules, tab_recording, console_screen] + computer_tabs.get_children():
node.hide()
#Disabling Buttons
green_button.set_mouse_filter(Control.MOUSE_FILTER_IGNORE)
red_button.set_mouse_filter(Control.MOUSE_FILTER_IGNORE)
#Setting up computer and console messages
var message: Array[String]
message.resize(3)
if choice == "release":
message[0] = Globals.colorize("- ASSESSMENT MADE -\n\n- LOADING RELEASE PROTOCOL... -", "green_yellow")
message[1] = Globals.colorize("- RELEASING SUBJECT -", "green_yellow")
message[2] = "EVALUATION RECORDED" + "\n\nPATIENT STATUS: " + Globals.colorize("HUMAN", "green") + "\n\nUPDATING DATABASE...\n\n" + Globals.colorize("INITIATING RELEASE SEQUENCE", "green_yellow")
elif choice == "terminate":
message[0] = Globals.colorize("- ASSESSMENT MADE -\n\n- LOADING TERMINATION PROTOCOL... -", "orange_red")
message[1] = Globals.colorize("- TERMINATING SUBJECT -", "orange_red")
message[2] = "EVALUATION RECORDED" + "\n\nPATIENT STATUS: " + Globals.colorize("ABNORMAL", "red") + "\n\nUPDATING DATABASE...\n\n" + Globals.colorize("INITIATING TERMINATION SEQUENCE", "orange_red")
console_display(message[0])
computer_display(message[2])
#Final Patient Dialogue
main.start_balloon("small", patient_dialogue_resource, choice)
main.start_balloon("test", Patient.dialogue_resource, choice)
await DialogueManager.dialogue_ended
#Transitioning
var scenes_to_hide = [patient_controls, patient_texture, face_zoom, panel_container] + margin_container.get_children()
var scenes_to_show:Array[Node]
#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
update_middle_screen(Globals.day_count, Globals.floor_count, accurate_diagnoses, Globals.diagnoses_quota)
#Showing second console message
console_display(message[1])
#Closing Shutters
shutters_animation.play("close")
await shutters_animation.animation_finished
#Hiding the cell and restoring the patient's original color
for scene in [patient, backroom, red_backroom, green_backroom]:
scene.hide()
patient.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
console_display(Globals.directives)
computer_screen.hide()
#Updating patient count
Globals.patient_count += 1
if Globals.patient_count < Globals.daily_patient_limit:
scenes_to_show.append(alone_controls)
if Globals.patient_count <= Globals.daily_patient_limit:
print("daily_limit not reached")
else:
scenes_to_show.append(end_of_day_controls)
print("daily_limit reached")
TransitionScreen.transition("big", scenes_to_hide, scenes_to_show)
await TransitionScreen.transition_finished
if Globals.patient_count < Globals.daily_patient_limit:
if Globals.patient_count <= Globals.daily_patient_limit:
#Setting Up Next Patient
new_patient("564")
new_patient()
next_patient.show()
else:
Globals.patient_count = 1
#Starting End of Day Dialogue
var start_title = "end_of_day_" + str(Globals.day_count)
main.start_balloon("small", end_of_day_dialogue_resource, start_title)
func _on_recovery_pressed():
end_day.show()
main.clear_balloon()
recovery_pressed.emit()
#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")
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