32 lines
783 B
GDScript
32 lines
783 B
GDScript
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
|