bitbrain / beehave

🐝 behavior tree AI for Godot Engine
https://bitbra.in/beehave
MIT License
1.85k stars 116 forks source link

LimiterDecorator resets to zero and always runs child nodes #349

Closed hengyang-xiaobin closed 2 months ago

hengyang-xiaobin commented 2 months ago

Description: When cache_key is set to zero in before_run, the LimiterDecorator resets every run and executes child nodes repeatedly. Is this intended behavior?

Code Snippet:

func before_run(actor: Node, blackboard: Blackboard) -> void:
    blackboard.set_value(cache_key, 0, str(actor.get_instance_id()))
    if get_child_count() > 0:
        get_child(0).before_run(actor, blackboard)

Expected: Setting cache_key to zero should [describe what you expect to happen].

Actual: It resets and runs child nodes every time.