mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +00:00
This commit is contained in:
@@ -185,25 +185,25 @@
|
||||
handled=1
|
||||
|
||||
if("set_input_pressure" in signal.data)
|
||||
input_pressure_min = between(
|
||||
0,
|
||||
input_pressure_min = Clamp(
|
||||
text2num(signal.data["set_input_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
handled=1
|
||||
|
||||
if("set_output_pressure" in signal.data)
|
||||
output_pressure_max = between(
|
||||
0,
|
||||
output_pressure_max = Clamp(
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
handled=1
|
||||
|
||||
if("set_external_pressure" in signal.data)
|
||||
external_pressure_bound = between(
|
||||
0,
|
||||
external_pressure_bound = Clamp(
|
||||
text2num(signal.data["set_external_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
handled=1
|
||||
|
||||
@@ -113,9 +113,9 @@
|
||||
on = !on
|
||||
|
||||
if("set_output_pressure" in signal.data)
|
||||
target_pressure = between(
|
||||
0,
|
||||
target_pressure = Clamp(
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
|
||||
@@ -134,9 +134,9 @@ Thus, the two variables affect pump operation are set in New():
|
||||
on = !on
|
||||
|
||||
if("set_output_pressure" in signal.data)
|
||||
target_pressure = between(
|
||||
0,
|
||||
target_pressure = Clamp(
|
||||
text2num(signal.data["set_output_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
|
||||
|
||||
@@ -125,9 +125,9 @@ Thus, the two variables affect pump operation are set in New():
|
||||
on = !on
|
||||
|
||||
if("set_transfer_rate" in signal.data)
|
||||
transfer_rate = between(
|
||||
0,
|
||||
transfer_rate = Clamp(
|
||||
text2num(signal.data["set_transfer_rate"]),
|
||||
0,
|
||||
air1.volume
|
||||
)
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@
|
||||
|
||||
if("set_volume_rate" in signal.data)
|
||||
var/number = text2num(signal.data["set_volume_rate"])
|
||||
volume_rate = between(0, number, air_contents.volume)
|
||||
volume_rate = Clamp(number, 0, air_contents.volume)
|
||||
|
||||
if("status" in signal.data)
|
||||
spawn(2)
|
||||
|
||||
@@ -225,33 +225,33 @@
|
||||
handled=1
|
||||
|
||||
if("set_internal_pressure" in signal.data)
|
||||
internal_pressure_bound = between(
|
||||
0,
|
||||
internal_pressure_bound = Clamp(
|
||||
text2num(signal.data["set_internal_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
handled=1
|
||||
|
||||
if("set_external_pressure" in signal.data)
|
||||
external_pressure_bound = between(
|
||||
0,
|
||||
external_pressure_bound = Clamp(
|
||||
text2num(signal.data["set_external_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
handled=1
|
||||
|
||||
if("adjust_internal_pressure" in signal.data)
|
||||
internal_pressure_bound = between(
|
||||
0,
|
||||
internal_pressure_bound = Clamp(
|
||||
internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
handled=1
|
||||
|
||||
if("adjust_external_pressure" in signal.data)
|
||||
external_pressure_bound = between(
|
||||
0,
|
||||
external_pressure_bound = Clamp(
|
||||
external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),
|
||||
0,
|
||||
ONE_ATMOSPHERE*50
|
||||
)
|
||||
handled=1
|
||||
|
||||
@@ -471,14 +471,6 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
||||
var/M = E/(SPEED_OF_LIGHT_SQ)
|
||||
return M
|
||||
|
||||
//Forces a variable to be posative
|
||||
/proc/modulus(var/M)
|
||||
if(M >= 0)
|
||||
return M
|
||||
if(M < 0)
|
||||
return -M
|
||||
|
||||
|
||||
/proc/key_name(var/whom, var/include_link = null, var/include_name = 1)
|
||||
var/mob/M
|
||||
var/client/C
|
||||
@@ -644,10 +636,6 @@ Turf and target are seperate in case you want to teleport some distance from a t
|
||||
var/y = min(world.maxy, max(1, A.y + dy))
|
||||
return locate(x,y,A.z)
|
||||
|
||||
//Makes sure MIDDLE is between LOW and HIGH. If not, it adjusts it. Returns the adjusted value.
|
||||
/proc/between(var/low, var/middle, var/high)
|
||||
return max(min(middle, high), low)
|
||||
|
||||
proc/arctan(x)
|
||||
var/y=arcsin(x/sqrt(1+x*x))
|
||||
return y
|
||||
@@ -1234,10 +1222,6 @@ proc/get_mob_with_client_list()
|
||||
loc = loc.loc
|
||||
return null
|
||||
|
||||
/proc/get_turf_or_move(turf/location)
|
||||
return get_turf(location)
|
||||
|
||||
|
||||
//Quick type checks for some tools
|
||||
var/global/list/common_tools = list(
|
||||
/obj/item/weapon/cable_coil,
|
||||
|
||||
@@ -748,7 +748,7 @@ datum/mind
|
||||
usr << "\red No changeling!"
|
||||
return
|
||||
var/new_g = input(usr,"Number of genomes","Changeling",changeling.geneticpoints) as num
|
||||
changeling.geneticpoints = between(0,new_g,100)
|
||||
changeling.geneticpoints = Clamp(new_g, 0, 100)
|
||||
log_admin("[key_name_admin(usr)] has set changeling [current] to [changeling.geneticpoints] genomes.")
|
||||
|
||||
else if (href_list["vampire"])
|
||||
|
||||
@@ -307,7 +307,7 @@ ________________________________________________________________________________
|
||||
dat += "</ul>"
|
||||
if(1)
|
||||
dat += "<h4><img src=sos_5.png> Atmospheric Scan:</h4>"//Headers don't need breaks. They are automatically placed.
|
||||
var/turf/T = get_turf_or_move(U.loc)
|
||||
var/turf/T = get_turf(U.loc)
|
||||
if (isnull(T))
|
||||
dat += "Unable to obtain a reading."
|
||||
else
|
||||
|
||||
@@ -484,7 +484,7 @@ legend {
|
||||
if(href_list["out_set_pressure"])
|
||||
var/response=input(usr,"Set new pressure, in kPa. \[0-[50*ONE_ATMOSPHERE]\]") as num
|
||||
pressure_setting = text2num(response)
|
||||
pressure_setting = between(0, pressure_setting, 50*ONE_ATMOSPHERE)
|
||||
pressure_setting = Clamp(pressure_setting, 0, 50*ONE_ATMOSPHERE)
|
||||
|
||||
if(!radio_connection)
|
||||
return 0
|
||||
@@ -503,7 +503,7 @@ legend {
|
||||
input_info = null
|
||||
var/new_rate=input("Enter the new volume rate of the injector:","Injector Rate") as num
|
||||
new_rate = text2num(new_rate)
|
||||
new_rate = between(0, new_rate, 300)
|
||||
new_rate = Clamp(new_rate, 0, new_rate)
|
||||
signal.data = list ("tag" = input_tag, "set_volume_rate"=new_rate)
|
||||
|
||||
else if(href_list["out_refresh_status"])
|
||||
|
||||
@@ -215,7 +215,7 @@ var/global/list/obj/machinery/telecomms/telecomms_list = list()
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
switch(environment.temperature)
|
||||
if(T0C to (T20C + 20))
|
||||
integrity = between(0, integrity, 100)
|
||||
integrity = Clamp(integrity, 0, 100)
|
||||
if((T20C + 20) to (T0C + 70))
|
||||
integrity = max(0, integrity - 1)
|
||||
if(delay)
|
||||
|
||||
@@ -587,7 +587,7 @@
|
||||
if(src)
|
||||
src.process()
|
||||
if(href_list["scan_range"])
|
||||
src.scan_range = between(1,src.scan_range+text2num(href_list["scan_range"]),8)
|
||||
src.scan_range = Clamp(src.scan_range + text2num(href_list["scan_range"]), 1, 8)
|
||||
if(href_list["scan_for"])
|
||||
if(href_list["scan_for"] in scan_for)
|
||||
scan_for[href_list["scan_for"]] = !scan_for[href_list["scan_for"]]
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
if(18) src.overlays += "pai-cry"
|
||||
|
||||
/obj/item/device/paicard/proc/alertUpdate()
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
var/turf/T = get_turf(src.loc)
|
||||
for (var/mob/M in viewers(T))
|
||||
M.show_message("\blue [src] flashes a message across its screen, \"Additional personalities available for download.\"", 3, "\blue [src] bleeps electronically.", 2)
|
||||
playsound(loc, 'sound/machines/paistartup.ogg', 50, 1)
|
||||
|
||||
@@ -188,7 +188,7 @@
|
||||
if(answer == "Yes")
|
||||
var/obj/item/device/paicard/card = loc
|
||||
card.removePersonality()
|
||||
var/turf/T = get_turf_or_move(card.loc)
|
||||
var/turf/T = get_turf(card.loc)
|
||||
for (var/mob/M in viewers(T))
|
||||
M.show_message("\blue [src] flashes a message across its screen, \"Wiping core files. Please acquire a new personality to continue using pAI device functions.\"", 3, "\blue [src] bleeps electronically.", 2)
|
||||
death(0)
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
return
|
||||
|
||||
if(!M)
|
||||
M = input("Direct narrate to who?", "Active Players") as null|anything in get_mob_with_client_list()
|
||||
M = input("Direct narrate to who?", "Active Players") as null|anything in player_list
|
||||
|
||||
if(!M)
|
||||
return
|
||||
|
||||
@@ -201,7 +201,7 @@
|
||||
var/datum/gas_mixture/environment = loc.return_air()
|
||||
switch(environment.temperature)
|
||||
if(T0C to (T20C + 20))
|
||||
integrity = between(0, integrity, 100)
|
||||
integrity = Clamp(integrity, 0, 100)
|
||||
if((T20C + 20) to INFINITY)
|
||||
integrity = max(0, integrity - 1)
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ function SetMusic(url, time, volume) {
|
||||
if (url != targetURL || abs(targetStartTime - start_time) > 1 || abs(targetVolume - source_volume) > 0.1 /* 10% */)
|
||||
url = targetURL
|
||||
start_time = targetStartTime
|
||||
source_volume = between(0,targetVolume,1)
|
||||
source_volume = Clamp(targetVolume, 0, 1)
|
||||
send_update()
|
||||
|
||||
proc/stop_music()
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
if(desired==0)
|
||||
return 1
|
||||
var/obj/item/stack/sheet/out = new mat.sheettype(output.loc)
|
||||
out.amount = between(0,desired,min(mat.stored,out.max_amount))
|
||||
out.amount = Clamp(desired, 0, min(mat.stored, out.max_amount))
|
||||
mat.stored -= out.amount
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
@@ -165,7 +165,7 @@ a.notsmelting {
|
||||
if(href_list["choose"])
|
||||
chosen = href_list["choose"]
|
||||
if(href_list["chooseAmt"])
|
||||
coinsToProduce = between(0, coinsToProduce + text2num(href_list["chooseAmt"]), 1000)
|
||||
coinsToProduce = Clamp(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000)
|
||||
if(href_list["makeCoins"])
|
||||
var/temp_coins = coinsToProduce
|
||||
if (src.output)
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
src.brainmob << "<b>Use say :b to speak to other artificial intelligences.</b>"
|
||||
src.brainmob.mind.assigned_role = "Positronic Brain"
|
||||
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
var/turf/T = get_turf(src.loc)
|
||||
for (var/mob/M in viewers(T))
|
||||
M.show_message("<span class='notice'>The [src] chimes quietly.</span>")
|
||||
icon_state = "posibrain-occupied"
|
||||
@@ -89,7 +89,7 @@
|
||||
src.searching = 0
|
||||
icon_state = "posibrain"
|
||||
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
var/turf/T = get_turf(src.loc)
|
||||
for (var/mob/M in viewers(T))
|
||||
M.show_message("<span class='notice'>The [src] buzzes quietly, and the golden lights fade away. Perhaps you could try again?</span>")
|
||||
|
||||
@@ -179,6 +179,6 @@
|
||||
if(searching)
|
||||
volunteer(O)
|
||||
else
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
var/turf/T = get_turf(src.loc)
|
||||
for (var/mob/M in viewers(T))
|
||||
M.show_message("<span class='notice'>The [src] pings softly.</span>")
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
/mob/living/silicon/pai/proc/securityHUD()
|
||||
if(client)
|
||||
var/image/holder
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
var/turf/T = get_turf(src.loc)
|
||||
for(var/mob/living/carbon/human/perp in view(T))
|
||||
if(src.see_invisible < perp.invisibility)
|
||||
continue
|
||||
@@ -51,7 +51,7 @@
|
||||
/mob/living/silicon/pai/proc/medicalHUD()
|
||||
if(client)
|
||||
var/image/holder
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
var/turf/T = get_turf(src.loc)
|
||||
for(var/mob/living/carbon/human/patient in view(T))
|
||||
if(src.see_invisible < patient.invisibility)
|
||||
continue
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
return
|
||||
if(src.cable)
|
||||
if(get_dist(src, src.cable) > 1)
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
var/turf/T = get_turf(src.loc)
|
||||
for (var/mob/M in viewers(T))
|
||||
M.show_message("\red [src.cable] rapidly retracts back into its spool.", 3, "\red You hear a click and the sound of wire spooling rapidly.", 2)
|
||||
del(src.cable)
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
src.silence_time = world.timeofday + 120 * 10 // Silence for 2 minutes
|
||||
src << "<font color=green><b>Communication circuit overload. Shutting down and reloading communication circuits - speech and messaging functionality will be unavailable until the reboot is complete.</b></font>"
|
||||
if(prob(20))
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
var/turf/T = get_turf(src.loc)
|
||||
for (var/mob/M in viewers(T))
|
||||
M.show_message("\red A shower of sparks spray from [src]'s inner workings.", 3, "\red You hear and smell the ozone hiss of electrical sparks being expelled violently.", 2)
|
||||
return src.death(0)
|
||||
|
||||
@@ -285,7 +285,7 @@
|
||||
if(href_list["cancel"])
|
||||
src.hackdoor = null
|
||||
if(href_list["cable"])
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
var/turf/T = get_turf(src.loc)
|
||||
src.cable = new /obj/item/weapon/pai_cable(T)
|
||||
for (var/mob/M in viewers(T))
|
||||
M.show_message("\red A port on [src] opens to reveal [src.cable], which promptly falls to the floor.", 3, "\red You hear the soft click of something light and hard falling to the ground.", 2)
|
||||
@@ -408,7 +408,7 @@
|
||||
/mob/living/silicon/pai/proc/CheckDNA(var/mob/M, var/mob/living/silicon/pai/P)
|
||||
var/answer = input(M, "[P] is requesting a DNA sample from you. Will you allow it to confirm your identity?", "[P] Check DNA", "No") in list("Yes", "No")
|
||||
if(answer == "Yes")
|
||||
var/turf/T = get_turf_or_move(P.loc)
|
||||
var/turf/T = get_turf(P.loc)
|
||||
for (var/mob/v in viewers(T))
|
||||
v.show_message("\blue [M] presses \his thumb against [P].", 3, "\blue [P] makes a sharp clicking sound as it extracts DNA material from [M].", 2)
|
||||
var/datum/dna/dna = M.dna
|
||||
@@ -562,7 +562,7 @@
|
||||
/mob/living/silicon/pai/proc/softwareAtmo()
|
||||
var/dat = "<h3>Atmospheric Sensor</h4>"
|
||||
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
var/turf/T = get_turf(src.loc)
|
||||
if (isnull(T))
|
||||
dat += "Unable to obtain a reading.<br>"
|
||||
else
|
||||
@@ -662,7 +662,7 @@ Cable status :"}
|
||||
|
||||
// Door Jack - supporting proc
|
||||
/mob/living/silicon/pai/proc/hackloop()
|
||||
var/turf/T = get_turf_or_move(src.loc)
|
||||
var/turf/T = get_turf(src.loc)
|
||||
for(var/mob/living/silicon/ai/AI in player_list)
|
||||
if(T.loc)
|
||||
AI << "<font color = red><b>Network Alert: Brute-force encryption crack in progress in [T.loc].</b></font>"
|
||||
|
||||
@@ -369,7 +369,7 @@ Note that amputating the affected organ does in fact remove the infection from t
|
||||
//having an infection raises your body temperature
|
||||
var/fever_temperature = (owner.species.heat_level_1 - owner.species.body_temperature - 5)* min(germ_level/INFECTION_LEVEL_TWO, 1) + owner.species.body_temperature
|
||||
//need to make sure we raise temperature fast enough to get around environmental cooling preventing us from reaching fever_temperature
|
||||
owner.bodytemperature += between(0, (fever_temperature - T20C)/BODYTEMP_COLD_DIVISOR + 1, fever_temperature - owner.bodytemperature)
|
||||
owner.bodytemperature += Clamp((fever_temperature - T20C) / BODYTEMP_COLD_DIVISOR + 1, 0, fever_temperature - owner.bodytemperature)
|
||||
|
||||
if(prob(round(germ_level/10)))
|
||||
if (antibiotics < 5)
|
||||
|
||||
@@ -44,7 +44,7 @@ field_generator power level display
|
||||
// Scale % power to % num_power_levels and truncate value
|
||||
var/level = round(num_power_levels * power / field_generator_max_power)
|
||||
// Clamp between 0 and num_power_levels for out of range power values
|
||||
level = between(0, level, num_power_levels)
|
||||
level = Clamp(level, 0, num_power_levels)
|
||||
if(level)
|
||||
overlays += "+p[level]"
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ k
|
||||
for(var/datum/tech/T in temp_techs)
|
||||
if(T.id in req_tech)
|
||||
new_reliability += T.level
|
||||
new_reliability = between(reliability_base, new_reliability, 100)
|
||||
new_reliability = Clamp(new_reliability, reliability_base, 100)
|
||||
reliability = new_reliability
|
||||
return
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ Note: Must be placed within 3 tiles of the R&D Console
|
||||
var/T = 0
|
||||
for(var/obj/item/weapon/stock_parts/S in src)
|
||||
T += S.rating * 0.1
|
||||
T = between (0, T, 1)
|
||||
T = Clamp(T, 0, 1)
|
||||
decon_mod = T
|
||||
|
||||
/obj/machinery/r_n_d/destructive_analyzer/meteorhit()
|
||||
|
||||
@@ -668,7 +668,7 @@ won't update every console in existence) but it's more of a hassle to do. Also,
|
||||
// AUTOFIXED BY fix_string_idiocy.py
|
||||
// C:\Users\Rob\Documents\Projects\vgstation13\code\modules\research\rdconsole.dm:644: dat += "Name: [d_disk.blueprint.name]<BR>"
|
||||
dat += {"Name: [d_disk.blueprint.name]<BR>
|
||||
Level: [between(0, (d_disk.blueprint.reliability + rand(-15,15)), 100)]<BR>"}
|
||||
Level: [Clamp(d_disk.blueprint.reliability + rand(-15,15), 0, 100)]<BR>"}
|
||||
// END AUTOFIX
|
||||
switch(d_disk.blueprint.build_type)
|
||||
if(IMPRINTER) dat += "Lathe Type: Circuit Imprinter<BR>"
|
||||
|
||||
@@ -141,7 +141,7 @@ research holder datum.
|
||||
if(DesignHasReqs(PD))
|
||||
AddDesign2Known(PD)
|
||||
for(var/datum/tech/T in known_tech)
|
||||
T = between(1,T.level,20)
|
||||
T = Clamp(T.level, 1, 20)
|
||||
for(var/datum/design/D in known_designs)
|
||||
D.CalcReliability(known_tech)
|
||||
return
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
if(0 to T0C)
|
||||
health = min(100, health + 1)
|
||||
if(T0C to (T20C + 20))
|
||||
health = between(0, health, 100)
|
||||
health = Clamp(health, 0, 100)
|
||||
if((T20C + 20) to INFINITY)
|
||||
health = max(0, health - 1)
|
||||
if(health <= 0)
|
||||
|
||||
Reference in New Issue
Block a user