fix(core): resolve review findings in Sprint 3-4
- Fix SaveManager reset_game to use DirAccess.remove correctly - Add null check for FileAccess.open in save_game - Fix AudioManager crossfade tween callback chain - Replace fragile absolute HUD path with relative onready - Guard character position save against empty id - Add GameState.has_character_position helper - Emit room_changed signal after tween completes - Add target_floor validation in ElevatorButton - Persist audio settings via GameState - Add class_name to RoomNavigator, AudioManager, HUD Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ func save_game() -> void:
|
||||
var data: Dictionary = GameState.get_save_data()
|
||||
var file: FileAccess = FileAccess.open(SAVE_PATH, FileAccess.WRITE)
|
||||
if file == null:
|
||||
push_error("SaveManager: cannot open save file for writing")
|
||||
return
|
||||
file.store_string(JSON.stringify(data))
|
||||
file.close()
|
||||
@@ -32,7 +33,9 @@ func load_game() -> void:
|
||||
|
||||
func reset_game() -> void:
|
||||
if FileAccess.file_exists(SAVE_PATH):
|
||||
DirAccess.remove_absolute(SAVE_PATH)
|
||||
var dir: DirAccess = DirAccess.open("user://")
|
||||
if dir != null:
|
||||
dir.remove("savegame.json")
|
||||
GameState.apply_save_data({})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user