Replaced txt by Loaders

This commit is contained in:
Kirill
2026-10-03 11:06:52 +03:00
parent e94093ac17
commit b6c683298b
22 changed files with 133 additions and 357 deletions
+24
View File
@@ -178,6 +178,30 @@ func load_data(filename: String, password: String) -> Dictionary:
return E.decode(data)
## Preserve a structurally readable but game-incompatible save, then allow the
## already initialized fresh session to use the original filename.
func archive_incompatible_save(filename: String) -> bool:
flush_saves()
var path: String = save_directory.path_join(E.add(filename, ".adventure"))
if not FileAccess.file_exists(path):
blocked_saves.erase(filename)
last_error = ""
return true
var archive: String = E.add(path, ".incompatible.bak")
var index: int = 0
while FileAccess.file_exists(archive):
index = E.add(index, 1)
archive = E.add(E.add(path, ".incompatible.bak."), str(index))
var error: Error = DirAccess.rename_absolute(path, archive)
if E.ne(error, OK):
blocked_saves[filename] = true
return _fail(E.add("Cannot archive incompatible save: ", error_string(error)))
blocked_saves.erase(filename)
last_error = ""
push_warning(E.add(E.add("Incompatible save preserved at ", archive), "; starting a new game."))
return true
static func _number(value: Variant, whole: bool = false, nonnegative: bool = true) -> bool:
return E.numeric(value) and E.finite(value) and (not value is float or absf(value) < 1e28) and (not whole or E.eq(value, E.floor_value(value))) and (not nonnegative or E.ge(value, 0))