| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -72,7 +72,7 @@ func list_saves(include_quick_saves: bool = true, include_auto_saves: bool = tru | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							_save_resource.filesize = _loaded_file.get_length() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							if FileAccess.file_exists(save_game_data_path + _save_icon): | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								_save_resource.save_icon = _save_icon | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
								_save_resource.save_icon = save_game_data_path + _save_icon | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							save_files.append(_save_resource) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -95,10 +95,20 @@ func quick_load_game() -> void: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						game_loaded.emit() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					## Sort the save files list by date created, descending | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					func _custom_save_file_sort(a: SaveFileDetailsResource, b: SaveFileDetailsResource) -> bool: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						return a.date_created > b.date_created | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					## Generates an icon by taking a screenshot[br] | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					##   The icon utilizes the same filename as the save file, replacing `.tres` with `.png` | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					func _generate_save_icon(save_game_file_path: String) -> void: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						# TODO: Hide the UI before taking the screenshot | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						var _icon_filepath: String = save_game_file_path.replace(".tres", ".png") | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						var _icon: Image = get_viewport().get_texture().get_image() | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						_icon.save_png(_icon_filepath) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					## Find the SaveLevelDataComponent within the level which stores the save paths and filenames | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					func _load_save_level_data_component() -> bool: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						_save_level_data_component = get_tree().get_first_node_in_group("save_level_data_component") | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -138,6 +148,8 @@ func _save_game_as_resource(resource_filename: String) -> void: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						if result != OK: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
							printerr("Failed to save game (" , result, "): ", save_game_file_path) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						_generate_save_icon(save_game_file_path) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					## Save the properties defined on the SaveDataComponents attached to various nodes (such as Block) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					func _save_node_data() -> void: | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
						var nodes: Array = get_tree().get_nodes_in_group("save_data_component") | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |