New profiles system + auto version label

This commit is contained in:
gotfishmakesticks 2023-11-11 01:08:43 +03:00
commit 6ffa6e643b
7 changed files with 128 additions and 49 deletions

32
scripts/profile.gd Normal file
View file

@ -0,0 +1,32 @@
class_name Profile
var profile_meta = {
'hash' : {},
'meta' : {
'created_in_version' : Game.gameversion,
'creation_date' : Time.get_datetime_string_from_system(),
'last_version' : Game.gameversion,
'last_updated' : Time.get_datetime_string_from_system(),
'profile_name' : "",
'legit' : true
}
}
var path : set = _set_path
var is_root : set = _check_root
func _check_root(file_path):
return file_path == "user://.cosmic"
func _set_path(name):
return "user://{name}.cosmic".format({"name" : name})
static func create(meta):
var profile = Profile.new()
profile.profile_meta = meta
profile.path = profile.profile_meta['meta']['profile_name']
profile.is_root = profile.path
if profile.is_root:
profile.profile_meta['profiles'] = {}
return profile