the _process(delta) function gets called every frame, assuming your monitor supports 60 fps means that the game runs (f not lagging) at 60 fps, so _process(delta) gets called 60 times with delta being about 0.016
in your code, in each run of _process(delta) the GlobalVar.energy only gets increased by 1 at most - so as soon as you hit a higher value of GlobalVar.energypersec that exceeds your monitor framerate, then you only add one but drop all others
you must consider the case, that in one _process(delta) run, that you need to be able to add more than 1
like...
func _process(delta):
if GlobalVar.energypersec > 0:
timer += delta
var energy_to_add = timer * GlobalVar.energypersec
if energy_to_add > 1.0:
GlobalVar.energy += floor(energy_to_add)
timer -= floor(energy_to_add) / GlobalVar.energypersec
mind that cutting the timer to 0 means losing precision, as you should only remove so much from the timer that was added as energy
it would be probably better to store the energy as a float instead of a int, so you do not have to consider discrete increment steps
func _process(delta: float) -> void:
if GlobalVar.energypersec > 0.0:
GlobalVar.energy += delta * GlobalVar.energypersec