载入中...
搜索中...
未找到
NpcAiECS.cpp
浏览该文件的文档.
1#include "npc_ai/NpcAiECS.h"
2
3#include <array>
4
5namespace eve::npc_ai {
6
8 auto created = world.createAgent(behaviorId);
9 if (!created.ok()) return Result<NpcAgentState>::failure(created.status());
11}
12
24
25std::span<const NpcAiSystemContract> npcAiSystemContracts() noexcept {
26 static constexpr std::array<NpcAiSystemContract, 1> contracts{{
27 {"npc_ai.decision_projection", "caller-selected gameplay short root",
28 "View<EntityRoot, NpcAgentState, NpcAiProjection>", "NpcAgentState; injected TickContext",
29 "NpcAiProjection; module-owned NpcAiWorld", "none", "AI trace/signals inside NpcAiWorld",
30 "NpcAiWorld and owned task providers", "GameplayDecision",
31 "stable handle order; injected tick/dt; provider-defined tolerance"},
32 }};
33 return contracts;
34}
35
36} // namespace eve::npc_ai
World3D * world
int created
Move-only operation result carrying either a value or Status.
Definition Result.h:155
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:164
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:175
constexpr bool isValid() const noexcept
Returns whether both coordinates are usable handle values.
static constexpr RuntimeHandle invalid() noexcept
Returns the canonical invalid handle.
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.h:81
Authoritative owner and deterministic scheduler for NPC AI agents.
Definition NpcAi.h:216
std::span< const NpcAiSystemContract > npcAiSystemContracts() noexcept
Returns immutable process-lifetime metadata for the NPC AI ECS phase.
Definition NpcAiECS.cpp:25
static Result< NpcAgentState > create(NpcAiWorld &world, std::string_view behaviorId)
Creates the canonical module-owned agent referenced by this component.
Definition NpcAiECS.cpp:7
Result< void > releaseAgent(NpcAiWorld &world)
Releases the owned agent once and clears this component's handle.
Definition NpcAiECS.cpp:13