2021-11-17 22:23:12 +00:00
|
|
|
extends Node
|
|
|
|
|
|
|
|
var auto_clutch: bool = false
|
2021-11-19 17:40:35 +00:00
|
|
|
var automatic_transmission: bool = true
|
2022-01-19 10:39:45 +00:00
|
|
|
var selected_camera: int = 0
|
2022-01-20 18:56:06 +00:00
|
|
|
var multiplayer_name: String = "Player"
|
2022-01-21 13:18:13 +00:00
|
|
|
|
|
|
|
var _config: Dictionary
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
_config = read_json_file("res://info.json")
|
|
|
|
|
|
|
|
|
|
|
|
func read_json_file(file_path: String) -> Dictionary:
|
|
|
|
var file = File.new()
|
|
|
|
if not file.file_exists(file_path):
|
|
|
|
print("File not found: %s" % file_path)
|
|
|
|
return Dictionary()
|
|
|
|
file.open(file_path, File.READ)
|
|
|
|
var content_as_text = file.get_as_text()
|
|
|
|
var content_as_dictionary = parse_json(content_as_text)
|
|
|
|
return content_as_dictionary
|
|
|
|
|
|
|
|
|
|
|
|
func save_json_file(file_path: String, contents: Dictionary) -> void:
|
|
|
|
var file = File.new()
|
|
|
|
file.open(file_path, File.WRITE)
|
|
|
|
file.store_line(to_json(contents))
|
|
|
|
file.close()
|
|
|
|
|
|
|
|
|
|
|
|
func get_version_string() -> String:
|
|
|
|
var version = _config["version"]
|
|
|
|
var major = version["major"]
|
|
|
|
var minor = version["minor"]
|
|
|
|
var patch = version["patch"]
|
|
|
|
return "%d.%d.%d" % [major, minor, patch]
|