2023-07-21 09:50:06 +00:00
|
|
|
/**
|
|
|
|
* limbo_debugger.h
|
|
|
|
* =============================================================================
|
|
|
|
* Copyright 2021-2023 Serhii Snitsaruk
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
* =============================================================================
|
|
|
|
*/
|
2023-04-13 07:29:45 +00:00
|
|
|
|
|
|
|
#ifndef LIMBO_DEBUGGER_H
|
|
|
|
#define LIMBO_DEBUGGER_H
|
|
|
|
|
2023-08-15 15:49:13 +00:00
|
|
|
#include "modules/limboai/bt/tasks/bt_task.h"
|
2023-07-20 16:35:36 +00:00
|
|
|
|
2023-04-13 07:29:45 +00:00
|
|
|
#include "core/object/class_db.h"
|
|
|
|
#include "core/object/object.h"
|
|
|
|
#include "core/string/node_path.h"
|
|
|
|
|
|
|
|
class LimboDebugger : public Object {
|
|
|
|
GDCLASS(LimboDebugger, Object);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static LimboDebugger *singleton;
|
|
|
|
|
|
|
|
LimboDebugger();
|
|
|
|
|
|
|
|
public:
|
|
|
|
static void initialize();
|
|
|
|
static void deinitialize();
|
|
|
|
static LimboDebugger *get_singleton();
|
|
|
|
|
|
|
|
~LimboDebugger();
|
|
|
|
|
|
|
|
#ifdef DEBUG_ENABLED
|
|
|
|
private:
|
|
|
|
HashMap<NodePath, Ref<BTTask>> active_trees;
|
2023-12-12 22:37:28 +00:00
|
|
|
NodePath tracked_player;
|
|
|
|
String bt_resource_path;
|
2023-04-13 07:29:45 +00:00
|
|
|
bool session_active = false;
|
|
|
|
|
|
|
|
void _track_tree(NodePath p_path);
|
|
|
|
void _untrack_tree();
|
2023-04-15 07:01:37 +00:00
|
|
|
void _send_active_bt_players();
|
2023-04-13 07:29:45 +00:00
|
|
|
|
|
|
|
void _on_bt_updated(int status, NodePath p_path);
|
|
|
|
void _on_state_updated(float _delta, NodePath p_path);
|
|
|
|
|
|
|
|
public:
|
|
|
|
static Error parse_message(void *p_user, const String &p_msg, const Array &p_args, bool &r_captured);
|
|
|
|
|
2023-04-15 08:53:57 +00:00
|
|
|
void register_bt_instance(Ref<BTTask> p_instance, NodePath p_player_path);
|
|
|
|
void unregister_bt_instance(Ref<BTTask> p_instance, NodePath p_player_path);
|
2023-04-13 07:29:45 +00:00
|
|
|
|
|
|
|
#endif // DEBUG_ENABLED
|
|
|
|
};
|
|
|
|
#endif // LIMBO_DEBUGGER
|