ReloadUnlocked
Fire or ADS cancels a reload, and an aborted reload resets: hands, weapon and magazine go back to idle instead of finishing the reload animation.
By alp
CHANGELOG
4.3.0
- 修复了一些问题。
4.2.0
- Performance / log noise pass, no behaviour change:
IsWielded()(the swap watch added in 4.1.0) costs two native property reads, so it now runs every third frame (~20 Hz) instead of every frame; a 50 ms detection delay is invisible and it removes ~40 native calls per second from the reload path.Verbosenow controls every remaining chatty line ([swap],[swap] rigs:,reload animators rebound: N (...)); the expensive rig dump is only built when it is actually going to be logged.- Abort logging stays at "at most one line per second", and when idle the driver does no native calls
at all (
_itemis cleared, so the per-frame work is one reference check).
4.1.1
- Diagnostics for the reported pair "revolver reload -> swap to MALATACK HXC inherits the reload animation":
with
Verbose = truethe swap detection now logs[swap] reload interrupted by a weapon swap -> '<new item>'and a one-line dump of every rig with the clip it is playing ([swap] rigs: <animator>(L<n>)[clip@layer] ...), captured at the exact moment the swap is noticed - before the reset runs. - No behaviour change otherwise.
4.1.0
- Fixed: swapping weapons mid-reload made the NEW weapon inherit the old weapon's reload animation.
Cause: the old item keeps reporting
IsReloadingfor a moment after the swap, so the driver kept forcingChangeState(Aim)and pinning the aim blend; the shared first-person animator then stayed on the old weapon's reload clip and the freshly wielded gun played it. Fix:IsWielded()comparesholder.m_inventoryLocal.WieldedItemagainst the tracked item every frame. On a mismatch the driver stops tracking and resets only the rigs that are still on a reload clip (Rebind), so the new weapon's own raise animation is untouched. The hand-overSettleSecondspin is skipped in that case too.
4.0.0
- Source restructure + lean release build (items 1-5 of the review):
- split:
ReloadDriver1673 -> 732 lines; animator plumbing moved toReloadAnims(200 lines); the diagnostic sampler lives inReloadTrace.csand is compiled ONLY with-p:Trace=true. - release has no diagnostics code: verified by decompiling the artifact - no
[trace]strings, noReloadTracetype. Release dll 21,504 B vs 24,576 B for the trace build. AnimResetModetrimmed toOff/RebindAll: the FinishCurrent / SpeedUp / FinishThenIdle / AnimatorCrossfade / AnimatorRebind / Weight experiments were all measured and rejected, and the static_idleClipcache they shared is gone with them (that cache could hand a stale clip name to a weapon with a different animator controller).- abort logging is rate-limited to one line per second instead of once per reason per session.
KeepAimingLogInterval,FinishSpeed,FinishSpeedSeconds,WeightBlackoutSeconds,TraceSeconds(release) removed from the config surface.
- split:
- Behaviour is unchanged:
RebindAllon abort, per-frame state forcing while keep-aiming,SettleSecondshand-over. A 4.0.0 build WITH the sampler is archived asReloadUnlocked-4.0.0-trace.dllfor future troubleshooting.
3.6.0
- Dropped the parts-rig smoothing experiment (3.4.0-3.5.0) entirely: it never matched on any weapon
(
[parts] cross-faded:was always empty and the 3.5.0 build was never even run), and the reload-end snap it targeted turned out to be vanilla behaviour (reproduced on 1.0.0). Removed ~320 lines: the two passes, the animator cache,IsMainAnimator, its scan fields and theSmoothPartsAtReloadEndconfig key. - Behaviour otherwise unchanged from 3.5.0:
RebindAllon abort, keep-aim,SettleSecondshand-over. - Config file trimmed to the keys this build reads.
3.5.0
- Confirmed first: the reload-end "snap" also happens on 1.0.0, so it is VANILLA behaviour, not a regression.
It comes from the weapon parts rig stepping
..._Parts_Reload->..._Parts_Idlein one frame. - The 3.4.x attempt matched nothing on the DREKKER DEL P1 / HEL Rifle even though the trace of the same frame
listed a reload clip on that rig, so the parts rigs are now REMEMBERED while the reload is still running
(
RefreshPartsAnimators, scanned every 0.25 s from the driver tick) and the repair pass uses that cache, not a fresh enumeration at the hand-over frame. - Verbose now logs the cache:
[parts] remembered (N): <names>and[parts] seen: ....
3.4.1
- 3.4.0's parts pass never matched anything on the DREKKER DEL P1 / HEL Rifle: the log showed
[parts] cross-faded:with an empty list, i.e. the filter (clip contains "reload" AND contains "parts") found no layer at reload end. Now:- the pass also accepts any rig that is NOT the main item animator (
holder.m_fpsItemAnim), so a weapon whose parts rig is named differently still gets blended; Verboselogs[parts] seen: <animator>(L<n>) [clip@layer] ...- the exact list the pass walked, so the next round shows whether the rig was even enumerated at that moment;cross-fadedline now carries the match count.
- the pass also accepts any rig that is NOT the main item animator (
3.4.0
SmoothPartsAtReloadEnd(default on): blend the weapon PARTS rig into its idle state at a normal reload end instead of letting it pop. Hand-over trace 2026-12-03 on Front_Precision_3 showed the parts animator swappingFront_Precision_3_Parts_Reload(w=0.09) forFront_Precision_3_Parts_Idle(w=1.00) between two 0.1 s samples, while the main rig (fp_weapon_animation_ref) and the FP state stayed correct - that is the "weapon snaps back while still aiming" report, and it only affects weapons that HAVE a parts rig.- The fix derives the idle state name from the live clip name (
..._Parts_Reload->..._Parts_Idle) and startsCrossFadeInFixedTimewith a duration equal to the time the reload clip still needs, so the remaining motion plays and the pose eases in. Unknown names are ignored by Unity. KeepAimingWhileReloadingis untouched: the whole point is to keep aiming through the reload.
3.3.0
- The trace now also samples a NORMAL reload end (
reason=reload-end), not only cancels, and the sample line carries the camera FOV again. The "weapon snaps right after the reload animation finishes" report happens on a normal completion, so it has to be measured there. - Trace start line relabelled
[trace] start reason=...(was[cancel], which was misleading for this case). SettleSecondsbehaviour unchanged.
3.2.0
- New
SettleSeconds(default 0.25, section "2. Reload while aiming"). After a NORMAL reload end with aim still held, the mod keeps forcingChangeState(Aim)for this long and writes nothing else. Rationale: our per-frame aim forcing stops the momentIsReloadinggoes false, and the game can drop the holder back to Hip for a frame or two before its own aim logic takes over - measured earlier as fov 41 -> 82 -> 41, which is exactly the "weapon snaps back right after the reload animation" feeling. 0 restores the previous behaviour (useful for A/B).
3.1.0
- Source optimisation pass, no behaviour change:
EnsureCreated()no longer probes the native object (WasCollected) on everyChangeStatecall. That prefix runs from the game AND from our own keep-aiming (once per frame while reloading); the liveness check is now cached and re-probed at most once per 30 calls.CollectTraceTargets()was rebuilding its own animator list withIl2CppSystem.Collections.Generic.Listand silently capped at 8; it now reusesCollectAnimators().- Removed the four
AnimResetModevalues that were proven useless in testing (Weight,WeightAndAnimator,PlaybackCrossfade,AnimatorCrossfade,AnimatorRebind) plus their dead config keys (ResetReloadAnimation,WeightBlackoutSeconds) and the dead_blackout*/_loggedNoIdleClipfields. Modes left:Off,RebindAll(default),FinishCurrent,SpeedUp,FinishThenIdle.
- Config file rewritten to contain only keys this version reads.
3.0.0
- Stable. Default
AnimResetMode = RebindAll: an aborted reload now RESETS every first-person animator that is still playing a reload clip (holder + FPS arms subtree, all layers) withRebind()+Update(0), instead of jumping the clips to their last frame (which froze the hands in the reload pose while the magazine kept animating). - Verified in game 2026-12-03 21:20:
reload animators rebound: 3 (fp_weapon_animation_ref PlayerCharacter_rig Front_Rifle_1_GripAlign)for a rifle,4 (fp_weapon_animation_ref Front_Revolver_2_Reload Front_Revolver_2_Reload (1) PlayerCharacter_rig)for the R66 — hands and magazine both reset, weapon swap no longer twitches, player confirms it looks right. - Debug defaults are quiet again:
Verbose = false,TraceSeconds = 0.
1.9.0
AnimResetMode = FinishCurrent(new default). 1.8.0 triedAnimator.CrossFade("fp_weapon_animation_ref_idle")on the item animator and the trace proved it did nothing -clipstayedStock_Revolver_2_Reload,w=1.00,normalizedTimekept climbing. That is consistent with the name not being a state in that layer. The new mode avoids names entirely: it reads the current state hash and callsAnimator.Play(hash, 0, 1f), i.e. jumps the reload clip straight to its last frame. The trace also showed the residual motion is exactly that clip playing out (itemPos settled the moment nt reached ~1.0), so jumping to 1.0 ends it immediately.- Modes available in cfg, no rebuild needed:
Off,Weight,PlaybackCrossfade,AnimatorCrossfade,AnimatorRebind,FinishCurrent,WeightAndAnimator.
1.6.0
- Instrumentation build.
TraceSeconds(default 0, set to 3 for this run): after an abort the mod samples the first-person item state every 0.1 s and logs it, so we can see WHICH subsystem keeps the weapon moving instead of guessing:[trace] +0.20s st=Hip aimW=0.90 itemW=1.00 seq=F reloading=F clip='…' w=0.00 nt=0.41 hash=0x… itemPos=(…)(clip/w/nt/hashcome from the Animator,itemPosfrom the item transform rig) - Also logs the state right after the abort:
[cancel] reason=fire seqCoroutineAfter=null isReloadingAfter=F idleClip='fp_weapon_animation_ref_idle' - Config file rewritten to contain only the keys this version actually reads.
1.5.0
- Reload animation reset, using the real clip name this time. The 1.3.3 diagnostic dumped the item
animator controller (53 clips) and the answer was in it: the idle clip is the GENERIC
fp_weapon_animation_ref_idle- there is no<weapon>_Idlename, so deriving it from the reload clip (Stock_Revolver_2_Reload->Stock_Revolver_2_Idle) could never match. That is why 1.3.x silently did nothing (log: "no idle clip derived from 'Stock_Revolver_2_Reload'"). - On abort the mod now cross-fades the item animator to that idle clip through the game's own
FirstPersonItemHolder.PlayFPSItemAnim. Because the clip is generic, it cannot leak one weapon's pose onto another (the 1.3.1 weapon-swap twitch came from cross-fading to a weapon-specific clip). ResetReloadAnimation = falsedisables it. No extra Harmony hook: the clip name is resolved once from the animator controller at the first abort and cached.
1.4.0
- Reverted to the exact 1.0.0 cancel:
StopAnimationSequenceCoroutine()+IsReloading = false, nothing else. Everything added in 1.1.0-1.3.3 that wrote to the weapon/holder outside that path is gone:m_wasReloadingwrites,FireThroughCancel(fire replay),OnIdleStart,PlayFPSItemAnimcross-fades, the extra Harmony hook. Those are the changes that introduced the leftover reload animation and the "weapon swap inherits the previous gun's reload hands / twitching". - Rebuilt the source files after a bad bulk edit collapsed them; verified by decompiling the artifact -
the only animation call left in the build is
StopAnimationSequenceCoroutine. - Kept: fire/ADS cancel, keep-aim (per-frame ChangeState, the 1.0.0 behaviour), per-frame cost measurement, driver shutdown on unload, path-overridable build.
1.3.3
- Fixed the reason 1.3.2 did nothing at all:
_lastReloadAnimwas cleared in the reload-start postfix, butStartCoroutineruns the sequence to its first yield synchronously, so the reload clip name is written into the cache BEFORE the postfix runs. Clearing it there deleted the only capture (log 20:34: neitherreload animation cutnorno idle clip derivedappeared). The cache is no longer cleared. - "reload"/"idle" matching is case-insensitive now.
- Diagnostics: with
Verbose = true, every PlayFPSItemAnim call whose name contains reload/idle is logged, and when no idle clip can be derived the animator controller's first 25 clip names are dumped once.
1.3.1
- The leftover reload animation is now actually cut. 1.3.0 called
FirstPersonItemHolder.OnIdleStart(), which was the wrong lever: disassembly shows it readsm_LookController(FPSCamera) and touches the camera, whileAnimationSequenceEnd()only clearsm_playingAnimationSequence. The reload animation isPerformWeaponAnimationAction -> PlayFPSItemAnim(name, duration)-> Animator cross-fade, i.e. the clip plays on its own after the sequence coroutine dies - that is why the gun kept finishing the reload motion while no ammo was granted. - New Harmony postfix on
FirstPersonItemHolder.PlayFPSItemAnimcaches the clip name; the reload start snapshots it, and an abort cross-fades back to that clip (0.1 s). No other installed mod patches that method (checked with scan_plugin_patches: only TacticalReload patches DoItemAnimationSequence). ResetReloadAnimation = falsestill disables the whole thing.
1.3.0
- Aborting a reload no longer leaves the weapon playing the rest of the reload animation.
ResetReloadAnimation(default on) callsFirstPersonItemHolder.OnIdleStart()after the cancel - the exact call the game makes when a reload COMPLETES (native evidence: the reload completion actionItemEquippable._TryTriggerReloadAnimationSequence_b__145_0tail-jumps intoOnIdleStart()).StopAnimationSequenceCoroutine()only kills the coroutine, so that callback never ran and the arms stayed in the reload pose. ResetReloadAnimation = falserestores the 1.2.1 behaviour if the snap back to idle looks worse.
1.2.1
- Restored the 1.0.0 keep-aim path:
ChangeState(Aim)is issued on every frame the state is not Aim, with no throttle and no "once per reload" gate. Both of those were my regression. - Why (measured 2026-12-03 20:02, FOV logged):
state=Aim -> fov=41.0,state=Hip -> fov=82.0, andm_aimWeightreads 1.00 in BOTH cases. The camera zoom follows the STATE, not the aim blend, and the game keeps putting the holder back to Hip while a reload runs. So a single ChangeState is undone at once (1.1.1/1.2.0 = no zoom at all), and a 0.15 s throttle lets the FOV flap 41 <-> 82 (1.1.0 = the "zoom keeps re-triggering" the user saw). Per-frame forcing is the only interval that holds it. AimWeightNudgedefault back to 0.90, matching 1.0.0 (the weight is a blend input only; changing it never fixed the FOV).- Diagnostic line:
stateForced=replaced bychanges=(number of ChangeState calls so far).
1.2.0
AimWeightNudgedefault 0.90 -> 1.00. Measured in the 19:56 log: a normal ADS readsaimW=1.00, the old default pinned the reload at0.90- i.e. the zoom really was ~10% short of native ADS.- State re-entry fixed. The 1.1.1 "skip if I already saw Aim" shortcut was wrong: the reload starts while
the player is already aimed (
state=Aim), the game then drops the holder toHiponce, and it never returns - but the flag had already been set, so no attempt was made for the rest of the reload. The flag is now set only whenChangeState(Aim)is actually issued, so a reload gets exactly one re-entry. - Diagnostic line now includes the real camera FOV and whether the state was forced:
[keepAim] state=... aimW=... itemW=... aimTrigger=... stateForced=... nudged=... fov=...
1.1.1
- Fixed the ADS zoom re-triggering over and over while reloading with aim held. Root cause, proven by
xref on GameAssembly.dll:
FirstPersonItemHolder.ChangeState(Aim)->FPIS_Aim.Enter()->ItemEquippable.TriggerAimAnimationSequence(), and that method has exactly one caller in the binary. EveryChangeState(Aim)therefore replays the raise-to-ADS animation, and the old code re-issued it whenever the state was not Aim. - Keep-aiming now enters Aim once per reload and holds it by re-asserting
m_itemAimTriggerafter the holder's own update (the game clears that flag every frame during a reload). No more animation replay. m_aimWeightis still pinned inLateUpdateevery frame, so the camera stays zoomed.
1.1.0
FireThroughCancel(default on): the fire click that aborts a reload now actually fires. Replayed one frame later, and skipped if the game already fired in between, so it cannot double-fire. No replay on an empty magazine.ResetReloadFlags(default on):BulletWeapon.m_wasReloadingis cleared when aborting, so the weapon no longer thinks it is unwinding a reload that was cancelled.AutoReloadSuppressSeconds(default 0 = off): optionally ignore a reload the game starts by itself right after a cancel. An explicit R press always goes through.- Keep-aiming
ChangeStateis throttled (~6/s) instead of being re-issued every frame; a failing call retries at 1 Hz instead of spamming the log every frame. - Plugin unload now destroys the driver GameObject (it lived under DontDestroyOnLoad and kept ticking as an orphan).
- Build no longer hard-codes the BepInEx path:
-p:BepInExRoot=...>$env:GTFO_BEPINEX> the current install.-p:Deploy=truecopies the dll straight into the loaded profile.
1.0.0
- First release under the ReloadUnlocked name (was ReloadControl): fire/ADS cancel a reload, camera stays aimed while reloading.