Gameplay-facing 2D candidate query service; it never values or selects targets. 更多...
#include <Sensing.h>
Public 成员函数 | |
| eve::Result< void > | upsert (std::string_view id, float x, float y, std::string_view faction, std::string_view tagsCsv, std::string_view visibleToCsv) |
| Inserts or replaces mirrored facts. CSV fields contain comma-separated stable keys. | |
| eve::Result< void > | remove (std::string_view id) |
| Removes mirrored facts, or returns NotFound when the id is absent. | |
| eve::Result< void > | setZones (std::string_view id, std::string_view zonesCsv) |
| Replaces logical zone membership for an existing subject. | |
| eve::Result< void > | setSpatialIndexEnabled (bool enabled, float cellSize=64.f) |
| Enables or disables an optional SpatialHash2D broadphase (off by default). | |
| bool | spatialIndexEnabled () const noexcept |
| Reports whether the optional spatial broadphase is active. | |
| eve::Result< CandidateQueryResult > | query (const QueryOrigin &origin, const QuerySpec &spec) |
| Runs a configurable candidate query. | |
| eve::Result< int > | circle (float x, float y, float radius, std::string_view requireTagsCsv, std::string_view excludeTagsCsv, std::string_view includeFactionsCsv, std::string_view excludeFactionsCsv, std::string_view visibleTo, int limit) |
| Queries a circle. Filters are CSV; empty fields disable that filter. | |
| eve::Result< int > | box (float minX, float minY, float maxX, float maxY, std::string_view requireTagsCsv, std::string_view excludeTagsCsv, std::string_view includeFactionsCsv, std::string_view excludeFactionsCsv, std::string_view visibleTo, int limit) |
| Queries an axis-aligned box with the same filters as circle(). | |
| eve::Result< int > | executePreset (std::string_view presetId, float originX, float originY, float dirX, float dirY) |
| Runs a registered TargetingPreset against this world and refreshes resultAt(). | |
| eve::OptionalRef< const Candidate > | resultAt (int index) const |
| Returns a candidate from the most recent query, or null for an invalid index. | |
| std::string | debugLastQueryJson () const |
| Deterministic JSON dump of the last successful query for MCP/debug overlays. | |
| std::string | snapshotJson () const |
| Exports deterministic JSON. | |
| eve::Result< void > | restoreJson (const std::string &json) |
| Restores a snapshot transactionally. | |
| const std::map< std::string, Subject > & | subjects () const noexcept |
| Returns a borrowed view of stored subjects for adapters; valid until mutation. | |
| SensingWorld ()=default | |
| ~SensingWorld ()=default | |
| Sensing world. | |
| SensingWorld (const SensingWorld &)=delete | |
| SensingWorld & | operator= (const SensingWorld &)=delete |
| SensingWorld (SensingWorld &&) noexcept=default | |
| Sensing world. | |
| SensingWorld & | operator= (SensingWorld &&) noexcept=default |
| Operator =. | |
详细描述
Gameplay-facing 2D candidate query service; it never values or selects targets.
构造及析构函数说明
◆ SensingWorld() [1/3]
|
default |
◆ ~SensingWorld()
|
default |
Sensing world.
◆ SensingWorld() [2/3]
|
delete |
◆ SensingWorld() [3/3]
|
defaultnoexcept |
Sensing world.
成员函数说明
◆ box()
| eve::Result< int > eve::sensing::SensingWorld::box | ( | float | minX, |
| float | minY, | ||
| float | maxX, | ||
| float | maxY, | ||
| std::string_view | requireTagsCsv, | ||
| std::string_view | excludeTagsCsv, | ||
| std::string_view | includeFactionsCsv, | ||
| std::string_view | excludeFactionsCsv, | ||
| std::string_view | visibleTo, | ||
| int | limit | ||
| ) |
Queries an axis-aligned box with the same filters as circle().
在文件 Sensing.cpp 第 495 行定义.
引用了 a, b, c, d, eve::Result< T >::failure(), limit, query(), r, size, eve::Result< T >::success() , 以及 v.
◆ circle()
| eve::Result< int > eve::sensing::SensingWorld::circle | ( | float | x, |
| float | y, | ||
| float | radius, | ||
| std::string_view | requireTagsCsv, | ||
| std::string_view | excludeTagsCsv, | ||
| std::string_view | includeFactionsCsv, | ||
| std::string_view | excludeFactionsCsv, | ||
| std::string_view | visibleTo, | ||
| int | limit | ||
| ) |
Queries a circle. Filters are CSV; empty fields disable that filter.
在文件 Sensing.cpp 第 486 行定义.
引用了 eve::Result< T >::failure(), limit, query(), r, radius, size, eve::Result< T >::success(), v, x , 以及 y.
◆ debugLastQueryJson()
| std::string eve::sensing::SensingWorld::debugLastQueryJson | ( | ) | const |
Deterministic JSON dump of the last successful query for MCP/debug overlays.
- 返回
- Schema
eve.sensing.lastQuerywith origin, shape, spatial stats, and ranked scores.
- 备注
- Empty ranked list when no query has succeeded yet. Does not assign primary.
在文件 Sensing.cpp 第 526 行定义.
◆ executePreset()
| eve::Result< int > eve::sensing::SensingWorld::executePreset | ( | std::string_view | presetId, |
| float | originX, | ||
| float | originY, | ||
| float | dirX, | ||
| float | dirY | ||
| ) |
Runs a registered TargetingPreset against this world and refreshes resultAt().
- 参数
-
presetId Stable preset id (e.g. "sensing.builtin.coneSelect"). originX Origin X used as QueryOrigin and cone apex. originY Origin Y used as QueryOrigin and cone apex. dirX Forward X for cone filter tasks (normalized on use). dirY Forward Y for cone filter tasks (normalized on use).
- 返回
- Number of ranked candidates, or a structured failure. @thread Call on the sensing world's owning simulation thread.
在文件 Sensing.cpp 第 506 行定义.
引用了 context, count, eve::sensing::TargetingPipeline::executePreset(), eve::Result< T >::failure(), eve::sensing::TargetingPipeline::sharedBuiltins(), eve::Result< T >::success() , 以及 eve::sensing::TargetingSourceContext::world.
◆ operator=() [1/2]
|
delete |
◆ operator=() [2/2]
|
defaultnoexcept |
Operator =.
◆ query()
| eve::Result< CandidateQueryResult > eve::sensing::SensingWorld::query | ( | const QueryOrigin & | origin, |
| const QuerySpec & | spec | ||
| ) |
Runs a configurable candidate query.
- 返回
- Owning ranked candidates, or a structured failure.
- 备注
- Also refreshes the resultAt() cache to match ranked() order. @thread Call on the sensing world's owning simulation thread.
在文件 Sensing.cpp 第 406 行定义.
引用了 a, accepts, b, eve::sensing::QuerySpec::countPolicy, distance, eve::sensing::RankedCandidate::distance, eve::sensing::DistanceAscending, eve::Diagnostic::error(), eve::Result< T >::failure(), finite, eve::sensing::RankedCandidate::id, eve::InvalidArgument, eve::sensing::QuerySpec::maxCount, eve::sensing::QuerySpec::maxRange, eve::sensing::QuerySpec::minCount, origin, eve::PreconditionViolation, eve::sensing::RankedCandidate::score, eve::sensing::RankedCandidate::scoreReason, eve::sensing::QuerySpec::shape, eve::sensing::QuerySpec::sortKey, subject, eve::Result< T >::success(), eve::sensing::TruncateToMax, valid, eve::sensing::QuerySpec::validate(), value, eve::sensing::RankedCandidate::x , 以及 eve::sensing::RankedCandidate::y.
被这些函数引用 box(), circle() , 以及 eve::sensing::SensingWorldCandidateProvider::query().
◆ remove()
| eve::Result< void > eve::sensing::SensingWorld::remove | ( | std::string_view | id | ) |
Removes mirrored facts, or returns NotFound when the id is absent.
在文件 Sensing.cpp 第 251 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), key, eve::NotFound, eve::Status::success() , 以及 eve::Result< T >::success().
被这些函数引用 eve::rts::CombatFireSystem::step().
◆ restoreJson()
| eve::Result< void > eve::sensing::SensingWorld::restoreJson | ( | const std::string & | json | ) |
Restores a snapshot transactionally.
在文件 Sensing.cpp 第 562 行定义.
引用了 a, d, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, n, eve::json::Document::parse(), eve::ParseError, subject, eve::Result< T >::success() , 以及 v.
◆ resultAt()
| eve::OptionalRef< const Candidate > eve::sensing::SensingWorld::resultAt | ( | int | index | ) | const |
Returns a candidate from the most recent query, or null for an invalid index.
- 返回
- Borrowed nullable candidate owned by the query result cache. @ownership SensingWorld owns the candidate cache; callers must not delete or mutate it. @lifetime Valid until the next query/circle/box, restore, or world destruction; copy it for later use. @thread Call on the sensing world's owning simulation thread. @reentrancy Do not retain across a callback or another query.
在文件 Sensing.cpp 第 522 行定义.
◆ setSpatialIndexEnabled()
| eve::Result< void > eve::sensing::SensingWorld::setSpatialIndexEnabled | ( | bool | enabled, |
| float | cellSize = 64.f |
||
| ) |
Enables or disables an optional SpatialHash2D broadphase (off by default).
- 参数
-
enabled When true, rebuilds the index from current subjects. cellSize Uniform grid cell size; must be finite and > 0 when enabling.
- 返回
- Applied on success, or InvalidArgument when cellSize is invalid.
- 备注
- Filtering/sorting remain QuerySpec-owned; the hash only culls candidates. @thread Call on the sensing world's owning simulation thread.
在文件 Sensing.cpp 第 282 行定义.
引用了 eve::Applied, enabled, eve::Diagnostic::error(), eve::Result< T >::failure(), finite, eve::InvalidArgument, eve::Status::success() , 以及 eve::Result< T >::success().
◆ setZones()
| eve::Result< void > eve::sensing::SensingWorld::setZones | ( | std::string_view | id, |
| std::string_view | zonesCsv | ||
| ) |
Replaces logical zone membership for an existing subject.
- 参数
-
id Subject id that must already be registered. zonesCsv Comma-separated LogicalId texts (e.g. "arena:central"); empty clears membership.
- 返回
- Applied on success, NotFound when absent, or InvalidArgument for empty/invalid zone ids. @thread Call on the sensing world's owning simulation thread.
在文件 Sensing.cpp 第 261 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, key, eve::NotFound, eve::LogicalId::parse(), eve::Status::success() , 以及 eve::Result< T >::success().
◆ snapshotJson()
| std::string eve::sensing::SensingWorld::snapshotJson | ( | ) | const |
◆ spatialIndexEnabled()
|
noexcept |
Reports whether the optional spatial broadphase is active.
在文件 Sensing.cpp 第 298 行定义.
◆ subjects()
|
inlinenoexcept |
Returns a borrowed view of stored subjects for adapters; valid until mutation.
被这些函数引用 eve::sensing::SensingWorldCandidateProvider::query().
◆ upsert()
| eve::Result< void > eve::sensing::SensingWorld::upsert | ( | std::string_view | id, |
| float | x, | ||
| float | y, | ||
| std::string_view | faction, | ||
| std::string_view | tagsCsv, | ||
| std::string_view | visibleToCsv | ||
| ) |
Inserts or replaces mirrored facts. CSV fields contain comma-separated stable keys.
在文件 Sensing.cpp 第 238 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), f, eve::Result< T >::failure(), finite, eve::InvalidArgument, subject, eve::Status::success(), eve::Result< T >::success(), t, v, x , 以及 y.
被这些函数引用 eve::rts::CombatFireSystem::step().
该类的文档由以下文件生成:
- src/modules/sensing/Sensing.h
- src/modules/sensing/Sensing.cpp