Merge pull request #49421 from ShizCalev/define-cleanup
Cleans up redundant math defines
This commit is contained in:
@@ -679,7 +679,7 @@
|
||||
var/path = preparsed[1]
|
||||
var/amount = 1
|
||||
if(preparsed.len > 1)
|
||||
amount = CLAMP(text2num(preparsed[2]),1,ADMIN_SPAWN_CAP)
|
||||
amount = clamp(text2num(preparsed[2]),1,ADMIN_SPAWN_CAP)
|
||||
|
||||
var/chosen = pick_closest_path(path)
|
||||
if(!chosen)
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
var/new_volume = input(user, "Choose a volume.", "Sound Emitter", sound_volume) as null|num
|
||||
if(isnull(new_volume))
|
||||
return
|
||||
new_volume = CLAMP(new_volume, 0, 100)
|
||||
new_volume = clamp(new_volume, 0, 100)
|
||||
sound_volume = new_volume
|
||||
to_chat(user, "<span class='notice'>Volume set to [sound_volume]%.</span>")
|
||||
if(href_list["edit_mode"])
|
||||
@@ -116,7 +116,7 @@
|
||||
var/new_radius = input(user, "Choose a radius.", "Sound Emitter", sound_volume) as null|num
|
||||
if(isnull(new_radius))
|
||||
return
|
||||
new_radius = CLAMP(new_radius, 0, 127)
|
||||
new_radius = clamp(new_radius, 0, 127)
|
||||
play_radius = new_radius
|
||||
to_chat(user, "<span class='notice'>Audible radius set to [play_radius].</span>")
|
||||
if(href_list["play"])
|
||||
|
||||
@@ -393,7 +393,7 @@
|
||||
var/nsd = CONFIG_GET(number/note_stale_days)
|
||||
var/nfd = CONFIG_GET(number/note_fresh_days)
|
||||
if (agegate && type == "note" && isnum(nsd) && isnum(nfd) && nsd > nfd)
|
||||
var/alpha = CLAMP(100 - (age - nfd) * (85 / (nsd - nfd)), 15, 100)
|
||||
var/alpha = clamp(100 - (age - nfd) * (85 / (nsd - nfd)), 15, 100)
|
||||
if (alpha < 100)
|
||||
if (alpha <= 15)
|
||||
if (skipped)
|
||||
|
||||
@@ -1619,7 +1619,7 @@
|
||||
return
|
||||
|
||||
var/list/offset = splittext(href_list["offset"],",")
|
||||
var/number = CLAMP(text2num(href_list["object_count"]), 1, ADMIN_SPAWN_CAP)
|
||||
var/number = clamp(text2num(href_list["object_count"]), 1, ADMIN_SPAWN_CAP)
|
||||
var/X = offset.len > 0 ? text2num(offset[1]) : 0
|
||||
var/Y = offset.len > 1 ? text2num(offset[2]) : 0
|
||||
var/Z = offset.len > 2 ? text2num(offset[3]) : 0
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
if ("set_charge")
|
||||
var/newcharge = input("New charge (0-[borg.cell.maxcharge]):", borg.name, borg.cell.charge) as num|null
|
||||
if (newcharge)
|
||||
borg.cell.charge = CLAMP(newcharge, 0, borg.cell.maxcharge)
|
||||
borg.cell.charge = clamp(newcharge, 0, borg.cell.maxcharge)
|
||||
message_admins("[key_name_admin(user)] set the charge of [ADMIN_LOOKUPFLW(borg)] to [borg.cell.charge].")
|
||||
log_admin("[key_name(user)] set the charge of [key_name(borg)] to [borg.cell.charge].")
|
||||
if ("remove_cell")
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
var/vol = input(usr, "What volume would you like the sound to play at?",, 100) as null|num
|
||||
if(!vol)
|
||||
return
|
||||
vol = CLAMP(vol, 1, 100)
|
||||
vol = clamp(vol, 1, 100)
|
||||
|
||||
var/sound/admin_sound = new()
|
||||
admin_sound.file = S
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
/mob/living/simple_animal/hostile/blob/fire_act(exposed_temperature, exposed_volume)
|
||||
..()
|
||||
if(exposed_temperature)
|
||||
adjustFireLoss(CLAMP(0.01 * exposed_temperature, 1, 5))
|
||||
adjustFireLoss(clamp(0.01 * exposed_temperature, 1, 5))
|
||||
else
|
||||
adjustFireLoss(5)
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ GLOBAL_LIST_EMPTY(blob_nodes)
|
||||
B.hud_used.blobpwrdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#82ed00'>[round(blob_core.obj_integrity)]</font></div>"
|
||||
|
||||
/mob/camera/blob/proc/add_points(points)
|
||||
blob_points = CLAMP(blob_points + points, 0, max_blob_points)
|
||||
blob_points = clamp(blob_points + points, 0, max_blob_points)
|
||||
hud_used.blobpwrdisplay.maptext = "<div align='center' valign='middle' style='position:relative; top:0px; left:6px'><font color='#82ed00'>[round(blob_points)]</font></div>"
|
||||
|
||||
/mob/camera/blob/say(message, bubble_type, list/spans = list(), sanitize = TRUE, datum/language/language = null, ignore_spam = FALSE, forced = null)
|
||||
|
||||
@@ -362,7 +362,7 @@
|
||||
if(NUKEUI_AWAIT_TIMER)
|
||||
var/number_value = text2num(numeric_input)
|
||||
if(number_value)
|
||||
timer_set = CLAMP(number_value, minimum_timer_set, maximum_timer_set)
|
||||
timer_set = clamp(number_value, minimum_timer_set, maximum_timer_set)
|
||||
playsound(src, 'sound/machines/nuke/general_beep.ogg', 50, FALSE)
|
||||
set_safety()
|
||||
. = TRUE
|
||||
|
||||
@@ -153,5 +153,5 @@
|
||||
var/value = text2num(params["adjust"])
|
||||
if(value)
|
||||
var/newtime = round(time+value)
|
||||
time = CLAMP(newtime, 0, 600)
|
||||
time = clamp(newtime, 0, 600)
|
||||
. = TRUE
|
||||
|
||||
@@ -321,7 +321,7 @@
|
||||
|
||||
var/new_heat_capacity = air.heat_capacity()
|
||||
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY && (air.temperature <= FUSION_MAXIMUM_TEMPERATURE || reaction_energy <= 0)) //If above FUSION_MAXIMUM_TEMPERATURE, will only adjust temperature for endothermic reactions.
|
||||
air.temperature = CLAMP(((air.temperature*old_heat_capacity + reaction_energy)/new_heat_capacity),TCMB,INFINITY)
|
||||
air.temperature = clamp(((air.temperature*old_heat_capacity + reaction_energy)/new_heat_capacity),TCMB,INFINITY)
|
||||
return REACTING
|
||||
|
||||
/datum/gas_reaction/nitrylformation //The formation of nitryl. Endothermic. Requires N2O as a catalyst.
|
||||
@@ -521,5 +521,5 @@
|
||||
if(energy_released)
|
||||
var/new_heat_capacity = air.heat_capacity()
|
||||
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
|
||||
air.temperature = CLAMP((air.temperature*old_heat_capacity + energy_released)/new_heat_capacity,TCMB,INFINITY)
|
||||
air.temperature = clamp((air.temperature*old_heat_capacity + energy_released)/new_heat_capacity,TCMB,INFINITY)
|
||||
return REACTING
|
||||
|
||||
@@ -159,13 +159,13 @@
|
||||
pump_direction = 1
|
||||
|
||||
if("set_input_pressure" in signal.data)
|
||||
input_pressure_min = CLAMP(text2num(signal.data["set_input_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
input_pressure_min = clamp(text2num(signal.data["set_input_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
|
||||
if("set_output_pressure" in signal.data)
|
||||
output_pressure_max = CLAMP(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
output_pressure_max = clamp(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
|
||||
if("set_external_pressure" in signal.data)
|
||||
external_pressure_bound = CLAMP(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
external_pressure_bound = clamp(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
|
||||
addtimer(CALLBACK(src, .proc/broadcast_status), 2)
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ Passive gate is similar to the regular pump except:
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
target_pressure = CLAMP(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||
update_icon()
|
||||
|
||||
@@ -147,7 +147,7 @@ Passive gate is similar to the regular pump except:
|
||||
on = !on
|
||||
|
||||
if("set_output_pressure" in signal.data)
|
||||
target_pressure = CLAMP(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
target_pressure = clamp(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
|
||||
if(on != old_on)
|
||||
investigate_log("was turned [on ? "on" : "off"] by a remote signal", INVESTIGATE_ATMOS)
|
||||
|
||||
@@ -131,7 +131,7 @@
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
target_pressure = CLAMP(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||
update_icon()
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
on = !on
|
||||
|
||||
if("set_output_pressure" in signal.data)
|
||||
target_pressure = CLAMP(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
target_pressure = clamp(text2num(signal.data["set_output_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
|
||||
if(on != old_on)
|
||||
investigate_log("was turned [on ? "on" : "off"] by a remote signal", INVESTIGATE_ATMOS)
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
rate = text2num(rate)
|
||||
. = TRUE
|
||||
if(.)
|
||||
transfer_rate = CLAMP(rate, 0, MAX_TRANSFER_RATE)
|
||||
transfer_rate = clamp(rate, 0, MAX_TRANSFER_RATE)
|
||||
investigate_log("was set to [transfer_rate] L/s by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||
update_icon()
|
||||
|
||||
@@ -167,7 +167,7 @@
|
||||
|
||||
if("set_transfer_rate" in signal.data)
|
||||
var/datum/gas_mixture/air1 = airs[1]
|
||||
transfer_rate = CLAMP(text2num(signal.data["set_transfer_rate"]),0,air1.volume)
|
||||
transfer_rate = clamp(text2num(signal.data["set_transfer_rate"]),0,air1.volume)
|
||||
|
||||
if(on != old_on)
|
||||
investigate_log("was turned [on ? "on" : "off"] by a remote signal", INVESTIGATE_ATMOS)
|
||||
|
||||
@@ -161,7 +161,7 @@
|
||||
rate = text2num(rate)
|
||||
. = TRUE
|
||||
if(.)
|
||||
transfer_rate = CLAMP(rate, 0, MAX_TRANSFER_RATE)
|
||||
transfer_rate = clamp(rate, 0, MAX_TRANSFER_RATE)
|
||||
investigate_log("was set to [transfer_rate] L/s by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||
if("filter")
|
||||
filter_type = null
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
target_pressure = CLAMP(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
target_pressure = clamp(pressure, 0, MAX_OUTPUT_PRESSURE)
|
||||
investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||
if("node1")
|
||||
var/value = text2num(params["concentration"])
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
if("set_volume_rate" in signal.data)
|
||||
var/number = text2num(signal.data["set_volume_rate"])
|
||||
var/datum/gas_mixture/air_contents = airs[1]
|
||||
volume_rate = CLAMP(number, 0, air_contents.volume)
|
||||
volume_rate = clamp(number, 0, air_contents.volume)
|
||||
|
||||
addtimer(CALLBACK(src, .proc/broadcast_status), 2)
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
rate = text2num(rate)
|
||||
. = TRUE
|
||||
if(.)
|
||||
volume_rate = CLAMP(rate, 0, MAX_TRANSFER_RATE)
|
||||
volume_rate = clamp(rate, 0, MAX_TRANSFER_RATE)
|
||||
investigate_log("was set to [volume_rate] L/s by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||
update_icon()
|
||||
broadcast_status()
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
target = text2num(target)
|
||||
. = TRUE
|
||||
if(.)
|
||||
target_temperature = CLAMP(target, min_temperature, max_temperature)
|
||||
target_temperature = clamp(target, min_temperature, max_temperature)
|
||||
investigate_log("was set to [target_temperature] K by [key_name(usr)]", INVESTIGATE_ATMOS)
|
||||
|
||||
update_icon()
|
||||
|
||||
@@ -212,13 +212,13 @@
|
||||
|
||||
if("set_internal_pressure" in signal.data)
|
||||
var/old_pressure = internal_pressure_bound
|
||||
internal_pressure_bound = CLAMP(text2num(signal.data["set_internal_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
internal_pressure_bound = clamp(text2num(signal.data["set_internal_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
if(old_pressure != internal_pressure_bound)
|
||||
investigate_log(" internal pressure was set to [internal_pressure_bound] by [key_name(signal_sender)]",INVESTIGATE_ATMOS)
|
||||
|
||||
if("set_external_pressure" in signal.data)
|
||||
var/old_pressure = external_pressure_bound
|
||||
external_pressure_bound = CLAMP(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
external_pressure_bound = clamp(text2num(signal.data["set_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
if(old_pressure != external_pressure_bound)
|
||||
investigate_log(" external pressure was set to [external_pressure_bound] by [key_name(signal_sender)]",INVESTIGATE_ATMOS)
|
||||
|
||||
@@ -229,10 +229,10 @@
|
||||
internal_pressure_bound = 0
|
||||
|
||||
if("adjust_internal_pressure" in signal.data)
|
||||
internal_pressure_bound = CLAMP(internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
internal_pressure_bound = clamp(internal_pressure_bound + text2num(signal.data["adjust_internal_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
|
||||
if("adjust_external_pressure" in signal.data)
|
||||
external_pressure_bound = CLAMP(external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
external_pressure_bound = clamp(external_pressure_bound + text2num(signal.data["adjust_external_pressure"]),0,ONE_ATMOSPHERE*50)
|
||||
|
||||
if("init" in signal.data)
|
||||
name = signal.data["init"]
|
||||
|
||||
@@ -128,9 +128,9 @@
|
||||
if(initialize_directions & dir)
|
||||
return ..()
|
||||
if((NORTH|EAST) & dir)
|
||||
user.ventcrawl_layer = CLAMP(user.ventcrawl_layer + 1, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||
user.ventcrawl_layer = clamp(user.ventcrawl_layer + 1, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||
if((SOUTH|WEST) & dir)
|
||||
user.ventcrawl_layer = CLAMP(user.ventcrawl_layer - 1, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||
user.ventcrawl_layer = clamp(user.ventcrawl_layer - 1, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||
to_chat(user, "You align yourself with the [user.ventcrawl_layer]\th output.")
|
||||
|
||||
/obj/machinery/atmospherics/pipe/layer_manifold/visible
|
||||
|
||||
@@ -403,7 +403,7 @@
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
release_pressure = CLAMP(round(pressure), can_min_release_pressure, can_max_release_pressure)
|
||||
release_pressure = clamp(round(pressure), can_min_release_pressure, can_max_release_pressure)
|
||||
investigate_log("was set to [release_pressure] kPa by [key_name(usr)].", INVESTIGATE_ATMOS)
|
||||
if("valve")
|
||||
var/logmsg
|
||||
@@ -447,7 +447,7 @@
|
||||
var/N = text2num(user_input)
|
||||
if(!N)
|
||||
return
|
||||
timer_set = CLAMP(N,minimum_timer_set,maximum_timer_set)
|
||||
timer_set = clamp(N,minimum_timer_set,maximum_timer_set)
|
||||
log_admin("[key_name(usr)] has activated a prototype valve timer")
|
||||
. = TRUE
|
||||
if("toggle_timer")
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
pump.target_pressure = CLAMP(round(pressure), PUMP_MIN_PRESSURE, PUMP_MAX_PRESSURE)
|
||||
pump.target_pressure = clamp(round(pressure), PUMP_MIN_PRESSURE, PUMP_MAX_PRESSURE)
|
||||
investigate_log("was set to [pump.target_pressure] kPa by [key_name(usr)].", INVESTIGATE_ATMOS)
|
||||
if("eject")
|
||||
if(holding)
|
||||
|
||||
@@ -878,8 +878,8 @@ GLOBAL_LIST_EMPTY(external_rsc_urls)
|
||||
var/viewscale = getviewsize(view)
|
||||
var/x = viewscale[1]
|
||||
var/y = viewscale[2]
|
||||
x = CLAMP(x+change, min, max)
|
||||
y = CLAMP(y+change, min,max)
|
||||
x = clamp(x+change, min, max)
|
||||
y = clamp(y+change, min,max)
|
||||
change_view("[x]x[y]")
|
||||
|
||||
/client/proc/update_movement_keys(datum/preferences/direct_prefs)
|
||||
|
||||
@@ -760,7 +760,7 @@
|
||||
/obj/item/clothing/suit/space/hardsuit/shielded/process()
|
||||
. = ..()
|
||||
if(recharge_rate && world.time > recharge_cooldown && current_charges < max_charges)
|
||||
current_charges = CLAMP((current_charges + recharge_rate), 0, max_charges)
|
||||
current_charges = clamp((current_charges + recharge_rate), 0, max_charges)
|
||||
playsound(loc, 'sound/magic/charge.ogg', 50, TRUE)
|
||||
if(current_charges == max_charges)
|
||||
playsound(loc, 'sound/machines/ding.ogg', 50, TRUE)
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
log_combat(usr, src, "dispensed [O] from", null, "with [stored_food[href_list["dispense"]]] remaining")
|
||||
|
||||
if(href_list["portion"])
|
||||
portion = CLAMP(input("How much drink do you want to dispense per glass?") as num|null, 0, 50)
|
||||
portion = clamp(input("How much drink do you want to dispense per glass?") as num|null, 0, 50)
|
||||
|
||||
if (isnull(portion))
|
||||
return
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
if (isnull(bomb_timer))
|
||||
return
|
||||
|
||||
bomb_timer = CLAMP(CEILING(bomb_timer / 2, 1), BOMB_TIMER_MIN, BOMB_TIMER_MAX)
|
||||
bomb_timer = clamp(CEILING(bomb_timer / 2, 1), BOMB_TIMER_MIN, BOMB_TIMER_MAX)
|
||||
bomb_defused = FALSE
|
||||
|
||||
log_bomber(user, "has trapped a", src, "with [bomb] set to [bomb_timer * 2] seconds")
|
||||
|
||||
@@ -165,7 +165,7 @@ GLOBAL_DATUM_INIT(iconCache, /savefile, new("tmp/iconCache.sav")) //Cache of ico
|
||||
|
||||
/datum/chatOutput/proc/setMusicVolume(volume = "")
|
||||
if(volume)
|
||||
adminMusicVolume = CLAMP(text2num(volume), 0, 100)
|
||||
adminMusicVolume = clamp(text2num(volume), 0, 100)
|
||||
|
||||
//Sends client connection details to the chat to handle and save
|
||||
/datum/chatOutput/proc/sendClientData()
|
||||
|
||||
@@ -314,7 +314,7 @@
|
||||
else if(href_list["create"])
|
||||
var/amount = (text2num(href_list["amount"]))
|
||||
//Can't be outside these (if you change this keep a sane limit)
|
||||
amount = CLAMP(amount, 1, 10)
|
||||
amount = clamp(amount, 1, 10)
|
||||
var/id = href_list["create"]
|
||||
if(!stored_research.researched_designs.Find(id))
|
||||
//naughty naughty
|
||||
|
||||
@@ -202,8 +202,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)
|
||||
W.pixel_x = CLAMP(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
W.pixel_y = CLAMP(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
W.pixel_x = clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
W.pixel_y = clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -914,26 +914,26 @@
|
||||
|
||||
/// Tray Setters - The following procs adjust the tray or plants variables, and make sure that the stat doesn't go out of bounds.///
|
||||
/obj/machinery/hydroponics/proc/adjustNutri(adjustamt)
|
||||
nutrilevel = CLAMP(nutrilevel + adjustamt, 0, maxnutri)
|
||||
nutrilevel = clamp(nutrilevel + adjustamt, 0, maxnutri)
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustWater(adjustamt)
|
||||
waterlevel = CLAMP(waterlevel + adjustamt, 0, maxwater)
|
||||
waterlevel = clamp(waterlevel + adjustamt, 0, maxwater)
|
||||
|
||||
if(adjustamt>0)
|
||||
adjustToxic(-round(adjustamt/4))//Toxicity dilutation code. The more water you put in, the lesser the toxin concentration.
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustHealth(adjustamt)
|
||||
if(myseed && !dead)
|
||||
plant_health = CLAMP(plant_health + adjustamt, 0, myseed.endurance)
|
||||
plant_health = clamp(plant_health + adjustamt, 0, myseed.endurance)
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustToxic(adjustamt)
|
||||
toxic = CLAMP(toxic + adjustamt, 0, 100)
|
||||
toxic = clamp(toxic + adjustamt, 0, 100)
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustPests(adjustamt)
|
||||
pestlevel = CLAMP(pestlevel + adjustamt, 0, 10)
|
||||
pestlevel = clamp(pestlevel + adjustamt, 0, 10)
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustWeeds(adjustamt)
|
||||
weedlevel = CLAMP(weedlevel + adjustamt, 0, 10)
|
||||
weedlevel = clamp(weedlevel + adjustamt, 0, 10)
|
||||
|
||||
/obj/machinery/hydroponics/proc/spawnplant() // why would you put strange reagent in a hydro tray you monster I bet you also feed them blood
|
||||
var/list/livingplants = list(/mob/living/simple_animal/hostile/tree, /mob/living/simple_animal/hostile/killertomato)
|
||||
|
||||
@@ -207,7 +207,7 @@
|
||||
/// Setters procs ///
|
||||
/obj/item/seeds/proc/adjust_yield(adjustamt)
|
||||
if(yield != -1) // Unharvestable shouldn't suddenly turn harvestable
|
||||
yield = CLAMP(yield + adjustamt, 0, 10)
|
||||
yield = clamp(yield + adjustamt, 0, 10)
|
||||
|
||||
if(yield <= 0 && get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
|
||||
yield = 1 // Mushrooms always have a minimum yield of 1.
|
||||
@@ -216,39 +216,39 @@
|
||||
C.value = yield
|
||||
|
||||
/obj/item/seeds/proc/adjust_lifespan(adjustamt)
|
||||
lifespan = CLAMP(lifespan + adjustamt, 10, 100)
|
||||
lifespan = clamp(lifespan + adjustamt, 10, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/lifespan)
|
||||
if(C)
|
||||
C.value = lifespan
|
||||
|
||||
/obj/item/seeds/proc/adjust_endurance(adjustamt)
|
||||
endurance = CLAMP(endurance + adjustamt, 10, 100)
|
||||
endurance = clamp(endurance + adjustamt, 10, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/endurance)
|
||||
if(C)
|
||||
C.value = endurance
|
||||
|
||||
/obj/item/seeds/proc/adjust_production(adjustamt)
|
||||
if(yield != -1)
|
||||
production = CLAMP(production + adjustamt, 1, 10)
|
||||
production = clamp(production + adjustamt, 1, 10)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/production)
|
||||
if(C)
|
||||
C.value = production
|
||||
|
||||
/obj/item/seeds/proc/adjust_potency(adjustamt)
|
||||
if(potency != -1)
|
||||
potency = CLAMP(potency + adjustamt, 0, 100)
|
||||
potency = clamp(potency + adjustamt, 0, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/potency)
|
||||
if(C)
|
||||
C.value = potency
|
||||
|
||||
/obj/item/seeds/proc/adjust_weed_rate(adjustamt)
|
||||
weed_rate = CLAMP(weed_rate + adjustamt, 0, 10)
|
||||
weed_rate = clamp(weed_rate + adjustamt, 0, 10)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_rate)
|
||||
if(C)
|
||||
C.value = weed_rate
|
||||
|
||||
/obj/item/seeds/proc/adjust_weed_chance(adjustamt)
|
||||
weed_chance = CLAMP(weed_chance + adjustamt, 0, 67)
|
||||
weed_chance = clamp(weed_chance + adjustamt, 0, 67)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_chance)
|
||||
if(C)
|
||||
C.value = weed_chance
|
||||
@@ -257,7 +257,7 @@
|
||||
|
||||
/obj/item/seeds/proc/set_yield(adjustamt)
|
||||
if(yield != -1) // Unharvestable shouldn't suddenly turn harvestable
|
||||
yield = CLAMP(adjustamt, 0, 10)
|
||||
yield = clamp(adjustamt, 0, 10)
|
||||
|
||||
if(yield <= 0 && get_gene(/datum/plant_gene/trait/plant_type/fungal_metabolism))
|
||||
yield = 1 // Mushrooms always have a minimum yield of 1.
|
||||
@@ -266,39 +266,39 @@
|
||||
C.value = yield
|
||||
|
||||
/obj/item/seeds/proc/set_lifespan(adjustamt)
|
||||
lifespan = CLAMP(adjustamt, 10, 100)
|
||||
lifespan = clamp(adjustamt, 10, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/lifespan)
|
||||
if(C)
|
||||
C.value = lifespan
|
||||
|
||||
/obj/item/seeds/proc/set_endurance(adjustamt)
|
||||
endurance = CLAMP(adjustamt, 10, 100)
|
||||
endurance = clamp(adjustamt, 10, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/endurance)
|
||||
if(C)
|
||||
C.value = endurance
|
||||
|
||||
/obj/item/seeds/proc/set_production(adjustamt)
|
||||
if(yield != -1)
|
||||
production = CLAMP(adjustamt, 1, 10)
|
||||
production = clamp(adjustamt, 1, 10)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/production)
|
||||
if(C)
|
||||
C.value = production
|
||||
|
||||
/obj/item/seeds/proc/set_potency(adjustamt)
|
||||
if(potency != -1)
|
||||
potency = CLAMP(adjustamt, 0, 100)
|
||||
potency = clamp(adjustamt, 0, 100)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/potency)
|
||||
if(C)
|
||||
C.value = potency
|
||||
|
||||
/obj/item/seeds/proc/set_weed_rate(adjustamt)
|
||||
weed_rate = CLAMP(adjustamt, 0, 10)
|
||||
weed_rate = clamp(adjustamt, 0, 10)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_rate)
|
||||
if(C)
|
||||
C.value = weed_rate
|
||||
|
||||
/obj/item/seeds/proc/set_weed_chance(adjustamt)
|
||||
weed_chance = CLAMP(adjustamt, 0, 67)
|
||||
weed_chance = clamp(adjustamt, 0, 67)
|
||||
var/datum/plant_gene/core/C = get_gene(/datum/plant_gene/core/weed_chance)
|
||||
if(C)
|
||||
C.value = weed_chance
|
||||
|
||||
@@ -266,7 +266,7 @@ GLOBAL_LIST(cachedbooks) // List of our cached book datums
|
||||
dat += "<A href='?src=[REF(src)];orderbyid=1'>(Order book by SS<sup>13</sup>BN)</A><BR><BR>"
|
||||
dat += "<table>"
|
||||
dat += "<tr><td>AUTHOR</td><td>TITLE</td><td>CATEGORY</td><td></td></tr>"
|
||||
dat += libcomp_menu[CLAMP(page,1,libcomp_menu.len)]
|
||||
dat += libcomp_menu[clamp(page,1,libcomp_menu.len)]
|
||||
dat += "<tr><td><A href='?src=[REF(src)];page=[(max(1,page-1))]'><<<<</A></td> <td></td> <td></td> <td><span style='text-align:right'><A href='?src=[REF(src)];page=[(min(libcomp_menu.len,page+1))]'>>>>></A></span></td></tr>"
|
||||
dat += "</table>"
|
||||
dat += "<BR><A href='?src=[REF(src)];switchscreen=0'>(Return to main menu)</A><BR>"
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
gridSet.ycrd = text2num(dmmRegex.group[4])
|
||||
gridSet.zcrd = text2num(dmmRegex.group[5])
|
||||
|
||||
bounds[MAP_MINX] = min(bounds[MAP_MINX], CLAMP(gridSet.xcrd, x_lower, x_upper))
|
||||
bounds[MAP_MINX] = min(bounds[MAP_MINX], clamp(gridSet.xcrd, x_lower, x_upper))
|
||||
bounds[MAP_MINZ] = min(bounds[MAP_MINZ], gridSet.zcrd)
|
||||
bounds[MAP_MAXZ] = max(bounds[MAP_MAXZ], gridSet.zcrd)
|
||||
|
||||
@@ -113,15 +113,15 @@
|
||||
if(gridLines.len && gridLines[gridLines.len] == "")
|
||||
gridLines.Cut(gridLines.len) // Remove only one blank line at the end.
|
||||
|
||||
bounds[MAP_MINY] = min(bounds[MAP_MINY], CLAMP(gridSet.ycrd, y_lower, y_upper))
|
||||
bounds[MAP_MINY] = min(bounds[MAP_MINY], clamp(gridSet.ycrd, y_lower, y_upper))
|
||||
gridSet.ycrd += gridLines.len - 1 // Start at the top and work down
|
||||
bounds[MAP_MAXY] = max(bounds[MAP_MAXY], CLAMP(gridSet.ycrd, y_lower, y_upper))
|
||||
bounds[MAP_MAXY] = max(bounds[MAP_MAXY], clamp(gridSet.ycrd, y_lower, y_upper))
|
||||
|
||||
var/maxx = gridSet.xcrd
|
||||
if(gridLines.len) //Not an empty map
|
||||
maxx = max(maxx, gridSet.xcrd + length(gridLines[1]) / key_len - 1)
|
||||
|
||||
bounds[MAP_MAXX] = CLAMP(max(bounds[MAP_MAXX], maxx), x_lower, x_upper)
|
||||
bounds[MAP_MAXX] = clamp(max(bounds[MAP_MAXX], maxx), x_lower, x_upper)
|
||||
CHECK_TICK
|
||||
|
||||
// Indicate failure to parse any coordinates by nulling bounds
|
||||
|
||||
@@ -856,13 +856,13 @@
|
||||
force = 0
|
||||
var/ghost_counter = ghost_check()
|
||||
|
||||
force = CLAMP((ghost_counter * 4), 0, 75)
|
||||
force = clamp((ghost_counter * 4), 0, 75)
|
||||
user.visible_message("<span class='danger'>[user] strikes with the force of [ghost_counter] vengeful spirits!</span>")
|
||||
..()
|
||||
|
||||
/obj/item/melee/ghost_sword/hit_reaction(mob/living/carbon/human/owner, atom/movable/hitby, attack_text = "the attack", final_block_chance = 0, damage = 0, attack_type = MELEE_ATTACK)
|
||||
var/ghost_counter = ghost_check()
|
||||
final_block_chance += CLAMP((ghost_counter * 5), 0, 75)
|
||||
final_block_chance += clamp((ghost_counter * 5), 0, 75)
|
||||
owner.visible_message("<span class='danger'>[owner] is protected by a ring of [ghost_counter] ghosts!</span>")
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ GLOBAL_LIST_EMPTY(silo_access_logs)
|
||||
var/list/logs = GLOB.silo_access_logs[REF(src)]
|
||||
var/len = LAZYLEN(logs)
|
||||
var/num_pages = 1 + round((len - 1) / 30)
|
||||
var/page = CLAMP(log_page, 1, num_pages)
|
||||
var/page = clamp(log_page, 1, num_pages)
|
||||
if(num_pages > 1)
|
||||
for(var/i in 1 to num_pages)
|
||||
if(i == page)
|
||||
|
||||
@@ -503,7 +503,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
views |= i
|
||||
var/new_view = input("Choose your new view", "Modify view range", 7) as null|anything in views
|
||||
if(new_view)
|
||||
client.change_view(CLAMP(new_view, 7, max_view))
|
||||
client.change_view(clamp(new_view, 7, max_view))
|
||||
else
|
||||
client.change_view(CONFIG_GET(string/default_view))
|
||||
|
||||
|
||||
@@ -17,4 +17,4 @@
|
||||
/mob/living/carbon/alien/AdjustStun(amount, updating = 1, ignore_canstun = 0)
|
||||
. = ..()
|
||||
if(!.)
|
||||
move_delay_add = CLAMP(move_delay_add + round(amount/2), 0, 10)
|
||||
move_delay_add = clamp(move_delay_add + round(amount/2), 0, 10)
|
||||
|
||||
@@ -101,19 +101,19 @@
|
||||
|
||||
for(var/obj/item/I in held_items)
|
||||
if(!istype(I, /obj/item/clothing))
|
||||
var/final_block_chance = I.block_chance - (CLAMP((armour_penetration-I.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example
|
||||
var/final_block_chance = I.block_chance - (clamp((armour_penetration-I.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example
|
||||
if(I.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
|
||||
return TRUE
|
||||
if(wear_suit)
|
||||
var/final_block_chance = wear_suit.block_chance - (CLAMP((armour_penetration-wear_suit.armour_penetration)/2,0,100)) + block_chance_modifier
|
||||
var/final_block_chance = wear_suit.block_chance - (clamp((armour_penetration-wear_suit.armour_penetration)/2,0,100)) + block_chance_modifier
|
||||
if(wear_suit.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
|
||||
return TRUE
|
||||
if(w_uniform)
|
||||
var/final_block_chance = w_uniform.block_chance - (CLAMP((armour_penetration-w_uniform.armour_penetration)/2,0,100)) + block_chance_modifier
|
||||
var/final_block_chance = w_uniform.block_chance - (clamp((armour_penetration-w_uniform.armour_penetration)/2,0,100)) + block_chance_modifier
|
||||
if(w_uniform.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
|
||||
return TRUE
|
||||
if(wear_neck)
|
||||
var/final_block_chance = wear_neck.block_chance - (CLAMP((armour_penetration-wear_neck.armour_penetration)/2,0,100)) + block_chance_modifier
|
||||
var/final_block_chance = wear_neck.block_chance - (clamp((armour_penetration-wear_neck.armour_penetration)/2,0,100)) + block_chance_modifier
|
||||
if(wear_neck.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -397,7 +397,7 @@
|
||||
var/new_y = P.starting.y + pick(0, 0, 0, 0, 0, -1, 1, -2, 2)
|
||||
// redirect the projectile
|
||||
P.firer = H
|
||||
P.preparePixelProjectile(locate(CLAMP(new_x, 1, world.maxx), CLAMP(new_y, 1, world.maxy), H.z), H)
|
||||
P.preparePixelProjectile(locate(clamp(new_x, 1, world.maxx), clamp(new_y, 1, world.maxy), H.z), H)
|
||||
return BULLET_ACT_FORCE_PIERCE
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -113,8 +113,8 @@
|
||||
to_chat(victim, "<span class='danger'>[H] is draining your blood!</span>")
|
||||
to_chat(H, "<span class='notice'>You drain some blood!</span>")
|
||||
playsound(H, 'sound/items/drink.ogg', 30, TRUE, -2)
|
||||
victim.blood_volume = CLAMP(victim.blood_volume - drained_blood, 0, BLOOD_VOLUME_MAXIMUM)
|
||||
H.blood_volume = CLAMP(H.blood_volume + drained_blood, 0, BLOOD_VOLUME_MAXIMUM)
|
||||
victim.blood_volume = clamp(victim.blood_volume - drained_blood, 0, BLOOD_VOLUME_MAXIMUM)
|
||||
H.blood_volume = clamp(H.blood_volume + drained_blood, 0, BLOOD_VOLUME_MAXIMUM)
|
||||
if(!victim.blood_volume)
|
||||
to_chat(H, "<span class='notice'>You finish off [victim]'s blood supply.</span>")
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@
|
||||
//TOXINS/PLASMA
|
||||
if(Toxins_partialpressure > safe_tox_max)
|
||||
var/ratio = (breath_gases[/datum/gas/plasma][MOLES]/safe_tox_max) * 10
|
||||
adjustToxLoss(CLAMP(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE))
|
||||
adjustToxLoss(clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE))
|
||||
throw_alert("too_much_tox", /obj/screen/alert/too_much_tox)
|
||||
else
|
||||
clear_alert("too_much_tox")
|
||||
@@ -681,7 +681,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
|
||||
amount = (amount > 0) ? min(amount, BODYTEMP_HEATING_MAX) : max(amount, BODYTEMP_COOLING_MAX)
|
||||
|
||||
if(bodytemperature >= min_temp && bodytemperature <= max_temp)
|
||||
bodytemperature = CLAMP(bodytemperature + amount,min_temp,max_temp)
|
||||
bodytemperature = clamp(bodytemperature + amount,min_temp,max_temp)
|
||||
|
||||
|
||||
/////////
|
||||
|
||||
@@ -39,10 +39,10 @@
|
||||
clear_alert("high")
|
||||
|
||||
/mob/living/carbon/adjust_disgust(amount)
|
||||
disgust = CLAMP(disgust+amount, 0, DISGUST_LEVEL_MAXEDOUT)
|
||||
disgust = clamp(disgust+amount, 0, DISGUST_LEVEL_MAXEDOUT)
|
||||
|
||||
/mob/living/carbon/set_disgust(amount)
|
||||
disgust = CLAMP(amount, 0, DISGUST_LEVEL_MAXEDOUT)
|
||||
disgust = clamp(amount, 0, DISGUST_LEVEL_MAXEDOUT)
|
||||
|
||||
|
||||
////////////////////////////////////////TRAUMAS/////////////////////////////////////////
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
/mob/living/proc/adjustBruteLoss(amount, updating_health = TRUE, forced = FALSE, required_status)
|
||||
if(!forced && (status_flags & GODMODE))
|
||||
return FALSE
|
||||
bruteloss = CLAMP((bruteloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||
bruteloss = clamp((bruteloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||
if(updating_health)
|
||||
updatehealth()
|
||||
return amount
|
||||
@@ -160,7 +160,7 @@
|
||||
/mob/living/proc/adjustOxyLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
if(!forced && (status_flags & GODMODE))
|
||||
return FALSE
|
||||
oxyloss = CLAMP((oxyloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||
oxyloss = clamp((oxyloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||
if(updating_health)
|
||||
updatehealth()
|
||||
return amount
|
||||
@@ -179,7 +179,7 @@
|
||||
/mob/living/proc/adjustToxLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
if(!forced && (status_flags & GODMODE))
|
||||
return FALSE
|
||||
toxloss = CLAMP((toxloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||
toxloss = clamp((toxloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||
if(updating_health)
|
||||
updatehealth()
|
||||
return amount
|
||||
@@ -198,7 +198,7 @@
|
||||
/mob/living/proc/adjustFireLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
if(!forced && (status_flags & GODMODE))
|
||||
return FALSE
|
||||
fireloss = CLAMP((fireloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||
fireloss = clamp((fireloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||
if(updating_health)
|
||||
updatehealth()
|
||||
return amount
|
||||
@@ -209,7 +209,7 @@
|
||||
/mob/living/proc/adjustCloneLoss(amount, updating_health = TRUE, forced = FALSE)
|
||||
if(!forced && ( (status_flags & GODMODE) || HAS_TRAIT(src, TRAIT_NOCLONELOSS)) )
|
||||
return FALSE
|
||||
cloneloss = CLAMP((cloneloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||
cloneloss = clamp((cloneloss + (amount * CONFIG_GET(number/damage_multiplier))), 0, maxHealth * 2)
|
||||
if(updating_health)
|
||||
updatehealth()
|
||||
return amount
|
||||
|
||||
@@ -1085,7 +1085,7 @@
|
||||
update_fire()
|
||||
|
||||
/mob/living/proc/adjust_fire_stacks(add_fire_stacks) //Adjusting the amount of fire_stacks we have on person
|
||||
fire_stacks = CLAMP(fire_stacks + add_fire_stacks, -20, 20)
|
||||
fire_stacks = clamp(fire_stacks + add_fire_stacks, -20, 20)
|
||||
if(on_fire && fire_stacks <= 0)
|
||||
ExtinguishMob()
|
||||
|
||||
|
||||
@@ -58,9 +58,9 @@
|
||||
|
||||
/obj/item/proc/get_volume_by_throwforce_and_or_w_class()
|
||||
if(throwforce && w_class)
|
||||
return CLAMP((throwforce + w_class) * 5, 30, 100)// Add the item's throwforce to its weight class and multiply by 5, then clamp the value between 30 and 100
|
||||
return clamp((throwforce + w_class) * 5, 30, 100)// Add the item's throwforce to its weight class and multiply by 5, then clamp the value between 30 and 100
|
||||
else if(w_class)
|
||||
return CLAMP(w_class * 8, 20, 100) // Multiply the item's weight class by 8, then clamp the value between 20 and 100
|
||||
return clamp(w_class * 8, 20, 100) // Multiply the item's weight class by 8, then clamp the value between 20 and 100
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
|
||||
/mob/living/silicon/pai/proc/process_hack()
|
||||
if(cable && cable.machine && istype(cable.machine, /obj/machinery/door) && cable.machine == hackdoor && get_dist(src, hackdoor) <= 1)
|
||||
hackprogress = CLAMP(hackprogress + 4, 0, 100)
|
||||
hackprogress = clamp(hackprogress + 4, 0, 100)
|
||||
else
|
||||
temp = "Door Jack: Connection to airlock has been lost. Hack aborted."
|
||||
hackprogress = 0
|
||||
@@ -283,7 +283,7 @@
|
||||
update_stat()
|
||||
|
||||
/mob/living/silicon/pai/process()
|
||||
emitterhealth = CLAMP((emitterhealth + emitterregen), -50, emittermaxhealth)
|
||||
emitterhealth = clamp((emitterhealth + emitterregen), -50, emittermaxhealth)
|
||||
|
||||
/obj/item/paicard/attackby(obj/item/W, mob/user, params)
|
||||
..()
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
return FALSE //No we're not flammable
|
||||
|
||||
/mob/living/silicon/pai/proc/take_holo_damage(amount)
|
||||
emitterhealth = CLAMP((emitterhealth - amount), -50, emittermaxhealth)
|
||||
emitterhealth = clamp((emitterhealth - amount), -50, emittermaxhealth)
|
||||
if(emitterhealth < 0)
|
||||
fold_in(force = TRUE)
|
||||
to_chat(src, "<span class='userdanger'>The impact degrades your holochassis!</span>")
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
if(cell && cell.charge)
|
||||
if(cell.charge <= 100)
|
||||
uneq_all()
|
||||
var/amt = CLAMP((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell.
|
||||
var/amt = clamp((lamp_intensity - 2) * 2,1,cell.charge) //Always try to use at least one charge per tick, but allow it to completely drain the cell.
|
||||
cell.use(amt) //Usage table: 1/tick if off/lowest setting, 4 = 4/tick, 6 = 8/tick, 8 = 12/tick, 10 = 16/tick
|
||||
else
|
||||
uneq_all()
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/mob/living/simple_animal/proc/adjustHealth(amount, updating_health = TRUE, forced = FALSE)
|
||||
if(!forced && (status_flags & GODMODE))
|
||||
return FALSE
|
||||
bruteloss = round(CLAMP(bruteloss + amount, 0, maxHealth),DAMAGE_PRECISION)
|
||||
bruteloss = round(clamp(bruteloss + amount, 0, maxHealth),DAMAGE_PRECISION)
|
||||
if(updating_health)
|
||||
updatehealth()
|
||||
return amount
|
||||
|
||||
@@ -107,8 +107,8 @@ Difficulty: Hard
|
||||
if(charging)
|
||||
return
|
||||
|
||||
anger_modifier = CLAMP(((maxHealth - health)/60),0,20)
|
||||
enrage_time = initial(enrage_time) * CLAMP(anger_modifier / 20, 0.5, 1)
|
||||
anger_modifier = clamp(((maxHealth - health)/60),0,20)
|
||||
enrage_time = initial(enrage_time) * clamp(anger_modifier / 20, 0.5, 1)
|
||||
ranged_cooldown = world.time + 50
|
||||
|
||||
if(client)
|
||||
|
||||
@@ -88,7 +88,7 @@ Difficulty: Very Hard
|
||||
chosen_attack_num = 4
|
||||
|
||||
/mob/living/simple_animal/hostile/megafauna/colossus/OpenFire()
|
||||
anger_modifier = CLAMP(((maxHealth - health)/50),0,20)
|
||||
anger_modifier = clamp(((maxHealth - health)/50),0,20)
|
||||
ranged_cooldown = world.time + 120
|
||||
|
||||
if(client)
|
||||
|
||||
@@ -104,7 +104,7 @@ Difficulty: Medium
|
||||
if(swooping)
|
||||
return
|
||||
|
||||
anger_modifier = CLAMP(((maxHealth - health)/50),0,20)
|
||||
anger_modifier = clamp(((maxHealth - health)/50),0,20)
|
||||
ranged_cooldown = world.time + ranged_cooldown_time
|
||||
|
||||
if(client)
|
||||
|
||||
@@ -485,7 +485,7 @@ Difficulty: Hard
|
||||
|
||||
/mob/living/simple_animal/hostile/megafauna/hierophant/proc/calculate_rage() //how angry we are overall
|
||||
did_reset = FALSE //oh hey we're doing SOMETHING, clearly we might need to heal if we recall
|
||||
anger_modifier = CLAMP(((maxHealth - health) / 42),0,50)
|
||||
anger_modifier = clamp(((maxHealth - health) / 42),0,50)
|
||||
burst_range = initial(burst_range) + round(anger_modifier * 0.08)
|
||||
beam_range = initial(beam_range) + round(anger_modifier * 0.12)
|
||||
|
||||
|
||||
@@ -199,7 +199,7 @@
|
||||
|
||||
/mob/living/simple_animal/updatehealth()
|
||||
..()
|
||||
health = CLAMP(health, 0, maxHealth)
|
||||
health = clamp(health, 0, maxHealth)
|
||||
|
||||
/mob/living/simple_animal/update_stat()
|
||||
if(status_flags & GODMODE)
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
step_away(M,src)
|
||||
M.Friends = Friends.Copy()
|
||||
babies += M
|
||||
M.mutation_chance = CLAMP(mutation_chance+(rand(5,-5)),0,100)
|
||||
M.mutation_chance = clamp(mutation_chance+(rand(5,-5)),0,100)
|
||||
SSblackbox.record_feedback("tally", "slime_babies_born", 1, M.colour)
|
||||
|
||||
if(original_nanites)
|
||||
|
||||
@@ -102,4 +102,4 @@
|
||||
///Adjust the body temperature of a mob, with min/max settings
|
||||
/mob/proc/adjust_bodytemperature(amount,min_temp=0,max_temp=INFINITY)
|
||||
if(bodytemperature >= min_temp && bodytemperature <= max_temp)
|
||||
bodytemperature = CLAMP(bodytemperature + amount,min_temp,max_temp)
|
||||
bodytemperature = clamp(bodytemperature + amount,min_temp,max_temp)
|
||||
|
||||
@@ -55,12 +55,12 @@
|
||||
return
|
||||
|
||||
var/desired_y = input(user, "How wide do you want the camera to shoot, between [picture_size_y_min] and [picture_size_y_max]?", "Zoom", picture_size_y) as num|null
|
||||
|
||||
|
||||
if (isnull(desired_y))
|
||||
return
|
||||
|
||||
picture_size_x = min(CLAMP(desired_x, picture_size_x_min, picture_size_x_max), CAMERA_PICTURE_SIZE_HARD_LIMIT)
|
||||
picture_size_y = min(CLAMP(desired_y, picture_size_y_min, picture_size_y_max), CAMERA_PICTURE_SIZE_HARD_LIMIT)
|
||||
picture_size_x = min(clamp(desired_x, picture_size_x_min, picture_size_x_max), CAMERA_PICTURE_SIZE_HARD_LIMIT)
|
||||
picture_size_y = min(clamp(desired_y, picture_size_y_min, picture_size_y_max), CAMERA_PICTURE_SIZE_HARD_LIMIT)
|
||||
|
||||
/obj/item/camera/AltClick(mob/user)
|
||||
if(!user.canUseTopic(src, BE_CLOSE))
|
||||
@@ -165,8 +165,8 @@
|
||||
if(!isturf(target_turf))
|
||||
blending = FALSE
|
||||
return FALSE
|
||||
size_x = CLAMP(size_x, 0, CAMERA_PICTURE_SIZE_HARD_LIMIT)
|
||||
size_y = CLAMP(size_y, 0, CAMERA_PICTURE_SIZE_HARD_LIMIT)
|
||||
size_x = clamp(size_x, 0, CAMERA_PICTURE_SIZE_HARD_LIMIT)
|
||||
size_y = clamp(size_y, 0, CAMERA_PICTURE_SIZE_HARD_LIMIT)
|
||||
var/list/desc = list("This is a photo of an area of [size_x+1] meters by [size_y+1] meters.")
|
||||
var/list/mobs_spotted = list()
|
||||
var/list/dead_spotted = list()
|
||||
@@ -186,7 +186,7 @@
|
||||
T = SSmapping.get_turf_below(T)
|
||||
if(!T)
|
||||
break
|
||||
|
||||
|
||||
if(T && ((ai_user && GLOB.cameranet.checkTurfVis(placeholder)) || (placeholder in seen)))
|
||||
turfs += T
|
||||
for(var/mob/M in T)
|
||||
|
||||
@@ -91,15 +91,15 @@
|
||||
switch(action)
|
||||
if("set_target_temperature")
|
||||
var/target = text2num(params["temperature"])
|
||||
target_temperature = CLAMP(target, 0, 1000)
|
||||
target_temperature = clamp(target, 0, 1000)
|
||||
if("set_allowed_temperature_difference")
|
||||
var/target = text2num(params["temperature"])
|
||||
allowed_temperature_difference = CLAMP(target, 0, 1000)
|
||||
allowed_temperature_difference = clamp(target, 0, 1000)
|
||||
if("toggle_power")
|
||||
enabled = !enabled
|
||||
if("change_volume")
|
||||
var/target = text2num(params["volume"])
|
||||
reagents.maximum_volume = CLAMP(round(target), 1, buffer)
|
||||
reagents.maximum_volume = clamp(round(target), 1, buffer)
|
||||
|
||||
#undef COOLING
|
||||
#undef HEATING
|
||||
|
||||
@@ -92,9 +92,9 @@
|
||||
. = TRUE
|
||||
switch(action)
|
||||
if("change_pill_style")
|
||||
pill_number = CLAMP(text2num(params["id"]), 1 , PILL_STYLE_COUNT)
|
||||
pill_number = clamp(text2num(params["id"]), 1 , PILL_STYLE_COUNT)
|
||||
if("change_pill_size")
|
||||
pill_size = CLAMP(text2num(params["volume"]), minimum_pill, maximum_pill)
|
||||
pill_size = clamp(text2num(params["volume"]), minimum_pill, maximum_pill)
|
||||
if("change_pill_name")
|
||||
var/new_name = html_encode(params["name"])
|
||||
if(findtext(new_name, "pill")) //names like pillatron and Pilliam are thus valid
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
var/transfer_side = 5
|
||||
//the maximum you can set the transfer to
|
||||
var/max_transfer = 9
|
||||
|
||||
|
||||
ui_x = 220
|
||||
ui_y = 105
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
switch(action)
|
||||
if("set_amount")
|
||||
var/direction = params["target"]
|
||||
var/value = CLAMP(text2num(params["amount"]), 1, max_transfer)
|
||||
var/value = clamp(text2num(params["amount"]), 1, max_transfer)
|
||||
switch(direction)
|
||||
if("straight")
|
||||
transfer_straight = value
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
GLOB.apcs_list -= src
|
||||
|
||||
if(malfai && operating)
|
||||
malfai.malf_picker.processing_time = CLAMP(malfai.malf_picker.processing_time - 10,0,1000)
|
||||
malfai.malf_picker.processing_time = clamp(malfai.malf_picker.processing_time - 10,0,1000)
|
||||
area.power_light = FALSE
|
||||
area.power_equip = FALSE
|
||||
area.power_environ = FALSE
|
||||
@@ -1374,7 +1374,7 @@
|
||||
|
||||
/obj/machinery/power/apc/proc/set_broken()
|
||||
if(malfai && operating)
|
||||
malfai.malf_picker.processing_time = CLAMP(malfai.malf_picker.processing_time - 10,0,1000)
|
||||
malfai.malf_picker.processing_time = clamp(malfai.malf_picker.processing_time - 10,0,1000)
|
||||
operating = FALSE
|
||||
obj_break()
|
||||
if(occupier)
|
||||
|
||||
@@ -206,7 +206,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri
|
||||
|
||||
/obj/structure/cable/proc/surplus()
|
||||
if(powernet)
|
||||
return CLAMP(powernet.avail-powernet.load, 0, powernet.avail)
|
||||
return clamp(powernet.avail-powernet.load, 0, powernet.avail)
|
||||
else
|
||||
return 0
|
||||
|
||||
@@ -222,7 +222,7 @@ GLOBAL_LIST_INIT(wire_node_generating_types, typecacheof(list(/obj/structure/gri
|
||||
|
||||
/obj/structure/cable/proc/delayed_surplus()
|
||||
if(powernet)
|
||||
return CLAMP(powernet.newavail - powernet.delayedload, 0, powernet.newavail)
|
||||
return clamp(powernet.newavail - powernet.delayedload, 0, powernet.newavail)
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
|
||||
/obj/item/stock_parts/cell/proc/get_electrocute_damage()
|
||||
if(charge >= 1000)
|
||||
return CLAMP(20 + round(charge/25000), 20, 195) + rand(-5,5)
|
||||
return clamp(20 + round(charge/25000), 20, 195) + rand(-5,5)
|
||||
else
|
||||
return 0
|
||||
|
||||
@@ -370,7 +370,7 @@
|
||||
. = ..()
|
||||
if(. & EMP_PROTECT_SELF)
|
||||
return
|
||||
charge = CLAMP((charge-(10000/severity)),0,maxcharge)
|
||||
charge = clamp((charge-(10000/severity)),0,maxcharge)
|
||||
|
||||
/obj/item/stock_parts/cell/emergency_light
|
||||
name = "miniature power cell"
|
||||
|
||||
@@ -336,7 +336,7 @@
|
||||
. = ..()
|
||||
if(on && status == LIGHT_OK)
|
||||
var/mutable_appearance/glowybit = mutable_appearance(overlayicon, base_state, ABOVE_LIGHTING_LAYER, ABOVE_LIGHTING_PLANE)
|
||||
glowybit.alpha = CLAMP(light_power*250, 30, 200)
|
||||
glowybit.alpha = clamp(light_power*250, 30, 200)
|
||||
. += glowybit
|
||||
|
||||
// update the icon_state and luminosity of the light depending on its state
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
/obj/machinery/power/proc/surplus()
|
||||
if(powernet)
|
||||
return CLAMP(powernet.avail-powernet.load, 0, powernet.avail)
|
||||
return clamp(powernet.avail-powernet.load, 0, powernet.avail)
|
||||
else
|
||||
return 0
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
|
||||
/obj/machinery/power/proc/delayed_surplus()
|
||||
if(powernet)
|
||||
return CLAMP(powernet.newavail - powernet.delayedload, 0, powernet.newavail)
|
||||
return clamp(powernet.newavail - powernet.delayedload, 0, powernet.newavail)
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
@@ -96,6 +96,6 @@
|
||||
|
||||
/datum/powernet/proc/get_electrocute_damage()
|
||||
if(avail >= 1000)
|
||||
return CLAMP(20 + round(avail/25000), 20, 195) + rand(-5,5)
|
||||
return clamp(20 + round(avail/25000), 20, 195) + rand(-5,5)
|
||||
else
|
||||
return 0
|
||||
|
||||
@@ -229,7 +229,7 @@
|
||||
|
||||
|
||||
/obj/machinery/power/smes/proc/chargedisplay()
|
||||
return CLAMP(round(5.5*charge/capacity),0,5)
|
||||
return clamp(round(5.5*charge/capacity),0,5)
|
||||
|
||||
/obj/machinery/power/smes/process()
|
||||
if(machine_stat & BROKEN)
|
||||
@@ -381,7 +381,7 @@
|
||||
target = text2num(target)
|
||||
. = TRUE
|
||||
if(.)
|
||||
input_level = CLAMP(target, 0, input_level_max)
|
||||
input_level = clamp(target, 0, input_level_max)
|
||||
log_smes(usr)
|
||||
if("output")
|
||||
var/target = params["target"]
|
||||
@@ -403,7 +403,7 @@
|
||||
target = text2num(target)
|
||||
. = TRUE
|
||||
if(.)
|
||||
output_level = CLAMP(target, 0, output_level_max)
|
||||
output_level = clamp(target, 0, output_level_max)
|
||||
log_smes(usr)
|
||||
|
||||
/obj/machinery/power/smes/proc/log_smes(mob/user)
|
||||
|
||||
@@ -164,7 +164,7 @@
|
||||
else
|
||||
//dot product of sun and panel -- Lambert's Cosine Law
|
||||
. = cos(azimuth_current - sun_azimuth)
|
||||
. = CLAMP(round(., 0.01), 0, 1)
|
||||
. = clamp(round(., 0.01), 0, 1)
|
||||
sunfrac = .
|
||||
|
||||
/obj/machinery/power/solar/process()
|
||||
@@ -385,7 +385,7 @@
|
||||
if(adjust)
|
||||
value = azimuth_rate + adjust
|
||||
if(value != null)
|
||||
azimuth_rate = round(CLAMP(value, -2 * SSsun.base_rotation, 2 * SSsun.base_rotation), 0.01)
|
||||
azimuth_rate = round(clamp(value, -2 * SSsun.base_rotation, 2 * SSsun.base_rotation), 0.01)
|
||||
return TRUE
|
||||
return FALSE
|
||||
if(action == "tracking")
|
||||
@@ -463,7 +463,7 @@
|
||||
|
||||
///Rotates the panel to the passed angles
|
||||
/obj/machinery/power/solar_control/proc/set_panels(azimuth)
|
||||
azimuth = CLAMP(round(azimuth, 0.01), -360, 719.99)
|
||||
azimuth = clamp(round(azimuth, 0.01), -360, 719.99)
|
||||
if(azimuth >= 360)
|
||||
azimuth -= 360
|
||||
if(azimuth < 0)
|
||||
|
||||
@@ -336,7 +336,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
|
||||
//We vary volume by power, and handle OH FUCK FUSION IN COOLING LOOP noises.
|
||||
if(power)
|
||||
soundloop.volume = CLAMP((50 + (power / 50)), 50, 100)
|
||||
soundloop.volume = clamp((50 + (power / 50)), 50, 100)
|
||||
if(damage >= 300)
|
||||
soundloop.mid_sounds = list('sound/machines/sm/loops/delamming.ogg' = 1)
|
||||
else
|
||||
@@ -375,7 +375,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
//((((some value between 0.5 and 1 * temp - ((273.15 + 40) * some values between 1 and 6)) * some number between 0.25 and knock your socks off / 150) * 0.25
|
||||
//Heat and mols account for each other, a lot of hot mols are more damaging then a few
|
||||
//Mols start to have a positive effect on damage after 350
|
||||
damage = max(damage + (max(CLAMP(removed.total_moles() / 200, 0.5, 1) * removed.temperature - ((T0C + HEAT_PENALTY_THRESHOLD)*dynamic_heat_resistance), 0) * mole_heat_penalty / 150 ) * DAMAGE_INCREASE_MULTIPLIER, 0)
|
||||
damage = max(damage + (max(clamp(removed.total_moles() / 200, 0.5, 1) * removed.temperature - ((T0C + HEAT_PENALTY_THRESHOLD)*dynamic_heat_resistance), 0) * mole_heat_penalty / 150 ) * DAMAGE_INCREASE_MULTIPLIER, 0)
|
||||
//Power only starts affecting damage when it is above 5000
|
||||
damage = max(damage + (max(power - POWER_PENALTY_THRESHOLD, 0)/500) * DAMAGE_INCREASE_MULTIPLIER, 0)
|
||||
//Molar count only starts affecting damage when it is above 1800
|
||||
@@ -405,14 +405,14 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
//Can cause an overestimation of mol count, should stabalize things though.
|
||||
//Prevents huge bursts of gas/heat when a large amount of something is introduced
|
||||
//They range between 0 and 1
|
||||
plasmacomp += CLAMP(max(removed.gases[/datum/gas/plasma][MOLES]/combined_gas, 0) - plasmacomp, -1, gas_change_rate)
|
||||
o2comp += CLAMP(max(removed.gases[/datum/gas/oxygen][MOLES]/combined_gas, 0) - o2comp, -1, gas_change_rate)
|
||||
co2comp += CLAMP(max(removed.gases[/datum/gas/carbon_dioxide][MOLES]/combined_gas, 0) - co2comp, -1, gas_change_rate)
|
||||
pluoxiumcomp += CLAMP(max(removed.gases[/datum/gas/pluoxium][MOLES]/combined_gas, 0) - pluoxiumcomp, -1, gas_change_rate)
|
||||
tritiumcomp += CLAMP(max(removed.gases[/datum/gas/tritium][MOLES]/combined_gas, 0) - tritiumcomp, -1, gas_change_rate)
|
||||
bzcomp += CLAMP(max(removed.gases[/datum/gas/bz][MOLES]/combined_gas, 0) - bzcomp, -1, gas_change_rate)
|
||||
n2ocomp += CLAMP(max(removed.gases[/datum/gas/nitrous_oxide][MOLES]/combined_gas, 0) - n2ocomp, -1, gas_change_rate)
|
||||
n2comp += CLAMP(max(removed.gases[/datum/gas/nitrogen][MOLES]/combined_gas, 0) - n2comp, -1, gas_change_rate)
|
||||
plasmacomp += clamp(max(removed.gases[/datum/gas/plasma][MOLES]/combined_gas, 0) - plasmacomp, -1, gas_change_rate)
|
||||
o2comp += clamp(max(removed.gases[/datum/gas/oxygen][MOLES]/combined_gas, 0) - o2comp, -1, gas_change_rate)
|
||||
co2comp += clamp(max(removed.gases[/datum/gas/carbon_dioxide][MOLES]/combined_gas, 0) - co2comp, -1, gas_change_rate)
|
||||
pluoxiumcomp += clamp(max(removed.gases[/datum/gas/pluoxium][MOLES]/combined_gas, 0) - pluoxiumcomp, -1, gas_change_rate)
|
||||
tritiumcomp += clamp(max(removed.gases[/datum/gas/tritium][MOLES]/combined_gas, 0) - tritiumcomp, -1, gas_change_rate)
|
||||
bzcomp += clamp(max(removed.gases[/datum/gas/bz][MOLES]/combined_gas, 0) - bzcomp, -1, gas_change_rate)
|
||||
n2ocomp += clamp(max(removed.gases[/datum/gas/nitrous_oxide][MOLES]/combined_gas, 0) - n2ocomp, -1, gas_change_rate)
|
||||
n2comp += clamp(max(removed.gases[/datum/gas/nitrogen][MOLES]/combined_gas, 0) - n2comp, -1, gas_change_rate)
|
||||
|
||||
//We're concerned about pluoxium being too easy to abuse at low percents, so we make sure there's a substantial amount.
|
||||
if(pluoxiumcomp >= 0.15)
|
||||
@@ -436,12 +436,12 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
//Given infinite time, powerloss_dynamic_scaling = co2comp
|
||||
//Some value between 0 and 1
|
||||
if (combined_gas > POWERLOSS_INHIBITION_MOLE_THRESHOLD && co2comp > POWERLOSS_INHIBITION_GAS_THRESHOLD) //If there are more then 20 mols, or more then 20% co2
|
||||
powerloss_dynamic_scaling = CLAMP(powerloss_dynamic_scaling + CLAMP(co2comp - powerloss_dynamic_scaling, -0.02, 0.02), 0, 1)
|
||||
powerloss_dynamic_scaling = clamp(powerloss_dynamic_scaling + clamp(co2comp - powerloss_dynamic_scaling, -0.02, 0.02), 0, 1)
|
||||
else
|
||||
powerloss_dynamic_scaling = CLAMP(powerloss_dynamic_scaling - 0.05,0, 1)
|
||||
powerloss_dynamic_scaling = clamp(powerloss_dynamic_scaling - 0.05,0, 1)
|
||||
//Ranges from 0 to 1(1-(value between 0 and 1 * ranges from 1 to 1.5(mol / 500)))
|
||||
//We take the mol count, and scale it to be our inhibitor
|
||||
powerloss_inhibitor = CLAMP(1-(powerloss_dynamic_scaling * CLAMP(combined_gas/POWERLOSS_INHIBITION_MOLE_BOOST_THRESHOLD,1 ,1.5)),0 ,1)
|
||||
powerloss_inhibitor = clamp(1-(powerloss_dynamic_scaling * clamp(combined_gas/POWERLOSS_INHIBITION_MOLE_BOOST_THRESHOLD,1 ,1.5)),0 ,1)
|
||||
|
||||
//Releases stored power into the general pool
|
||||
//We get this by consuming shit or being scalpeled
|
||||
@@ -501,7 +501,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
if(!istype(l.glasses, /obj/item/clothing/glasses/meson))
|
||||
var/D = sqrt(1 / max(1, get_dist(l, src)))
|
||||
l.hallucination += power * config_hallucination_power * D
|
||||
l.hallucination = CLAMP(l.hallucination, 0, 200)
|
||||
l.hallucination = clamp(l.hallucination, 0, 200)
|
||||
|
||||
for(var/mob/living/l in range(src, round((power / 100) ** 0.25)))
|
||||
var/rads = (power / 10) * sqrt( 1 / max(get_dist(l, src),1) )
|
||||
@@ -515,12 +515,12 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
//Handle high power zaps/anomaly generation
|
||||
if(power > POWER_PENALTY_THRESHOLD || damage > damage_penalty_point) //If the power is above 5000 or if the damage is above 550
|
||||
if(removed && removed.temperature)
|
||||
zap_cutoff = CLAMP(3000 - (power * (env.total_moles()) / 10) / env.return_temperature(), 350, 3000)//If the core is cold, it's easier to jump, ditto if there are a lot of mols
|
||||
zap_cutoff = clamp(3000 - (power * (env.total_moles()) / 10) / env.return_temperature(), 350, 3000)//If the core is cold, it's easier to jump, ditto if there are a lot of mols
|
||||
else
|
||||
zap_cutoff = 1500
|
||||
//We should always be able to zap our way out of the default enclosure
|
||||
//See supermatter_zap() for more details
|
||||
var/range = CLAMP(power / env.return_pressure() * 10, 2, 8)
|
||||
var/range = clamp(power / env.return_pressure() * 10, 2, 8)
|
||||
if(power > POWER_PENALTY_THRESHOLD)
|
||||
playsound(src.loc, 'sound/weapons/emitter2.ogg', 100, TRUE, extrarange = 10)
|
||||
supermatter_zap(src, range, min(power*2, 20000))
|
||||
@@ -531,7 +531,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
supermatter_zap(src, range, min(power*2, 20000))
|
||||
else if (damage > damage_penalty_point && prob(20))
|
||||
playsound(src.loc, 'sound/weapons/emitter2.ogg', 100, TRUE, extrarange = 10)
|
||||
supermatter_zap(src, range, CLAMP(power*2, 4000, 20000))
|
||||
supermatter_zap(src, range, clamp(power*2, 4000, 20000))
|
||||
|
||||
if(prob(15) && power > POWER_PENALTY_THRESHOLD)
|
||||
supermatter_pull(src, power/750)
|
||||
@@ -939,7 +939,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
|
||||
var/turf/T = get_turf(target)
|
||||
var/pressure = max(1,T.return_air().return_pressure())
|
||||
//We get our range with the strength of the zap and the pressure, the lower the former and the higher the latter the better
|
||||
var/new_range = CLAMP(zap_str / pressure * 10, 2, 7)
|
||||
var/new_range = clamp(zap_str / pressure * 10, 2, 7)
|
||||
if(prob(5))
|
||||
zap_str = zap_str - (zap_str/10)
|
||||
supermatter_zap(target, new_range, zap_str, targets_copy)
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
pixel_x = -32
|
||||
pixel_y = -32
|
||||
for (var/ball in orbiting_balls)
|
||||
var/range = rand(1, CLAMP(orbiting_balls.len, 3, 7))
|
||||
var/range = rand(1, clamp(orbiting_balls.len, 3, 7))
|
||||
tesla_zap(ball, range, TESLA_MINI_POWER/7*range)
|
||||
else
|
||||
energy = 0 // ensure we dont have miniballs of miniballs
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
|
||||
///Used by update_icon_state() and update_overlays()
|
||||
/obj/item/gun/energy/proc/get_charge_ratio()
|
||||
return can_shoot() ? CEILING(CLAMP(cell.charge / cell.maxcharge, 0, 1) * charge_sections, 1) : 0
|
||||
return can_shoot() ? CEILING(clamp(cell.charge / cell.maxcharge, 0, 1) * charge_sections, 1) : 0
|
||||
// Sets the ratio to 0 if the gun doesn't have enough charge to fire, or if its power cell is removed.
|
||||
|
||||
/obj/item/gun/energy/suicide_act(mob/living/user)
|
||||
|
||||
@@ -317,7 +317,7 @@
|
||||
AC.sync_stats()
|
||||
|
||||
/obj/item/gun/energy/beam_rifle/proc/delay_penalty(amount)
|
||||
aiming_time_left = CLAMP(aiming_time_left + amount, 0, aiming_time)
|
||||
aiming_time_left = clamp(aiming_time_left + amount, 0, aiming_time)
|
||||
|
||||
/obj/item/ammo_casing/energy/beam_rifle
|
||||
name = "particle acceleration lens"
|
||||
@@ -368,11 +368,11 @@
|
||||
HS_BB.stun = projectile_stun
|
||||
HS_BB.impact_structure_damage = impact_structure_damage
|
||||
HS_BB.aoe_mob_damage = aoe_mob_damage
|
||||
HS_BB.aoe_mob_range = CLAMP(aoe_mob_range, 0, 15) //Badmin safety lock
|
||||
HS_BB.aoe_mob_range = clamp(aoe_mob_range, 0, 15) //Badmin safety lock
|
||||
HS_BB.aoe_fire_chance = aoe_fire_chance
|
||||
HS_BB.aoe_fire_range = aoe_fire_range
|
||||
HS_BB.aoe_structure_damage = aoe_structure_damage
|
||||
HS_BB.aoe_structure_range = CLAMP(aoe_structure_range, 0, 15) //Badmin safety lock
|
||||
HS_BB.aoe_structure_range = clamp(aoe_structure_range, 0, 15) //Badmin safety lock
|
||||
HS_BB.wall_devastate = wall_devastate
|
||||
HS_BB.wall_pierce_amount = wall_pierce_amount
|
||||
HS_BB.structure_pierce_amount = structure_piercing
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
|
||||
/obj/projectile/proc/vol_by_damage()
|
||||
if(src.damage)
|
||||
return CLAMP((src.damage) * 0.67, 30, 100)// Multiply projectile damage by 0.67, then CLAMP the value between 30 and 100
|
||||
return clamp((src.damage) * 0.67, 30, 100)// Multiply projectile damage by 0.67, then CLAMP the value between 30 and 100
|
||||
else
|
||||
return 50 //if the projectile doesn't do damage, play its hitsound at 50% volume
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
def_zone = ran_zone(def_zone, max(100-(7*distance), 5)) //Lower accurancy/longer range tradeoff. 7 is a balanced number to use.
|
||||
|
||||
if(isturf(A) && hitsound_wall)
|
||||
var/volume = CLAMP(vol_by_damage() + 20, 0, 100)
|
||||
var/volume = clamp(vol_by_damage() + 20, 0, 100)
|
||||
if(suppressed)
|
||||
volume = 5
|
||||
playsound(loc, hitsound_wall, volume, TRUE, -1)
|
||||
@@ -379,7 +379,7 @@
|
||||
stack_trace("WARNING: Projectile [type] deleted due to being unable to resolve a target after angle was null!")
|
||||
qdel(src)
|
||||
return
|
||||
var/turf/target = locate(CLAMP(starting + xo, 1, world.maxx), CLAMP(starting + yo, 1, world.maxy), starting.z)
|
||||
var/turf/target = locate(clamp(starting + xo, 1, world.maxx), clamp(starting + yo, 1, world.maxy), starting.z)
|
||||
setAngle(Get_Angle(src, target))
|
||||
original_angle = Angle
|
||||
if(!nondirectional_sprite)
|
||||
@@ -509,10 +509,10 @@
|
||||
if(!homing_target)
|
||||
return FALSE
|
||||
var/datum/point/PT = RETURN_PRECISE_POINT(homing_target)
|
||||
PT.x += CLAMP(homing_offset_x, 1, world.maxx)
|
||||
PT.y += CLAMP(homing_offset_y, 1, world.maxy)
|
||||
PT.x += clamp(homing_offset_x, 1, world.maxx)
|
||||
PT.y += clamp(homing_offset_y, 1, world.maxy)
|
||||
var/angle = closer_angle_difference(Angle, angle_between_points(RETURN_PRECISE_POINT(src), PT))
|
||||
setAngle(Angle + CLAMP(angle, -homing_turn_speed, homing_turn_speed))
|
||||
setAngle(Angle + clamp(angle, -homing_turn_speed, homing_turn_speed))
|
||||
|
||||
/obj/projectile/proc/set_homing_target(atom/A)
|
||||
if(!A || (!isturf(A) && !isturf(A.loc)))
|
||||
|
||||
@@ -646,7 +646,7 @@
|
||||
|
||||
/datum/reagents/proc/adjust_thermal_energy(J, min_temp = 2.7, max_temp = 1000)
|
||||
var/S = specific_heat()
|
||||
chem_temp = CLAMP(chem_temp + (J / (S * total_volume)), 2.7, 1000)
|
||||
chem_temp = clamp(chem_temp + (J / (S * total_volume)), 2.7, 1000)
|
||||
|
||||
/datum/reagents/proc/add_reagent(reagent, amount, list/data=null, reagtemp = 300, no_react = 0)
|
||||
if(!isnum(amount) || !amount)
|
||||
@@ -737,7 +737,7 @@
|
||||
if (R.type == reagent)
|
||||
//clamp the removal amount to be between current reagent amount
|
||||
//and zero, to prevent removing more than the holder has stored
|
||||
amount = CLAMP(amount, 0, R.volume)
|
||||
amount = clamp(amount, 0, R.volume)
|
||||
R.volume -= amount
|
||||
update_total()
|
||||
if(!safety)//So it does not handle reactions when it need not to
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
target = text2num(target)
|
||||
. = TRUE
|
||||
if(.)
|
||||
target_temperature = CLAMP(target, 0, 1000)
|
||||
target_temperature = clamp(target, 0, 1000)
|
||||
if("eject")
|
||||
on = FALSE
|
||||
replace_beaker(usr)
|
||||
|
||||
@@ -246,7 +246,7 @@
|
||||
amount = text2num(input(usr,
|
||||
"Max 10. Buffer content will be split evenly.",
|
||||
"How many to make?", 1))
|
||||
amount = CLAMP(round(amount), 0, 10)
|
||||
amount = clamp(round(amount), 0, 10)
|
||||
if (amount <= 0)
|
||||
return FALSE
|
||||
// Get units per item
|
||||
@@ -272,7 +272,7 @@
|
||||
"Maximum [vol_each_max] units per item.",
|
||||
"How many units to fill?",
|
||||
vol_each_max))
|
||||
vol_each = CLAMP(vol_each, 0, vol_each_max)
|
||||
vol_each = clamp(vol_each, 0, vol_each_max)
|
||||
if(vol_each <= 0)
|
||||
return FALSE
|
||||
// Get item name
|
||||
|
||||
@@ -59,7 +59,7 @@ GLOBAL_LIST_INIT(name2reagent, build_name2reagent())
|
||||
return 0
|
||||
if(method == VAPOR) //smoke, foam, spray
|
||||
if(M.reagents)
|
||||
var/modifier = CLAMP((1 - touch_protection), 0, 1)
|
||||
var/modifier = clamp((1 - touch_protection), 0, 1)
|
||||
var/amount = round(reac_volume*modifier, 0.1)
|
||||
if(amount >= 0.5)
|
||||
M.reagents.add_reagent(type, amount)
|
||||
|
||||
@@ -1085,7 +1085,7 @@ All effects don't start immediately, but rather get worse over time; the rate is
|
||||
var/datum/antagonist/changeling/changeling = M.mind.has_antag_datum(/datum/antagonist/changeling)
|
||||
if(changeling)
|
||||
changeling.chem_charges += metabolization_rate
|
||||
changeling.chem_charges = CLAMP(changeling.chem_charges, 0, changeling.chem_storage)
|
||||
changeling.chem_charges = clamp(changeling.chem_charges, 0, changeling.chem_storage)
|
||||
return ..()
|
||||
|
||||
/datum/reagent/consumable/ethanol/irishcarbomb
|
||||
|
||||
@@ -1932,9 +1932,9 @@
|
||||
|
||||
/datum/reagent/peaceborg/confuse/on_mob_life(mob/living/carbon/M)
|
||||
if(M.confused < 6)
|
||||
M.confused = CLAMP(M.confused + 3, 0, 5)
|
||||
M.confused = clamp(M.confused + 3, 0, 5)
|
||||
if(M.dizziness < 6)
|
||||
M.dizziness = CLAMP(M.dizziness + 3, 0, 5)
|
||||
M.dizziness = clamp(M.dizziness + 3, 0, 5)
|
||||
if(prob(20))
|
||||
to_chat(M, "You feel confused and disoriented.")
|
||||
..()
|
||||
|
||||
@@ -244,7 +244,7 @@
|
||||
return
|
||||
holder.remove_reagent(/datum/reagent/sorium, created_volume*4)
|
||||
var/turf/T = get_turf(holder.my_atom)
|
||||
var/range = CLAMP(sqrt(created_volume*4), 1, 6)
|
||||
var/range = clamp(sqrt(created_volume*4), 1, 6)
|
||||
goonchem_vortex(T, 1, range)
|
||||
|
||||
/datum/chemical_reaction/sorium_vortex
|
||||
@@ -253,7 +253,7 @@
|
||||
|
||||
/datum/chemical_reaction/sorium_vortex/on_reaction(datum/reagents/holder, created_volume)
|
||||
var/turf/T = get_turf(holder.my_atom)
|
||||
var/range = CLAMP(sqrt(created_volume), 1, 6)
|
||||
var/range = clamp(sqrt(created_volume), 1, 6)
|
||||
goonchem_vortex(T, 1, range)
|
||||
|
||||
/datum/chemical_reaction/liquid_dark_matter
|
||||
@@ -265,7 +265,7 @@
|
||||
return
|
||||
holder.remove_reagent(/datum/reagent/liquid_dark_matter, created_volume*3)
|
||||
var/turf/T = get_turf(holder.my_atom)
|
||||
var/range = CLAMP(sqrt(created_volume*3), 1, 6)
|
||||
var/range = clamp(sqrt(created_volume*3), 1, 6)
|
||||
goonchem_vortex(T, 0, range)
|
||||
|
||||
/datum/chemical_reaction/ldm_vortex
|
||||
@@ -274,7 +274,7 @@
|
||||
|
||||
/datum/chemical_reaction/ldm_vortex/on_reaction(datum/reagents/holder, created_volume)
|
||||
var/turf/T = get_turf(holder.my_atom)
|
||||
var/range = CLAMP(sqrt(created_volume/2), 1, 6)
|
||||
var/range = clamp(sqrt(created_volume/2), 1, 6)
|
||||
goonchem_vortex(T, 0, range)
|
||||
|
||||
/datum/chemical_reaction/flash_powder
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
|
||||
if(total_reagent_weight && amount_of_reagents) //don't bother if the container is empty - DIV/0
|
||||
var/average_reagent_weight = total_reagent_weight / amount_of_reagents
|
||||
spray_range = CLAMP(round((initial(spray_range) / average_reagent_weight) - ((amount_of_reagents - 1) * 1)), 3, 5) //spray distance between 3 and 5 tiles rounded down; extra reagents lose a tile
|
||||
spray_range = clamp(round((initial(spray_range) / average_reagent_weight) - ((amount_of_reagents - 1) * 1)), 3, 5) //spray distance between 3 and 5 tiles rounded down; extra reagents lose a tile
|
||||
else
|
||||
spray_range = initial(spray_range)
|
||||
if(stream_mode == 0)
|
||||
|
||||
@@ -179,7 +179,7 @@
|
||||
///Used by update_icon() and update_overlays()
|
||||
/obj/item/reagent_containers/syringe/proc/get_rounded_vol()
|
||||
if(reagents && reagents.total_volume)
|
||||
return CLAMP(round((reagents.total_volume / volume * 15),5), 1, 15)
|
||||
return clamp(round((reagents.total_volume / volume * 15),5), 1, 15)
|
||||
else
|
||||
return 0
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
update_icon_state()
|
||||
say("Attempting to deposit 0 credits. Aborting.")
|
||||
return
|
||||
deposit_value = CLAMP(round(deposit_value, 1), 1, 15000)
|
||||
deposit_value = clamp(round(deposit_value, 1), 1, 15000)
|
||||
if(!account)
|
||||
say("Cannot find user account. Please swipe a valid ID.")
|
||||
return
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
materials.set_local_size(total_storage)
|
||||
var/total_rating = 1.2
|
||||
for(var/obj/item/stock_parts/manipulator/M in component_parts)
|
||||
total_rating = CLAMP(total_rating - (M.rating * 0.1), 0, 1)
|
||||
total_rating = clamp(total_rating - (M.rating * 0.1), 0, 1)
|
||||
if(total_rating == 0)
|
||||
efficiency_coeff = INFINITY
|
||||
else
|
||||
@@ -136,7 +136,7 @@
|
||||
say("Mineral access is on hold, please contact the quartermaster.")
|
||||
return FALSE
|
||||
var/power = 1000
|
||||
amount = CLAMP(amount, 1, 50)
|
||||
amount = clamp(amount, 1, 50)
|
||||
for(var/M in D.materials)
|
||||
power += round(D.materials[M] * amount / 35)
|
||||
power = min(3000, power)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
value = text2num(value)
|
||||
if(!value || !isnum(value))
|
||||
return
|
||||
src.value = CLAMP(value, min, max)
|
||||
src.value = clamp(value, min, max)
|
||||
|
||||
/datum/nanite_extra_setting/number/get_copy()
|
||||
return new /datum/nanite_extra_setting/number(value, min, max, unit)
|
||||
|
||||
@@ -72,14 +72,14 @@
|
||||
if("set_safety")
|
||||
var/threshold = text2num(params["value"])
|
||||
if(!isnull(threshold))
|
||||
chamber.set_safety(CLAMP(round(threshold, 1),0,500))
|
||||
chamber.set_safety(clamp(round(threshold, 1),0,500))
|
||||
playsound(src, "terminal_type", 25, FALSE)
|
||||
chamber.occupant.investigate_log("'s nanites' safety threshold was set to [threshold] by [key_name(usr)] via [src] at [AREACOORD(src)].", INVESTIGATE_NANITES)
|
||||
. = TRUE
|
||||
if("set_cloud")
|
||||
var/cloud_id = text2num(params["value"])
|
||||
if(!isnull(cloud_id))
|
||||
chamber.set_cloud(CLAMP(round(cloud_id, 1),0,100))
|
||||
chamber.set_cloud(clamp(round(cloud_id, 1),0,100))
|
||||
playsound(src, "terminal_type", 25, FALSE)
|
||||
chamber.occupant.investigate_log("'s nanites' cloud id was set to [cloud_id] by [key_name(usr)] via [src] at [AREACOORD(src)].", INVESTIGATE_NANITES)
|
||||
. = TRUE
|
||||
|
||||
@@ -174,7 +174,7 @@
|
||||
var/cloud_id = new_backup_id
|
||||
if(!isnull(cloud_id))
|
||||
playsound(src, 'sound/machines/terminal_prompt.ogg', 50, FALSE)
|
||||
cloud_id = CLAMP(round(cloud_id, 1),1,100)
|
||||
cloud_id = clamp(round(cloud_id, 1),1,100)
|
||||
generate_backup(cloud_id, usr)
|
||||
. = TRUE
|
||||
if("delete_backup")
|
||||
|
||||
@@ -86,13 +86,13 @@
|
||||
var/target_code = params["target_code"]
|
||||
switch(target_code)
|
||||
if("activation")
|
||||
program.activation_code = CLAMP(round(new_code, 1),0,9999)
|
||||
program.activation_code = clamp(round(new_code, 1),0,9999)
|
||||
if("deactivation")
|
||||
program.deactivation_code = CLAMP(round(new_code, 1),0,9999)
|
||||
program.deactivation_code = clamp(round(new_code, 1),0,9999)
|
||||
if("kill")
|
||||
program.kill_code = CLAMP(round(new_code, 1),0,9999)
|
||||
program.kill_code = clamp(round(new_code, 1),0,9999)
|
||||
if("trigger")
|
||||
program.trigger_code = CLAMP(round(new_code, 1),0,9999)
|
||||
program.trigger_code = clamp(round(new_code, 1),0,9999)
|
||||
. = TRUE
|
||||
if("set_extra_setting")
|
||||
program.set_extra_setting(params["target_setting"], params["value"])
|
||||
@@ -102,7 +102,7 @@
|
||||
var/timer = text2num(params["delay"])
|
||||
if(!isnull(timer))
|
||||
playsound(src, "terminal_type", 25, FALSE)
|
||||
timer = CLAMP(round(timer, 1), 0, 3600)
|
||||
timer = clamp(round(timer, 1), 0, 3600)
|
||||
timer *= 10 //convert to deciseconds
|
||||
program.timer_restart = timer
|
||||
. = TRUE
|
||||
@@ -110,7 +110,7 @@
|
||||
var/timer = text2num(params["delay"])
|
||||
if(!isnull(timer))
|
||||
playsound(src, "terminal_type", 25, FALSE)
|
||||
timer = CLAMP(round(timer, 1), 0, 3600)
|
||||
timer = clamp(round(timer, 1), 0, 3600)
|
||||
timer *= 10 //convert to deciseconds
|
||||
program.timer_shutdown = timer
|
||||
. = TRUE
|
||||
@@ -118,7 +118,7 @@
|
||||
var/timer = text2num(params["delay"])
|
||||
if(!isnull(timer))
|
||||
playsound(src, "terminal_type", 25, FALSE)
|
||||
timer = CLAMP(round(timer, 1), 0, 3600)
|
||||
timer = clamp(round(timer, 1), 0, 3600)
|
||||
timer *= 10 //convert to deciseconds
|
||||
program.timer_trigger = timer
|
||||
. = TRUE
|
||||
@@ -126,7 +126,7 @@
|
||||
var/timer = text2num(params["delay"])
|
||||
if(!isnull(timer))
|
||||
playsound(src, "terminal_type", 25, FALSE)
|
||||
timer = CLAMP(round(timer, 1), 0, 3600)
|
||||
timer = clamp(round(timer, 1), 0, 3600)
|
||||
timer *= 10 //convert to deciseconds
|
||||
program.timer_trigger_delay = timer
|
||||
. = TRUE
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
/datum/nanite_program/explosive/on_trigger(comm_message)
|
||||
host_mob.visible_message("<span class='warning'>[host_mob] starts emitting a high-pitched buzzing, and [host_mob.p_their()] skin begins to glow...</span>",\
|
||||
"<span class='userdanger'>You start emitting a high-pitched buzzing, and your skin begins to glow...</span>")
|
||||
addtimer(CALLBACK(src, .proc/boom), CLAMP((nanites.nanite_volume * 0.35), 25, 150))
|
||||
addtimer(CALLBACK(src, .proc/boom), clamp((nanites.nanite_volume * 0.35), 25, 150))
|
||||
|
||||
/datum/nanite_program/explosive/proc/boom()
|
||||
var/nanite_amount = nanites.nanite_volume
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
return
|
||||
var/new_code = text2num(params["code"])
|
||||
if(!isnull(new_code))
|
||||
new_code = CLAMP(round(new_code, 1),0,9999)
|
||||
new_code = clamp(round(new_code, 1),0,9999)
|
||||
code = new_code
|
||||
. = TRUE
|
||||
if("set_relay_code")
|
||||
@@ -114,7 +114,7 @@
|
||||
return
|
||||
var/new_code = text2num(params["code"])
|
||||
if(!isnull(new_code))
|
||||
new_code = CLAMP(round(new_code, 1),0,9999)
|
||||
new_code = clamp(round(new_code, 1),0,9999)
|
||||
relay_code = new_code
|
||||
. = TRUE
|
||||
if("update_name")
|
||||
|
||||
@@ -827,7 +827,7 @@
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You feed the slime the stabilizer. It is now less likely to mutate.</span>")
|
||||
M.mutation_chance = CLAMP(M.mutation_chance-15,0,100)
|
||||
M.mutation_chance = clamp(M.mutation_chance-15,0,100)
|
||||
qdel(src)
|
||||
|
||||
/obj/item/slimepotion/slime/mutator
|
||||
@@ -851,7 +851,7 @@
|
||||
return
|
||||
|
||||
to_chat(user, "<span class='notice'>You feed the slime the mutator. It is now more likely to mutate.</span>")
|
||||
M.mutation_chance = CLAMP(M.mutation_chance+12,0,100)
|
||||
M.mutation_chance = clamp(M.mutation_chance+12,0,100)
|
||||
M.mutator_used = TRUE
|
||||
qdel(src)
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
///Tries to charge from powernet excess, no upper limit except max charge.
|
||||
/obj/machinery/computer/vaultcontroller/proc/attempt_siphon()
|
||||
var/surpluspower = CLAMP(attached_cable.surplus(), 0, (siphon_max - siphoned_power))
|
||||
var/surpluspower = clamp(attached_cable.surplus(), 0, (siphon_max - siphoned_power))
|
||||
if(surpluspower)
|
||||
attached_cable.add_load(surpluspower)
|
||||
siphoned_power += surpluspower
|
||||
|
||||
@@ -832,13 +832,13 @@
|
||||
var/change_per_engine = (1 - ENGINE_COEFF_MIN) / ENGINE_DEFAULT_MAXSPEED_ENGINES // 5 by default
|
||||
if(initial_engines > 0)
|
||||
change_per_engine = (1 - ENGINE_COEFF_MIN) / initial_engines // or however many it had
|
||||
return CLAMP(1 - delta * change_per_engine,ENGINE_COEFF_MIN,ENGINE_COEFF_MAX)
|
||||
return clamp(1 - delta * change_per_engine,ENGINE_COEFF_MIN,ENGINE_COEFF_MAX)
|
||||
if(new_value < initial_engines)
|
||||
var/delta = initial_engines - new_value
|
||||
var/change_per_engine = 1 //doesn't really matter should not be happening for 0 engine shuttles
|
||||
if(initial_engines > 0)
|
||||
change_per_engine = (ENGINE_COEFF_MAX - 1) / initial_engines //just linear drop to max delay
|
||||
return CLAMP(1 + delta * change_per_engine,ENGINE_COEFF_MIN,ENGINE_COEFF_MAX)
|
||||
return clamp(1 + delta * change_per_engine,ENGINE_COEFF_MIN,ENGINE_COEFF_MAX)
|
||||
|
||||
|
||||
/obj/docking_port/mobile/proc/in_flight()
|
||||
|
||||
@@ -313,7 +313,7 @@
|
||||
var/mob/living/M = AM
|
||||
M.Paralyze(stun_amt)
|
||||
to_chat(M, "<span class='userdanger'>You're thrown back by [user]!</span>")
|
||||
AM.safe_throw_at(throwtarget, ((CLAMP((maxthrow - (CLAMP(distfromcaster - 2, 0, distfromcaster))), 3, maxthrow))), 1,user, force = repulse_force)//So stuff gets tossed around at the same time.
|
||||
AM.safe_throw_at(throwtarget, ((clamp((maxthrow - (clamp(distfromcaster - 2, 0, distfromcaster))), 3, maxthrow))), 1,user, force = repulse_force)//So stuff gets tossed around at the same time.
|
||||
|
||||
/obj/effect/proc_holder/spell/aoe_turf/repulse/xeno //i fixed conflicts only to find out that this is in the WIZARD file instead of the xeno file?!
|
||||
name = "Tail Sweep"
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
burn_dam += burn
|
||||
|
||||
//We've dealt the physical damages, if there's room lets apply the stamina damage.
|
||||
stamina_dam += round(CLAMP(stamina, 0, max_stamina_damage - stamina_dam), DAMAGE_PRECISION)
|
||||
stamina_dam += round(clamp(stamina, 0, max_stamina_damage - stamina_dam), DAMAGE_PRECISION)
|
||||
|
||||
|
||||
if(owner && updating_health)
|
||||
@@ -288,7 +288,7 @@
|
||||
C = source
|
||||
if(!original_owner)
|
||||
original_owner = source
|
||||
else
|
||||
else
|
||||
C = owner
|
||||
if(original_owner && owner != original_owner) //Foreign limb
|
||||
no_update = TRUE
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
return FALSE
|
||||
|
||||
var/obj/item/bodypart/affecting = C.get_bodypart(BODY_ZONE_CHEST)
|
||||
affecting.receive_damage(CLAMP(brute_dam/2 * affecting.body_damage_coeff, 15, 50), CLAMP(burn_dam/2 * affecting.body_damage_coeff, 0, 50)) //Damage the chest based on limb's existing damage
|
||||
affecting.receive_damage(clamp(brute_dam/2 * affecting.body_damage_coeff, 15, 50), clamp(burn_dam/2 * affecting.body_damage_coeff, 0, 50)) //Damage the chest based on limb's existing damage
|
||||
C.visible_message("<span class='danger'><B>[C]'s [src.name] has been violently dismembered!</B></span>")
|
||||
C.emote("scream")
|
||||
SEND_SIGNAL(C, COMSIG_ADD_MOOD_EVENT, "dismembered", /datum/mood_event/dismembered)
|
||||
|
||||
@@ -252,7 +252,7 @@
|
||||
return
|
||||
var/range = input(user, "Enter range (0 - [max_light_beam_distance])", "Range Select", 0) as null|num
|
||||
|
||||
set_distance(CLAMP(range, 0, max_light_beam_distance))
|
||||
set_distance(clamp(range, 0, max_light_beam_distance))
|
||||
assume_rgb(C)
|
||||
|
||||
/obj/item/organ/eyes/robotic/glow/proc/assume_rgb(newcolor)
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
if(safe_oxygen_max)
|
||||
if(O2_pp > safe_oxygen_max)
|
||||
var/ratio = (breath_gases[/datum/gas/oxygen][MOLES]/safe_oxygen_max) * 10
|
||||
H.apply_damage_type(CLAMP(ratio, oxy_breath_dam_min, oxy_breath_dam_max), oxy_damage_type)
|
||||
H.apply_damage_type(clamp(ratio, oxy_breath_dam_min, oxy_breath_dam_max), oxy_damage_type)
|
||||
H.throw_alert("too_much_oxy", /obj/screen/alert/too_much_oxy)
|
||||
else
|
||||
H.clear_alert("too_much_oxy")
|
||||
@@ -141,7 +141,7 @@
|
||||
if(safe_nitro_max)
|
||||
if(N2_pp > safe_nitro_max)
|
||||
var/ratio = (breath_gases[/datum/gas/nitrogen][MOLES]/safe_nitro_max) * 10
|
||||
H.apply_damage_type(CLAMP(ratio, nitro_breath_dam_min, nitro_breath_dam_max), nitro_damage_type)
|
||||
H.apply_damage_type(clamp(ratio, nitro_breath_dam_min, nitro_breath_dam_max), nitro_damage_type)
|
||||
H.throw_alert("too_much_nitro", /obj/screen/alert/too_much_nitro)
|
||||
else
|
||||
H.clear_alert("too_much_nitro")
|
||||
@@ -207,7 +207,7 @@
|
||||
if(safe_toxins_max)
|
||||
if(Toxins_pp > safe_toxins_max)
|
||||
var/ratio = (breath_gases[/datum/gas/plasma][MOLES]/safe_toxins_max) * 10
|
||||
H.apply_damage_type(CLAMP(ratio, tox_breath_dam_min, tox_breath_dam_max), tox_damage_type)
|
||||
H.apply_damage_type(clamp(ratio, tox_breath_dam_min, tox_breath_dam_max), tox_damage_type)
|
||||
H.throw_alert("too_much_tox", /obj/screen/alert/too_much_tox)
|
||||
else
|
||||
H.clear_alert("too_much_tox")
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
return
|
||||
if(maximum < damage)
|
||||
return
|
||||
damage = CLAMP(damage + d, 0, maximum)
|
||||
damage = clamp(damage + d, 0, maximum)
|
||||
var/mess = check_damage_thresholds(owner)
|
||||
prev_damage = damage
|
||||
if(mess && owner)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user