Rename to Work-Death Balance, add mascot favicon and rebalance rifle/grenade damage

This commit is contained in:
enne2
2026-10-15 17:15:16 +02:00
parent 2606fc5cc2
commit 21a1d5bf79
22 changed files with 352 additions and 39 deletions
+15 -2
View File
@@ -5,6 +5,7 @@ extends RefCounted
## IndexedDB di Godot puo' non essere sincronizzata). Chiavi: zombie_fps_*.
## Il nome, una volta scelto, resta bloccato: non viene piu' richiesto.
const PATH := "user://zombie_fps_profile.cfg"
const LEGACY_PROJECT_NAME := "Zombie Room FPS"
const DEFAULT_NAME := "Giocatore"
const NAME_MAX := 16
const KEY_NAME := "zombie_fps_name"
@@ -14,10 +15,19 @@ const KEY_LOCKED := "zombie_fps_locked"
## Legge il profilo (o i valori predefiniti) e lo riscrive, cosi' il primo avvio
## lascia sempre un id stabile e le chiavi del browser allineate.
static func load_profile(path := PATH) -> Dictionary:
static func load_profile(path := PATH, legacy_path := "") -> Dictionary:
var data := {"name": DEFAULT_NAME, "player_id": "", "best": 0, "locked": false}
var config := ConfigFile.new()
if config.load(path) == OK:
var loaded := config.load(path)
# Renaming application/config/name moves native user://. Import the old file
# only when the new one does not exist; never change/delete the source profile.
# Explicit legacy_path enables isolated migration tests using temporary files.
if loaded != OK and not FileAccess.file_exists(path):
if legacy_path == "" and path == PATH and not OS.has_feature("web"):
legacy_path = legacy_profile_path()
if legacy_path != "" and legacy_path != ProjectSettings.globalize_path(path):
loaded = config.load(legacy_path)
if loaded == OK:
var raw_name := text_of(config.get_value("player", "name", DEFAULT_NAME))
# Una versione precedente poteva salvare la stringa "null": in quel caso il
# nome va considerato non scelto e il blocco rimosso (riparazione automatica).
@@ -35,6 +45,9 @@ static func load_profile(path := PATH) -> Dictionary:
save_profile(data, path)
return data
static func legacy_profile_path() -> String:
return OS.get_user_data_dir().get_base_dir().path_join(LEGACY_PROJECT_NAME).path_join(PATH.get_file())
static func save_profile(data: Dictionary, path := PATH) -> void:
var raw_name := text_of(data.get("name"))
var name := sanitize_name(raw_name) if is_stored_name_usable(raw_name) else DEFAULT_NAME