Wrench in Opposing Force

The wrench in Half-Life: Opposing Force is the standard melee weapon of Adrian Shephard. Unlike the crowbar, it has a secondary attack mode. Also unlike the crowbar, its primary attacks are slower. If you’ve ever wondered about the wrench’s attack characteristics, I will describe here some notable features by examining the disassembled and decompiled code of opfor.so.

The primary and secondary attacks read the skill cvar sk_plr_pipewrenchX. In the default settings, the value is 20 in all difficulties. This doesn’t mean that the primary attack deals 20 damage, however. Due to a similar bug that afflicted the crowbar in modern Half-Life versions, the weapon never deals its full damage. The primary attack rate is two hits per second, giving a damage rate of 20, which is the same as the crowbar.

The secondary attack can be charged, similar to the gauss. When a charge of time \(t\) is released, the damage dealt is

$$D = \min(25 + \mathtt{sk\_plr\_pipewrenchX} \cdot t, 150)$$

The minimum charge time is roughly 1.1 seconds. This is due to a check in CPipeWrench::WeaponIdle for a minimum of 1s, before it sets the think function to CPipeWrench::BigSwing which is run after 0.1s.

Notice the maximum possible damage of 150. By inverting the equation, we see that \(t = 6.25\) is the charge time required to achieve the maximum damage, which is glacial in speedrunning contexts.

There is no “quickwrench”, unlike quickgauss with the gauss weapon in Half-Life. Saving and reloading while the wrench is charging does not increase its damage. This is because the CPipeWrench::m_flBigSwingStart class member is properly saved.