all this wrapping and it's not even christmas (#33035)

This commit is contained in:
Emmett Gaines
2017-11-23 10:43:59 +01:00
committed by AnturK
parent b726f9df10
commit faaf151580
3 changed files with 35 additions and 43 deletions
+6 -16
View File
@@ -165,7 +165,7 @@
to_chat(user, "<span class='warning'>You can't do that right now!</span>")
return
if(!isnull(new_angle))
setAngle(NORM_ROT(new_angle))
setAngle(SIMPLIFY_DEGREES(new_angle))
return TRUE
/obj/structure/reflector/AltClick(mob/user)
@@ -198,15 +198,10 @@
/obj/structure/reflector/single/auto_reflect(obj/item/projectile/P, pdir, turf/ploc, pangle)
var/incidence = GET_ANGLE_OF_INCIDENCE(rotation_angle, P.Angle)
var/incidence_norm = NORM_ANGLE_OF_INCIDENCE(incidence)
if((incidence_norm > -90) && (incidence_norm < 90))
if(ISINRANGE_EX(ROLLING_CLAMP(incidence, -90, 180), -90, 90))
return FALSE
var/new_angle_s = rotation_angle + incidence
while(new_angle_s > 180) // Translate to regular projectile degrees
new_angle_s -= 360
while(new_angle_s < -180)
new_angle_s += 360
P.Angle = new_angle_s
P.Angle = ROLLING_CLAMP(new_angle_s, -180, 360)
return ..()
//DOUBLE
@@ -229,16 +224,11 @@
/obj/structure/reflector/double/auto_reflect(obj/item/projectile/P, pdir, turf/ploc, pangle)
var/incidence = GET_ANGLE_OF_INCIDENCE(rotation_angle, P.Angle)
var/incidence_norm = NORM_ANGLE_OF_INCIDENCE(incidence)
var/invert = ((incidence_norm > -90) && (incidence_norm < 90))
var/incidence_norm = ROLLING_CLAMP(incidence, -90, 180)
var/new_angle_s = rotation_angle + incidence
if(invert)
if(ISINRANGE_EX(incidence_norm, -90, 90))
new_angle_s += 180
while(new_angle_s > 180) // Translate to regular projectile degrees
new_angle_s -= 360
while(new_angle_s < -180)
new_angle_s += 360
P.Angle = new_angle_s
P.Angle = ROLLING_CLAMP(new_angle_s, -180, 360)
return ..()
//BOX