feat: added configurationwarnings to AlwaysSuccess

This commit is contained in:
Sara Gerretsen 2026-03-12 21:43:52 +01:00
parent 964bcc1217
commit 78db4ffa07
2 changed files with 11 additions and 0 deletions

View file

@ -1,8 +1,17 @@
#include "decorator_nodes.h"
#include "behaviour_nodes/behaviour_node.h"
#include "core/variant/variant.h"
void BehaviourAlwaysSuccess::_bind_methods() {}
PackedStringArray BehaviourAlwaysSuccess::get_configuration_warnings() const {
PackedStringArray warnings{ super_type::get_configuration_warnings() };
if (get_child_behaviours().size() != 1) {
warnings.push_back("BehaviourAlwaysSuccess should have exactly one child");
}
return warnings;
}
void BehaviourAlwaysSuccess::execute() {
if (get_child_behaviours().is_empty()) {
set_status(Fail);

View file

@ -2,12 +2,14 @@
#include "behaviour_nodes/behaviour_composite.h"
#include "behaviour_nodes/behaviour_node.h"
#include "core/variant/variant.h"
class BehaviourAlwaysSuccess : public BehaviourComposite {
GDCLASS(BehaviourAlwaysSuccess, BehaviourComposite);
static void _bind_methods();
public:
PackedStringArray get_configuration_warnings() const override;
void execute() override;
BehaviourNode *get_next() override;
};