42 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			GDScript
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			GDScript
		
	
	
	
	
	
| ## freeftf
 | |
| ## Copyright (C) 2024  Patrick_Pluto
 | |
| ##
 | |
| ## This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
 | |
| ##
 | |
| ## This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
 | |
| ##
 | |
| ## You should have received a copy of the GNU General Public License along with this program.  If not, see <https://www.gnu.org/licenses/>.
 | |
| 
 | |
| extends Node
 | |
| 
 | |
| var settings = {"save_version" = 2, "fps_counter" = 1}
 | |
| var computers = 0
 | |
| var players = 0
 | |
| var map_name = "mansion"
 | |
| 
 | |
| func _ready():
 | |
| 	if FileAccess.file_exists("user://settings.json"):
 | |
| 		var temp = Load.loadJSON("user://settings.json")
 | |
| 		if !(temp is Dictionary) or settings["save_version"] != temp["save_version"]:
 | |
| 			Save.saveJSON("user://settings.json", settings)
 | |
| 		else:
 | |
| 			settings = temp
 | |
| 	else:
 | |
| 		Save.saveJSON("user://settings.json", settings)
 | |
| 	if OS.is_debug_build():
 | |
| 		settings["fps_counter"] = 1
 | |
| 
 | |
| func _process(delta):
 | |
| 	pass
 | |
| 	
 | |
| func reset():
 | |
| 	computers = 0
 | |
| 	players = 0
 | |
| 
 | |
| func save_setting(setting_name, value):
 | |
| 	settings[setting_name] = value
 | |
| 	Save.saveJSON("user://settings.json", settings)
 | |
| 
 | |
| func apply_settings():
 | |
| 	pass
 | |
| 
 | 
