Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix limiter node behaviour #250

Merged
merged 8 commits into from
Nov 17, 2023
Merged

🐛 fix limiter node behaviour #250

merged 8 commits into from
Nov 17, 2023

Conversation

bitbrain
Copy link
Owner

Closes #247

@@ -124,6 +124,8 @@ func _physics_process(delta: float) -> void:


func tick() -> int:
if actor == null:
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there was a scenario where you can set a null actor on a behaviour tree. In this case, the tree should not break the game but show a configuration warning.

@@ -10,7 +10,10 @@ class_name LimiterDecorator extends Decorator
@export var max_count : float = 0

func tick(actor: Node, blackboard: Blackboard) -> int:
var child = self.get_child(0)
if not get_child_count():
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if for whatever reason there is no child node added to this node, we should skip this behaviour (and show a configuration warning)



func tick(actor: Node, blackboard: Blackboard) -> int:
if not get_child_count():
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if for whatever reason there is no child node added to this node, we should skip this behaviour (and show a configuration warning)

return

if self.get_child_count() < 1:
push_warning("BehaviorTree Error: Composite %s should have at least one child (NodePath: %s)" % [self.name, self.get_path()])
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_get_configuration_warnings should be sufficient. No need to spam the console

@bitbrain
Copy link
Owner Author

@rxlecky I have adjusted the PR - it was previously not clear when exactly a TimeLimiter and Limiter would work. I clarified in the docs that it only works with children that return RUNNING and in other cases it resets.

@bitbrain bitbrain merged commit ac045a5 into godot-4.x Nov 17, 2023
3 checks passed
@bitbrain bitbrain deleted the fix-limiter-nodes branch November 17, 2023 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limiter and TimeLimiter exhibit inconsistent behaviour
2 participants