next_patient_type code
This commit is contained in:
@@ -27,8 +27,11 @@ 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_patient_list = ["its_01"]
|
||||
var its_patient_list = []
|
||||
var og_its_list = ["its_01"]
|
||||
var its_list = []
|
||||
var og_it_list = ["itl"]
|
||||
var it_list = []
|
||||
|
||||
|
||||
#Supervisor file path
|
||||
var supervisor_name = "loeveth"
|
||||
@@ -43,10 +46,11 @@ func _ready() -> void:
|
||||
#Setting up patient lists
|
||||
og_patient_list.resize(len(symptoms_arrays))
|
||||
patient_list.resize(len(symptoms_arrays))
|
||||
its_patient_list = og_its_patient_list
|
||||
its_list = og_its_list
|
||||
it_list = og_it_list
|
||||
|
||||
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
|
||||
|
||||
@@ -189,7 +193,7 @@ func weighted_random(patients: Dictionary):
|
||||
return null
|
||||
|
||||
|
||||
func generate_patient_id() -> String: #Generates a patient ID
|
||||
func random_patient_id() -> String: #Generates a patient ID
|
||||
|
||||
#Generating patient_id
|
||||
var floor_index = -Globals.floor_count -1
|
||||
@@ -200,25 +204,49 @@ func generate_patient_id() -> String: #Generates a patient ID
|
||||
for i in range(len(patient_list)):
|
||||
if len(patient_list[i]) > 1:
|
||||
patient_list[i].erase(patient_id)
|
||||
print("Updated Floor " + str(i) + " list: " + str(patient_list[i]))
|
||||
print("Updated Floor " + str(i) + " patient_list: " + str(patient_list[i]))
|
||||
|
||||
|
||||
return patient_id
|
||||
|
||||
|
||||
func generate_its_patient_id() -> String: #Generates an ITS patient ID
|
||||
func random_its_id() -> String: #Generates an ITS patient ID
|
||||
|
||||
#Generating ITS patient ID
|
||||
var its_patient_id = its_patient_list.pick_random()
|
||||
print("ITS Patient selected: " + str(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_patient_list) > 1:
|
||||
its_patient_list.erase(its_patient_id)
|
||||
print("Updated ITS Patient list: " + str(its_patient_list))
|
||||
if len(its_list) > 1:
|
||||
its_list.erase(its_id)
|
||||
print("Updated ITS Patient list: " + str(its_list))
|
||||
|
||||
return its_patient_id
|
||||
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):
|
||||
match patient_type:
|
||||
"patient":
|
||||
return random_patient_id()
|
||||
"its":
|
||||
return random_its_id()
|
||||
"it":
|
||||
return random_it_id()
|
||||
|
||||
|
||||
func next_patient() -> String: #Decides next patient ID
|
||||
|
||||
var next_patient_id: String
|
||||
@@ -227,16 +255,37 @@ func next_patient() -> String: #Decides next patient ID
|
||||
-2:
|
||||
if Globals.patient_count == 0:
|
||||
next_patient_id = "its_00"
|
||||
elif Globals.its_patient_count < 1:
|
||||
next_patient_id = generate_its_patient_id()
|
||||
else:
|
||||
next_patient_id = generate_patient_id()
|
||||
next_patient_id = generate_next_id(next_patient_type())
|
||||
_:
|
||||
next_patient_id = generate_patient_id()
|
||||
next_patient_id = generate_next_id(next_patient_type())
|
||||
|
||||
return next_patient_id
|
||||
|
||||
|
||||
#Randomizes next patient type (human, it, its)
|
||||
func next_patient_type():
|
||||
var type_list = []
|
||||
match Globals.floor_count:
|
||||
-1:
|
||||
return "patient"
|
||||
-2:
|
||||
return "patient"
|
||||
-3:
|
||||
type_list.append("its")
|
||||
for i in range(Globals.diagnoses_quota - 1):
|
||||
type_list.append("patient")
|
||||
return type_list.pick_random()
|
||||
_:
|
||||
for i in range(int(floor(Globals.diagnoses_quota/4))):
|
||||
type_list.append("its")
|
||||
type_list.append("it")
|
||||
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
|
||||
@@ -246,10 +295,16 @@ func update_patient_list():
|
||||
patient_list[i].erase(patient_id)
|
||||
|
||||
#Erasing ITS patients already seen from ITS patient list
|
||||
for its_patient_id in Globals.its_patients_seen:
|
||||
if len(its_patient_list) > 1:
|
||||
its_patient_list.erase(its_patient_id)
|
||||
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 Patient list: " + str(its_patient_list))
|
||||
print("Loaded ITS list: " + str(its_list))
|
||||
|
||||
Reference in New Issue
Block a user