Skip to main content

Consumer recipes

Weapon and reload state​

Request RuntimeState and FrameCallbacks. On FrameComplete, read getRuntimeState: weaponFormId and weaponGenerationKey name the equipped weapon (invalidate weapon caches on the key, not the form ID alone), and reloadStartSequence and reloadEndSequence advance once per reload start and end. Read getConfigState again when its revision changes or a ConfigReloaded event arrives.

Native hand capture​

Request NativeHandPose (and CapturedTransforms for the named node transforms). getNativeHandPose returns the native hand in weapon space with finger-local transforms; check fingerLocalTransformMask and compare captureSequence with the runtime state before combining reads.

Final native-pose observer​

The native-pose pipeline is published after control completion. Request NativePosePipeline plus FrameCallbacks, filter events for PresentationComplete, then query the frame and physical hand solutions. Check validity and identity before using final residuals or finger transforms. Continue renewing any control lease at its control boundary, not a second time from this observation event.

Hand-driven reload​

Register with AnimationAuthority (and RuntimeState if you read the lease back), then Client::acquire the physical_reload::Api. While the player's hands drive the reload, call acquire once per frame with the equipped weapon's form ID and the ROCK frame your hands acted on; set Flag::ManualCycle when your mod also owns the bolt cycle. Treat OwnerConflict as another mod or PAPER authority owning the weapon, and StaleSnapshot as a changed item or frame: stop driving and re-read. Call clear when physical control ends.

paper::api::physical_reload::Request request{};
request.weaponFormId = equippedFormId;
request.observedFrame = rockFrameIndex; // the ROCK frame your hands acted on
request.flags = static_cast<std::uint32_t>(paper::api::physical_reload::Flag::ManualCycle);
const auto status = reload->acquire(client.owner(), &request);