Files
imnotsick/Scenes/screening_desk/journal_layer.gd
T
2026-06-11 21:33:17 +02:00

154 lines
5.3 KiB
GDScript

extends CanvasLayer
@onready var journal_symptoms = $Boundaries/VBoxContainer/Journal/MarginContainer/Symptoms/RightPage/Symptoms
@onready var bookmarks = $Boundaries/VBoxContainer/Bookmarks
@onready var journal = $Boundaries/VBoxContainer/Journal
#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",
"THOUGHT INSERTION\nFalse conviction of having alien thoughts implanted in one's brain"],
["CHEMOSENSORY HALLUCINATIONS\nFalse perceptions of smell or taste",
"DISORGANIZED SPEECH\nIncoherent sentences, words and speech"],
["HETERO-AGRESSIVE BEHAVIOUR\nExcessive hostility, verbal agression, threats",
"DISSOCIATIVE IDENTITY\nPresence of two or more alternate personalities"]
]
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
#Connecting signals
$Boundaries/VBoxContainer/Journal/MarginContainer/Rules/LeftPage/CloseManual.pressed.connect(self._on_close_manual_pressed)
$Boundaries/VBoxContainer/Journal/MarginContainer/Symptoms/LeftPage/CloseManual.pressed.connect(self._on_close_manual_pressed)
$Boundaries/VBoxContainer/Journal/MarginContainer/Entities/LeftPage/CloseManual.pressed.connect(self._on_close_manual_pressed)
bookmarks.rules.pressed.connect(self._on_tab_rules_pressed)
bookmarks.symptoms.pressed.connect(self._on_tab_symptoms_pressed)
bookmarks.entities.pressed.connect(self._on_tab_entities_pressed)
Globals.add_entity.connect(self.add_entity)
hide() #Hiding at start
func _on_close_manual_pressed():
hide()
func _on_journal_pressed():
show()
func update_symptoms(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_page.text = symptoms_page
func add_entity(entity):
if Globals.entities.has(entity) == false:
Globals.entities.append(entity)
update_entities(Globals.entities)
func update_entities(entities):
journal.entities_page.text = ""
for entity in entities:
add_entity_to_journal(entity)
func add_entity_to_journal(entity: String):
var config := ConfigFile.new()
var entity_name: String = ""
var entity_characteristics: String = ""
var entity_course_of_action: String = ""
var entity_text: String = ""
config.load("res://Text Data/entities.cfg") #Loading Entity file
entity_name = config.get_value(entity, "entity_name")
entity_characteristics = config.get_value(entity, "entity_characteristics")
entity_course_of_action = config.get_value(entity, "entity_course_of_action")
entity_text = Globals.colorize(entity_name, "dark_red") + "\n\nCHARACTERISTICS" + entity_characteristics + "\nRECOMMENDED COURSE OF ACTION" + entity_course_of_action
journal.entities_page.text += "\n\n\n" + entity_text
#func update_entities(): Old function, to be deleted
#journal.entities_page.text = ""
#if Patient.entities_current_floor.is_empty():
# Patient.pick_floor_entities() #Picking floor entities unless a save was just loaded
#var config := ConfigFile.new()
#var entity_name: String = ""
#var entity_characteristics: String = ""
#var entity_course_of_action: String = ""
#var entity_text: String = ""
#journal.entities_page.text += its_entity_file
#for entity in Patient.entities_current_floor:
#config.load("res://Dialogues/Entities/" + entity + "_file.cfg") #Loading Entity file
#entity_name = config.get_value("", "entity_name")
#entity_characteristics = config.get_value("", "entity_characteristics")
#entity_course_of_action = config.get_value("", "entity_course_of_action")
#entity_text = Globals.colorize(entity_name, "dark_red") + "\n\nCHARACTERISTICS" + entity_characteristics + "\nRECOMMENDED COURSE OF ACTION" + entity_course_of_action
#journal.entities_page.text += "\n\n\n" + entity_text
#Resets to initial state
func reset():
hide()
update_symptoms(Globals.floor_count)
update_entities(Globals.entities)
if Globals.floor_count <= -2:
bookmarks.entities.show()
else:
bookmarks.entities.hide()
#Shows the rules tab
func _on_tab_rules_pressed():
tab_switch(bookmarks.rules, journal.rules)
#Shows the symptoms tab
func _on_tab_symptoms_pressed():
tab_switch(bookmarks.symptoms, journal.symptoms)
#Shows the entities tab
func _on_tab_entities_pressed():
tab_switch(bookmarks.entities, journal.entities)
#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 [bookmarks.rules, bookmarks.symptoms, bookmarks.entities]:
if tab == pressed_tab:
pressed_tab.set_pressed(true)
pressed_tab.set_mouse_filter(Control.MOUSE_FILTER_IGNORE)
else:
tab.set_pressed(false)
tab.set_mouse_filter(Control.MOUSE_FILTER_STOP)
#Showing desired screen and hiding the others
for screen in [journal.rules, journal.symptoms, journal.entities]:
if screen == tab_screen:
screen.show()
else:
screen.hide()