tgstation/-tg-station — pull request #3921 by Menshin (2014-06-13 20:29:57+00:00)
Title: Fixes energy weapons drawing charges on click even when no shot was fire.

The click code was drawing the charge before even checking if the gun could fire.

The new procedure goes as follow :
* the click code goes on until its end (_afterattack_),
* if there's enough energy in the gun cell, a selected mode shot is chambered (laser, electrode, ...),
* the attack/firing code does its things,
* at the end of it, we check if the shot was spend (i.e the actual "bullet" was send). If so, we draw on the gun cell the correct amount of power. If not, we just discard the chambered shot.

Fixes #3910 (and every types of energy guns).

I wish we could overload variables, preventing those two typecasts.

By the way, is there any reason the laser projectile cost only 83 energy on the laser gun, instead of 100 for every others guns that uses lasers (practise, egun, ...) ?