diff --git a/current_patient.gd b/current_patient.gd index 22cf8f2..0883f13 100644 --- a/current_patient.gd +++ b/current_patient.gd @@ -2,66 +2,54 @@ extends Node var emotion: String var dialog_flags : Dictionary = { - "psychiatric_history": "not_asked", - "substance_use_history": "not_asked", - "lifestyle" : "not_asked", - "history_of_present_illness": "not_asked", - "appearance": "not_asked", - "behaviour": "not_asked", - "speech": "not_asked", - "thought_process": "not_asked", - "delusions": "not_asked", - "hallucinations": "not_asked", - "insight": "not_asked", - "sleep": "not_asked", - "mood": "not_asked", - "suicidal_ideation": "not_asked", + "history_of_present_illness": [], + "appearance": [], + "behaviour": [], + "speech": [], + "thought_process": [], + "thought_content": [], + "perceptions": [], + "insight": [], + "sleep": [], + "mood": [], + "suicidal_ideation": [], } -var dialog_branch: Array = [] -var dialog_tree: Dictionary = {"completed":false} +var dialog_tree: Dictionary +var marker: Array[int] -var marker: int = 0 # Called when the node enters the scene tree for the first time. func _ready() -> void: - dialog_branch.resize(100000) - #dialog_tree.merge({1:{"completed":false}}) - #var tree = [110,120,121,122,130,210,220,230,310,320,330] - #build_dialog_tree(tree) + marker.resize(10) + marker.fill(0) pass -func build_dialog_tree(tree) -> void: - var dialog_model = tree - var choices_max = [] - var string_var = [] - choices_max.resize(20) - - print(tree.max()) - choices_max[1] = str(tree.max()).split()[0] - for i in range(tree.size()): - if str(tree[i]).split()[0] == "1": - string_var.append(int(tree[i])) - - choices_max[11] = str(string_var.max()).split()[1] - print(string_var.max()) - print(choices_max[11]) - - print(choices_max[1]) - for i in range(1,10): - add_branch(dialog_tree, i) - for i in range(1,10): - add_branch(dialog_tree[1], i) - for i in range (1,3): - add_branch(dialog_tree[1][2], i) - -func add_branch(parent_branch: Dictionary, child_branch: int) -> void: - var new_branch = {child_branch: {"completed": false}} - parent_branch.merge(new_branch) +func build_dialog_tree(tree_model: Array[int]) -> Dictionary: + + var branch : Dictionary + var tree : Dictionary + + for branch_id in tree_model: + branch = {branch_id: "not_asked"} + tree.merge(branch) + + return tree -func change_emotion(emotion) -> void: + +func change_emotion(new_emotion: String) -> void: + emotion = new_emotion pass + +func send_to_reset() -> void: + pass + + +func send_to_isolation() -> void: + pass + + # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta: float) -> void: pass diff --git a/dialog_main.gd b/dialog_main.gd index ecefa05..bdd4290 100644 --- a/dialog_main.gd +++ b/dialog_main.gd @@ -3,7 +3,7 @@ extends Control # Called when the node enters the scene tree for the first time. func _ready() -> void: - var dialogue_resource = load("res://dialogues/test.dialogue") + var dialogue_resource = load("res://dialogues/mr_orleg.dialogue") var dialogue_start = "mr_orleg_day_1_dialogue_start" var dialogue = DialogueManager.show_dialogue_balloon(dialogue_resource, dialogue_start) diff --git a/dialogues/mr_orleg.dialogue b/dialogues/mr_orleg.dialogue index 1c3f142..bf49492 100644 --- a/dialogues/mr_orleg.dialogue +++ b/dialogues/mr_orleg.dialogue @@ -1,62 +1,170 @@ ~ mr_orleg_day_1_dialogue_start -#dialog_branch[1215] signifie dialog_branch[choix_1][answer_2][answer_1][answer_5] - -set CurrentPatient.marker = 0 +do CurrentPatient.marker.fill(0) +set CurrentPatient.dialog_tree = CurrentPatient.build_dialog_tree([1100,1200,1210,1220, 1300, 1400, 1500, 1610, 1620]) : The patient remains still, watching you expectantly. + Psychiatrist: Greetings Mr Orleg. You shall be my in care for the duration of your stay in this facility. + Mr Orleg: Greetings Doctor. I need your help, i don't know why i'm here, there must have been a mistake ! - ~ choice_1 -- Tell me why you were brought here. [if CurrentPatient.dialog_branch[11] == false] - set CurrentPatient.dialog_branch[11] = true + +- Tell me why you were brought here. [if CurrentPatient.dialog_tree[1100] == "not_asked"] + + set CurrentPatient.dialog_tree[1100] = "asked" + do CurrentPatient.marker[0] += 1 do CurrentPatient.change_emotion("neutral") + do CurrentPatient.dialog_flags["insight"].append("Anosognosia") Mr Orleg: Sure. I was at the usual grocery store next door, and there was that cashier who was threatening me. I was busy explaining her nobody can talk to Mr Orleg this way, when these damned cops came out of nowhere and brutally restrained me ! Can you imagine ?! => choice_1 -- Do you feel safe in this room ? [if CurrentPatient.dialog_branch[12] == false] +- Do you feel safe in this room ? [if CurrentPatient.dialog_tree[1200] == "not_asked"] + + set CurrentPatient.dialog_tree[1200] = "asked" + do CurrentPatient.marker[0] += 1 + do CurrentPatient.change_emotion("scared") + do CurrentPatient.dialog_flags["thought_content"].append("Persecutory delusions") Mr Orleg: Honestly ? I don't. Some of your colleagues have been giving me the heeby jeebies. Gotta stay sharp, i'm pretty sure he's here. ~ choice_1_2 - - Who's "he" ? [if CurrentPatient.dialog_branch[121] == false] - set CurrentPatient.dialog_branch[121] = true - do CurrentPatient.marker += 1 + + - Who's "he" ? [if CurrentPatient.dialog_tree[1210] == "not_asked"] + + set CurrentPatient.dialog_tree[1210] = "asked" + do CurrentPatient.marker[1] += 1 + do CurrentPatient.dialog_flags["thought_content"].append("Mystical delusions") Mr Orleg: Shhh... you musntn't speak his name aloud. "He" is the Harbinger. The Prophet and the Reaper. The Messiah and the Deceiver. - if CurrentPatient.marker == 2 - set CurrentPatient.dialog_branch[12] = true - set CurrentPatient.marker = 0 - set CurrentPatient.dialog_flags["delusions"] = "Mystical and Persecutory" + if CurrentPatient.marker[1] == 2 + set CurrentPatient.marker[1] = 0 => choice_1 else => choice_1_2 - - Which of my colleagues are you talking about ? [if CurrentPatient.dialog_branch[122] == false] - set CurrentPatient.dialog_branch[122] = true - do CurrentPatient.marker += 1 + - Which of my colleagues are you talking about ? [if CurrentPatient.dialog_tree[1220] == "not_asked"] + + set CurrentPatient.dialog_tree[1220] = "asked" + do CurrentPatient.marker[1] += 1 + do CurrentPatient.dialog_flags["perceptions"].append("Mystical delusions") Mr Orleg: Every single one of them... He's been using their shapes to contact me. I need to remain strong, Doctor. - if CurrentPatient.marker == 2 - set CurrentPatient.dialog_branch[12] = true - set CurrentPatient.marker = 0 + if CurrentPatient.marker[1] == 2 + set CurrentPatient.marker[1] = 0 => choice_1 else => choice_1_2 -- Have you ever been hospitalized in Psychiatry before ? +- How has your sleep been recently ? [if CurrentPatient.dialog_tree[1300] == "not_asked"] -- Do you have any relatives suffering from a psychiatric condition ? + set CurrentPatient.dialog_tree[1300] = "asked" + do CurrentPatient.marker[0] += 1 + do CurrentPatient.change_emotion("neutral") + do CurrentPatient.dialog_flags["sleep"].append("Insomnia") + + Mr Orleg: Hard to keep my eyes shut lately, i'll admit. I definitely could use some rest. + + => choice_1 -- Did you sleep well last night ? +- How are you feeling lately ? [if CurrentPatient.dialog_tree[1400] == "not_asked"] -- Start again => mr_orleg_day_1_dialogue_start -- End the conversation => END + set CurrentPatient.dialog_tree[1400] = "asked" + do CurrentPatient.marker[0] += 1 + do CurrentPatient.change_emotion("neutral") + do CurrentPatient.dialog_flags["mood"].append("Euthymia") + + Mr Orleg: I'm feeling rather fine, actually. My life's quite enjoyable, except for the whole "i'm locked in here cause people think i'm crazy" situation. You've got to help me Doctor. + + - Have you had any thoughts about wanting to end your life ? + + do CurrentPatient.dialog_flags["suicidal_ideation"].append("None") + + Mr Orleg: I would never dare end the life God has given me. + + => choice_1 + +- Examine [if CurrentPatient.dialog_tree[1500] == "not_asked"] + + set CurrentPatient.dialog_tree[1500] = "asked" + do CurrentPatient.marker[0] += 1 + do CurrentPatient.dialog_flags["appearance"].append("Fixed gaze") + + : The patient appears to be calm and collected. His garment is clean, if a bit crumpled. His gaze switches back and forth between a wide-eyed focus on your face, and vacantly staring at the wall. + + => choice_1 + +- Don't you feel anxious about this otherwordly being targeting you ? [if CurrentPatient.marker[0] == 5] + + set CurrentPatient.marker[0] = 0 + do CurrentPatient.change_emotion("happy") + do CurrentPatient.dialog_flags["thought_process"].append("Ideo-affective dissociation") + do CurrentPatient.dialog_flags["thought_content"].append("Megalomaniac delusions") + + Mr Orleg: Not really. I'm protected by God. No one can hurt me. + + ~ choice_1_6 + + - How do you know God protects you ? [if CurrentPatient.dialog_tree[1610] == "not_asked"] + + set CurrentPatient.dialog_tree[1610] = "asked" + set CurrentPatient.marker[2] += 1 + do CurrentPatient.dialog_flags["perceptions"].append("Intra-psychic auditory hallucinations") + + Mr Orleg: He shares his Will with me directly inside my head. We have a special connection. + + if CurrentPatient.marker[2] == 2 + set CurrentPatient.marker[2] = 0 + => choice_2 + else + => choice_1_6 + + - Have you ever seen God or this evil being with your own eyes ? [if CurrentPatient.dialog_tree[1620] == "not_asked"] + + set CurrentPatient.dialog_tree[1620] = "asked" + set CurrentPatient.marker[2] += 1 + + Mr Orleg: Never. I don't need to see them to know they're here. + + if CurrentPatient.marker[2] == 2 + set CurrentPatient.marker[2] = 0 + => choice_2 + else + => choice_1_6 + +~ choice_2 + +- Send to Reset + + Psychiatrist: You are in need of psychiatric care, Mr Orleg. My colleagues here will take you to the resetting room for adequate treatment. + + Mr Orleg: You can't do that Doctor ! This is a mistake ! + + Mr Orleg: I swear i'm not crazy ! + + do CurrentPatient.send_to_reset() + + => END + +- Send to Isolation + + Psychiatrist: I have assessed that you are currently unstable, Mr Orleg. You may be dangerous to other people, and even to yourself. We are going to Isolate you to ensure your safety. + + do CurrentPatient.change_emotion("scared") + + Mr Orleg: What ?? Th- This can't be... + + Mr Orleg: Please, have mercy. + + do CurrentPatient.send_to_isolation + + => END + +- End the evaluation => END => END \ No newline at end of file diff --git a/dialogues/mr_orleg.dialogue.import b/dialogues/mr_orleg.dialogue.import index 14ec655..1e6f256 100644 --- a/dialogues/mr_orleg.dialogue.import +++ b/dialogues/mr_orleg.dialogue.import @@ -2,7 +2,7 @@ importer="dialogue_manager_compiler_14" type="Resource" -uid="uid://d180ahgobkj4e" +uid="uid://j4cb2hniy7mk" path="res://.godot/imported/mr_orleg.dialogue-de858637a612f91e5bc83867aa2a9e9f.tres" [deps] diff --git a/dialogues/test.dialogue b/dialogues/test.dialogue deleted file mode 100644 index 803e4d0..0000000 --- a/dialogues/test.dialogue +++ /dev/null @@ -1,61 +0,0 @@ -~ mr_orleg_day_1_dialogue_start - -set CurrentPatient.marker = 0 -do CurrentPatient.build_dialog_tree([110,120,121,122,130,210,220,230,310,320,330]) - -: The patient remains still, watching you expectantly. -Psychiatrist: Greetings Mr Orleg. You shall be my in care for the duration of your stay in this facility. -Mr Orleg: Greetings Doctor. I need your help, i don't know why i'm here, there must have been a mistake ! - - -~ choice_1 -- Tell me why you were brought here. [if CurrentPatient.dialog_tree[1][1]["completed"] == false] - set CurrentPatient.dialog_tree[1][1]["completed"] = true - do CurrentPatient.change_emotion("neutral") - - Mr Orleg: Sure. I was at the usual grocery store next door, and there was that cashier who was threatening me. I was busy explaining her nobody can talk to Mr Orleg this way, when these damned cops came out of nowhere and brutally restrained me ! Can you imagine ?! - - => choice_1 - -- Do you feel safe in this room ? [if CurrentPatient.dialog_tree[1][2]["completed"] == false] - set CurrentPatient.dialog_tree[1][2]["completed"] = true - do CurrentPatient.change_emotion("scared") - set CurrentPatient.dialog_flags["delusions"] = "Mystical and Persecutory" - - Mr Orleg: Honestly ? I don't. Some of your colleagues have been giving me the heeby jeebies. Gotta stay sharp, i'm pretty sure he's here. - - ~ choice_1_2 - - Who's "he" ? [if CurrentPatient.dialog_tree[1][2][1]["completed"] == false] - set CurrentPatient.dialog_tree[1][2][1]["completed"] = true - do CurrentPatient.marker += 1 - - Mr Orleg: Shhh... you musntn't speak his name aloud. "He" is the Harbinger. The Prophet and the Reaper. The Messiah and the Deceiver. - - if CurrentPatient.marker == 2 - set CurrentPatient.marker = 0 - => choice_1 - else - => choice_1_2 - - - Which of my colleagues are you talking about ? [if CurrentPatient.dialog_tree[1][2][2]["completed"] == false] - set CurrentPatient.dialog_tree[1][2][2]["completed"] = true - do CurrentPatient.marker += 1 - - Mr Orleg: Every single one of them... He's been using their shapes to contact me. I need to remain strong, Doctor. - - if CurrentPatient.marker == 2 - set CurrentPatient.marker = 0 - => choice_1 - else - => choice_1_2 - -- Have you ever been hospitalized in Psychiatry before ? - -- Do you have any relatives suffering from a psychiatric condition ? - -- Did you sleep well last night ? - -- Start again => mr_orleg_day_1_dialogue_start -- End the conversation => END - -=> END \ No newline at end of file diff --git a/dialogues/test.dialogue.import b/dialogues/test.dialogue.import deleted file mode 100644 index feb1989..0000000 --- a/dialogues/test.dialogue.import +++ /dev/null @@ -1,15 +0,0 @@ -[remap] - -importer="dialogue_manager_compiler_14" -type="Resource" -uid="uid://j4cb2hniy7mk" -path="res://.godot/imported/test.dialogue-dc69268be77aa19a4b95a0f66b796254.tres" - -[deps] - -source_file="res://dialogues/test.dialogue" -dest_files=["res://.godot/imported/test.dialogue-dc69268be77aa19a4b95a0f66b796254.tres"] - -[params] - -defaults=true diff --git a/project.godot b/project.godot index 0c2df31..654cdd9 100644 --- a/project.godot +++ b/project.godot @@ -45,4 +45,4 @@ enabled=PackedStringArray("res://addons/dialogue_manager/plugin.cfg") [internationalization] -locale/translations_pot_files=PackedStringArray("res://dialogues/mr_orleg.dialogue", "res://dialogues/test.dialogue") +locale/translations_pot_files=PackedStringArray("res://dialogues/mr_orleg.dialogue")