garrynewman/garrysmod — pull request #685 by Bo98 (2014-04-28 17:40:38+00:00)
Title: TTT: Fixed not being able to shoot a weapon when equipped while being held by a magneto stick

When a weapon is equipped while it's being held by a magneto stick, errors occur. The player is unable to shoot their weapon and the ammo count is potentially incorrect or not visible at all. The shotgun also spits errors when shot.

The magneto stick calls its Reset function after a weapon is equipped. Because there was no owner when the weapon was first picked up with the magneto stick, the owner is set to nil. Reequipping the weapon worked around this issue.

This fix uses the WeaponEquip hook which is called before the owner it set. This gives us time to call SWEP:Drop() and reset the owner before the new owner is set.