move settings definition file to root, store savepath there too

This commit is contained in:
Crispy 2021-06-29 00:47:55 +02:00
parent 386465e8d9
commit b15c00f5f0
3 changed files with 5 additions and 4 deletions

View file

@ -5,8 +5,8 @@ signal settings_loaded # emitted when settings are loaded from file, needs to be
signal settings_changed # has to be manually called by the modifying script
var DEBUG_SETTINGS = false
var SETTINGS_PATH = "user://overlay_data.json"
const SETTINGS_DEF = preload("res://addons/settings-manager/settings_definition.gd").DEF
var SETTINGS_PATH = preload("res://settings_definition.gd").PATH
const SETTINGS_DEF = preload("res://settings_definition.gd").DEF
var has_loaded := false
var s := {}

View file

@ -39,10 +39,10 @@ func save_all() -> void:
func _save_prop(prop_name: String, prop_value) -> void:
Settings.s.overlays[p.name][prop_name] = prop_value
func load_all() -> void:
if Settings.s.overlays.has(p.name):
var new = Settings.s.overlays[p.name]
# type is assigned at creation
if new.has("visible"):
p.overlay_visible = new.visible
@ -61,7 +61,7 @@ func load_all() -> void:
p.set_offset(t_key, offset.pos, offset.rot)
else:
print("FAILED")
print("FAILED to load settings")
save_all()
loaded = true

View file

@ -1,5 +1,6 @@
extends Node
const PATH = "user://overlay_data.json"
const DEF = {
"grab_mode": {
"name": "Grab mode",