Code reorganizing
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
extends Control
|
||||
|
||||
@onready var tab_patient_file = $Margin/ComputerScreen/Tabs/PatientFile
|
||||
@onready var tab_rules = $Margin/ComputerScreen/Tabs/Rules
|
||||
@onready var tab_recording = $Margin/ComputerScreen/Tabs/Recording
|
||||
@onready var patient_file = $Margin/ComputerScreen/ComputerTabs/FileContainer/PatientFile
|
||||
@onready var rules = $Margin/ComputerScreen/ComputerTabs/Rules
|
||||
@onready var recording = $Margin/ComputerScreen/ComputerTabs/Recording
|
||||
@onready var screen = $Margin/ComputerScreen2
|
||||
@onready var next_patient_button = $Margin/NextPatient/CallNextPatient
|
||||
|
||||
var tab_list
|
||||
var screen_list
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
|
||||
tab_list = [tab_patient_file, tab_rules, tab_recording]
|
||||
screen_list = [patient_file, rules, recording]
|
||||
|
||||
#Connecting signals
|
||||
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.response_chosen.connect(self._on_response_chosen)
|
||||
|
||||
#Hiding everything
|
||||
for node in tab_list + screen_list + [screen, next_patient_button]:
|
||||
node.hide()
|
||||
|
||||
|
||||
#Displays a message on the computer screen
|
||||
func display(message):
|
||||
var text = message.replace("\\n", "\n") #Replaces litteral backslashes by actual newlines (necessary because of Dialogue Manager)
|
||||
screen.text = text
|
||||
screen.show()
|
||||
|
||||
|
||||
#Shows the patient file tab
|
||||
func _on_tab_patient_file_pressed():
|
||||
tab_switch(tab_patient_file, patient_file)
|
||||
|
||||
#Shows the rules tab
|
||||
func _on_tab_rules_pressed():
|
||||
tab_switch(tab_rules, rules)
|
||||
|
||||
#Shows the recording tab
|
||||
func _on_tab_recording_pressed():
|
||||
tab_switch(tab_recording, recording)
|
||||
|
||||
|
||||
#Shows the correct screen according to the pressed tab
|
||||
func tab_switch(pressed_tab, tab_screen):
|
||||
|
||||
#Highlights pressed tab and unpress the others
|
||||
for tab in tab_list:
|
||||
tab.set_pressed(false)
|
||||
tab.set_mouse_filter(Control.MOUSE_FILTER_STOP)
|
||||
pressed_tab.set_pressed(true)
|
||||
pressed_tab.set_mouse_filter(Control.MOUSE_FILTER_IGNORE)
|
||||
|
||||
#Showing desired screen and hiding the others
|
||||
for node in screen_list:
|
||||
node.hide()
|
||||
tab_screen.show()
|
||||
|
||||
|
||||
func _recording_text(dialogue_line): #Records the dialogues
|
||||
|
||||
recording.append_text("\n\n")
|
||||
recording.append_text("[color=red]" + dialogue_line.character + "[/color]" + "\n")
|
||||
recording.append_text(dialogue_line.text)
|
||||
|
||||
|
||||
func _on_response_chosen(response): #Adds protagonist responses to the recording tab
|
||||
|
||||
recording.append_text("\n\n")
|
||||
recording.append_text("[color=green]You[/color]" + "\n")
|
||||
recording.append_text(response.text)
|
||||
@@ -0,0 +1 @@
|
||||
uid://chhh7v5iwiqw2
|
||||
@@ -0,0 +1,15 @@
|
||||
extends RichTextLabel
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
Globals.console_message.connect(self.display)
|
||||
hide()
|
||||
|
||||
|
||||
#Displays a message on the console screen
|
||||
func display(message):
|
||||
var text_to_display = message
|
||||
text_to_display = text_to_display.replace("\\n", "\n") #Replaces litteral backslashes by actual newlines (necessary because of Dialogue Manager)
|
||||
text = text_to_display
|
||||
show()
|
||||
@@ -0,0 +1 @@
|
||||
uid://cyennu12fufbt
|
||||
@@ -0,0 +1,14 @@
|
||||
extends TextureButton
|
||||
|
||||
signal decision_made
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
self.pressed.connect(self._on_green_button_pressed)
|
||||
set_disabled(true)
|
||||
|
||||
func _on_green_button_pressed():
|
||||
if Globals.buttons_activated:
|
||||
decision_made.emit("release")
|
||||
set_toggle_mode(true)
|
||||
set_pressed_no_signal(true)
|
||||
@@ -0,0 +1 @@
|
||||
uid://nj1oo2nh44dh
|
||||
@@ -0,0 +1,44 @@
|
||||
extends CanvasLayer
|
||||
|
||||
@onready var journal_symptoms = $JournalOpen/JournalMargin/PageArea/RightPage/Symptoms
|
||||
|
||||
#Journal Settings
|
||||
var symptoms_detailed: Array[Array] = [
|
||||
["SUICIDAL IDEATIONS\nPersistent thoughts about ending one's own life",
|
||||
"PERSECUTORY DELUSIONS\nFalse conviction of being targeted or harmed",
|
||||
"UNNATURAL BEHAVIOUR\nSigns or marks of non-human nature",
|
||||
"AUDITORY HALLUCINATIONS\nFalse perceptions of external sound"],
|
||||
|
||||
["MEGALOMANIAC DELUSIONS\nFalse exaggeration of self-importance or power",
|
||||
"SOMATIC HALLUCINATIONS\nFalse sensations, from inside the body or on the skin"],
|
||||
|
||||
["MYSTICAL DELUSIONS\nFalse certainty of spiritual, divine connection",
|
||||
"MANIA\nExcessively elevated mood and increased energy"],
|
||||
|
||||
["CHEMOSENSORY HALLUCINATIONS\nFalse perceptions of smell or taste",
|
||||
"SELF-MUTILATION\nDeliberate self-injury"],
|
||||
|
||||
["HETERO-AGRESSIVE BEHAVIOUR\nExcessive hostility, verbal agression, threats",
|
||||
"VISUAL HALLUCINATIONS\nFalse perceptions of visual stimuli"]
|
||||
]
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
$JournalOpen/JournalMargin/PageArea/LeftPage/CloseManual.pressed.connect(self._on_close_manual_pressed)
|
||||
hide()
|
||||
|
||||
func _on_close_manual_pressed():
|
||||
hide()
|
||||
|
||||
func _on_journal_pressed():
|
||||
show()
|
||||
|
||||
|
||||
func update_journal(floor_count:int):
|
||||
|
||||
var symptoms_page : String = ""
|
||||
for i in range(-floor_count):
|
||||
for symptom in symptoms_detailed[i]:
|
||||
symptoms_page += "\n\n" + symptom
|
||||
journal_symptoms.text = symptoms_page
|
||||
@@ -0,0 +1 @@
|
||||
uid://dcax2vggaexnr
|
||||
@@ -0,0 +1,15 @@
|
||||
extends RichTextLabel
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
#Updates Middle Screen Info
|
||||
func update(day_count, floor_count, diagnoses_count, diagnoses_quota):
|
||||
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")
|
||||
|
||||
text = "DAY: " + day + "\n\nFLOOR: " + floor + "\n\nACCURATE DIAGNOSES: " + diagnoses
|
||||
@@ -0,0 +1 @@
|
||||
uid://p3a2y1dqk63c
|
||||
@@ -0,0 +1,18 @@
|
||||
extends TextureRect
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
||||
#Hiding
|
||||
hide()
|
||||
|
||||
|
||||
#Change emotions following dialogue tags
|
||||
func _change_emotion(dialogue_line) -> void:
|
||||
|
||||
var line_tag = dialogue_line.tags
|
||||
print("Patient marker value: " + str(Patient.marker[0]))
|
||||
if line_tag.is_empty() == false:
|
||||
var new_emotion = line_tag[0]
|
||||
texture = Patient.emotions[String(new_emotion)]
|
||||
print("Patient emotion changed to ", new_emotion)
|
||||
@@ -0,0 +1 @@
|
||||
uid://vjvnh47s4akq
|
||||
@@ -0,0 +1,213 @@
|
||||
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
|
||||
|
||||
#Patient symptoms ordered from floor to floor
|
||||
var symptoms_arrays: Array[Array] = [
|
||||
["SUICIDAL IDEATIONS", "PERSECUTORY DELUSIONS", "UNNATURAL BEHAVIOUR", "AUDITORY HALLUCINATIONS"],
|
||||
["SOMATIC HALLUCINATIONS", "MEGALOMANIAC DELUSIONS"],
|
||||
["MYSTICAL DELUSIONS", "MANIA"],
|
||||
["CHEMOSENSORY HALLUCINATIONS", "SELF-MUTILATION"],
|
||||
["VISUAL HALLUCINATIONS", "HETERO-AGRESSIVE BEHAVIOUR"]
|
||||
]
|
||||
#Lists of possible patients sorted by floor
|
||||
var patient_list : Array[Dictionary]
|
||||
|
||||
#Supervisor file path
|
||||
var supervisor_name = "loeveth"
|
||||
|
||||
# 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)
|
||||
|
||||
#Setting up patient list
|
||||
patient_list.resize(len(symptoms_arrays))
|
||||
|
||||
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(patient_id):
|
||||
|
||||
var file_path: String
|
||||
|
||||
#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_path = "res://Art/Patients/patient_" + patient_id + "/patient_" + patient_id + "_"
|
||||
load_emotions(config, file_path)
|
||||
|
||||
#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
|
||||
|
||||
|
||||
func load_emotions(config, patient_path):
|
||||
|
||||
#Loading Patient Initial Face
|
||||
var initial_emotion = config.get_value("", "initial_emotion")
|
||||
var file_path = patient_path + initial_emotion + ".png"
|
||||
image = load(file_path)
|
||||
|
||||
#Loading Face Emotions
|
||||
var face: Resource
|
||||
var emotion_branch: Dictionary
|
||||
var emotion_list = ["neutral", "peaceful", "praying", "puzzled", "suspicious",
|
||||
"sadsmiling", "crazysmiling", "shockedcrying", "smiling",
|
||||
"laughing", "happy", "elated", "maniac", "ecstatic",
|
||||
"irritated", "angry",
|
||||
"sad", "depressed", "crying", "surprised",
|
||||
"worried", "scared", "shocked", "panicked", "terrified",
|
||||
"abnormal", "abnormal1", "abnormal2", "abnormal3", "special"]
|
||||
|
||||
emotions.clear() #Clearing previous patient emotions
|
||||
for emotion in emotion_list:
|
||||
file_path = patient_path + emotion + ".png"
|
||||
face = load(file_path)
|
||||
if face != null:
|
||||
emotion_branch = {emotion: face}
|
||||
emotions.merge(emotion_branch)
|
||||
|
||||
|
||||
#Sorts the patients to determine who can appear on what floor depending on the symptoms unlocked
|
||||
func sort_patients():
|
||||
|
||||
var config := ConfigFile.new()
|
||||
var file_path : String
|
||||
var patient_symptoms: Array
|
||||
var symptom_matched : bool
|
||||
var symptom_list: Array
|
||||
|
||||
for patient_id in Globals.patient_list:
|
||||
|
||||
#Loads symptoms for each patient
|
||||
patient_symptoms.clear()
|
||||
file_path = "res://Dialogues/Patients/patient_" + patient_id + "_file.cfg"
|
||||
config.load(file_path)
|
||||
symptom_list = config.get_value("", "psychiatric_assessment").split("\n", false)
|
||||
patient_symptoms = symptom_list
|
||||
symptom_list = config.get_value("", "abnormal_symptoms").split("\n", false)
|
||||
patient_symptoms.append_array(symptom_list)
|
||||
print("Patient #" + patient_id + " symptom list: " + str(patient_symptoms))
|
||||
|
||||
#Goes through the symptoms_arrays from the last to the first,
|
||||
#If a symptom matches with the patient symptoms,
|
||||
#Add that patient to the floors from that floor to the last one
|
||||
|
||||
for j in range(len(symptoms_arrays)-1, -1, -1):
|
||||
for symptom in patient_symptoms:
|
||||
if symptoms_arrays[j].has(symptom):
|
||||
symptom_matched = true
|
||||
print("Symptom matched: " + str(symptoms_arrays[j]) + " and " + str(symptom))
|
||||
break
|
||||
if symptom_matched:
|
||||
for k in range(j, symptoms_arrays.size()):
|
||||
patient_list[k].merge({patient_id: j+1}) # Adds the patient to every floor compatible
|
||||
symptom_matched = false
|
||||
break
|
||||
|
||||
for i in range(len(patient_list)):
|
||||
print("Floor " + str(i) + " possible patients: " + str(patient_list[i]))
|
||||
|
||||
|
||||
#Weighted random selection from an Array
|
||||
func weighted_random(patients: Dictionary):
|
||||
|
||||
#Calculating total weight
|
||||
var total_weight : int
|
||||
for weight in patients.values():
|
||||
total_weight += weight
|
||||
print("Total weight: " + str(total_weight))
|
||||
|
||||
var r = randf() * total_weight
|
||||
print("r :" + str(r))
|
||||
|
||||
var weight_sum : int
|
||||
for patient_id in patients:
|
||||
weight_sum += patients[patient_id]
|
||||
if weight_sum >= r:
|
||||
print("Patient selected: " + patient_id + ", Weight: " + str(patients[patient_id]))
|
||||
return patient_id
|
||||
return null
|
||||
|
||||
|
||||
func generate_patient_id() -> String: #Generates a patient ID
|
||||
|
||||
#Generating patient_id
|
||||
var floor_index = -Globals.floor_count -1
|
||||
print("Floor Index: " + str(floor_index))
|
||||
var patient_id = weighted_random(patient_list[floor_index]) #Picks a random patient depending on floor, with weighted odds
|
||||
|
||||
for j in range(len(patient_list)):
|
||||
if len(patient_list[j]) > 1:
|
||||
patient_list[j].erase(patient_id) #Removes picked patient from unseen patients list
|
||||
print("Updated Floor " + str(j) + " list: " + str(patient_list[j]))
|
||||
|
||||
|
||||
return patient_id
|
||||
|
||||
|
||||
func next_patient() -> String: #Decides next patient ID
|
||||
|
||||
var next_patient_id: String
|
||||
|
||||
match Globals.floor_count:
|
||||
-2:
|
||||
if Globals.patient_count == 0:
|
||||
next_patient_id = "it_that_smiles"
|
||||
else:
|
||||
next_patient_id = generate_patient_id()
|
||||
_:
|
||||
next_patient_id = generate_patient_id()
|
||||
|
||||
|
||||
return next_patient_id
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://by4i7c1foffu3
|
||||
@@ -0,0 +1,14 @@
|
||||
extends TextureButton
|
||||
|
||||
signal decision_made
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
self.pressed.connect(self._on_green_button_pressed)
|
||||
set_disabled(true)
|
||||
|
||||
func _on_green_button_pressed():
|
||||
if Globals.buttons_activated:
|
||||
decision_made.emit("terminate")
|
||||
set_toggle_mode(true)
|
||||
set_pressed_no_signal(true)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cmbmtqoh5iytr
|
||||
@@ -0,0 +1,11 @@
|
||||
extends RichTextLabel
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
Globals.release_display.connect(self._on_release_display)
|
||||
text = Globals.colorize("RELEASE", "web_gray")
|
||||
|
||||
|
||||
func _on_release_display(message:String):
|
||||
text = message
|
||||
@@ -0,0 +1 @@
|
||||
uid://bvi3qtmbubkck
|
||||
@@ -0,0 +1,249 @@
|
||||
extends Control
|
||||
|
||||
#DeskAssets
|
||||
@onready var patient = $UpperHalf/ControlGlass/Patient
|
||||
@onready var supervisor = $UpperHalf/ControlGlass/Supervisor
|
||||
@onready var green_button = $LowerHalf/GreenButton
|
||||
@onready var red_button = $LowerHalf/RedButton
|
||||
@onready var journal = $LowerHalf/Journal/JournalButton
|
||||
@onready var journal_layer = $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 = $LowerHalf/Computer
|
||||
@onready var middle_screen = $LowerHalf/MiddleScreen/MarginContainer/MiddleScreen
|
||||
@onready var console_screen = $LowerHalf/Console/Margin/ConsoleScreen
|
||||
|
||||
#RoomAssets
|
||||
@onready var cell_top = $RoomAssets/CellTop
|
||||
@onready var cell_bot = $RoomAssets/CellBot
|
||||
@onready var cell_animation = $RoomAssets/CellAnimation
|
||||
@onready var cell_wall = $RoomAssets/CellWall
|
||||
@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
|
||||
computer.next_patient_button.pressed.connect(self._on_call_next_patient_pressed)
|
||||
red_button.decision_made.connect(self._on_decision_made)
|
||||
green_button.decision_made.connect(self._on_decision_made)
|
||||
journal.pressed.connect(journal_layer._on_journal_pressed)
|
||||
Globals.clear_patient.connect(self._on_clear_patient)
|
||||
Globals.color_change.connect(self._on_color_change)
|
||||
|
||||
#Hiding and showing appropriate RoomAssets
|
||||
for room_asset in [cell_top, cell_bot, cell_wall]:
|
||||
room_asset.hide()
|
||||
for room_asset in [$RoomAssets/Glass, $RoomAssets/Room, $RoomAssets/Backwall]:
|
||||
room_asset.show()
|
||||
#$RoomAssets/Backwall.position = Vector2(0, -2700)
|
||||
|
||||
hide() #Hiding ScreeningDesk
|
||||
|
||||
message_array.resize(3) #Setting up message array
|
||||
|
||||
|
||||
func new_patient():
|
||||
|
||||
var new_id = Patient.next_patient()
|
||||
#Patient.new_patient("it_that_smiles") #Line for testing purposes
|
||||
Patient.new_patient(new_id) #Line for generating new patient
|
||||
|
||||
computer.patient_file.text = Patient.file_text
|
||||
computer.recording.text = ""
|
||||
patient.texture = Patient.image
|
||||
|
||||
#Setting up UI
|
||||
computer.next_patient_button.show()
|
||||
console_screen.display(Globals.directives)
|
||||
|
||||
|
||||
func _on_call_next_patient_pressed(): #Brings in next patient and sets up the desk controls
|
||||
|
||||
#Hiding the next_patient button
|
||||
var scenes_to_hide = [computer.next_patient_button, supervisor]
|
||||
for scenes in scenes_to_hide:
|
||||
scenes.hide()
|
||||
|
||||
# Shows transition messages on computer and console
|
||||
var message : String
|
||||
message = Globals.colorize("COMPUTING CELL TRANSLATION...", "orange_red")
|
||||
computer.display(message)
|
||||
message = Globals.colorize("- BRINGING IN NEXT PATIENT -", "dark_orange")
|
||||
console_screen.display(message)
|
||||
|
||||
#Shutters entry animation
|
||||
cell_animation.play("incoming")
|
||||
cell_top.show()
|
||||
cell_bot.show()
|
||||
await cell_animation.animation_finished
|
||||
|
||||
#Showing the Patient and the Backroom
|
||||
var scenes_to_show = [patient, cell_wall]
|
||||
for scene in scenes_to_show:
|
||||
scene.show()
|
||||
|
||||
#Opening Shutters
|
||||
cell_animation.play("open")
|
||||
await cell_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 Screen by default
|
||||
for tab in computer.tab_list:
|
||||
tab.show()
|
||||
tab.set_mouse_filter(Control.MOUSE_FILTER_STOP)
|
||||
computer.patient_file.show()
|
||||
|
||||
#Updating patient_count
|
||||
Globals.patient_count += 1
|
||||
|
||||
|
||||
#Starts release or termination protocols when the corresponding button is pressed
|
||||
func _on_decision_made(choice: String):
|
||||
|
||||
#Hiding computer tabs screen
|
||||
for node in computer.tab_list + computer.screen_list:
|
||||
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_screen.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)
|
||||
|
||||
|
||||
#Clears patient and transitions towards next patient or end of day
|
||||
func _on_clear_patient(choice:String):
|
||||
|
||||
# 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
|
||||
middle_screen.update(Globals.day_count, Globals.floor_count, accurate_diagnoses, Globals.diagnoses_quota)
|
||||
|
||||
#Showing second console message
|
||||
console_screen.display(message_array[1])
|
||||
|
||||
#Closing Shutters
|
||||
cell_animation.play("close")
|
||||
await cell_animation.animation_finished
|
||||
|
||||
#Hiding the cell and restoring the backroom and patient's original colors
|
||||
for scene in [patient, cell_wall]:
|
||||
scene.hide()
|
||||
patient.modulate = Patient.original_color
|
||||
cell_wall.modulate = Patient.original_color
|
||||
|
||||
#Hiding Computer screen and resetting Console screen once the animation is done
|
||||
cell_animation.play(choice)
|
||||
await cell_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_toggle_mode(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
|
||||
cell_wall.modulate = new_color
|
||||
print("Color changed to: " + str(new_color))
|
||||
|
||||
|
||||
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_screen.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
|
||||
middle_screen.update(Globals.day_count, Globals.floor_count, accurate_diagnoses, Globals.diagnoses_quota)
|
||||
|
||||
#Resetting patient_count
|
||||
Globals.patient_count = 0
|
||||
|
||||
#Updating journal symptoms
|
||||
journal_layer.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()
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
uid://b3ms0imu0umn8
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,103 @@
|
||||
extends TextureRect
|
||||
|
||||
@onready var mat := material as ShaderMaterial
|
||||
|
||||
signal reveal_done
|
||||
signal hide_done
|
||||
signal dialogue_finished
|
||||
|
||||
|
||||
func _ready():
|
||||
|
||||
#Hiding
|
||||
hide()
|
||||
|
||||
#Setting up shader
|
||||
randomize()
|
||||
#Noise setup
|
||||
var noise := FastNoiseLite.new()
|
||||
noise.noise_type = FastNoiseLite.TYPE_SIMPLEX
|
||||
noise.frequency = 20.0
|
||||
noise.seed = randi()
|
||||
|
||||
var noise_tex := NoiseTexture2D.new()
|
||||
noise_tex.noise = noise
|
||||
noise_tex.width = 512
|
||||
noise_tex.height = 512
|
||||
noise_tex.seamless = true
|
||||
|
||||
mat.set_shader_parameter("noise_tex", noise_tex)
|
||||
|
||||
|
||||
#Revealing supervisor in a noise spray
|
||||
func reveal_spray():
|
||||
|
||||
mat.set_shader_parameter("progress", 0.0)
|
||||
|
||||
var tween = create_tween()
|
||||
tween.tween_method(set_progress, 0.0, 1.0, 3.0) \
|
||||
.set_trans(Tween.TRANS_SINE) \
|
||||
.set_ease(Tween.EASE_OUT)
|
||||
|
||||
await tween.finished
|
||||
reveal_done.emit()
|
||||
|
||||
|
||||
#hiding supervisor in a hiding spray
|
||||
func hide_spray():
|
||||
|
||||
mat.set_shader_parameter("progress", 1.0)
|
||||
|
||||
var tween = create_tween()
|
||||
tween.tween_method(set_progress, 1.0, 0.0, 3.0) \
|
||||
.set_trans(Tween.TRANS_SINE) \
|
||||
.set_ease(Tween.EASE_OUT)
|
||||
|
||||
await tween.finished
|
||||
hide_done.emit()
|
||||
|
||||
|
||||
#Progressing the reveal/hide
|
||||
func set_progress(value: float):
|
||||
mat.set_shader_parameter("progress", value)
|
||||
|
||||
|
||||
#Supervisor dialogue, mainly between floors
|
||||
func dialogue(dialogue_start):
|
||||
|
||||
#Loading supervisor data
|
||||
var config := ConfigFile.new()
|
||||
var file_path = "res://Dialogues/Patients/prime_supervisor_" + Patient.supervisor_name + "_file.cfg"
|
||||
config.load(file_path)
|
||||
|
||||
file_path = "res://Art/Patients/prime_supervisor_" + Patient.supervisor_name + "/prime_supervisor_" + Patient.supervisor_name + "_"
|
||||
Patient.load_emotions(config, file_path)
|
||||
|
||||
#Showing the supervisor
|
||||
texture = Patient.image
|
||||
show()
|
||||
reveal_spray()
|
||||
await reveal_done
|
||||
|
||||
#Dialogue
|
||||
var dialogue_resource = load("res://Dialogues/Patients/prime_supervisor_" + Patient.supervisor_name + ".dialogue")
|
||||
Globals.start_balloon.emit("screening", "supervisor", dialogue_resource, dialogue_start)
|
||||
await DialogueManager.dialogue_ended
|
||||
|
||||
#Hiding the supervisor
|
||||
hide_spray()
|
||||
await hide_done
|
||||
hide()
|
||||
|
||||
dialogue_finished.emit()
|
||||
|
||||
|
||||
#Change emotions following dialogue tags
|
||||
func _change_emotion(dialogue_line) -> void:
|
||||
|
||||
var line_tag = dialogue_line.tags
|
||||
print("Supervisor marker value: " + str(Patient.marker[0]))
|
||||
if line_tag.is_empty() == false:
|
||||
var new_emotion = line_tag[0]
|
||||
texture = Patient.emotions[String(new_emotion)]
|
||||
print("Supervisor emotion changed to ", new_emotion)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cdkbyikbjqlsh
|
||||
@@ -0,0 +1,12 @@
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D noise_tex;
|
||||
uniform float progress : hint_range(0.0, 1.0) = 0.0;
|
||||
uniform float softness : hint_range(0.001, 0.2) = 0.05;
|
||||
|
||||
void fragment() {
|
||||
vec4 img = texture(TEXTURE, UV);
|
||||
float noise = texture(noise_tex, UV).r;
|
||||
float alpha = 1.0 - smoothstep(progress - softness, progress + softness, noise);
|
||||
COLOR = vec4(img.rgb, img.a * alpha);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://dwepb0lm1veje
|
||||
@@ -0,0 +1,11 @@
|
||||
extends RichTextLabel
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
Globals.terminate_display.connect(self._on_terminate_display)
|
||||
text = Globals.colorize("TERMINATE", "web_gray")
|
||||
|
||||
|
||||
func _on_terminate_display(message:String):
|
||||
text = message
|
||||
@@ -0,0 +1 @@
|
||||
uid://dcjfpyxp3hqg8
|
||||
Reference in New Issue
Block a user