Added a basic test map, options menu, bug fixes, and much more.
This commit is contained in:
Patrick 2025-08-08 10:57:42 +02:00
parent d72b5ac57b
commit 2dce012535
34 changed files with 1268 additions and 84 deletions

34
global/options.gd Normal file
View file

@ -0,0 +1,34 @@
class_name OptionsClass
extends Node
var username: String = "DefaultUsername"
var ip_address: String = "127.0.0.1"
var data_collection: bool = false
func _ready() -> void:
load_options()
func save_options() -> void:
var save_data: String = JSON.stringify({
"username": username,
"ip_address": ip_address,
"data_collection": data_collection,
})
var file: FileAccess = FileAccess.open("user://options.json", FileAccess.WRITE)
if file and !file.store_string(save_data):
print("Failed to save settings.")
func load_options() -> void:
var file: FileAccess = FileAccess.open("user://options.json", FileAccess.READ)
if file:
var save_data: Dictionary = JSON.parse_string(file.get_as_text())
if save_data:
if save_data.has("username"):
username = save_data.username
if save_data.has("ip_address"):
ip_address = save_data.ip_address
if save_data.has("data_collection"):
data_collection = save_data.data_collection