On this page
The workbench: weapon upgrades and their alt-fire
At the workbench a hero puts upgrades on a weapon: a larger magazine, a scope, a better critical hit, or a second way to fire on the right mouse button. A sweep of 2026-11-28 read what the original does with each of them and laid it beside the port. It was started by a player's report: an alt-fire added at the workbench did nothing. This page is that sweep, row by row, in its own verdict words.
SAME: a test or a play shows it. DIFFERS: filed. NOT WIRED: the original does it and the port has no code that does. NOT SETTLED: the original was not read far enough. A row that is a reading has no test or play behind it yet, and can be wrong. The sweep is one day old; several of its rows change with the patches named below.
What an upgrade is#
A weapon upgrade is an item of the hero's ("weapon gear") with a template of console lines. A gear of the alt-fire slot has one line, upgradeWeapon.addAltFireWeapon <template>: Push Beam for the submachine gun names a weapon template of its own. That weapon is an ordinary fire arm with isAltFireWeapon 1, its fire input set to the alt-fire key, and (for the six upgrade weapons) its own ammunition of 1 to 50 rounds that reloads by itself.
A built-in alt-fire is the same kind of weapon, named by the arm's own template (altFireWeaponName: a rifle's grenade launcher). The 36 weapons that have one also carry it as a default upgrade in the weapons' list.
The other slots hold stat upgrades: lines that add to or replace a value of the weapon (magazine, reload, zoom, recoil, critical hits, damage and its distances). See damage for what those values do.
How an alt-fire upgrade reaches the weapon#
As read in the original (version 1.126):
- At the kit's pickup (
BFHeroes.exe@bfh126!0x0075af1c) the game goes over the player's items. An item that is a weapon gear gives its template's upgrade component; when that names an alt-fire weapon (0x007e5d76) and a template of the name exists, the player is asked which weapons the gear is on (0x006ef603). For each one a kit object for the alternate is made, and the alternate's id is recorded on that weapon (0x006f4735). Then the gear's own template is made a kit object too: an ability whose activation applies the stat lines (0x007e8cbc). - When the soldier gets the alternate (
0x0072437a) a pass goes over his fire arms (0x007234a0). The arm whose template names the weapon, or whose id is in the recorded set, takes it as its alternate, when it has none or another one. - From there on it is the arm's alternate as a built-in one is: the alt-fire input goes to it (
0x0070e853).
The stat pass (0x007e8540) does not touch the alternate.
| # | What | The port | Verdict | What a player meets |
|---|---|---|---|---|
| 1 | an upgrade's alt-fire on the server | before: the pass ran with an empty set, and nothing made the upgrade's weapon. The pure functions are in the tree; the server's statement is a patch | see the state | the right button on a weapon with an alt-fire upgrade did nothing at all |
| 2 | the same on the player's own client (prediction, effects, sound, the alternate's ammunition) | written as a patch | see the state | without it the server would fire and the shooter would see and hear nothing of his own shot |
| 3 | another player's upgrade alt-fire on your client | a client knows its own hero's upgrades only; the server sends no hero's upgrade pairs | NOT WIRED; how the original's clients learn another hero's upgrades is NOT SETTLED | another player's upgrade alt-fire would hit and push without a flash or a sound on your screen |
| 4 | a weapon's default upgrades in a played game | the server and the client's kit take the equipped pairs only | NOT SETTLED (not read in the game) | nothing for the alt-fires (the arm's template names the same weapon); the health gun's alt-fire emote does not play |
| 5 | the emote on the health gun's alt-fire (0x007095c4) | ported as a statement without a host | NOT WIRED | no emote on the health gun's right button |
| 6 | which alt-fire wins when a weapon with a built-in one gets an upgrade's | the same function; the replaced alternate's object is not removed on the server | SAME for the choice (tests); the left-over object is the port's | none known: the workbench blocks that slot for the 8 weapons concerned |
| 7 | an alternate no arm takes | the original keeps it in an item slot of the soldier; the port removes it (it has no such slot) | DIFFERS (the port's model) | none known |
The stat upgrades#
| # | What | Verdict | Note |
|---|---|---|---|
| 8 | magazine, reload, batch, projectile limit, zoom, recoil (a line adds or replaces) | SAME (tests; played: a magazine of 40 becomes 42) | applied to the weapon's template copy, on the server and the client |
| 9 | critical hit chance and damage, projectile damage and its distances | SAME (tests) | damage |
| 10 | speed and damage below a health, health back at every n-th critical hit, less damage over time, blast damage, flag capture speed | SAME where a test stands | ported on the server; the speed one on the client too |
| 11 | the detonation lines of six gears and the blast's force | SAME where a test stands; not replayed in the sweep's round | |
| 11b | a muzzle effect, the weapon's HUD picture, deviation and target lines, an ability's ammunition interval | NOT WIRED | no gear template of version 1.126 has such a line, so a player meets nothing |
| 12 | when the stats apply | DIFFERS, open | the original applies them at the gear ability's activation, to the live weapon, and resets them at its end (0x007e8728); the port applies them at the kit's pickup. By the sweep's reading an upgrade equipped during a life counts from the next spawn in both |
| 13 | the zoom block's copy (unset fields take the upgrade's defaults, 0x0070f582) | DIFFERS, open | not modelled; what a player meets is not known |
The screen#
| # | What | Verdict | What a player meets |
|---|---|---|---|
| 14 | the tooltip's box | DIFFERS | the original sizes the box from the text field's width, which in its Flash player is the widest line's of a word-wrapped field. The port's player answers one line's width, so a tooltip with a short name and a longer description has a box as wide as the short line and the long line runs out of it. The mend is a patch for the Flash player: written, not applied, not built |
| 15 | the shelves, the four slots, drag and drop, the equip and unequip questions | SAME as far as it was played | |
| 17 | blocked slots and the default upgrades shown | SAME (tests) | |
| 19 | prices | NOT SETTLED | the 1.126 data has none (upgrades came through supply drops); the port's are stand-ins |
The sweep's rows 16 and 18 (what happens to the upgrade a new one replaces, and the count on a stack) are open too; they are about a hero's stored items and not about the game.
The state of the port, as the sweep has it#
As of 2026-11-28:
| Part | State |
|---|---|
| the pure functions (which weapons a gear is on, the record on a weapon, the pickup's gear branch, the upgrade's alt-fire name) | landed, with their tests; nothing calls them in that commit |
| the server's statement (the alternate made at the kit's pickup, the pass with the upgrade's set) | a patch, not landed. Its test from the address was red with the set left empty and is green with it. A server statement lands behind a vehicle replay, and the replay could not be started in the sweep's round |
| the client's part for the player's own hero | a patch, written and never built. It must not land without the server's part: a client that predicts an alt-fire the server does not fire would be worse than today |
| a scenario with two heroes (a built-in launcher, and a submachine gun with Push Beam) | written, never run |
| a play on a page | not started |
So the fault itself is, in the sweep's words, a reading plus one library test today, not a played run. What is next, in the sweep's order: the vehicle replay on the server patch and its landing; the client's libraries and their landing with it; the scenario red on the tip without the patches and green with them; then row 3, which first needs a read of how the original's clients get another hero's upgrades; then the Flash player's patch for the tooltip.
The checklist#
Each of these has a checklist in the feature ledger: every step of the original's code behind it and every situation it must work in. None is called done until every line is checked.
| Feature | Checked | What it does | What you see |
|---|---|---|---|
| Workbench alternate fire (a weapon's second fire) | 9 of 66 lines checked | 1 of 15 | 0 of 15 |
What the port has#
| Part | State |
|---|---|
| stat upgrades (rows 8 to 11) | ported; the same where a test stands |
| an upgrade's alt-fire, server and own client (rows 1, 2) | not landed: patches, see above |
| another player's upgrade alt-fire (row 3) | not wired; the original's side not settled |
| the health gun's emote (row 5) | not wired |
| a weapon's default upgrades in a played game (row 4) | not settled: not read in the game |
| when the stats apply, the zoom block's copy (rows 12, 13) | differs, open |
| the tooltip's box (row 14) | differs; the mend is an unapplied patch |
How it is tested#
The sweep's own checks, as its notes give them (the wiki's worker runs no cargo, so they are quoted and not run here; see notes/bfheroes/workbench_sweep.md, "Checks"):
cargo test -p bfh-game --lib gear_alt
cargo test -p bf2-server --lib workbench_alt_fire
cargo test -p bfh-client --lib equipped_alt_fire
cargo test -p bf2-client --test heroes_gear_alt_fireThe first runs on the tree today. The other three name tests that come with the patches. The rule for a row is the one every Heroes sweep uses: a test written from the address first, red against the port as it stands, then the port, then one mutation that the test must catch (how a port is made).
In the code#
| What | Where |
|---|---|
| the pickup's gear branch, the weapon sets | crates/bfh-game/src/customization (gear_alt: kit_pickup_gear_alt, WeaponItemSets) |
| the stat lines | weapon_gear (upgrade_components, PROPERTIES) in crates/bfh-game |
| the alternate's pass on the server | crates/bf2-server/src/alt_fire_heroes.rs |
| the workbench screen | crates/bfh-ui/src/workbench.rs |
Notes: notes/bfheroes/workbench_sweep.md, notes/bfheroes/weapongear.md. See also abilities, widgets, the Flash player.
docs/dev/heroes/workbench.md · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.