You probably do not want to use the Euler angles, as its a Vector3 that represents the rotation but is not necessarily the direction the node is in. I’m not sure what direction (0, 0, 0)
rotation is in Euler angles, nor if it would be consistent.
I’d check to see which of the three axes is “forward” for your weapon. Once you figure that out, you can then get its global-space direction from the basis. If your weapon faces the -Z axes, then -$weapon.global_transform.basis.z.normalized()
should give you its current direction.
Then I think you should just be able to use a dot product to figure out the angle difference between the weapon direction and Vector3.DOWN.
Something like this should work, I think (untested):
# assuming -Z is “forward” for your weapon
var direction = global_transform.basis.z.normalized()
var angle = Vector3.DOWN.dot(direction)
# In Godot, most every function uses radians (with a few exceptions)
var angle_needed = deg2rad(20)
if (angle <= angle_needed):
reload()