Clean progression initialization

This commit is contained in:
Adrien Ufferte
2025-06-25 09:46:38 +02:00
parent 7e798a193e
commit 7d5f524d5c
2 changed files with 2 additions and 13 deletions
+1 -11
View File
@@ -18,9 +18,7 @@ func _init() -> void:
init_unlocks()
# Make sure the unlocks are correct
func init_unlocks() -> bool:
var has_changes: bool = false
func init_unlocks() -> void:
if not unlocks:
unlocks = {}
@@ -41,17 +39,9 @@ func init_unlocks() -> bool:
while unlocks.size() > number_of_lessons:
unlocks.erase(unlocks.size())
has_changes = true
# Make sure that the first garden is always accessible
if unlocks[1]["look_and_learn"] == Status.Locked:
unlocks[1]["look_and_learn"] = Status.Unlocked
has_changes = true
if has_changes:
last_modified = Time.get_datetime_string_from_system(true)
return has_changes
func get_max_unlocked_lesson_index() -> int:
+1 -2
View File
@@ -428,8 +428,7 @@ func _load_student_progression() -> void:
DirAccess.make_dir_recursive_absolute(get_student_folder())
_save_student_progression()
if student_progression.init_unlocks():
_save_student_progression()
student_progression.init_unlocks()
student_progression.unlocks_changed.connect(_on_user_progression_unlocks_changed)
func _save_student_progression() -> void: