Skip to content

Conversation

@bakugo
Copy link
Contributor

@bakugo bakugo commented Jul 29, 2025

Fixes ValveSoftware/Source-1-Games#4039

CBaseCombatWeapon::ItemPostFrame() is responsible for calling both SecondaryAttack() and PrimaryAttack(), in that order, depending on the player's input. Engineer's building pickup ability (CTFPlayer::DoClassSpecialSkill()) is called from within the active weapon's SecondaryAttack(), but if it activates (and switches to tf_weapon_builder, calling Holster() on the previous weapon in the process), it doesn't do anything to block a subsequent primary attack, so if both attack inputs are pressed simultaneously, ItemPostFrame() ends up calling PrimaryAttack() immediately afterwards too. This results in the previous weapon attacking after it has supposedly been switched away from and holstered. PrimaryAttack() then schedules the melee hit by setting m_flSmackTime. Holster() would normally unset m_flSmackTime to prevent this attack from being stored between weapon switches, but since this is being done after Holster() was already called, it stays stored, and activates as soon as the weapon is deployed again.

Fixed by blocking primary attacks on the same frame as a building pickup by setting m_flNextPrimaryAttack.

Bitl added a commit to BitlDevelopmentStudios/source-sdk-2013-bds-base that referenced this pull request Jul 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TF2] Engineer's rapid double melee swing

1 participant