Skip to main content

PhysicalReload API

Interface ID 2, version 2.0. Include <PAPER/PhysicalReload.h>. Namespace paper::api::physical_reload. For a mod that drives a reload or manual cycle with the player's own hands: it takes the equipped weapon away from PAPER's native reload animation for a short lease that it renews every frame. Acquire it with client.acquire(table) after connecting to Provider; every call takes the Provider owner token and runs on the game thread.

It replaces the pre-2.0 PAPERAPI_QueryPhysicalReloadV1, V2 and V3 exports, which now refuse with a logged reason. Its semantics are those of the former V3 early takeover.

Entry points​

FunctionCapabilityThreadPurpose
acquireAnimationAuthorityGameBinds the exact native equipped item (form, equipped data and instance) for leaseFrames (1 to kMaxLeaseFrames, 120) after observedFrame. Repeating the call renews the lease.
clearownerGameEnds your lease.
readRuntimeStateGameCopies the live lease, or a zeroed state with active 0 when there is none.

acquire returns NotReady before PAPER is ready, OwnerConflict while another owner holds a live lease or any consumer holds Provider animation authority, StaleSnapshot when the item or frame does not match, and InvalidArgument for a zero form ID, a lease outside its range or unknown flag bits. observedFrame is the ROCK frame your hands acted on and must be within one frame of PAPER's. No PAPER animation snapshot or weapon-part readiness is required. The lease ends after observedFrame + leaseFrames, when the equipped item is replaced, on a world reset or when the owner is revoked. clear returns OwnerConflict while another owner's lease is live.

Records​

  • Request (48 bytes): weaponFormId, leaseFrames (default 2), weaponGenerationKey, observedFrame, the caller's worldGeneration, skeletonGeneration and rockProviderGeneration, and flags.
  • State (48 bytes): active, weaponFormId, owner, weaponGenerationKey, expiresAfterFrame, flags. With active 0 every other field is zero.
  • Flag::ManualCycle: you own bolt cycling, chambering, casing ejection and their sounds; PAPER suppresses the native automatic cycle for the lease. kKnownFlags holds every known bit.
const paper::api::physical_reload::Api* reload{};
if (client.acquire(reload) == paper::api::Status::Ok) {
paper::api::physical_reload::Request request{};
request.weaponFormId = equippedFormId;
request.observedFrame = rockFrameIndex; // renew every frame of physical control
reload->acquire(client.owner(), &request);
}

PAPER's tests/ConsumerExample.cpp connects, acquires this interface and renews the lease with the current ROCK frame. The full header is in complete declarations.