replace string with string name for collectible_id
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
extends Node
|
||||
|
||||
signal on_collectible_unlocked(collectible_id: String)
|
||||
signal on_collectible_unlocked(collectible_id: StringName)
|
||||
signal on_photo_saved(filePath: String)
|
||||
|
||||
var collectibles_library: CollectibleLibrary = preload("res://core/photo_mode/data/collectible_library.tres")
|
||||
|
||||
var unlocked_collectibles_ids: Array[String] = []
|
||||
var unlocked_collectibles_ids: Array[StringName] = []
|
||||
var saved_photos: Array[String] = []
|
||||
|
||||
func _ready() -> void:
|
||||
load_save_data()
|
||||
|
||||
func unlock_collectible(collectible_id: String) -> void:
|
||||
func unlock_collectible(collectible_id: StringName) -> void:
|
||||
if not collectible_id in unlocked_collectibles_ids:
|
||||
var new_collectible = get_collectible_by_id(collectible_id)
|
||||
if new_collectible:
|
||||
@@ -19,7 +19,7 @@ func unlock_collectible(collectible_id: String) -> void:
|
||||
sync_save_data()
|
||||
on_collectible_unlocked.emit(collectible_id)
|
||||
|
||||
func get_collectible_by_id(id: String) -> CollectibleResource:
|
||||
func get_collectible_by_id(id: StringName) -> CollectibleResource:
|
||||
for collectible in collectibles_library.collectibles:
|
||||
if collectible.id == id:
|
||||
return collectible
|
||||
@@ -28,7 +28,7 @@ func get_collectible_by_id(id: String) -> CollectibleResource:
|
||||
func get_all_collectibles() -> Array[CollectibleResource]:
|
||||
return collectibles_library.collectibles
|
||||
|
||||
func get_unlocked_collectible_ids() -> Array[String]:
|
||||
func get_unlocked_collectible_ids() -> Array[StringName]:
|
||||
return unlocked_collectibles_ids
|
||||
|
||||
func save_photo_to_disk_async() -> void:
|
||||
@@ -55,6 +55,6 @@ func load_save_data() -> void:
|
||||
saved_photos = GameState.save_data.saved_photos.duplicate()
|
||||
|
||||
if unlocked_collectibles_ids.is_empty() and saved_photos.is_empty():
|
||||
unlocked_collectibles_ids.append("cane")
|
||||
unlocked_collectibles_ids.append(&"cane")
|
||||
|
||||
sync_save_data()
|
||||
|
||||
Reference in New Issue
Block a user