big work
This commit is contained in:
@@ -35,14 +35,7 @@ var symptoms_arrays: Array[Array] = [
|
||||
#Lists of possible patients sorted by floor
|
||||
var og_patient_list : Array[Dictionary]
|
||||
var patient_list: Array[Dictionary]
|
||||
var og_its_list = ["its_01", "its_02", "its_03", "its_04"]
|
||||
var its_list = []
|
||||
var og_ite_list = ["ite_01", "ite_02", "ite_03", "ite_04"]
|
||||
var ite_list = []
|
||||
var og_entities_list = ["entity_01"]
|
||||
var patients_seen = []
|
||||
var its_seen = []
|
||||
var ite_seen = []
|
||||
|
||||
#Supervisor file path
|
||||
var supervisor_name = "siveyan"
|
||||
@@ -60,8 +53,6 @@ func _ready() -> void:
|
||||
#Setting up patient lists
|
||||
og_patient_list.resize(len(symptoms_arrays))
|
||||
patient_list.resize(len(symptoms_arrays))
|
||||
its_list = og_its_list
|
||||
ite_list = og_ite_list
|
||||
|
||||
original_color = texture.modulate #Saving original modulation color to reset it after modification
|
||||
|
||||
@@ -82,31 +73,17 @@ func build_dialog_tree(tree_model: Array[int]) -> Dictionary: #Builds the dialog
|
||||
return tree
|
||||
|
||||
|
||||
func load_patient(patient_info: Dictionary): #Loads new patient
|
||||
func load_patient(patient_id: String): #Loads new patient
|
||||
|
||||
#Storing patient info
|
||||
id = patient_info["id"]
|
||||
type = patient_info["type"]
|
||||
id = patient_id
|
||||
|
||||
#Loading Subject resources
|
||||
var file_path: String
|
||||
var config := ConfigFile.new()
|
||||
|
||||
match type: #Setting right file path depending on subject type
|
||||
"patient":
|
||||
file_path = "Patients/"
|
||||
"its":
|
||||
file_path = "ITS/"
|
||||
"ite":
|
||||
file_path = "ITE/"
|
||||
"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
|
||||
config.load("res://Dialogues/Patients/" + id + "_file.cfg") #Loading Subject file
|
||||
dialogue_resource = load("res://Dialogues/Patients/" + id + ".dialogue") #Loading Dialogue Resource
|
||||
load_emotions(config, "res://Art/Subjects/Patients/" + id + "/" + id + "_") #Loading Subject emotions
|
||||
|
||||
#Setting up Patient File
|
||||
var patient_name = config.get_value("", "name")
|
||||
@@ -167,8 +144,10 @@ func sort_patients():
|
||||
var config := ConfigFile.new()
|
||||
var file_path : String
|
||||
var patient_symptoms: Array
|
||||
var symptom_matched : bool
|
||||
var symptom_list: Array
|
||||
var symptom_matched : bool = false
|
||||
var symptom_list : Array
|
||||
var patient_type : String
|
||||
var min_floor : int
|
||||
|
||||
for patient_id in Globals.patient_list:
|
||||
|
||||
@@ -182,6 +161,17 @@ func sort_patients():
|
||||
patient_symptoms.append_array(symptom_list)
|
||||
print("Patient #" + patient_id + " symptom list: " + str(patient_symptoms))
|
||||
|
||||
patient_type = config.get_value("", "type")
|
||||
|
||||
#Sets up a minimum floor depending on patient type
|
||||
match patient_type:
|
||||
"patient":
|
||||
min_floor = 0
|
||||
"its":
|
||||
min_floor = 2
|
||||
"ite":
|
||||
min_floor = 4
|
||||
print(patient_id + " min_floor : " + str(min_floor))
|
||||
#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
|
||||
@@ -193,8 +183,9 @@ func sort_patients():
|
||||
print("Symptom matched: " + str(symptoms_arrays[j]) + " and " + str(symptom))
|
||||
break
|
||||
if symptom_matched:
|
||||
for k in range(j, symptoms_arrays.size()):
|
||||
og_patient_list[k].merge({patient_id: j+1}) # Adds the patient to every floor compatible, with a weighted odd
|
||||
print(patient_id + " threshold : " + str(max(j,min_floor)))
|
||||
for k in range(max(j,min_floor), symptoms_arrays.size()):
|
||||
og_patient_list[k].merge({patient_id: j+1+min_floor}) # Adds the patient to every floor compatible, with a weighted odd
|
||||
symptom_matched = false
|
||||
break
|
||||
|
||||
@@ -224,120 +215,54 @@ func weighted_random(patients: Dictionary):
|
||||
return null
|
||||
|
||||
|
||||
func generate_next_id(patient_type: String):
|
||||
func generate_next_id():
|
||||
|
||||
var floor_index = -Globals.floor_count -1
|
||||
print("Floor Index: " + str(floor_index))
|
||||
var next_id : String = ""
|
||||
var next_id : String
|
||||
|
||||
match patient_type:
|
||||
"patient":
|
||||
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":
|
||||
next_id = its_list.pick_random()
|
||||
print("ITS selected: " + str(next_id))
|
||||
"ite":
|
||||
next_id = ite_list.pick_random()
|
||||
print("ITE selected: " + str(next_id))
|
||||
next_id = weighted_random(patient_list[floor_index]) #Picks a random patient depending on floor, with weighted odds
|
||||
print("Floor Index: " + str(floor_index))
|
||||
print("Patient selected : " + str(next_id))
|
||||
|
||||
return next_id
|
||||
|
||||
|
||||
func next_patient() -> Dictionary: #Decides next patient ID
|
||||
func next_patient() -> String: #Decides next patient ID
|
||||
|
||||
var next_id: String
|
||||
var next_type: String
|
||||
|
||||
dialogue_start = "start"
|
||||
match Globals.floor_count:
|
||||
-2:
|
||||
if Globals.patient_count == 0:
|
||||
next_id = "its_00"
|
||||
next_type = "its"
|
||||
next_id = "patient_its_0"
|
||||
else:
|
||||
next_type = next_patient_type()
|
||||
next_id = generate_next_id(next_type)
|
||||
next_id = generate_next_id()
|
||||
-3:
|
||||
next_type = next_patient_type()
|
||||
next_id = generate_next_id(next_type)
|
||||
next_id = generate_next_id()
|
||||
-4:
|
||||
if Globals.patient_count == 0:
|
||||
next_id = "ite_00"
|
||||
next_type = "ite"
|
||||
next_id = "patient_ite_0"
|
||||
else:
|
||||
next_type = next_patient_type()
|
||||
next_id = generate_next_id(next_type)
|
||||
-5:
|
||||
next_id = generate_next_id()
|
||||
-6:
|
||||
if Globals.patient_count == 0:
|
||||
next_id = "patient_spy"
|
||||
next_type = "patient"
|
||||
else:
|
||||
next_type = next_patient_type()
|
||||
next_id = generate_next_id(next_type)
|
||||
next_id = generate_next_id()
|
||||
_:
|
||||
next_type = next_patient_type()
|
||||
next_id = generate_next_id(next_type)
|
||||
next_id = generate_next_id()
|
||||
|
||||
print("NEXT SUBJECT CHARACTERISTICS - ID: " + next_id + ", Type: " + next_type)
|
||||
return {"id": next_id, "type": next_type}
|
||||
|
||||
|
||||
#Randomizes next patient type (human, it, its)
|
||||
func next_patient_type():
|
||||
var type_list = []
|
||||
var next_type: String
|
||||
match Globals.floor_count:
|
||||
-1:
|
||||
type_list.append("patient")
|
||||
-2:
|
||||
type_list.append("patient")
|
||||
-3:
|
||||
for i in range(int(Globals.diagnoses_quota)):
|
||||
if len(its_list) > 0:
|
||||
type_list.append("its")
|
||||
-4:
|
||||
for i in range(int(Globals.diagnoses_quota)):
|
||||
if len(its_list) > 0:
|
||||
type_list.append("its")
|
||||
-5:
|
||||
for i in range(int(Globals.diagnoses_quota)):
|
||||
if len(its_list) > 0:
|
||||
type_list.append("its")
|
||||
if len(ite_list) > 0:
|
||||
type_list.append("ite")
|
||||
_:
|
||||
for i in range(int(Globals.diagnoses_quota)):
|
||||
if len(its_list) > 0:
|
||||
type_list.append("its")
|
||||
if len(ite_list) > 0:
|
||||
type_list.append("ite")
|
||||
|
||||
for i in range(2*int(Globals.diagnoses_quota)):
|
||||
type_list.append("patient")
|
||||
|
||||
print("Type List generated: " + str(type_list))
|
||||
next_type = type_list.pick_random()
|
||||
print("Next subject type picked: " + str(next_type))
|
||||
return next_type
|
||||
print("NEXT SUBJECT ID: " + next_id)
|
||||
return next_id
|
||||
|
||||
|
||||
#Erases current subject ID from the corresponding subject 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)
|
||||
its_list.erase(id)
|
||||
print("Updated ITS list: " + str(its_list))
|
||||
"ite":
|
||||
ite_seen.append(id)
|
||||
ite_list.erase(id)
|
||||
print("Updated ITE list: " + str(ite_list))
|
||||
|
||||
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]))
|
||||
|
||||
Reference in New Issue
Block a user