You just need a cooldown timer except that instead of preventing you from casting the spell, it inhibits damage.
Cooldown timers, gun bullet intervals, shot spacing, rate of fire:
GunHeat (gunheat) spawning shooting rate of fire: