Save/Load rework
This commit is contained in:
@@ -13,13 +13,7 @@ extends Control
|
||||
@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
|
||||
@onready var room_assets = $RoomAssets
|
||||
|
||||
#DialogueAssets
|
||||
@onready var patient_dialogue_resource: Resource
|
||||
@@ -44,35 +38,30 @@ func _ready() -> void:
|
||||
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)
|
||||
|
||||
room_assets.reset()
|
||||
hide() #Hiding ScreeningDesk
|
||||
|
||||
message_array.resize(3) #Setting up message array
|
||||
|
||||
|
||||
#Selecting next patient
|
||||
func new_patient():
|
||||
|
||||
var new_id = Patient.next_patient()
|
||||
Patient.new_patient("its_01") #Line for testing purposes
|
||||
#Patient.new_patient(new_id) #Line for generating new patient
|
||||
#Patient.new_patient("its_01") #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
|
||||
|
||||
#Selecting next_patient
|
||||
new_patient()
|
||||
|
||||
|
||||
#Hiding the next_patient button
|
||||
var scenes_to_hide = [computer.next_patient_button, supervisor]
|
||||
for scenes in scenes_to_hide:
|
||||
@@ -86,19 +75,21 @@ func _on_call_next_patient_pressed(): #Brings in next patient and sets up the de
|
||||
console_screen.display(message)
|
||||
|
||||
#Shutters entry animation
|
||||
cell_animation.play("incoming")
|
||||
cell_top.show()
|
||||
cell_bot.show()
|
||||
await cell_animation.animation_finished
|
||||
room_assets.cell_animation.play("incoming")
|
||||
room_assets.cell_top.show()
|
||||
room_assets.cell_bot.show()
|
||||
await room_assets.cell_animation.animation_finished
|
||||
|
||||
#Showing the Patient and the Backroom
|
||||
var scenes_to_show = [patient, cell_wall]
|
||||
var scenes_to_show = [patient, room_assets.cell_wall]
|
||||
for scene in scenes_to_show:
|
||||
scene.show()
|
||||
|
||||
#Opening Shutters
|
||||
cell_animation.play("open")
|
||||
await cell_animation.animation_finished
|
||||
room_assets.cell_animation.play("open")
|
||||
await room_assets.cell_animation.animation_finished
|
||||
room_assets.cell_top.hide()
|
||||
room_assets.cell_bot.hide()
|
||||
|
||||
#Activating Buttons
|
||||
green_button.set_disabled(false)
|
||||
@@ -162,37 +153,29 @@ func _on_clear_patient(choice:String):
|
||||
console_screen.display(message_array[1])
|
||||
|
||||
#Closing Shutters
|
||||
cell_animation.play("close")
|
||||
await cell_animation.animation_finished
|
||||
room_assets.cell_top.show()
|
||||
room_assets.cell_bot.show()
|
||||
room_assets.cell_animation.play("close")
|
||||
await room_assets.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 patient and cell_wall
|
||||
for node in [patient, room_assets.cell_wall]:
|
||||
node.hide()
|
||||
|
||||
#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()
|
||||
#Playing release or terminate cell animation
|
||||
room_assets.cell_animation.play(choice)
|
||||
await room_assets.cell_animation.animation_finished
|
||||
|
||||
#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")
|
||||
#Resetting the scene
|
||||
reset()
|
||||
|
||||
#Descending Floor if diagnoses_quota reached
|
||||
if accurate_diagnoses == Globals.diagnoses_quota:
|
||||
descend_floor()
|
||||
else:
|
||||
new_patient()
|
||||
#Setting up UI
|
||||
computer.next_patient_button.show()
|
||||
console_screen.display(Globals.directives)
|
||||
|
||||
|
||||
func _on_color_change(color: String): #Modulating backroom and patient colors
|
||||
@@ -205,7 +188,7 @@ func _on_color_change(color: String): #Modulating backroom and patient colors
|
||||
"green":
|
||||
new_color = Color(0.5,1,0.5,1)
|
||||
patient.modulate = new_color
|
||||
cell_wall.modulate = new_color
|
||||
room_assets.cell_wall.modulate = new_color
|
||||
print("Color changed to: " + str(new_color))
|
||||
|
||||
|
||||
@@ -219,10 +202,10 @@ func descend_floor(): #Descends to next floor
|
||||
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
|
||||
room_assets.backwall_animation.play("going_down_1")
|
||||
await room_assets.backwall_animation.animation_finished
|
||||
room_assets.backwall_animation.play("going_down_2")
|
||||
await room_assets.backwall_animation.animation_finished
|
||||
|
||||
#Updating middle screen info
|
||||
Globals.floor_count -= 1
|
||||
@@ -244,6 +227,13 @@ func descend_floor(): #Descends to next floor
|
||||
supervisor.dialogue("interfloor_" + str(-Globals.floor_count-1))
|
||||
await supervisor.dialogue_finished
|
||||
|
||||
#Setting up new patient
|
||||
new_patient()
|
||||
#Setting up UI
|
||||
computer.next_patient_button.show()
|
||||
console_screen.display(Globals.directives)
|
||||
|
||||
|
||||
#Resets to initial state
|
||||
func reset():
|
||||
for node in [patient, supervisor, journal_layer, computer, console_screen, release, terminate,
|
||||
green_button, red_button, room_assets]:
|
||||
node.reset()
|
||||
|
||||
Reference in New Issue
Block a user