Defines math, take 2

This commit is contained in:
Emmett Gaines
2017-12-17 11:02:11 -05:00
committed by CitadelStationBot
parent 220e1cd8cf
commit f875d4e176
180 changed files with 1250 additions and 644 deletions

View File

@@ -129,7 +129,7 @@
if(burn_time_remaining() < MAXIMUM_BURN_TIMER)
flame_expiry_timer = world.time + MAXIMUM_BURN_TIMER
else
fuel_added = Clamp(fuel_added + amount, 0, MAXIMUM_BURN_TIMER)
fuel_added = CLAMP(fuel_added + amount, 0, MAXIMUM_BURN_TIMER)
/obj/structure/fireplace/proc/burn_time_remaining()
if(lit)

View File

@@ -30,7 +30,7 @@
return
var/ratio = obj_integrity / max_integrity
ratio = Ceiling(ratio*4) * 25
ratio = CEILING(ratio*4, 1) * 25
if(smooth)
queue_smooth(src)

View File

@@ -67,7 +67,7 @@
resistance_flags |= INDESTRUCTIBLE
/obj/structure/lattice/clockwork/ratvar_act()
if(IsOdd(x+y))
if(ISODD(x+y))
icon = 'icons/obj/smooth_structures/lattice_clockwork_large.dmi'
pixel_x = -9
pixel_y = -9
@@ -124,7 +124,7 @@
resistance_flags |= INDESTRUCTIBLE
/obj/structure/lattice/catwalk/clockwork/ratvar_act()
if(IsOdd(x+y))
if(ISODD(x+y))
icon = 'icons/obj/smooth_structures/catwalk_clockwork_large.dmi'
pixel_x = -9
pixel_y = -9

View File

@@ -119,7 +119,7 @@
else
cur_oct[cur_note] = text2num(ni)
if(user.dizziness > 0 && prob(user.dizziness / 2))
cur_note = Clamp(cur_note + rand(round(-user.dizziness / 10), round(user.dizziness / 10)), 1, 7)
cur_note = CLAMP(cur_note + rand(round(-user.dizziness / 10), round(user.dizziness / 10)), 1, 7)
if(user.dizziness > 0 && prob(user.dizziness / 5))
if(prob(30))
cur_acc[cur_note] = "#"

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)
@@ -197,16 +197,12 @@
anchored = TRUE
/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 = get_angle_of_incidence(rotation_angle, P.Angle, FALSE)
if((incidence_norm > -90) && (incidence_norm < 90))
var/incidence = GET_ANGLE_OF_INCIDENCE(rotation_angle, P.Angle)
var/norm_inc = WRAP(incidence, -90, 90)
var/new_angle = WRAP(rotation_angle + norm_inc, 180, -180)
if(ISINRANGE_EX(norm_inc, -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 = new_angle
return ..()
//DOUBLE
@@ -228,17 +224,12 @@
anchored = TRUE
/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 = get_angle_of_incidence(rotation_angle, P.Angle, FALSE)
var/invert = ((incidence_norm > -90) && (incidence_norm < 90))
var/new_angle_s = rotation_angle + incidence
if(invert)
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
var/incidence = GET_ANGLE_OF_INCIDENCE(rotation_angle, P.Angle)
var/norm_inc = WRAP(incidence, -90, 90)
var/new_angle = WRAP(rotation_angle + norm_inc, 180, -180)
if(ISINRANGE_EX(norm_inc, -90, 90))
new_angle += 180
P.Angle = new_angle
return ..()
//BOX

View File

@@ -134,8 +134,8 @@
if(!click_params || !click_params["icon-x"] || !click_params["icon-y"])
return
//Clamp it so that the icon never moves more than 16 pixels in either direction (thus leaving the table turf)
I.pixel_x = Clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
I.pixel_y = Clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
I.pixel_x = CLAMP(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
I.pixel_y = CLAMP(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
return 1
else
return ..()

View File

@@ -380,7 +380,7 @@
return
var/ratio = obj_integrity / max_integrity
ratio = Ceiling(ratio*4) * 25
ratio = CEILING(ratio*4, 1) * 25
if(smooth)
queue_smooth(src)