2023-08-15 11:09:18 +00:00
|
|
|
/**
|
|
|
|
* bt_call_method.h
|
|
|
|
* =============================================================================
|
2024-03-04 11:49:09 +00:00
|
|
|
* 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"
|
2024-01-15 20:51:17 +00:00
|
|
|
#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:
|
2023-08-28 17:24:55 +00:00
|
|
|
StringName method;
|
2023-08-15 11:09:18 +00:00
|
|
|
Ref<BBNode> node_param;
|
2024-01-15 20:51:17 +00:00
|
|
|
TypedArray<BBVariant> args;
|
2023-12-27 18:43:54 +00:00
|
|
|
bool include_delta = false;
|
2024-03-04 11:49:09 +00:00
|
|
|
StringName result_var;
|
2023-08-15 11:09:18 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2024-01-06 23:47:46 +00:00
|
|
|
virtual String _generate_name() override;
|
2023-09-19 11:43:26 +00:00
|
|
|
virtual Status _tick(double p_delta) override;
|
2023-08-15 11:09:18 +00:00
|
|
|
|
|
|
|
public:
|
2024-03-04 11:49:09 +00:00
|
|
|
void set_method(const StringName &p_method_name);
|
2023-08-28 17:24:55 +00:00
|
|
|
StringName get_method() const { return method; }
|
2023-08-15 11:09:18 +00:00
|
|
|
|
2024-03-04 11:49:09 +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; }
|
|
|
|
|
2024-01-15 20:51:17 +00:00
|
|
|
void set_args(TypedArray<BBVariant> p_args);
|
|
|
|
TypedArray<BBVariant> get_args() const { return args; }
|
2023-08-15 11:09:18 +00:00
|
|
|
|
2023-12-27 18:43:54 +00:00
|
|
|
void set_include_delta(bool p_include_delta);
|
|
|
|
bool is_delta_included() const { return include_delta; }
|
|
|
|
|
2024-03-04 11:49:09 +00:00
|
|
|
void set_result_var(const StringName &p_result_var);
|
|
|
|
StringName get_result_var() const { return result_var; }
|
2024-01-15 16:03:52 +00:00
|
|
|
|
2024-01-06 23:47:46 +00:00
|
|
|
virtual PackedStringArray get_configuration_warnings() override;
|
2023-12-28 13:26:39 +00:00
|
|
|
|
|
|
|
BTCallMethod();
|
2023-08-15 11:09:18 +00:00
|
|
|
};
|
|
|
|
|
2024-01-13 16:10:42 +00:00
|
|
|
#endif // BT_CALL_METHOD_H
|