载入中...
搜索中...
未找到
ClimbingBindings.cpp
浏览该文件的文档.
1#include "climbing/Climbing.h"
4
7#include "physics/Body3D.h"
8#include "physics/World3D.h"
9
10#include <functional>
11#include <optional>
12#include <simplesquirrel/simplesquirrel.hpp>
13#include <utility>
14
15namespace eve::climbing {
16namespace {
17
18eve::Value vecValue(Vec3 value) { return eve::Value::object({{"x", value.x}, {"y", value.y}, {"z", value.z}}); }
19
20eve::Value candidateValue(ClimbingCandidate candidate) {
21 return eve::Value::object({
22 {"actionId", std::move(candidate.actionId)},
23 {"definitionGeneration", std::to_string(candidate.definitionGeneration)},
24 {"world", static_cast<std::int64_t>(candidate.world.packed())},
25 {"obstacleBody", static_cast<std::int64_t>(candidate.obstacleBody.packed())},
26 {"obstacleShape", static_cast<std::int64_t>(candidate.obstacleShape.packed())},
27 {"obstacleBodyId", candidate.obstacleBodyId},
28 {"obstacleShapeId", candidate.obstacleShapeId},
29 {"ignoredBodyId", candidate.ignoredBodyId},
30 {"frontPoint", vecValue(candidate.frontPoint)},
31 {"topPoint", vecValue(candidate.topPoint)},
32 {"landingFeet", vecValue(candidate.landingFeet)},
33 {"surfaceNormal", vecValue(candidate.surfaceNormal)},
34 {"surfaceTangent", vecValue(candidate.surfaceTangent)},
35 {"leftHandAnchor", vecValue(candidate.leftHandAnchor)},
36 {"rightHandAnchor", vecValue(candidate.rightHandAnchor)},
37 {"bodyLocalTop", vecValue(candidate.bodyLocalTop)},
38 {"bodyLocalLanding", vecValue(candidate.bodyLocalLanding)},
39 {"obstacleHeight", candidate.obstacleHeight},
40 {"obstacleDepth", candidate.obstacleDepth},
41 {"score", candidate.score},
42 {"kind", static_cast<std::int64_t>(candidate.kind)},
43 {"support", static_cast<std::int64_t>(candidate.support)},
44 });
45}
46
47const char* phaseName(ClimbingPhase phase) {
48 switch (phase) {
49 case ClimbingPhase::Idle: return "idle";
50 case ClimbingPhase::Requested: return "requested";
51 case ClimbingPhase::Aligning: return "aligning";
52 case ClimbingPhase::Launching: return "launching";
53 case ClimbingPhase::Climbing: return "climbing";
54 case ClimbingPhase::Landing: return "landing";
55 case ClimbingPhase::Recovering: return "recovering";
56 case ClimbingPhase::Hanging: return "hanging";
57 case ClimbingPhase::Dropping: return "dropping";
58 case ClimbingPhase::Completed: return "completed";
59 case ClimbingPhase::Cancelled: return "cancelled";
60 case ClimbingPhase::Failed: return "failed";
61 case ClimbingPhase::Balanced: return "balanced";
62 case ClimbingPhase::Swinging: return "swinging";
63 }
64 return "failed";
65}
66
67eve::Value eventBatchValue(std::vector<ClimbingEvent> events) { return climbingEventArrayValue(events); }
68
69eve::Value advanceValue(ClimbingAdvance advance) {
70 return eve::Value::object({
71 {"phase", phaseName(advance.phase)},
72 {"actionId", std::move(advance.actionId)},
73 {"feet", vecValue(advance.feet)},
74 {"desiredDelta", vecValue(advance.desiredDelta)},
75 {"actualDelta", vecValue(advance.actualDelta)},
76 {"warpResidual", vecValue(advance.warpResidual)},
77 {"normalizedTime", advance.normalizedTime},
78 {"constrained", advance.constrained},
79 {"grounded", advance.grounded},
80 {"support", static_cast<std::int64_t>(advance.support)},
81 {"leftHandAnchor", vecValue(advance.leftHandAnchor)},
82 {"rightHandAnchor", vecValue(advance.rightHandAnchor)},
83 {"contactWeight", advance.contactWeight},
84 {"leftHandWeight", advance.leftHandWeight},
85 {"rightHandWeight", advance.rightHandWeight},
86 {"leftFootAnchor", vecValue(advance.leftFootAnchor)},
87 {"rightFootAnchor", vecValue(advance.rightFootAnchor)},
88 {"hasLeftFootAnchor", advance.hasLeftFootAnchor},
89 {"hasRightFootAnchor", advance.hasRightFootAnchor},
90 {"leftFootWeight", advance.leftFootWeight},
91 {"rightFootWeight", advance.rightFootWeight},
92 {"pelvisWeight", advance.pelvisWeight},
93 {"compactCollisionRequested", advance.compactCollisionRequested},
94 {"compactCollisionActive", advance.compactCollisionActive},
95 {"branchWindowOpen", advance.branchWindowOpen},
96 {"branchComboTag", std::move(advance.branchComboTag)},
97 {"executionId", std::to_string(advance.executionId.value())},
98 {"appliedWarp", vecValue(advance.appliedWarp)},
99 {"desiredYawDelta", advance.desiredYawDelta},
100 {"cameraCueProfile", std::move(advance.cameraCueProfile)},
101 {"cameraCue", std::move(advance.cameraCue)},
102 {"animationClipId", std::move(advance.animationClipId)},
103 {"animationGraphNodeId", std::move(advance.animationGraphNodeId)},
104 {"animationMirrored", advance.animationMirrored},
105 {"terminalVelocity", vecValue(advance.terminalVelocity)},
106 {"hasTerminalVelocity", advance.hasTerminalVelocity},
107 });
108}
109
110eve::Value debugValue(ClimbingDebugSnapshot snapshot) {
112 candidates.reserve(snapshot.candidates.size());
113 for (auto& candidate : snapshot.candidates) candidates.push_back(candidateValue(std::move(candidate)));
114 eve::Value::Array queries;
115 queries.reserve(snapshot.queries.size());
116 for (auto& query : snapshot.queries)
117 queries.push_back(eve::Value::object({{"actionId", std::move(query.actionId)},
118 {"code", std::move(query.code)},
119 {"start", vecValue(query.start)},
120 {"end", vecValue(query.end)},
121 {"radius", query.radius},
122 {"height", query.height}}));
124 evidence.reserve(snapshot.evidence.size());
125 for (auto& item : snapshot.evidence)
126 evidence.push_back(eve::Value::object({{"actionId", std::move(item.actionId)},
127 {"code", std::move(item.code)},
128 {"biasCost", item.biasCost},
129 {"heightCost", item.heightCost},
130 {"distanceCost", item.distanceCost},
131 {"totalCost", item.totalCost}}));
132 eve::Value::Array motion;
133 motion.reserve(snapshot.motion.size());
134 for (const auto& item : snapshot.motion)
135 motion.push_back(eve::Value::object({{"tick", std::to_string(item.tick.value())},
136 {"plannedFeet", vecValue(item.plannedFeet)},
137 {"actualFeet", vecValue(item.actualFeet)},
138 {"residual", vecValue(item.residual)},
139 {"capsuleHeight", item.capsuleHeight},
140 {"constrained", item.constrained}}));
141 return eve::Value::object({
142 {"phase", phaseName(snapshot.phase)},
143 {"candidates", eve::Value(std::move(candidates))},
144 {"accumulatedWarpResidual", vecValue(snapshot.accumulatedWarpResidual)},
145 {"broadPhaseQueryCount", static_cast<std::int64_t>(snapshot.broadPhaseQueryCount)},
146 {"broadPhaseHitCount", static_cast<std::int64_t>(snapshot.broadPhaseHitCount)},
147 {"queryCount", static_cast<std::int64_t>(snapshot.queryCount)},
148 {"terminalCode", std::move(snapshot.terminalCode)},
149 {"executionId", static_cast<std::int64_t>(snapshot.executionId.value())},
150 {"queries", eve::Value(std::move(queries))},
151 {"evidence", eve::Value(std::move(evidence))},
152 {"motion", eve::Value(std::move(motion))},
153 });
154}
155
156std::optional<ClimbingActionKind> parseActionKind(std::string_view value) {
157 if (value == "vault") return ClimbingActionKind::Vault;
158 if (value == "mantle") return ClimbingActionKind::Mantle;
159 if (value == "ledge_grab") return ClimbingActionKind::LedgeGrab;
160 if (value == "climb_up") return ClimbingActionKind::ClimbUp;
161 if (value == "shimmy") return ClimbingActionKind::Shimmy;
162 if (value == "corner_inner") return ClimbingActionKind::CornerInner;
163 if (value == "corner_outer") return ClimbingActionKind::CornerOuter;
164 if (value == "ledge_jump") return ClimbingActionKind::LedgeJump;
165 if (value == "climb_down") return ClimbingActionKind::ClimbDown;
166 if (value == "ladder_mount") return ClimbingActionKind::LadderMount;
167 if (value == "ladder_climb") return ClimbingActionKind::LadderClimb;
168 if (value == "ladder_dismount") return ClimbingActionKind::LadderDismount;
169 if (value == "wall_run") return ClimbingActionKind::WallRun;
170 if (value == "slide") return ClimbingActionKind::Slide;
171 if (value == "beam_balance") return ClimbingActionKind::BeamBalance;
172 if (value == "pole_swing") return ClimbingActionKind::PoleSwing;
173 if (value == "bar_swing") return ClimbingActionKind::BarSwing;
174 return std::nullopt;
175}
176
177std::optional<ClimbingAnchorEdgeKind> parseAnchorEdgeKind(std::string_view value) {
178 if (value == "shimmy") return ClimbingAnchorEdgeKind::Shimmy;
179 if (value == "corner") return ClimbingAnchorEdgeKind::Corner;
180 if (value == "jump") return ClimbingAnchorEdgeKind::Jump;
181 if (value == "drop") return ClimbingAnchorEdgeKind::Drop;
182 if (value == "mount") return ClimbingAnchorEdgeKind::Mount;
183 if (value == "dismount") return ClimbingAnchorEdgeKind::Dismount;
184 if (value == "climb") return ClimbingAnchorEdgeKind::Climb;
185 if (value == "balance") return ClimbingAnchorEdgeKind::Balance;
186 if (value == "swing") return ClimbingAnchorEdgeKind::Swing;
187 return std::nullopt;
188}
189
190eve::Value anchorNodeValue(ClimbingAnchorNodeRef reference) {
191 return eve::Value::object({
192 {"graphId", std::move(reference.graphId)},
193 {"nodeId", std::move(reference.nodeId)},
194 {"graphGeneration", std::to_string(reference.graphGeneration)},
195 });
196}
197
198eve::Value graphReloadValue(ClimbingAnchorGraphReload reload) {
199 eve::Value::Array invalidated;
200 invalidated.reserve(reload.invalidatedOccupants.size());
201 for (const auto& occupant : reload.invalidatedOccupants)
202 invalidated.push_back(eve::Value::object({
203 {"agentId", std::to_string(occupant.agentId.value())},
204 {"executionId", std::to_string(occupant.executionId.value())},
205 }));
206 return eve::Value::object({
207 {"oldGeneration", std::to_string(reload.oldGeneration)},
208 {"newGeneration", std::to_string(reload.newGeneration)},
209 {"invalidatedOccupants", eve::Value(std::move(invalidated))},
210 });
211}
212
213const char* anchorEdgeKindName(ClimbingAnchorEdgeKind kind);
214
215eve::Value anchorRouteValue(ClimbingAnchorRoute route) {
217 nodes.reserve(route.nodes.size());
218 for (auto& node : route.nodes) nodes.push_back(anchorNodeValue(std::move(node)));
220 steps.reserve(route.steps.size());
221 for (auto& step : route.steps)
222 steps.push_back(eve::Value::object({
223 {"from", anchorNodeValue(std::move(step.from))},
224 {"to", anchorNodeValue(std::move(step.to))},
225 {"kind", anchorEdgeKindName(step.kind)},
226 }));
227 return eve::Value::object({
228 {"graphId", std::move(route.graphId)},
229 {"graphGeneration", std::to_string(route.graphGeneration)},
230 {"nodes", eve::Value(std::move(nodes))},
231 {"steps", eve::Value(std::move(steps))},
232 });
233}
234
235const char* anchorKindName(ClimbingAnchorKind kind) {
236 switch (kind) {
237 case ClimbingAnchorKind::Ledge: return "ledge";
238 case ClimbingAnchorKind::CornerInner: return "corner_inner";
239 case ClimbingAnchorKind::CornerOuter: return "corner_outer";
240 case ClimbingAnchorKind::LadderRung: return "ladder_rung";
241 case ClimbingAnchorKind::Pole: return "pole";
242 case ClimbingAnchorKind::Beam: return "beam";
243 case ClimbingAnchorKind::Bar: return "bar";
244 }
245 return "unknown";
246}
247
248const char* anchorEdgeKindName(ClimbingAnchorEdgeKind kind) {
249 switch (kind) {
250 case ClimbingAnchorEdgeKind::Shimmy: return "shimmy";
251 case ClimbingAnchorEdgeKind::Corner: return "corner";
252 case ClimbingAnchorEdgeKind::Jump: return "jump";
253 case ClimbingAnchorEdgeKind::Drop: return "drop";
254 case ClimbingAnchorEdgeKind::Mount: return "mount";
255 case ClimbingAnchorEdgeKind::Dismount: return "dismount";
256 case ClimbingAnchorEdgeKind::Climb: return "climb";
257 case ClimbingAnchorEdgeKind::Balance: return "balance";
258 case ClimbingAnchorEdgeKind::Swing: return "swing";
259 }
260 return "unknown";
261}
262
263eve::Value anchorOverlayValue(ClimbingAnchorAuthoringOverlay overlay) {
265 nodes.reserve(overlay.nodes.size());
266 for (auto& node : overlay.nodes)
267 nodes.push_back(eve::Value::object({
268 {"id", std::move(node.id)},
269 {"kind", anchorKindName(node.kind)},
270 {"position", vecValue(node.position)},
271 {"normal", vecValue(node.normal)},
272 {"tangent", vecValue(node.tangent)},
273 {"leftHandSocket", vecValue(node.leftHandSocket)},
274 {"rightHandSocket", vecValue(node.rightHandSocket)},
275 {"feetSocket", vecValue(node.feetSocket)},
276 {"occupancySlots", static_cast<std::int64_t>(node.occupancySlots)},
277 }));
279 edges.reserve(overlay.edges.size());
280 for (auto& edge : overlay.edges)
281 edges.push_back(eve::Value::object({
282 {"from", std::move(edge.from)},
283 {"to", std::move(edge.to)},
284 {"kind", anchorEdgeKindName(edge.kind)},
285 {"bidirectional", edge.bidirectional},
286 }));
287 return eve::Value::object({
288 {"graphId", std::move(overlay.graphId)},
289 {"buildSettingsHash", std::move(overlay.buildSettingsHash)},
290 {"nodes", eve::Value(std::move(nodes))},
291 {"edges", eve::Value(std::move(edges))},
292 });
293}
294
295eve::Result<eve::Value> anchorBakeResultValue(ClimbingAnchorBakeResult result) {
296 auto encoded = encodeClimbingAnchorGraphDefinition(result.graph);
297 if (!encoded) return eve::Result<eve::Value>::failure(encoded.status());
298 auto json = encoded.value().toJson();
299 if (!json) return eve::Result<eve::Value>::failure(json.status());
301 {"graphJson", std::move(json).takeValue()},
302 {"buildSettingsHash", std::move(result.graph.buildSettingsHash)},
303 {"ledgeNodeCount", static_cast<std::int64_t>(result.ledgeNodeCount)},
304 {"ladderNodeCount", static_cast<std::int64_t>(result.ladderNodeCount)},
305 }));
306}
307
308eve::Value identityValue(eve::Value value) { return value; }
309
310std::vector<std::string> requiredNotifiesForKind(ClimbingActionKind kind) {
311 switch (kind) {
312 case ClimbingActionKind::Vault: return {"contact.left_hand", "land"};
314 case ClimbingActionKind::ClimbUp: return {"contact.left_hand", "contact.right_hand", "land"};
315 case ClimbingActionKind::LedgeGrab: return {"contact.left_hand", "contact.right_hand"};
322 case ClimbingActionKind::LadderClimb: return {"contact.left_hand", "contact.right_hand"};
324 return {"contact.left_hand", "contact.right_hand", "land"};
325 case ClimbingActionKind::Slide: return {"collision.compact", "land"};
327 case ClimbingActionKind::BarSwing: return {"contact.left_hand", "contact.right_hand"};
329 case ClimbingActionKind::BeamBalance: return {};
330 }
331 return {};
332}
333
334std::optional<ClimbingCancelReason> parseCancelReason(std::string_view value) {
335 if (value == "player_request") return ClimbingCancelReason::PlayerRequest;
336 if (value == "drop_requested") return ClimbingCancelReason::DropRequested;
337 if (value == "link_stale") return ClimbingCancelReason::LinkStale;
338 if (value == "anchor_stale") return ClimbingCancelReason::AnchorStale;
339 if (value == "motion_blocked") return ClimbingCancelReason::MotionBlocked;
340 if (value == "warp_budget_exceeded") return ClimbingCancelReason::WarpBudgetExceeded;
341 if (value == "definition_reloaded") return ClimbingCancelReason::DefinitionReloaded;
342 return std::nullopt;
343}
344
345template <class Ref, class Proxy, class Release>
346ssq::Table makeOwnedProxy(HSQUIRRELVM vm, eve::Result<Ref>&& reference, Release&& release) {
348 const Ref ref = std::move(reference).takeValue();
349 auto object = eve::script::makeOwnedSquirrelInstance<Proxy>(vm, std::make_unique<Proxy>(ref));
350 if (!object) {
351 const eve::Status status = object.status();
352 object.ignore("failed to create owned climbing proxy");
353 std::invoke(std::forward<Release>(release), ref).ignore("rollback failed climbing allocation");
355 }
356 ssq::Object owned = std::move(object).takeValue();
358 result.set("value", owned);
359 result.set("ownership", std::string("owned"));
360 result.set("ownerEpoch", static_cast<std::int64_t>(ref.ownerEpoch));
361 result.set("handle", static_cast<std::int64_t>(ref.packed()));
362 return result;
363}
364
365
366struct ScriptClimbingAnchorGraph {
367 explicit ScriptClimbingAnchorGraph(ClimbingAnchorGraphHandleRef value) : reference(value) {}
368 ~ScriptClimbingAnchorGraph() noexcept {
369 Climbing::releaseAnchorGraph(reference).ignore("script climbing anchor graph proxy destruction");
370 }
372};
373
374} // namespace
375
376eve::Value projectClimbingAdvance(ClimbingAdvance value) { return advanceValue(std::move(value)); }
377
379
380void Climbing::expose(ssq::Table& table) {
381 const HSQUIRRELVM vm = table.getHandle();
382 auto graph = table.addClass<ScriptClimbingAnchorGraph>(
383 "ClimbingAnchorGraph", std::function<ScriptClimbingAnchorGraph*()>([]() { return nullptr; }), false);
384 graph.addFunc("ownership", [](ScriptClimbingAnchorGraph*) { return std::string("owned"); });
385 graph.addFunc("isStale", [](ScriptClimbingAnchorGraph* value) {
386 return !value || Climbing::isAnchorGraphStale(value->reference);
387 });
388 graph.addFunc("release", [vm](ScriptClimbingAnchorGraph* value) {
389 if (!value)
392 "climbing anchor graph proxy must not be null",
393 "anchorGraph", {}, "climbing.binding")));
395 });
396 graph.addFunc("node", [vm](ScriptClimbingAnchorGraph* value, const std::string& nodeId) {
397 if (!value)
399 vm,
401 eve::DiagnosticCode::InvalidArgument, "climbing anchor graph proxy must not be null", "anchorGraph",
402 {}, "climbing.binding")),
403 anchorNodeValue);
406 vm,
407 resolved.isBound() ? resolved->nodeRef(nodeId)
408 : eve::Result<ClimbingAnchorNodeRef>::failure(eve::Diagnostic::error(
409 eve::DiagnosticCode::StaleHandle, "climbing anchor graph handle is stale",
410 "anchorGraph", {}, "climbing.binding")),
411 anchorNodeValue);
412 });
413 graph.addFunc("reloadJson", [vm](ScriptClimbingAnchorGraph* value, const std::string& json) {
414 if (!value)
416 vm,
418 eve::DiagnosticCode::InvalidArgument, "climbing anchor graph proxy must not be null", "anchorGraph",
419 {}, "climbing.binding")),
420 graphReloadValue);
421 auto parsed = eve::Value::fromJson(json);
422 if (!parsed)
424 vm, eve::Result<ClimbingAnchorGraphReload>::failure(parsed.status()), graphReloadValue);
425 auto definition = decodeClimbingAnchorGraphDefinition(parsed.value());
426 if (!definition)
428 vm, eve::Result<ClimbingAnchorGraphReload>::failure(definition.status()), graphReloadValue);
431 vm,
432 resolved.isBound() ? resolved->reload(std::move(definition).takeValue())
433 : eve::Result<ClimbingAnchorGraphReload>::failure(eve::Diagnostic::error(
434 eve::DiagnosticCode::StaleHandle, "climbing anchor graph handle is stale",
435 "anchorGraph", {}, "climbing.binding")),
436 graphReloadValue);
437 });
438 graph.addFunc("planRoute", [vm](ScriptClimbingAnchorGraph* value, const std::string& startNodeId,
439 const std::string& goalNodeId, bool avoidFull, std::int64_t agentId,
440 std::int64_t executionId, std::int64_t maxVisitedNodes) {
441 if (!value || agentId < 0 || executionId < 0 || (agentId == 0) != (executionId == 0) ||
442 maxVisitedNodes <= 0 || maxVisitedNodes > 65536)
446 "graph, paired non-negative owner ids, and route bound are required",
447 "planRoute", {}, "climbing.binding")),
448 anchorRouteValue);
450 if (!resolved.isBound())
452 vm,
454 eve::Diagnostic::error(eve::DiagnosticCode::StaleHandle, "climbing anchor graph handle is stale",
455 "anchorGraph", {}, "climbing.binding")),
456 anchorRouteValue);
457 auto start = resolved->nodeRef(startNodeId);
458 if (!start)
460 anchorRouteValue);
461 auto goal = resolved->nodeRef(goalNodeId);
462 if (!goal)
464 anchorRouteValue);
465 ClimbingAnchorRouteRequest request;
466 request.start = std::move(start).takeValue();
467 request.goal = std::move(goal).takeValue();
468 request.occupancyPolicy = avoidFull ? ClimbingRouteOccupancyPolicy::AvoidFull
470 request.requester = {
471 ClimbingAnchorAgentId(static_cast<std::uint64_t>(agentId)),
472 ClimbingExecutionId(static_cast<std::uint64_t>(executionId)),
473 };
474 request.maxVisitedNodes = static_cast<std::uint32_t>(maxVisitedNodes);
475 return eve::script::projectResult(vm, resolved->planRoute(request), anchorRouteValue);
476 });
477 graph.addFunc("generation", [](ScriptClimbingAnchorGraph* value) -> std::string {
478 if (!value) return {};
480 return resolved.isBound() ? std::to_string(resolved->generation()) : std::string{};
481 });
482 graph.addFunc("reservationCount", [](ScriptClimbingAnchorGraph* value) -> std::int64_t {
483 if (!value) return 0;
485 return resolved.isBound() ? static_cast<std::int64_t>(resolved->reservationCount()) : 0;
486 });
487 auto runtime = table.addClass<ScriptClimbingRuntime>(
488 "ClimbingRuntime", std::function<ScriptClimbingRuntime*()>([]() { return nullptr; }), false);
489 runtime.addFunc("ownership", [](ScriptClimbingRuntime*) { return std::string("owned"); });
490 runtime.addFunc("isStale",
491 [](ScriptClimbingRuntime* value) { return !value || Climbing::isStale(value->reference); });
492 runtime.addFunc("release", [vm](ScriptClimbingRuntime* value) {
493 if (!value)
496 "climbing runtime proxy must not be null",
497 "runtime", {}, "climbing.binding")));
499 });
500 runtime.addFunc("setProfileJson", [vm](ScriptClimbingRuntime* value, const std::string& json) {
501 if (!value)
504 "climbing runtime proxy must not be null",
505 "runtime", {}, "climbing.binding")));
506 auto resolved = Climbing::resolve(value->reference);
508 vm, resolved.isBound() ? resolved->setProfileJson(json)
509 : eve::Result<void>::failure(eve::Diagnostic::error(
510 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale",
511 "runtime", {}, "climbing.binding")));
512 });
513 runtime.addFunc("reloadProfileJson", [vm](ScriptClimbingRuntime* value, const std::string& json) {
514 if (!value)
517 "climbing runtime proxy must not be null",
518 "runtime", {}, "climbing.binding")));
519 auto resolved = Climbing::resolve(value->reference);
521 vm, resolved.isBound() ? resolved->reloadProfileJson(json)
522 : eve::Result<void>::failure(eve::Diagnostic::error(
523 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale",
524 "runtime", {}, "climbing.binding")));
525 });
526 runtime.addFunc("setProfile", [vm](ScriptClimbingRuntime* value, float radius, float height, float skin,
527 float probeDistance, float obstacleHeight, float minTopNormalY,
528 float maxWarpResidual, int maskBits) {
529 if (!value)
532 "climbing runtime proxy must not be null",
533 "runtime", {}, "climbing.binding")));
534 auto resolved = Climbing::resolve(value->reference);
535 if (!resolved.isBound())
538 "climbing runtime handle is stale", "runtime", {},
539 "climbing.binding")));
540 ClimbingProfile profile;
541 profile.capsuleRadius = radius;
542 profile.capsuleHeight = height;
543 profile.skin = skin;
544 profile.maxProbeDistance = probeDistance;
545 profile.maxObstacleHeight = obstacleHeight;
546 profile.minTopNormalY = minTopNormalY;
547 profile.maxWarpResidual = maxWarpResidual;
548 profile.queryFilter.maskBits = static_cast<std::uint32_t>(maskBits);
549 return eve::script::projectResult(vm, resolved->setProfile(std::move(profile)));
550 });
551 runtime.addFunc("upsertAction", [vm](ScriptClimbingRuntime* value, const std::string& id, float minHeight,
552 float maxHeight, float minSpeed, float durationSeconds, float landingForward,
553 float apexHeight, int selectionBias) {
554 if (!value)
557 "climbing runtime proxy must not be null",
558 "runtime", {}, "climbing.binding")));
559 auto resolved = Climbing::resolve(value->reference);
560 if (!resolved.isBound())
563 "climbing runtime handle is stale", "runtime", {},
564 "climbing.binding")));
565 auto duration = eve::Duration::fromSeconds(durationSeconds);
568 vm, resolved->upsertAction({id, minHeight, maxHeight, minSpeed, std::move(duration).takeValue(),
569 landingForward, apexHeight, selectionBias}));
570 });
571 runtime.addFunc("upsertActionKind", [vm](ScriptClimbingRuntime* value, const std::string& id,
572 const std::string& kind, float minHeight, float maxHeight, float minSpeed,
573 float durationSeconds, float landingForward, float apexHeight,
574 int selectionBias, float hangBodyOffset, float hangFeetBelowLedge,
575 float handSpacing, float cancelStart, float cancelEnd) {
576 if (!value)
579 "climbing runtime proxy must not be null",
580 "runtime", {}, "climbing.binding")));
581 auto resolved = Climbing::resolve(value->reference);
582 if (!resolved.isBound())
585 "climbing runtime handle is stale", "runtime", {},
586 "climbing.binding")));
587 const auto parsedKind = parseActionKind(kind);
588 if (!parsedKind)
591 "unknown climbing action kind", "kind", {}, "climbing.binding")));
592 auto duration = eve::Duration::fromSeconds(durationSeconds);
594 ClimbingActionDefinition action{
595 id, minHeight, maxHeight, minSpeed, std::move(duration).takeValue(), landingForward,
596 apexHeight, selectionBias};
597 action.kind = *parsedKind;
598 action.hangBodyOffset = hangBodyOffset;
599 action.hangFeetBelowLedge = hangFeetBelowLedge;
600 action.handSpacing = handSpacing;
601 action.cancelWindowStart = cancelStart;
602 action.cancelWindowEnd = cancelEnd;
603 action.requiredNotifies = requiredNotifiesForKind(*parsedKind);
604 return eve::script::projectResult(vm, resolved->upsertAction(std::move(action)));
605 });
606 runtime.addFunc("validateActionClip", [vm](ScriptClimbingRuntime* value, const std::string& actionId,
607 animation::AnimClip* clip) {
608 if (!value || !clip)
611 "runtime and animation clip are required",
612 "validateActionClip", {}, "climbing.binding")));
613 auto resolved = Climbing::resolve(value->reference);
615 vm, resolved.isBound() ? resolved->validateAnimationBinding(actionId, *clip)
616 : eve::Result<void>::failure(eve::Diagnostic::error(
617 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale",
618 "runtime", {}, "climbing.binding")));
619 });
620 runtime.addFunc("probeMode", [vm](ScriptClimbingRuntime* value, physics::World3D* world, float x, float y, float z,
621 float forwardX, float forwardZ, float speed, float verticalSpeed, bool grounded) {
622 if (!value || !world)
624 vm,
626 "runtime and world are required",
627 "probeMode", {}, "climbing.binding")),
628 candidateValue);
629 auto resolved = Climbing::resolve(value->reference);
630 if (!resolved.isBound())
633 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale",
634 "runtime", {}, "climbing.binding")),
635 candidateValue);
636 auto candidates =
637 resolved->probe(*world, {{x, y, z}, {forwardX, 0.f, forwardZ}, speed, -1, verticalSpeed, grounded});
638 if (!candidates.ok())
640 candidateValue);
641 if (candidates.value().empty())
643 vm,
645 eve::DiagnosticCode::NotFound, "no traversable obstacle", "probeMode", {}, "climbing.binding")),
646 candidateValue);
648 candidateValue);
649 });
650 runtime.addFunc("tryBegin", [vm](ScriptClimbingRuntime* value, physics::World3D* world, float x, float y, float z,
651 float forwardX, float forwardZ, float speed, int ignoredBodyId,
652 std::int64_t tick) {
653 if (!value || !world || tick < 0)
655 vm,
657 eve::DiagnosticCode::InvalidArgument, "runtime, world, and non-negative tick are required",
658 "tryBegin", {}, "climbing.binding")),
659 candidateValue);
660 auto resolved = Climbing::resolve(value->reference);
661 if (!resolved.isBound())
664 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale",
665 "runtime", {}, "climbing.binding")),
666 candidateValue);
668 vm,
669 resolved->tryBegin(*world, {{x, y, z}, {forwardX, 0.f, forwardZ}, speed, ignoredBodyId},
670 eve::SimulationTick(static_cast<std::uint64_t>(tick))),
671 candidateValue);
672 });
673 runtime.addFunc("tryBeginMode", [vm](ScriptClimbingRuntime* value, physics::World3D* world, float x, float y,
674 float z, float forwardX, float forwardZ, float speed, int ignoredBodyId,
675 float verticalSpeed, bool grounded, std::int64_t tick) {
676 if (!value || !world || tick < 0)
678 vm,
680 eve::DiagnosticCode::InvalidArgument, "runtime, world, and non-negative tick are required",
681 "tryBeginMode", {}, "climbing.binding")),
682 candidateValue);
683 auto resolved = Climbing::resolve(value->reference);
684 if (!resolved.isBound())
687 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale",
688 "runtime", {}, "climbing.binding")),
689 candidateValue);
691 vm,
692 resolved->tryBegin(*world,
693 {{x, y, z}, {forwardX, 0.f, forwardZ}, speed, ignoredBodyId, verticalSpeed, grounded},
694 eve::SimulationTick(static_cast<std::uint64_t>(tick))),
695 candidateValue);
696 });
697 runtime.addFunc("tryBeginAnchor", [vm](ScriptClimbingRuntime* value, ScriptClimbingAnchorGraph* graphValue,
698 physics::World3D* world, const std::string& nodeId,
699 std::int64_t agentId, const std::string& actionId, float x, float y,
700 float z, float forwardX, float forwardZ, float speed, int ignoredBodyId,
701 float verticalSpeed, bool grounded, std::int64_t tick) {
702 if (!value || !graphValue || !world || agentId <= 0 || tick < 0)
706 "runtime, graph, world, positive agent id, and tick are required",
707 "tryBeginAnchor", {}, "climbing.binding")),
708 candidateValue);
709 auto runtimeResolved = Climbing::resolve(value->reference);
710 auto graphResolved = Climbing::resolveAnchorGraph(graphValue->reference);
711 if (!runtimeResolved.isBound() || !graphResolved.isBound())
713 vm,
715 eve::DiagnosticCode::StaleHandle, "climbing runtime or anchor graph handle is stale", "runtime", {},
716 "climbing.binding")),
717 candidateValue);
718 auto node = graphResolved->nodeRef(nodeId);
719 if (!node)
721 candidateValue);
723 vm,
724 runtimeResolved->tryBeginAnchor(
725 *world, graphValue->reference, node.value(),
726 ClimbingAnchorAgentId(static_cast<std::uint64_t>(agentId)), actionId,
727 {{x, y, z}, {forwardX, 0.f, forwardZ}, speed, ignoredBodyId, verticalSpeed, grounded},
728 eve::SimulationTick(static_cast<std::uint64_t>(tick))),
729 candidateValue);
730 });
731 runtime.addFunc("transitionAnchor", [vm](ScriptClimbingRuntime* value,
732 ScriptClimbingAnchorGraph* graphValue,
733 physics::World3D* world, const std::string& targetNodeId,
734 const std::string& edgeKind, const std::string& actionId,
735 std::int64_t tick) {
736 if (!value || !graphValue || !world || tick < 0)
739 "runtime, graph, world, and non-negative tick are required",
740 "transitionAnchor", {}, "climbing.binding")));
741 const auto parsedEdge = parseAnchorEdgeKind(edgeKind);
742 if (!parsedEdge)
745 "unknown climbing anchor edge kind", "edgeKind",
746 {}, "climbing.binding")));
747 auto runtimeResolved = Climbing::resolve(value->reference);
748 auto graphResolved = Climbing::resolveAnchorGraph(graphValue->reference);
749 if (!runtimeResolved.isBound() || !graphResolved.isBound())
752 eve::DiagnosticCode::StaleHandle, "climbing runtime or anchor graph handle is stale", "runtime",
753 {}, "climbing.binding")));
754 auto node = graphResolved->nodeRef(targetNodeId);
757 vm, runtimeResolved->transitionAnchor(*world, node.value(), *parsedEdge, actionId,
758 eve::SimulationTick(static_cast<std::uint64_t>(tick))));
759 });
760 runtime.addFunc("currentAnchor", [vm](ScriptClimbingRuntime* value) {
761 if (!value)
763 vm,
765 eve::DiagnosticCode::InvalidArgument, "climbing runtime proxy must not be null", "runtime", {},
766 "climbing.binding")),
767 anchorNodeValue);
768 auto resolved = Climbing::resolve(value->reference);
770 vm,
771 resolved.isBound() ? resolved->currentAnchor()
772 : eve::Result<ClimbingAnchorNodeRef>::failure(eve::Diagnostic::error(
773 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale", "runtime",
774 {}, "climbing.binding")),
775 anchorNodeValue);
776 });
778 runtime.addFunc("cancel", [vm](ScriptClimbingRuntime* value, const std::string& reason, std::int64_t tick) {
779 if (!value || tick < 0)
782 "runtime and non-negative tick are required",
783 "cancel", {}, "climbing.binding")));
784 auto resolved = Climbing::resolve(value->reference);
785 if (!resolved.isBound())
788 "climbing runtime handle is stale", "runtime", {},
789 "climbing.binding")));
790 const auto parsed = parseCancelReason(reason);
791 if (!parsed)
794 "unknown climbing cancellation reason", "reason",
795 {}, "climbing.binding")));
797 vm, resolved->cancel(*parsed, eve::SimulationTick(static_cast<std::uint64_t>(tick))));
798 });
799 runtime.addFunc("drainEvents", [vm](ScriptClimbingRuntime* value) {
800 if (!value)
802 vm,
803 eve::Result<std::vector<ClimbingEvent>>::failure(eve::Diagnostic::error(
804 eve::DiagnosticCode::InvalidArgument, "climbing runtime proxy must not be null", "runtime", {},
805 "climbing.binding")),
806 eventBatchValue);
807 auto resolved = Climbing::resolve(value->reference);
809 vm,
810 resolved.isBound() ? resolved->drainEvents()
811 : eve::Result<std::vector<ClimbingEvent>>::failure(eve::Diagnostic::error(
812 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale", "runtime",
813 {}, "climbing.binding")),
814 eventBatchValue);
815 });
816 runtime.addFunc("drop", [vm](ScriptClimbingRuntime* value, std::int64_t tick) {
817 if (!value || tick < 0)
820 "runtime and non-negative tick are required",
821 "drop", {}, "climbing.binding")));
822 auto resolved = Climbing::resolve(value->reference);
824 vm, resolved.isBound() ? resolved->drop(eve::SimulationTick(static_cast<std::uint64_t>(tick)))
825 : eve::Result<void>::failure(eve::Diagnostic::error(
826 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale",
827 "runtime", {}, "climbing.binding")));
828 });
829 runtime.addFunc("climbUp", [vm](ScriptClimbingRuntime* value, std::int64_t tick) {
830 if (!value || tick < 0)
833 "runtime and non-negative tick are required",
834 "climbUp", {}, "climbing.binding")));
835 auto resolved = Climbing::resolve(value->reference);
837 vm, resolved.isBound() ? resolved->climbUp(eve::SimulationTick(static_cast<std::uint64_t>(tick)))
838 : eve::Result<void>::failure(eve::Diagnostic::error(
839 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale",
840 "runtime", {}, "climbing.binding")));
841 });
842 runtime.addFunc("snapshotJson", [vm](ScriptClimbingRuntime* value) {
843 if (!value)
845 vm,
847 "climbing runtime proxy must not be null",
848 "runtime", {}, "climbing.binding")),
849 [](std::string text) { return eve::Value(std::move(text)); });
850 auto resolved = Climbing::resolve(value->reference);
852 vm,
853 resolved.isBound() ? resolved->snapshotJson()
854 : eve::Result<std::string>::failure(eve::Diagnostic::error(
855 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale", "runtime",
856 {}, "climbing.binding")),
857 [](std::string text) { return eve::Value(std::move(text)); });
858 });
859 runtime.addFunc("restoreJson", [vm](ScriptClimbingRuntime* value, const std::string& json,
860 physics::World3D* world) {
861 if (!value || !world)
864 "runtime and world are required", "restoreJson",
865 {}, "climbing.binding")));
866 auto resolved = Climbing::resolve(value->reference);
868 vm, resolved.isBound() ? resolved->restoreJson(json, *world)
869 : eve::Result<void>::failure(eve::Diagnostic::error(
870 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale",
871 "runtime", {}, "climbing.binding")));
872 });
873 runtime.addFunc("definitionGeneration", [](ScriptClimbingRuntime* value) -> std::string {
874 if (!value) return {};
875 auto resolved = Climbing::resolve(value->reference);
876 return resolved.isBound() ? std::to_string(resolved->definitionGeneration()) : std::string{};
877 });
878 runtime.addFunc("setDebugCapture", [vm](ScriptClimbingRuntime* value, bool enabled) {
879 if (!value)
882 "climbing runtime proxy must not be null",
883 "runtime", {}, "climbing.binding")));
884 auto resolved = Climbing::resolve(value->reference);
885 if (!resolved.isBound())
888 "climbing runtime handle is stale", "runtime", {},
889 "climbing.binding")));
890 resolved->setDebugCapture(enabled ? ClimbingDebugCapture::Enabled : ClimbingDebugCapture::Disabled);
892 });
893 runtime.addFunc("inspect", [vm](ScriptClimbingRuntime* value) {
894 if (!value)
896 vm,
898 eve::DiagnosticCode::InvalidArgument, "climbing runtime proxy must not be null", "runtime", {},
899 "climbing.binding")),
900 debugValue);
901 auto resolved = Climbing::resolve(value->reference);
902 if (!resolved.isBound())
905 eve::DiagnosticCode::StaleHandle, "climbing runtime handle is stale",
906 "runtime", {}, "climbing.binding")),
907 debugValue);
909 debugValue);
910 });
911
912 auto module = table.addClass(name, Climbing::create, false);
913 expose(module);
914}
915
916void Climbing::expose(ssq::Class& cls) {
917 cls.addFunc("getName", &Climbing::getName);
918 cls.addFunc("newRuntime", [vm = cls.getHandle()](Climbing*) {
919 return makeOwnedProxy<ClimbingRuntimeHandleRef, ScriptClimbingRuntime>(
920 vm, Climbing::newRuntime(),
921 [](ClimbingRuntimeHandleRef reference) { return Climbing::release(reference); });
922 });
923 cls.addFunc("newAnchorGraphJson", [vm = cls.getHandle()](Climbing*, const std::string& json,
924 physics::World3D* world, physics::Body3D* body) {
925 if (!world || !body)
926 return makeOwnedProxy<ClimbingAnchorGraphHandleRef, ScriptClimbingAnchorGraph>(
927 vm,
930 "newAnchorGraphJson", {}, "climbing.binding")),
931 [](ClimbingAnchorGraphHandleRef reference) { return Climbing::releaseAnchorGraph(reference); });
932 auto parsed = eve::Value::fromJson(json);
933 if (!parsed)
934 return makeOwnedProxy<ClimbingAnchorGraphHandleRef, ScriptClimbingAnchorGraph>(
936 [](ClimbingAnchorGraphHandleRef reference) { return Climbing::releaseAnchorGraph(reference); });
937 auto definition = decodeClimbingAnchorGraphDefinition(parsed.value());
938 if (!definition)
939 return makeOwnedProxy<ClimbingAnchorGraphHandleRef, ScriptClimbingAnchorGraph>(
941 [](ClimbingAnchorGraphHandleRef reference) { return Climbing::releaseAnchorGraph(reference); });
942 return makeOwnedProxy<ClimbingAnchorGraphHandleRef, ScriptClimbingAnchorGraph>(
943 vm, Climbing::newAnchorGraph(std::move(definition).takeValue(), *world, body->runtimeHandle()),
944 [](ClimbingAnchorGraphHandleRef reference) { return Climbing::releaseAnchorGraph(reference); });
945 });
946 cls.addFunc("bakeAnchorGraphJson", [vm = cls.getHandle()](Climbing*, const std::string& json) {
947 auto parsed = eve::Value::fromJson(json);
948 if (!parsed)
950 vm, eve::Result<eve::Value>::failure(parsed.status()), identityValue);
951 auto request = decodeClimbingAnchorBakeRequest(parsed.value());
952 if (!request)
954 vm, eve::Result<eve::Value>::failure(request.status()), identityValue);
955 auto baked = bakeClimbingAnchorGraph(std::move(request).takeValue());
956 if (!baked)
958 vm, eve::Result<eve::Value>::failure(baked.status()), identityValue);
959 return eve::script::projectResult(vm, anchorBakeResultValue(std::move(baked).takeValue()), identityValue);
960 });
961 cls.addFunc("inspectAnchorGraphJson", [vm = cls.getHandle()](Climbing*, const std::string& json) {
962 auto parsed = eve::Value::fromJson(json);
963 if (!parsed)
965 vm, eve::Result<ClimbingAnchorAuthoringOverlay>::failure(parsed.status()), anchorOverlayValue);
966 auto graph = decodeClimbingAnchorGraphDefinition(parsed.value());
967 if (!graph)
969 vm, eve::Result<ClimbingAnchorAuthoringOverlay>::failure(graph.status()), anchorOverlayValue);
971 vm, inspectClimbingAnchorGraphAuthoring(graph.value()), anchorOverlayValue);
972 });
973}
974
975} // namespace eve::climbing
double z
double y
double x
Duration start
float duration
eve::action::ActionExecutionId executionId
ActiveSource owned
AuthorityStoreHandleRef reference
Definition Authority.cpp:24
攀爬事件 ↔ eve::Value 的**唯一**映射。
Deterministic climbing/parkour planning and capsule-constrained execution.
struct SQVM * HSQUIRRELVM
std::string nodeId
HSQUIRRELVM vm
Definition ECS.cpp:38
HSQOBJECT cls
Definition ECS.cpp:39
const GltfImportRequest & request
wgpu::PopErrorScopeStatus status
glm::vec4 clip
std::uint32_t height
std::vector< Edge > edges
std::string evidence
std::map< std::string, Node > nodes
std::string id
Poco::JSON::Object::Ptr result
Snapshot snapshot
double radius
Definition MeleeHit.cpp:42
#define Module_IMPL(ModuleName, newExpr)
Definition Module.h:27
std::string error
Definition Package.cpp:174
std::map< std::string, std::vector< std::string > > graph
Definition Package.cpp:173
std::vector< particles::ParticleRecordEvent > events
std::string action
Definition PlayHost.cpp:118
std::string body
Object::Ptr value
int steps
RoadNetwork resolved
const RoadNode * node
std::string text
std::string kind
std::map< std::array< int, 4 >, std::vector< const Subject * > > candidates
Definition Sensing.cpp:32
std::string string
The single Squirrel projection for common Result, Status and Value.
float phase
SimulationTick tick
Json object
float step
Definition TreeMesh.cpp:451
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
static Result< Duration > fromSeconds(double seconds)
Convert finite seconds to the nearest nanosecond.
Definition Time.cpp:17
void ignore(std::string_view reason={}) const noexcept
Explicitly discard this result after documenting the reason.
Definition Result.h:571
Move-only operation result carrying either a value or Status.
Definition Result.h:176
static Result success(T value)
Construct a successful result owning value.
Definition Result.h:185
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Structured status and zero or more diagnostics for an operation.
Definition Status.h:70
static Status success(StatusCode code=StatusCode::Ok)
Construct a successful status with an explicit non-error outcome.
Definition Status.cpp:19
The canonical owning dynamic value used by data-facing protocols.
Definition Value.h:31
static Result< Value > fromJson(std::string_view json)
Parse one strict JSON value into an owning Value.
Definition Value.cpp:177
std::vector< Value > Array
Definition Value.h:33
static Value object(Object value)
Compatibility factory for an object value.
Definition Value.cpp:129
Script-facing factory and owner for independent climbing runtimes.
Definition Climbing.h:903
static eve::Result< void > release(ClimbingRuntimeHandleRef reference)
Releases a module-owned runtime and invalidates its reference.
static eve::Result< void > releaseAnchorGraph(ClimbingAnchorGraphHandleRef reference)
Releases a module-owned graph instance and all of its reservations.
static bool isStale(ClimbingRuntimeHandleRef reference) noexcept
Reports whether a runtime reference is stale.
static eve::script::Borrowed< ClimbingAnchorGraphInstance > resolveAnchorGraph(ClimbingAnchorGraphHandleRef reference) noexcept
Resolves a live graph instance as a synchronous non-owning observation.
static bool isAnchorGraphStale(ClimbingAnchorGraphHandleRef reference) noexcept
Reports whether a graph instance reference is stale.
static eve::script::Borrowed< ClimbingRuntime > resolve(ClimbingRuntimeHandleRef reference) noexcept
Resolves a live runtime as a non-owning observation.
I * query()
Queries .
Definition Capability.h:88
eve::Result< ClimbingAnchorBakeResult > bakeClimbingAnchorGraph(const ClimbingAnchorBakeRequest &request)
Bakes deterministic ledge and ladder topology from owning semantic geometry samples.
eve::detail::StrongUint64< detail::ClimbingExecutionIdTag > ClimbingExecutionId
Stable non-zero identity assigned when a climbing selection transaction commits.
Value climbingEventArrayValue(std::span< const ClimbingEvent > events)
一批事件 → Value 数组,顺序与传入一致。
ClimbingAnchorEdgeKind
Allowed authored transition between two explicit anchors.
eve::Result< ClimbingAnchorGraphDefinition > decodeClimbingAnchorGraphDefinition(const eve::Value &value)
Decodes and validates a complete owning graph candidate transactionally.
ClimbingAnchorKind
Authored semantic of one explicit climbing anchor.
ClimbingPhase
Execution lifecycle visible to gameplay and animation adapters.
Definition Climbing.h:470
eve::Result< ClimbingAnchorAuthoringOverlay > inspectClimbingAnchorGraphAuthoring(const ClimbingAnchorGraphDefinition &graph)
Builds a validated owning snapshot for an editor or debug-draw adapter.
void exposeClimbingMotionBindings(ssq::Class &runtime, HSQUIRRELVM vm)
Expose climbing motion bindings.
ClimbingDebugCapture
Runtime policy controlling optional owning diagnostic capture.
Definition Climbing.h:606
eve::script::RuntimeHandleRef< ClimbingAnchorGraphHandleTag > ClimbingAnchorGraphHandleRef
Generation- and module-epoch-qualified anchor graph instance reference.
ClimbingActionKind
Data-driven action family; stable action identity remains the definition id.
Definition Climbing.h:46
eve::detail::StrongUint64< detail::ClimbingAnchorAgentIdTag > ClimbingAnchorAgentId
Stable non-zero identity of the character/agent that owns graph occupancy.
eve::Result< ClimbingAnchorBakeRequest > decodeClimbingAnchorBakeRequest(const eve::Value &value)
Decodes all known bake request fields without publishing a graph.
eve::Result< eve::Value > encodeClimbingAnchorGraphDefinition(const ClimbingAnchorGraphDefinition &graph)
Encodes a validated graph to its canonical owning Value representation.
ClimbingProfileDefinition ClimbingProfile
Compatibility-only spelling; ClimbingProfileDefinition is canonical.
Definition Climbing.h:272
eve::Value projectClimbingAdvance(ClimbingAdvance value)
Project climbing advance.
std::variant< std::monostate, std::int64_t, double, std::string, bool > Value
Definition Database.h:27
eve::Diagnostic Diagnostic
eve::Result< T > Result
ssq::Table makeOwnedProxy(HSQUIRRELVM vm, eve::Result< Ref > &&reference, Release &&release)
std::unordered_map< std::string, SkillDefinition > & table()
Definition Skill.cpp:73
ssq::Table projectStatusResult(HSQUIRRELVM vm, const Status &status)
Project a checked native status that carries no payload.
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
std::string_view phaseName(BattlePhase phase) noexcept
Return the stable protocol spelling of a battle phase.
Build metadata (engine git commit, build time, third-party version).
Definition Build.cpp:16
DiagnosticCode
Stable machine-readable diagnostic codes.
Definition Diagnostic.h:47
detail::StrongUint64< detail::SimulationTickTag > SimulationTick
Deterministic simulation time step; it is not wall-clock time.
Definition Time.h:31
bool enabled
Owning output of one execution tick.
Definition Climbing.h:553