载入中...
搜索中...
未找到
CrowdBatchBindings.cpp
浏览该文件的文档.
10 if (value.getType() != ssq::Type::INTEGER) throw ssq::TypeException("Agent reference needs integer fields");
39 {"movement", Value(Value::Object{{"classId", Value(std::to_string(state.movement.movement.value()))},
58 if (flow && defaultFlow) throw ssq::TypeException("flowRequest and useDefaultFlow cannot be combined");
66 if (auto item = optionalField<ssq::Table>(table, "movement")) update.movement = parseMovementBinding(*item);
75 update.interaction = {item->get<float>("pushability"), item->get<bool>("holdPosition"), item->get<int>("layer"),
78 if (auto item = optionalField<ssq::Table>(table, "policy")) update.policy = parseInteractionPolicy(*item);
92 update.intent = {mode, item->get<bool>("hasTarget"), item->get<float>("targetX"), item->get<float>("targetY")};
98 return Result<T>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, error.what(), "agentBatch"));
105 Value::Object{{"reference", projectReference(entry.reference)}, {"state", projectState(entry.state)}});
113 const auto identity = integerField(table, "classId"), revision = integerField(table, "revision");
116 return {MovementClassId(static_cast<std::uint64_t>(identity)), static_cast<std::uint64_t>(revision)};
180 return script::projectResult(vm, malformed<StepReport>(error), [](StepReport) { return Value(); });
206 cls.addFunc("setInteractionPolicy", [vm = cls.getHandle()](Crowd* crowd, ssq::Table reference, ssq::Table policy) {
217 cls.addFunc("readInteractionPolicy", [vm = cls.getHandle()](Crowd* crowd, ssq::Table reference) {
276 cls.addFunc("relocateAgents", [vm = cls.getHandle()](Crowd* crowd, ssq::Array agents, int maxChecks) {
280 if (agents.size() > 1024) throw ssq::TypeException("Relocation batches support at most 1024 agents");
The single Squirrel projection for common Result, Status and Value.
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
static constexpr index_type invalidIndex
Reserved index value shared by all invalid handles.
Definition RuntimeHandle.h:124
Result< StepReport > advance(float dt)
Advance using bounded simultaneous integration and contact projection.
Definition CrowdAdvance.cpp:60
Definition Crowd.cpp:14
Result< FlowLease > resolveFlowRequestLease(Crowd &crowd, const ssq::Table &token)
Resolve a checked request-owned lease without retaining script table references.
Definition CrowdNavigationBindings.cpp:61
MovementBinding parseMovementBinding(const ssq::Table &table)
Decode exact integer movement identities; no floating-point identity coercion.
Definition CrowdBatchBindings.cpp:112
void exposeAgentBatches(ssq::Class &cls)
Compose public numeric identity/batch bindings without accessing private storage.
Definition CrowdBatchBindings.cpp:134
RuntimeHandle< CrowdAgentTag > AgentHandle
Generation-qualified runtime agent identity; never persist its packed representation.
Definition CrowdTypes.h:82
InteractionPolicy parseInteractionPolicy(ssq::Table table)
Decode a canonical policy at the script boundary; throws on missing or wrongly typed fields.
Definition CrowdBatchBindings.cpp:119
AgentAction
Strong locomotion intent; numeric values retain compatibility action codes.
Definition Crowd.h:153
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:27
Snapshot project(Files files, Object::Ptr stats, std::string defaultProjectId, std::string projectDir)
Build a candidate evidence graph without touching the published snapshot.
Definition ProjectIndexGraph.cpp:144
@ InvalidArgument
@ Object
Canonical independent predictive-steering and body-contact policy; both filters are symmetric.
Definition Crowd.h:145
Agent-owned selection of a provider-defined movement policy. Zero identity and revision mean compatib...
Definition CrowdTypes.h:27
Owning observations of one completed advance; simulation-thread only.
Definition Crowd.h:94