extends Node #Dialogue variables var dialog_tree: Dictionary var marker: Array[int] var dialogue_resource: Resource #Patient attributes var texture := TextureRect.new() var image : Texture2D var original_color: Color var emotions : Dictionary var abnormal: bool #Patient file var file_text : String var file_title: String # Called when the node enters the scene tree for the first time. func _ready() -> void: #Setting up dialogue marker marker.resize(100) marker.fill(0) original_color = texture.modulate #Saving original modulation color to reset it after modification func build_dialog_tree(tree_model: Array[int]) -> Dictionary: #Builds the dialog tree for each dialogue var branch : Dictionary var tree : Dictionary for branch_id in tree_model: branch = {branch_id: "not_asked"} tree.merge(branch) return tree func new_patient(): var file_path: String #Generating patient_id var patient_id = Globals.patient_list.pick_random() Globals.patient_id = patient_id Globals.patient_list.erase(patient_id) #Line to be reenabled when there is more than one patient in the list Globals.patients_seen.append(patient_id) #Loading Patient Files var config := ConfigFile.new() file_path = "res://Dialogues/Patients/patient_" + patient_id + "_file.cfg" config.load(file_path) #Setting up Patient File var patient_name = config.get_value("", "name") var age = config.get_value("", "age") var profession = config.get_value("", "profession") var psychiatric_assessment = config.get_value("", "psychiatric_assessment") file_text = "NAME: " + patient_name + "\nAGE: " + age + "\n\nPROFESSION: " + profession + "\n\nPRE-SCREENING PSYCHIATRIC ASSESSMENT:\n\n" + "[color=orange_red]" + psychiatric_assessment + "[/color]" file_title = "[center]PATIENT FILE #" + patient_id #Loading Patient Initial Face var initial_emotion = config.get_value("", "initial_emotion") file_path = "res://Art/Patients/patient_" + patient_id + "/patient_" + patient_id + "_" + initial_emotion + ".png" image = load(file_path) #Loading Face Emotions var face: Resource var emotion_branch: Dictionary var emotion_list = ["neutral", "peaceful", "praying", "puzzled", "sadsmiling", "crazysmiling", "smiling", "laughing", "happy", "elated", "maniac", "irritated", "angry", "sad", "depressed", "crying", "surprised", "worried", "scared", "shocked", "panicked", "suspicious", "abnormal", "abnormal1", "abnormal2", "special"] emotions.clear() #Clearing previous patient emotions for emotion in emotion_list: file_path = "res://Art/Patients/patient_" + patient_id + "/patient_" + patient_id + "_" + emotion + ".png" face = load(file_path) if face != null: emotion_branch = {emotion: face} emotions.merge(emotion_branch) #Loading Dialogue Resource file_path = "res://Dialogues/Patients/patient_" + patient_id + ".dialogue" dialogue_resource = load(file_path) #Randomizing abnormal status if required var status = config.get_value("", "status") match status: "random": abnormal = randf() < 0.5 #50/50 abnormal/normal print("Abnormal value: " + str(abnormal)) "normal": abnormal = false "abnormal": abnormal = true