SelinaDev / Godot-Roguelike-Tutorial

Yet Another Roguelike Tutorial in Godot
MIT License
102 stars 11 forks source link

Bug with ConfusedEnemyAIComponent cannot be loaded properly #11

Closed Pastque closed 10 months ago

Pastque commented 10 months ago

<entity.gd -> restore(save_data: Dictionary)> ...

    if ai_component and save_data.has("ai_component"):
        var ai_data: Dictionary = save_data["ai_component"]
        if ai_data["type"] == "ConfusedEnemyAIComponent":
            var confused_enemy_ai := ConfusedEnemyAIComponent.new(ai_data["turns_remaining"])
            add_child(confused_enemy_ai)

... The third row " if ai_data["type"] == "ConfusedEnemyAIComponent": " corresponding <confused_enemy_ai_component.gd -> get_save_data()> " "type": "ConfusedEnemyAI", " ...

    return {
        "type": "ConfusedEnemyAI",
        "turns_remaining": turns_remaining
    }

...

" if ai_data["type"] == "ConfusedEnemyAIComponent": " in the <entity.gd -> restore()> function should be changed to " if ai_data["type"] == "ConfusedEnemyAI": "

(This is the first time I have raised issues on github, please forgive me if the format is wrong😊)

SelinaDev commented 10 months ago

Thank you! I just fixed that, confused enemies should reload properly now.