Defines math, take 2
This commit is contained in:
committed by
CitadelStationBot
parent
220e1cd8cf
commit
f875d4e176
@@ -14,7 +14,7 @@
|
||||
new_data = 1
|
||||
|
||||
if(isnum(new_data))
|
||||
data = Clamp(round(new_data), 1, IC_MAX_LIST_LENGTH)
|
||||
data = CLAMP(round(new_data), 1, IC_MAX_LIST_LENGTH)
|
||||
holder.on_data_written()
|
||||
|
||||
/datum/integrated_io/index/display_pin_type()
|
||||
|
||||
@@ -265,7 +265,7 @@
|
||||
pull_data()
|
||||
var/incoming = get_pin_data(IC_INPUT, 1)
|
||||
if(!isnull(incoming))
|
||||
result = ToDegrees(incoming)
|
||||
result = TODEGREES(incoming)
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
@@ -283,7 +283,7 @@
|
||||
pull_data()
|
||||
var/incoming = get_pin_data(IC_INPUT, 1)
|
||||
if(!isnull(incoming))
|
||||
result = ToRadians(incoming)
|
||||
result = TORADIANS(incoming)
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
/obj/item/integrated_circuit/transfer/pulsedemultiplexer/do_work()
|
||||
var/output_index = get_pin_data(IC_INPUT, 1)
|
||||
|
||||
if(output_index == Clamp(output_index, 1, number_of_pins))
|
||||
if(output_index == CLAMP(output_index, 1, number_of_pins))
|
||||
activate_pin(round(output_index + 1 ,1))
|
||||
|
||||
/obj/item/integrated_circuit/transfer/pulsedemultiplexer/medium
|
||||
|
||||
@@ -373,7 +373,7 @@
|
||||
var/rad = get_pin_data(IC_INPUT, 2)
|
||||
|
||||
if(isnum(rad))
|
||||
rad = Clamp(rad, 0, 8)
|
||||
rad = CLAMP(rad, 0, 8)
|
||||
radius = rad
|
||||
|
||||
/obj/item/integrated_circuit/input/advanced_locator_list/do_work()
|
||||
@@ -426,7 +426,7 @@
|
||||
/obj/item/integrated_circuit/input/advanced_locator/on_data_written()
|
||||
var/rad = get_pin_data(IC_INPUT, 2)
|
||||
if(isnum(rad))
|
||||
rad = Clamp(rad, 0, 8)
|
||||
rad = CLAMP(rad, 0, 8)
|
||||
radius = rad
|
||||
|
||||
/obj/item/integrated_circuit/input/advanced_locator/do_work()
|
||||
|
||||
@@ -93,8 +93,8 @@
|
||||
yo.data = round(yo.data, 1)
|
||||
|
||||
var/turf/T = get_turf(assembly)
|
||||
var/target_x = Clamp(T.x + xo.data, 0, world.maxx)
|
||||
var/target_y = Clamp(T.y + yo.data, 0, world.maxy)
|
||||
var/target_x = CLAMP(T.x + xo.data, 0, world.maxx)
|
||||
var/target_y = CLAMP(T.y + yo.data, 0, world.maxy)
|
||||
|
||||
shootAt(locate(target_x, target_y, T.z))
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
var/datum/integrated_io/detonation_time = inputs[1]
|
||||
var/dt
|
||||
if(isnum(detonation_time.data) && detonation_time.data > 0)
|
||||
dt = Clamp(detonation_time.data, 1, 12)*10
|
||||
dt = CLAMP(detonation_time.data, 1, 12)*10
|
||||
else
|
||||
dt = 15
|
||||
addtimer(CALLBACK(attached_grenade, /obj/item/grenade.proc/prime), dt)
|
||||
@@ -389,9 +389,9 @@
|
||||
if(!M.temporarilyRemoveItemFromInventory(A))
|
||||
return
|
||||
|
||||
var/x_abs = Clamp(T.x + target_x_rel, 0, world.maxx)
|
||||
var/y_abs = Clamp(T.y + target_y_rel, 0, world.maxy)
|
||||
var/range = round(Clamp(sqrt(target_x_rel*target_x_rel+target_y_rel*target_y_rel),0,8),1)
|
||||
var/x_abs = CLAMP(T.x + target_x_rel, 0, world.maxx)
|
||||
var/y_abs = CLAMP(T.y + target_y_rel, 0, world.maxy)
|
||||
var/range = round(CLAMP(sqrt(target_x_rel*target_x_rel+target_y_rel*target_y_rel),0,8),1)
|
||||
|
||||
A.forceMove(drop_location())
|
||||
A.throw_at(locate(x_abs, y_abs, T.z), range, 3)
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
var/brightness = get_pin_data(IC_INPUT, 2)
|
||||
|
||||
if(new_color && isnum(brightness))
|
||||
brightness = Clamp(brightness, 0, 6)
|
||||
brightness = CLAMP(brightness, 0, 6)
|
||||
light_rgb = new_color
|
||||
light_brightness = brightness
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
var/selected_sound = sounds[ID]
|
||||
if(!selected_sound)
|
||||
return
|
||||
vol = Clamp(vol ,0 , 100)
|
||||
vol = CLAMP(vol ,0 , 100)
|
||||
playsound(get_turf(src), selected_sound, vol, freq, -1)
|
||||
|
||||
/obj/item/integrated_circuit/output/sound/on_data_written()
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
else
|
||||
direction_mode = SYRINGE_INJECT
|
||||
if(isnum(new_amount))
|
||||
new_amount = Clamp(new_amount, 0, volume)
|
||||
new_amount = CLAMP(new_amount, 0, volume)
|
||||
transfer_amount = new_amount
|
||||
|
||||
// Hydroponics trays have no reagents holder and handle reagents in their own snowflakey way.
|
||||
@@ -184,7 +184,7 @@
|
||||
activate_pin(3)
|
||||
return
|
||||
|
||||
var/tramount = Clamp(transfer_amount, 0, reagents.total_volume)
|
||||
var/tramount = CLAMP(transfer_amount, 0, reagents.total_volume)
|
||||
|
||||
if(isliving(AM))
|
||||
var/mob/living/L = AM
|
||||
@@ -235,7 +235,7 @@
|
||||
else
|
||||
direction_mode = SYRINGE_INJECT
|
||||
if(isnum(new_amount))
|
||||
new_amount = Clamp(new_amount, 0, 50)
|
||||
new_amount = CLAMP(new_amount, 0, 50)
|
||||
transfer_amount = new_amount
|
||||
|
||||
/obj/item/integrated_circuit/reagent/pump/do_work()
|
||||
@@ -383,7 +383,7 @@
|
||||
else
|
||||
direction_mode = SYRINGE_INJECT
|
||||
if(isnum(new_amount))
|
||||
new_amount = Clamp(new_amount, 0, 50)
|
||||
new_amount = CLAMP(new_amount, 0, 50)
|
||||
transfer_amount = new_amount
|
||||
|
||||
/obj/item/integrated_circuit/reagent/filter/do_work()
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
/obj/item/integrated_circuit/time/delay/custom/do_work()
|
||||
var/delay_input = get_pin_data(IC_INPUT, 1)
|
||||
if(delay_input && isnum(delay_input) )
|
||||
var/new_delay = Clamp(delay_input ,1 ,36000) //An hour.
|
||||
var/new_delay = CLAMP(delay_input ,1 ,36000) //An hour.
|
||||
delay = new_delay
|
||||
|
||||
..()
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
var/result = null
|
||||
var/A = get_pin_data(IC_INPUT, 1)
|
||||
if(!isnull(A))
|
||||
result = Tan(A)
|
||||
result = TAN(A)
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
@@ -91,7 +91,7 @@
|
||||
var/result = null
|
||||
var/A = get_pin_data(IC_INPUT, 1)
|
||||
if(!isnull(A))
|
||||
result = Csc(A)
|
||||
result = CSC(A)
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
@@ -111,7 +111,7 @@
|
||||
var/result = null
|
||||
var/A = get_pin_data(IC_INPUT, 1)
|
||||
if(!isnull(A))
|
||||
result = Sec(A)
|
||||
result = SEC(A)
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
@@ -131,7 +131,7 @@
|
||||
var/result = null
|
||||
var/A = get_pin_data(IC_INPUT, 1)
|
||||
if(!isnull(A))
|
||||
result = Cot(A)
|
||||
result = COT(A)
|
||||
|
||||
set_pin_data(IC_OUTPUT, 1, result)
|
||||
push_data()
|
||||
|
||||
Reference in New Issue
Block a user