Skip to content

Commit

Permalink
simplify Get_Angle()
Browse files Browse the repository at this point in the history
arctan(x, y) can handle nulls and zeroes by itself
  • Loading branch information
Doubleumc committed Dec 14, 2023
1 parent 9e51207 commit c40919a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions code/__HELPERS/unsorted.dm
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,8 @@
return 0 //Atoms are not on turfs.
var/dy = get_pixel_position_y(end) - get_pixel_position_y(start)
var/dx = get_pixel_position_x(end) - get_pixel_position_x(start)
if(!dy)
return (dx >= 0) ? 90 : 270
. = arctan(dx / dy)
if(dy < 0)
. += 180
else if(dx < 0)
. = arctan(dy, dx)
if(. < 0)
. += 360

/proc/Get_Pixel_Angle(dx, dy)//for getting the angle when animating something's pixel_x and pixel_y
Expand Down

0 comments on commit c40919a

Please sign in to comment.