feat(input): make double-tap placement the default
New saves start in double-tap mode. Version 1 saves migrate once to double-tap and are rewritten as version 2, while the settings toggle still persists a later choice. Smoke tests now force hold mode for their hold checks; UI tests cover the fresh default and the migration.
This commit is contained in:
1 parent
15e79ae38c
commit
82c5691d2e
3 files changed
+47
-4
No files matched your search
+12
-2
@@ -13,7 +13,7 @@ const DEFAULTS := {
|
||||
"show_timer": true,
|
||||
"reduce_motion": false,
|
||||
"hold_seconds": 0.35,
|
||||
"double_tap_place": false,
|
||||
"double_tap_place": true,
|
||||
}
|
||||
|
||||
var data := {}
|
||||
@@ -25,7 +25,7 @@ func _ready() -> void:
|
||||
|
||||
func _default_data() -> Dictionary:
|
||||
return {
|
||||
"version": 1,
|
||||
"version": 2,
|
||||
"completed_rooms": [],
|
||||
"unlocked_guests": [],
|
||||
"settings": DEFAULTS.duplicate(true),
|
||||
@@ -35,6 +35,7 @@ func _default_data() -> Dictionary:
|
||||
|
||||
func load_game() -> void:
|
||||
data = _default_data()
|
||||
var stored_version := 2
|
||||
|
||||
if FileAccess.file_exists(PATH):
|
||||
var file := FileAccess.open(PATH, FileAccess.READ)
|
||||
@@ -42,6 +43,7 @@ func load_game() -> void:
|
||||
var parsed = JSON.parse_string(file.get_as_text())
|
||||
file.close()
|
||||
if typeof(parsed) == TYPE_DICTIONARY:
|
||||
stored_version = int(parsed.get("version", 1))
|
||||
for key in parsed:
|
||||
data[key] = parsed[key]
|
||||
|
||||
@@ -51,6 +53,14 @@ func load_game() -> void:
|
||||
if not data["settings"].has(key):
|
||||
data["settings"][key] = DEFAULTS[key]
|
||||
|
||||
# Version 2 makes double-tap the default. Older saves were written while
|
||||
# hold was the default, so switch them once; the toggle still persists
|
||||
# after that.
|
||||
if stored_version < 2:
|
||||
data["settings"]["double_tap_place"] = true
|
||||
data["version"] = 2
|
||||
save_game()
|
||||
|
||||
if typeof(data.get("completed_rooms")) != TYPE_ARRAY:
|
||||
data["completed_rooms"] = []
|
||||
if typeof(data.get("unlocked_guests")) != TYPE_ARRAY:
|
||||
|
||||
Reference in new issue
Block a user