entity 01 WIP
This commit is contained in:
@@ -12,6 +12,7 @@ var original_color: Color
|
||||
var emotions : Dictionary
|
||||
var abnormal: bool
|
||||
var id : String
|
||||
var type: String
|
||||
|
||||
#Patient file
|
||||
var file_text : String
|
||||
@@ -29,8 +30,11 @@ var og_patient_list : Array[Dictionary]
|
||||
var patient_list: Array[Dictionary]
|
||||
var og_its_list = ["its_01"]
|
||||
var its_list = []
|
||||
var og_it_list = ["itl"]
|
||||
var it_list = []
|
||||
var og_entities_list = ["entity_01"]
|
||||
var entities_list = []
|
||||
var patients_seen = []
|
||||
var its_seen = []
|
||||
var entities_seen = []
|
||||
|
||||
|
||||
#Supervisor file path
|
||||
@@ -47,7 +51,7 @@ func _ready() -> void:
|
||||
og_patient_list.resize(len(symptoms_arrays))
|
||||
patient_list.resize(len(symptoms_arrays))
|
||||
its_list = og_its_list
|
||||
it_list = og_it_list
|
||||
entities_list = og_entities_list
|
||||
|
||||
original_color = texture.modulate #Saving original modulation color to reset it after modification
|
||||
|
||||
@@ -64,32 +68,37 @@ func build_dialog_tree(tree_model: Array[int]) -> Dictionary: #Builds the dialog
|
||||
return tree
|
||||
|
||||
|
||||
func load_patient(patient_id):
|
||||
func load_patient(patient_info: Dictionary): #Loads new patient
|
||||
|
||||
#Storing patient info
|
||||
id = patient_info["id"]
|
||||
type = patient_info["type"]
|
||||
|
||||
#Loading Subject resources
|
||||
var file_path: String
|
||||
|
||||
id = patient_id
|
||||
|
||||
#Loading Patient Files
|
||||
var config := ConfigFile.new()
|
||||
file_path = "res://Dialogues/Patients/patient_" + patient_id + "_file.cfg"
|
||||
config.load(file_path)
|
||||
|
||||
match type: #Setting right file path depending on subject type
|
||||
"patient":
|
||||
file_path = "Patients/"
|
||||
"its":
|
||||
file_path = "ITS/"
|
||||
"entity":
|
||||
file_path = "Entities/"
|
||||
"supervisor":
|
||||
file_path = "Supervisors/"
|
||||
|
||||
config.load("res://Dialogues/" + file_path + id + "_file.cfg") #Loading Subject file
|
||||
dialogue_resource = load("res://Dialogues/" + file_path + id + ".dialogue") #Loading Dialogue Resource
|
||||
load_emotions(config, "res://Art/Subjects/" + file_path + id + "/" + id + "_") #Loading Subject emotions
|
||||
|
||||
#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:
|
||||
@@ -143,7 +152,7 @@ func sort_patients():
|
||||
|
||||
#Loads symptoms for each patient
|
||||
patient_symptoms.clear()
|
||||
file_path = "res://Dialogues/Patients/patient_" + patient_id + "_file.cfg"
|
||||
file_path = "res://Dialogues/Patients/" + patient_id + "_file.cfg"
|
||||
config.load(file_path)
|
||||
symptom_list = config.get_value("", "psychiatric_assessment").split("\n", false)
|
||||
patient_symptoms = symptom_list
|
||||
@@ -176,7 +185,7 @@ func sort_patients():
|
||||
func weighted_random(patients: Dictionary):
|
||||
|
||||
#Calculating total weight
|
||||
var total_weight : int
|
||||
var total_weight : int = 0
|
||||
for weight in patients.values():
|
||||
total_weight += weight
|
||||
print("Total weight: " + str(total_weight))
|
||||
@@ -184,7 +193,7 @@ func weighted_random(patients: Dictionary):
|
||||
var r = randf() * total_weight
|
||||
print("r :" + str(r))
|
||||
|
||||
var weight_sum : int
|
||||
var weight_sum : int = 0
|
||||
for patient_id in patients:
|
||||
weight_sum += patients[patient_id]
|
||||
if weight_sum >= r:
|
||||
@@ -193,74 +202,44 @@ func weighted_random(patients: Dictionary):
|
||||
return null
|
||||
|
||||
|
||||
func random_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
|
||||
|
||||
#Removes picked patient from patients list
|
||||
for i in range(len(patient_list)):
|
||||
if len(patient_list[i]) > 1:
|
||||
patient_list[i].erase(patient_id)
|
||||
print("Updated Floor " + str(i) + " patient_list: " + str(patient_list[i]))
|
||||
|
||||
return patient_id
|
||||
|
||||
|
||||
func random_its_id() -> String: #Generates an ITS patient ID
|
||||
|
||||
#Generating ITS patient ID
|
||||
var its_id = its_list.pick_random()
|
||||
print("ITS selected: " + str(its_id))
|
||||
#Remove picked ITS patient from ITS patient list
|
||||
if len(its_list) > 1:
|
||||
its_list.erase(its_id)
|
||||
print("Updated ITS Patient list: " + str(its_list))
|
||||
|
||||
return its_id
|
||||
|
||||
|
||||
func random_it_id():
|
||||
#Generating it_patient_id
|
||||
var floor_index = -Globals.floor_count -1
|
||||
print("Floor Index: " + str(floor_index))
|
||||
var it_id = it_list[floor_index].pick_random() #Picks a random patient depending on floor, with weighted odds
|
||||
|
||||
#Removes picked patient from patients list
|
||||
for i in range(len(it_list)):
|
||||
if len(it_list[i]) > 1:
|
||||
it_list[i].erase(it_id)
|
||||
print("Updated Floor " + str(i) + " it_list: " + str(it_list[i]))
|
||||
|
||||
return it_id
|
||||
|
||||
|
||||
func generate_next_id(patient_type: String):
|
||||
|
||||
var floor_index = -Globals.floor_count -1
|
||||
print("Floor Index: " + str(floor_index))
|
||||
var next_id : String = ""
|
||||
|
||||
match patient_type:
|
||||
"patient":
|
||||
return random_patient_id()
|
||||
next_id = weighted_random(patient_list[floor_index]) #Picks a random patient depending on floor, with weighted odds
|
||||
print("Patient selected : " + str(next_id))
|
||||
"its":
|
||||
return random_its_id()
|
||||
"it":
|
||||
return random_it_id()
|
||||
next_id = its_list.pick_random()
|
||||
print("ITS selected: " + str(next_id))
|
||||
"entity":
|
||||
next_id = entities_list[floor_index].pick_random()
|
||||
print("Entity selected: " + str(next_id))
|
||||
|
||||
return next_id
|
||||
|
||||
|
||||
func next_patient() -> String: #Decides next patient ID
|
||||
func next_patient() -> Dictionary: #Decides next patient ID
|
||||
|
||||
var next_patient_id: String
|
||||
var next_id: String
|
||||
var next_type: String
|
||||
|
||||
match Globals.floor_count:
|
||||
-2:
|
||||
if Globals.patient_count == 0:
|
||||
next_patient_id = "its_00"
|
||||
next_id = "its_00"
|
||||
next_type = "its"
|
||||
else:
|
||||
next_patient_id = generate_next_id(next_patient_type())
|
||||
next_type = next_patient_type()
|
||||
next_id = generate_next_id(next_type)
|
||||
_:
|
||||
next_patient_id = generate_next_id(next_patient_type())
|
||||
next_type = next_patient_type()
|
||||
next_id = generate_next_id(next_patient_type())
|
||||
|
||||
return next_patient_id
|
||||
return {"id": next_id, "type": next_type}
|
||||
|
||||
|
||||
#Randomizes next patient type (human, it, its)
|
||||
@@ -279,32 +258,32 @@ func next_patient_type():
|
||||
_:
|
||||
for i in range(int(floor(Globals.diagnoses_quota/4))):
|
||||
type_list.append("its")
|
||||
type_list.append("it")
|
||||
type_list.append("entity")
|
||||
for i in range(int(floor(Globals.diagnoses_quota/2))):
|
||||
type_list.append("patient")
|
||||
return type_list.pick_random()
|
||||
|
||||
|
||||
|
||||
func update_patient_list():
|
||||
|
||||
#Erasing patients already seen from patient lists
|
||||
for patient_id in Globals.patients_seen:
|
||||
for i in range(len(patient_list)):
|
||||
if len(patient_list[i]) > 1:
|
||||
patient_list[i].erase(patient_id)
|
||||
|
||||
#Erasing ITS patients already seen from ITS patient list
|
||||
for its_id in Globals.its_seen:
|
||||
if len(its_list) > 1:
|
||||
its_list.erase(its_id)
|
||||
|
||||
#Erasing IT patients already seen from IT lists
|
||||
for it_id in Globals.it_seen:
|
||||
for i in range(len(it_list)):
|
||||
if len(it_list[i]) > 1:
|
||||
it_list[i].erase(it_id)
|
||||
|
||||
for j in range(len(patient_list)):
|
||||
print("Loaded Floor " + str(j) + " list: " + str(patient_list[j]))
|
||||
print("Loaded ITS list: " + str(its_list))
|
||||
#Erases current patient ID from the corresponding patient list, so it can't be seen twice
|
||||
func update_list():
|
||||
print("Patient type: " + str(Patient.type))
|
||||
match type:
|
||||
"patient":
|
||||
patients_seen.append(id)
|
||||
for i in range(len(patient_list)):
|
||||
if len(patient_list[i])>1:
|
||||
patient_list[i].erase(id)
|
||||
for j in range(len(patient_list)):
|
||||
print("Updated Floor " + str(j) + " patient list: " + str(patient_list[j]))
|
||||
"its":
|
||||
its_seen.append(id)
|
||||
if len(its_list)>1:
|
||||
its_list.erase(id)
|
||||
print("Updated ITS list: " + str(its_list))
|
||||
"entity":
|
||||
entities_seen.append(id)
|
||||
for i in range(len(entities_list)):
|
||||
if len(entities_list[i]) > 1:
|
||||
entities_list[i].erase(id)
|
||||
for j in range(len(entities_list)):
|
||||
print("Updated Floor " + str(j) + " Entity list: " + str(entities_list[j]))
|
||||
|
||||
@@ -151,8 +151,7 @@ func _on_clear_patient(choice:String):
|
||||
Globals.accurate_diagnoses = 0 # Resetting to 0 if the player makes a wrong diagnosis
|
||||
middle_screen.update(Globals.day_count, Globals.floor_count, Globals.accurate_diagnoses, Globals.diagnoses_quota)
|
||||
|
||||
Globals.patients_seen.append(Patient.id) #Updating Patient seens list
|
||||
print("Updated patients seen list: " + str(Globals.patients_seen))
|
||||
Patient.update_list() #Updating patient list
|
||||
Globals.patient_count += 1 #Updating patient_count
|
||||
|
||||
#Showing second console message
|
||||
|
||||
@@ -67,10 +67,10 @@ func dialogue(dialogue_start):
|
||||
|
||||
#Loading supervisor data
|
||||
var config := ConfigFile.new()
|
||||
var file_path = "res://Dialogues/Patients/prime_supervisor_" + Patient.supervisor_name + "_file.cfg"
|
||||
var file_path = "res://Dialogues/Supervisors/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 + "_"
|
||||
file_path = "res://Art/Subjects/Supervisors/supervisor_" + Patient.supervisor_name + "/supervisor_" + Patient.supervisor_name + "_"
|
||||
Patient.load_emotions(config, file_path)
|
||||
|
||||
#Showing the supervisor
|
||||
@@ -80,7 +80,7 @@ func dialogue(dialogue_start):
|
||||
await reveal_done
|
||||
|
||||
#Dialogue
|
||||
var dialogue_resource = load("res://Dialogues/Patients/prime_supervisor_" + Patient.supervisor_name + ".dialogue")
|
||||
var dialogue_resource = load("res://Dialogues/Supervisors/supervisor_" + Patient.supervisor_name + ".dialogue")
|
||||
Globals.start_balloon.emit("screening", "supervisor", dialogue_resource, dialogue_start)
|
||||
await DialogueManager.dialogue_ended
|
||||
|
||||
|
||||
Reference in New Issue
Block a user