limboai/bt/tasks/utility/bt_call_method.h

59 lines
1.6 KiB
C
Raw Normal View History

2023-08-15 11:09:18 +00:00
/**
* bt_call_method.h
* =============================================================================
* Copyright 2021-2024 Serhii Snitsaruk
2023-08-15 11:09:18 +00:00
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE file or at
* https://opensource.org/licenses/MIT.
* =============================================================================
*/
#ifndef BT_CALL_METHOD_H
#define BT_CALL_METHOD_H
2023-08-15 15:49:13 +00:00
#include "../bt_action.h"
2023-08-15 11:09:18 +00:00
2024-01-10 22:26:24 +00:00
#include "../../../blackboard/bb_param/bb_node.h"
#include "../../../blackboard/bb_param/bb_variant.h"
2023-08-15 11:09:18 +00:00
class BTCallMethod : public BTAction {
GDCLASS(BTCallMethod, BTAction);
2023-09-20 08:40:16 +00:00
TASK_CATEGORY(Utility);
2023-08-15 11:09:18 +00:00
private:
StringName method;
2023-08-15 11:09:18 +00:00
Ref<BBNode> node_param;
TypedArray<BBVariant> args;
bool include_delta = false;
StringName result_var;
2023-08-15 11:09:18 +00:00
protected:
static void _bind_methods();
virtual String _generate_name() override;
virtual Status _tick(double p_delta) override;
2023-08-15 11:09:18 +00:00
public:
void set_method(const StringName &p_method_name);
StringName get_method() const { return method; }
2023-08-15 11:09:18 +00:00
void set_node_param(const Ref<BBNode> &p_object);
2023-08-15 11:09:18 +00:00
Ref<BBNode> get_node_param() const { return node_param; }
void set_args(TypedArray<BBVariant> p_args);
TypedArray<BBVariant> get_args() const { return args; }
2023-08-15 11:09:18 +00:00
void set_include_delta(bool p_include_delta);
bool is_delta_included() const { return include_delta; }
void set_result_var(const StringName &p_result_var);
StringName get_result_var() const { return result_var; }
virtual PackedStringArray get_configuration_warnings() override;
BTCallMethod();
2023-08-15 11:09:18 +00:00
};
2024-01-13 16:10:42 +00:00
#endif // BT_CALL_METHOD_H