Improve BTComment
Warn user about having comment as root task or having other tasks as children
This commit is contained in:
parent
0ae2b6869a
commit
3f673c6865
|
@ -11,9 +11,22 @@
|
|||
|
||||
#include "bt_comment.h"
|
||||
|
||||
#include "bt_task.h"
|
||||
|
||||
Ref<BTTask> BTComment::clone() const {
|
||||
if (Engine::get_singleton()->is_editor_hint()) {
|
||||
return BTTask::clone();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PackedStringArray BTComment::get_configuration_warnings() const {
|
||||
PackedStringArray warnings = BTTask::get_configuration_warnings();
|
||||
if (get_child_count_excluding_comments() > 0) {
|
||||
warnings.append("Can only have other comment tasks as children.");
|
||||
}
|
||||
if (get_parent() == nullptr) {
|
||||
warnings.append("Can't be the root task.");
|
||||
}
|
||||
return warnings;
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ class BTComment : public BTTask {
|
|||
private:
|
||||
public:
|
||||
virtual Ref<BTTask> clone() const override;
|
||||
virtual PackedStringArray get_configuration_warnings() const override;
|
||||
};
|
||||
|
||||
#endif // BT_COMMENT
|
Loading…
Reference in New Issue