BF2.US bf2-rsdeveloper wiki Parity Discord bf2.us
Battlefield Heroes
On this page

The workbench: weapon upgrades and their alt-fire

Heroes

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.

An upgrade's alt-fire, from the hero's items to the right mouse button the kit's pickup over the player's items: a weapon gear whose template names an alt-fire weapon which weapons the gear is on a kit object for the alternate; its id recorded on each of those weapons the soldier gets the alternate a pass over his fire arms: the arm that names it, or whose id is in the recorded set the arm's alternate taken when the arm has none or another one; from here on as a built-in alt-fire the alt-fire input goes to the alternate; the stat pass does not touch it BFHeroes.exe@bfh126!0x0075af1c (pickup), 0x006ef603, 0x006f4735 (the sets), 0x007234a0 (the pass), 0x0070e853 (the input)
An upgrade's alt-fire on its way to the weapon, as the sweep read the original's functions.
The verdicts, and what they rest on

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):

  1. 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).
  2. 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.
  3. 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.

#WhatThe portVerdictWhat a player meets
1an upgrade's alt-fire on the serverbefore: 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 patchsee the statethe right button on a weapon with an alt-fire upgrade did nothing at all
2the same on the player's own client (prediction, effects, sound, the alternate's ammunition)written as a patchsee the statewithout it the server would fire and the shooter would see and hear nothing of his own shot
3another player's upgrade alt-fire on your clienta client knows its own hero's upgrades only; the server sends no hero's upgrade pairsNOT WIRED; how the original's clients learn another hero's upgrades is NOT SETTLEDanother player's upgrade alt-fire would hit and push without a flash or a sound on your screen
4a weapon's default upgrades in a played gamethe server and the client's kit take the equipped pairs onlyNOT 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
5the emote on the health gun's alt-fire (0x007095c4)ported as a statement without a hostNOT WIREDno emote on the health gun's right button
6which alt-fire wins when a weapon with a built-in one gets an upgrade'sthe same function; the replaced alternate's object is not removed on the serverSAME for the choice (tests); the left-over object is the port'snone known: the workbench blocks that slot for the 8 weapons concerned
7an alternate no arm takesthe 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#

#WhatVerdictNote
8magazine, 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
9critical hit chance and damage, projectile damage and its distancesSAME (tests)damage
10speed and damage below a health, health back at every n-th critical hit, less damage over time, blast damage, flag capture speedSAME where a test standsported on the server; the speed one on the client too
11the detonation lines of six gears and the blast's forceSAME where a test stands; not replayed in the sweep's round
11ba muzzle effect, the weapon's HUD picture, deviation and target lines, an ability's ammunition intervalNOT WIREDno gear template of version 1.126 has such a line, so a player meets nothing
12when the stats applyDIFFERS, openthe 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
13the zoom block's copy (unset fields take the upgrade's defaults, 0x0070f582)DIFFERS, opennot modelled; what a player meets is not known

The screen#

#WhatVerdictWhat a player meets
14the tooltip's boxDIFFERSthe 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
15the shelves, the four slots, drag and drop, the equip and unequip questionsSAME as far as it was played
17blocked slots and the default upgrades shownSAME (tests)
19pricesNOT SETTLEDthe 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:

PartState
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 heroa 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 pagenot 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.

FeatureCheckedWhat it doesWhat you see
Workbench alternate fire (a weapon's second fire)9 of 66 lines checked1 of 150 of 15

What the port has#

PartState
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"):

text
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_fire

The 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#

WhatWhere
the pickup's gear branch, the weapon setscrates/bfh-game/src/customization (gear_alt: kit_pickup_gear_alt, WeaponItemSets)
the stat linesweapon_gear (upgrade_components, PROPERTIES) in crates/bfh-game
the alternate's pass on the servercrates/bf2-server/src/alt_fire_heroes.rs
the workbench screencrates/bfh-ui/src/workbench.rs

Notes: notes/bfheroes/workbench_sweep.md, notes/bfheroes/weapongear.md. See also abilities, widgets, the Flash player.

Source: docs/dev/heroes/workbench.md · built from bf2-rs e3b4f05 · part of the Battlefield 2 / 2142 / Heroes reimplementation. Not affiliated with EA or DICE.