Repository navigation
Partial reloads 05: Keep a chambered round through a partial reload - #2286
Closed
sunzenshen wants to merge 1 commit into
Closed
sunzenshen wants to merge 1 commit into
sunzenshen wants to merge 1 commit into
Conversation
Contributor
Author
|
This PR is not ready for review, it was mostly intended to sketch out what the full code of a vertical slice would look like for one weapon for partial reloads, so that the code in #2285 ideally mostly survives with the end goal in mind. I do plan to keep tinkering with this branch while the smaller single transition MVP is under review. |
This was referenced Nov 8, 2026
With sv_neo_reload_experimental, a weapon script can declare "ChamberedRound": the ZR68C now holds 30+1. A reload with a round chambered plays reload_skipcycle, which leaves out the bolt cycle and keeps that round; a dry reload still cycles the bolt. The last shot empties the chamber, and only a reload's 3_cycle phase fills it again. The old magazine's rounds now leave at the unload, as the magazine does, so the clip shows only the chambered round from there. Bots do not switch away from a reload that is past the unload, since the switch would only delay the refill. The ammo HUD shows the chamber as "+1" and lights the fire-mode glyph's round icon while it is loaded. Flag off: every new path checks IsReloadPhaseSystemEnabled() first, so the weapon behaves as on master.
sunzenshen
force-pushed
the
sketch-zr68c-full
branch
from
November 9, 2026 07:12
31e7eac to
7307cf0
Compare
sunzenshen
changed the base branch from
master
to
stack/reload-zr68c/40-attach
November 9, 2026 07:12
Contributor
Author
|
Closing in favor of #2294 because this PR cannot be added to the PR stack. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Depends on NeotokyoRebuild/neoAssets#173 (layer 05: the
skipcycleclips, their phases rows and the unload sound).Partial reloads 05: keep a chambered round through a partial reload. This PR builds on #2292 (04: the resume after
the load) and pairs with neoAssets layer 05. Next: 06 (the M41 family).
The ZR68C is a closed-bolt rifle: a reload with a round in the chamber keeps that round and needs no bolt pull.
With this PR the ZR68C tracks its chamber:
reloadreload_skipcycle(new)drawunloaded_reload(03)drawunloaded_reload_skipcycle(new)drawtocycle_reload(04)drawsv_neo_reload_experimentaldefaults to 1 while the partial-reload stack is reviewed (Partial reloads 03: Resume a ZR68C reload after the magazine is unloaded #2285); thelast PR of the stack sets it back to 0. With the flag at 0 nothing here runs.
"ChamberedRound" "1"in the weapon script and a phase table;only the ZR68C has both.
How it works
"ChamberedRound"inweapon_zr68c.txt. The clip counts the chambered round: a fresh gun holds29+1 (30, as on master), a tactical reload fills it to 30+1.
m_bChamberEmpty(one networked, predicted bool) is set by the last shot and cleared only by a reload's3_cycle; while it is set a loaded magazine cannot fire.ReloadPhasesOnRequestanswers a reload press before the default reload: refuse during areload or with a full magazine, chamber a loaded magazine (the dry reload without taking reserve ammo, when a resume
was lost), or start
reload_skipcyclewhen a round is chambered. Otherwise the default reload runs.1_unload), the clip drops to the chambered round, 1 or 0,until the new magazine loads. Master's reload already discards the old magazine's rounds at the load; they now go at
the unload, so the reserve changes as on master: a tactical reload from 20 takes 30 from the reserve and ends at
30+1, with or without a switch after the unload. A switch before the unload keeps the old magazine.
IsReloadPastUnload). Before, the empty clipmade
EquipBestWeaponForThreatswitch to the secondary with an enemy within 250 units, which interrupted thereload.
+1while a round is chambered (29+1/30), and lightsthe round icon of the fire-mode glyph only then.
reload_skipcycleis shorter than the reload gesture. It plays the gesture from the start and cutsit at the clip end (
RELOAD_GESTURE_KEEP_START, added in 04).weapon_zr68.reload_unload, the unload piecereload_skipcycleplays (thereload_<step>patternof Partial reloads 03: Resume a ZR68C reload after the magazine is unloaded #2285).
How to review
weapon_neobasecombatweapon.cpp:ReloadPhasesOnRequest,StartPartialReload,PlayReloadSequence(split outof 04's
ResumeReload),FinishReloadPhase, the chamber helpers, and the twoPrimaryAttacklines.neo_bot.cpp: the early return inEquipBestWeaponForThreat.neo_hud_ammo.cpp: the+1row andDrawFireModeWithChamber.How to test
29+1.30+1.then
29+1.with a round chambered; then dry, switch after the new magazine is seated (about 1.4-2.2 s in), and back.
sv_neo_reload_experimental 0(set before the map loads): master behavior, 30 rounds, no+1.Results
Linux Debug client and dedicated server, 0 compiler warnings, neoAssets layer 05 assets. Client runs used a listen
server with one bot replaying the owner's inputs (
bot_mimic), seen as a remote player. HUD values were read frommovie frames.
reload_skipcycle, no bolt pull; clip 1 (the chambered round) at the unload +0.705 s, 31 (30+1) at the load +1.335 s, fire at +2.175 s; reserve 90 to 60; unload, load and tap sounds once; HUD: magazine bullets all dim at the unload with the round icon litreload; 30 at the load with the round icon dim, 29+1 at the bolt pull (+2.28 s), fire at +2.715 sdrawunloaded_reload; 0, then 30 dim, then 29+1drawunloaded_reload_skipcycle; 31 at the end; no cycle sounddrawtocycle_reload; 30 dim, then 29+1; cycle sound oncedraw, keeps 30+1reload_skipcycleplays the gesture from its start and cuts it at cycle 0.80 after 2.17 s+1; a switch cancels the dry reloadThe only client assert is the engine baseline shadow-leaf assert, outside the reloads.
Known limits
tested.
Toolchain
Linked Issues