I was tired, when I posted that so my mind defaulted to the standard way. There is actually a easier way to aim at the mouse:
func beam_fire(InDelta): # This is where I want most of the laser beam's code to be.
$Line2D.position = $LazerSpawn.global_position
$Line2D.points[0] = Vector2.ZERO
#Just get the mouse position and subtract our own position from it
$Line2D.points[1] = get_global_mouse_position() - self.global_position
$Line2D/RayCast2D.cast_to = $Line2D.points[1]
The more advanced way uses a distance calculation to impose a limit on the beam:
func beam_fire(): # This is where I want most of the laser beam's code to be.
$Line2D.global_position = $LazerSpawn.global_position
$Line2D.points[0] = Vector2.ZERO
var Offset = get_global_mouse_position() - $Line2D.global_position
var DistanceToMouse = Offset.length()
var Rotation = Offset / DistanceToMouse #Optimal same as Offset.normalized()
var LimitedLazer = 300
if DistanceToMouse > LimitedLazer:
$Line2D.points[1] = Rotation* LimitedLazer
else:
$Line2D.points[1] = Offset
$Line2D/RayCast2D.cast_to = $Line2D.points[1]
I recommend that if you have some time, learn the basis of linear algebra. It is fundamental to game design; or learn it as you go.