18#include "../../AtomicTaskRegistry.h"
19#include "../../LocalBlackboard.h"
20#include "../../../system/system_utils.h"
41 SYSTEM_LOG <<
"[Task_RequestPathfinding] Abort() - cancelling request "
72 SYSTEM_LOG <<
"[Task_RequestPathfinding] 'Position' key not found in LocalBlackboard\n";
81 catch (
const std::exception&
e)
83 SYSTEM_LOG <<
"[Task_RequestPathfinding] Failed to read 'Position': " <<
e.what() <<
"\n";
93 SYSTEM_LOG <<
"[Task_RequestPathfinding] Missing or invalid 'Target' parameter\n";
96 target =
it->second.AsVector();
102 auto it =
params.find(
"AsyncDelay");
113 SYSTEM_LOG <<
"[Task_RequestPathfinding] 'Path' key not found in LocalBlackboard\n";
121 SYSTEM_LOG <<
"[Task_RequestPathfinding] Entity " <<
ctx.Entity
123 <<
" from (" << start.
x <<
"," << start.
y <<
")"
124 <<
" to (" << target.
x <<
"," << target.
y <<
")\n";
133 SYSTEM_LOG <<
"[Task_RequestPathfinding] Entity " <<
ctx.Entity
150 catch (
const std::exception&
e)
152 SYSTEM_LOG <<
"[Task_RequestPathfinding] Failed to write 'Path': " <<
e.what() <<
"\n";
156 SYSTEM_LOG <<
"[Task_RequestPathfinding] Entity " <<
ctx.Entity
157 <<
" path ready: " << path <<
" - Success\n";
#define REGISTER_ATOMIC_TASK(ClassName, Id)
Registers a factory for ClassName under Id at static init time.
ComponentTypeID GetComponentTypeID_Static()
Atomic task that asynchronously requests a path via PathfindingManager.
std::unordered_map< std::string, TaskValue > ParameterMap
Convenience alias for the parameter map passed to Execute().
Singleton async pathfinding request manager.
static constexpr RequestID INVALID_REQUEST_ID
Sentinel value for an invalid / unsubmitted request.
static PathfindingManager & Get()
Returns the singleton PathfindingManager instance.
void Cancel(RequestID id)
Cancels a pending request and removes its entry.
RequestID Request(const ::Vector &start, const ::Vector &target, float delaySeconds=0.0f)
Submits an async pathfinding request.
std::string GetPathString(RequestID id)
Returns the path string computed for id.
C++14-compliant type-safe value container for task parameters.
Async pathfinding task that polls PathfindingManager for completion.
Task_RequestPathfinding()
void Abort() override
Aborts the task, releasing any in-progress state.
TaskStatus Execute(const ParameterMap ¶ms) override
Executes the atomic task for one frame.
TaskStatus ExecuteWithContext(const AtomicTaskContext &ctx, const ParameterMap ¶ms) override
Executes the atomic task for one frame with full runtime context.
PathfindingManager::RequestID m_requestID
Active request ID (0 = none)
bool m_hasRequest
True after first-tick submission.
< Provides AssetID and INVALID_ASSET_ID
@ Float
Single-precision float.
@ Vector
3-component vector (Vector from vector.h)
TaskStatus
Result code returned by IAtomicTask::Execute().
@ Success
Task completed successfully.
@ Running
Task is still in progress (multi-frame tasks)
static const char * BB_KEY_POSITION
static const char * BB_KEY_PATH
Lightweight context bundle passed to IAtomicTask::ExecuteWithContext().