calls load_card

This commit is contained in:
Nathan Singer 2025-04-23 17:06:28 -04:00
parent a3fb627310
commit bf9244c2b7

View File

@ -21,12 +21,18 @@ func _card_error(error_type: String) -> String:
func _init(id) -> void:
card_id = id
func _ready() -> void:
var err = load_card()
if err == false:
push_error("Failed to load card.")
func load_card() -> bool:
var ondisk_card = FileAccess.open(
"user://card_cache/" + card_id + "/card.json", FileAccess.READ
)
if ondisk_card == null:
push_error("ERROR::CRITICAL::CACHE\nCard being accessed wasn't cached, yell at the coders plz")
return false
var card_json = JSON.parse_string(ondisk_card.get_as_text())
card_name = card_json["name"]