between() -> clamp() & swaps args 1 and 2 in uses

This commit is contained in:
Spookerton
2024-02-05 15:47:07 +00:00
parent dfac4a77fe
commit ebbf0e33fb
68 changed files with 137 additions and 146 deletions
@@ -92,7 +92,7 @@
holder.say(pick("Why...?", "I don't understand...?", "Cruel...", "Stop...", "Nooo..."))
resentment++ // Done after check so first time will never enrage.
discipline = between(0, discipline + amount, 10)
discipline = clamp(discipline + amount, 0, 10)
my_slime.update_mood()
// This slime always enrages if disciplined.
+1 -1
View File
@@ -437,7 +437,7 @@ GLOBAL_LIST_EMPTY(all_blobs)
return
/obj/structure/blob/proc/adjust_integrity(amount)
integrity = between(0, integrity + amount, max_integrity)
integrity = clamp(integrity + amount, 0, max_integrity)
if(integrity == 0)
playsound(src, 'sound/effects/splat.ogg', 50, 1)
if(overmind)
+1 -1
View File
@@ -97,7 +97,7 @@ var/global/list/overminds = list()
return TRUE
/mob/observer/blob/proc/add_points(points)
blob_points = between(0, blob_points + points, max_blob_points)
blob_points = clamp(blob_points + points, 0, max_blob_points)
/mob/observer/blob/Life()
if(ai_controlled && (!client || auto_pilot))
+1 -1
View File
@@ -44,7 +44,7 @@ var/global/list/breach_burn_descriptors = list(
/datum/breach/proc/update_descriptor()
//Sanity...
class = between(1, round(class), 5)
class = clamp(round(class), 1, 5)
//Apply the correct descriptor.
if(damtype == BURN)
descriptor = breach_burn_descriptors[class]
+2 -2
View File
@@ -123,7 +123,7 @@
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)
@@ -207,4 +207,4 @@
processing = 0;
coinsToProduce = temp_coins
src.updateUsrDialog()
return
return
@@ -103,7 +103,7 @@
if(length(neighbors) && prob(spread_chance))
//spread to 1-3 adjacent turfs depending on yield trait.
var/max_spread = between(1, round(seed.get_trait(TRAIT_YIELD)*3/14), 3)
var/max_spread = clamp(round(seed.get_trait(TRAIT_YIELD) * 3 / 14), 1, 3)
for(var/i in 1 to max_spread)
if(prob(spread_chance))
@@ -180,7 +180,7 @@
if(attached_grenade && !attached_grenade.active)
var/datum/integrated_io/detonation_time = inputs[1]
if(isnum(detonation_time.data) && detonation_time.data > 0)
attached_grenade.det_time = between(1, detonation_time.data, 12) SECONDS
attached_grenade.det_time = clamp(detonation_time.data, 1, 12) SECONDS
attached_grenade.activate()
var/atom/holder = loc
log_and_message_admins("activated a grenade assembly. Last touches: Assembly: [holder.fingerprintslast] Circuit: [fingerprintslast] Grenade: [attached_grenade.fingerprintslast]")
@@ -203,4 +203,4 @@
/obj/item/integrated_circuit/manipulation/grenade/frag
pre_attached_grenade_type = /obj/item/grenade/explosive
origin_tech = list(TECH_ENGINEERING = 3, TECH_DATA = 3, TECH_COMBAT = 10)
spawn_flags = null // Used for world initializing, see the #defines above.
spawn_flags = null // Used for world initializing, see the #defines above.
@@ -196,7 +196,7 @@
var/selected_sound = sounds[ID]
if(!selected_sound)
return
vol = between(0, vol, 100)
vol = clamp(vol, 0, 100)
playsound(src, selected_sound, vol, freq, -1)
/obj/item/integrated_circuit/output/sound/beeper
@@ -449,7 +449,7 @@
if(!isnum(holo_scale) || !isnum(holo_rotation) )
return FALSE // Invalid.
hologram.adjust_scale(between(-2, holo_scale, 2) )
hologram.adjust_scale(clamp(holo_scale, -2, 2))
hologram.adjust_rotation(holo_rotation)
update_hologram_position()
@@ -462,8 +462,8 @@
if(!isnum(holo_x) || !isnum(holo_y) )
return FALSE
holo_x = between(-7, holo_x, 7)
holo_y = between(-7, holo_y, 7)
holo_x = clamp(holo_x, -7, 7)
holo_y = clamp(holo_y, -7, 7)
var/turf/T = get_turf(src)
if(T)
+1 -1
View File
@@ -40,7 +40,7 @@
else
L = holder
L.mind.changeling.chem_charges = between(0, L.mind.changeling.chem_charges - chem_maintenance, L.mind.changeling.chem_storage)
L.mind.changeling.chem_charges = clamp(L.mind.changeling.chem_charges - chem_maintenance, 0, L.mind.changeling.chem_storage)
/datum/modifier/changeling/thermal_sight
name = "Thermal Adaptation"
@@ -26,7 +26,7 @@
/datum/modifier/trait/phobia/proc/adjust_fear(var/amount)
var/last_fear = current_fear
current_fear = between(0, current_fear + amount, max_fear)
current_fear = clamp(current_fear + amount, 0, max_fear)
// Handle messages. safepick() is used so that if no messages are defined, it just does nothing, verses runtiming.
var/message = null
@@ -689,4 +689,3 @@
"WetSkrell was a mistake."
)
return pick(generic_responses)
@@ -508,7 +508,7 @@ emp_act
catch_chance -= get_accuracy_penalty() // Same issues with shooting a gun, or swinging a weapon
catch_chance = between(1, catch_chance, 100)
catch_chance = clamp(catch_chance, 1, 100)
if(prob(catch_chance))
return TRUE
+1 -1
View File
@@ -747,7 +747,7 @@
//Use heat transfer as proportional to the gas density. However, we only care about the relative density vs standard 101 kPa/20 C air. Therefore we can use mole ratios
var/relative_density = environment.total_moles / MOLES_CELLSTANDARD
bodytemperature += between(BODYTEMP_COOLING_MAX, temp_adj*relative_density, BODYTEMP_HEATING_MAX)
bodytemperature += clamp(temp_adj * relative_density, BODYTEMP_COOLING_MAX, BODYTEMP_HEATING_MAX)
// +/- 50 degrees from 310.15K is the 'safe' zone, where no damage is dealt.
if(bodytemperature >= species.heat_level_1)
+4 -4
View File
@@ -899,9 +899,9 @@
for(var/C in colors_to_blend)
var/RGB = rgb2num(C)
R = between(0, R + RGB[1], 255)
G = between(0, G + RGB[2], 255)
B = between(0, B + RGB[3], 255)
R = clamp(R + RGB[1], 0, 255)
G = clamp(G + RGB[2], 0, 255)
B = clamp(B + RGB[3], 0, 255)
final_color = rgb(R,G,B)
if(final_color)
@@ -1067,7 +1067,7 @@
return !isSynthetic()
/mob/living/proc/adjust_nutrition(amount)
nutrition = between(0, nutrition + amount, max_nutrition)
nutrition = clamp(nutrition + amount, 0, max_nutrition)
/mob/living/vv_get_header()
. = ..()
@@ -8,7 +8,7 @@
return FALSE
if(I_DISARM)
var/stun_power = between(0, power_charge + rand(0, 3), 10)
var/stun_power = clamp(power_charge + rand(0, 3), 0, 10)
if(ishuman(L))
var/mob/living/carbon/human/H = L
@@ -40,7 +40,7 @@
else if(nutrition >= get_grow_nutrition() && amount_grown < 10)
adjust_nutrition(-20)
amount_grown = between(0, amount_grown + 1, 10)
amount_grown = clamp(amount_grown + 1, 0, 10)
// Called if above proc happens while below a nutrition threshold.
/mob/living/simple_mob/slime/xenobio/proc/handle_starvation()
@@ -45,7 +45,7 @@
// Shocked grilles don't hurt slimes, and in fact give them charge.
/mob/living/simple_mob/slime/xenobio/electrocute_act(shock_damage, obj/source, siemens_coeff = 1.0, def_zone = null)
power_charge = between(0, power_charge + round(shock_damage / 10), 10)
power_charge = clamp(power_charge + round(shock_damage / 10), 0, 10)
to_chat(src, span("notice", "\The [source] shocks you, and it charges you."))
// Getting slimebatoned/xenotased.
@@ -166,7 +166,7 @@
/mob/living/simple_mob/slime/xenobio/yellow/handle_special()
if(stat == CONSCIOUS)
if(prob(25))
power_charge = between(0, power_charge + 1, 10)
power_charge = clamp(power_charge + 1, 0, 10)
..()
/obj/item/projectile/beam/lightning/slime
@@ -461,7 +461,7 @@
var/mob/living/carbon/human/H = L
if(H.isSynthetic())
continue
H.nutrition = between(0, H.nutrition + rand(15, 25), 800)
H.nutrition = clamp(H.nutrition + rand(15, 25), 0, 800)
/mob/living/simple_mob/slime/xenobio/cerulean
desc = "This slime is generally superior in a wide range of attributes, compared to the common slime. The jack of all trades, but master of none."
@@ -609,7 +609,7 @@
)
/mob/living/simple_mob/slime/xenobio/gold/slimebatoned(mob/living/user, amount)
power_charge = between(0, power_charge + amount, 10)
power_charge = clamp(power_charge + amount, 0, 10)
/mob/living/simple_mob/slime/xenobio/gold/get_description_interaction() // So it doesn't say to use a baton on them.
return list()
@@ -787,4 +787,4 @@
/mob/living/simple_mob/slime/xenobio/rainbow/kendrick/Initialize()
pacify() // So the physical mob also gets made harmless.
return ..()
return ..()
@@ -153,7 +153,7 @@ var/global/datum/ntnet/ntnet_global = new()
if(!lognumber)
return 0
// Trim the value if necessary
lognumber = between(MIN_NTNET_LOGS, lognumber, MAX_NTNET_LOGS)
lognumber = clamp(lognumber, MIN_NTNET_LOGS, MAX_NTNET_LOGS)
setting_maxlogcount = lognumber
add_log("Configuration Updated. Now keeping [setting_maxlogcount] logs in system memory.")
@@ -185,4 +185,3 @@ var/global/datum/ntnet/ntnet_global = new()
for(var/datum/ntnet_conversation/chan in chat_channels)
if(chan.id == id)
return chan
@@ -23,7 +23,7 @@
amount = round(amount)
if(damage_casing)
damage += amount
damage = between(0, damage, max_damage)
damage = clamp(damage, 0, max_damage)
if(component_probability)
for(var/obj/item/computer_hardware/H in get_all_components())
@@ -84,4 +84,4 @@
// Damages the component. Contains necessary checks. Negative damage "heals" the component.
/obj/item/computer_hardware/take_damage(var/amount)
damage += round(amount) // We want nice rounded numbers here.
damage = between(0, damage, max_damage) // Clamp the value.
damage = clamp(damage, 0, max_damage) // Clamp the value.
+4 -4
View File
@@ -226,7 +226,7 @@ var/global/list/organ_cache = list()
if(germ_level >= INFECTION_LEVEL_ONE)
. = 1 //Organ qualifies for effect-specific processing
//var/fever_temperature = (owner.species.heat_level_1 - owner.species.body_temperature - 5)* min(germ_level/INFECTION_LEVEL_TWO, 1) + owner.species.body_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)
var/fever_temperature = owner?.species.heat_discomfort_level * 1.10 //Heat discomfort level plus 10%
if(owner?.bodytemperature < fever_temperature)
owner?.bodytemperature += min(0.2,(fever_temperature - owner?.bodytemperature) / 10) //Will usually climb by 0.2, else 10% of the difference if less
@@ -319,10 +319,10 @@ var/global/list/organ_cache = list()
//Note: external organs have their own version of this proc
/obj/item/organ/take_damage(amount, var/silent=0)
if(src.robotic >= ORGAN_ROBOT)
src.damage = between(0, src.damage + (amount * 0.8), max_damage)
if(robotic >= ORGAN_ROBOT)
damage = clamp(damage + (amount * 0.8), 0, max_damage)
else
src.damage = between(0, src.damage + amount, max_damage)
damage = clamp(damage + amount, 0, max_damage)
//only show this if the organ is not robotic
if(owner && parent_organ && amount > 0)
+5 -5
View File
@@ -65,7 +65,7 @@
icon_update = 0
var/cellcount = 0
var/charge_level = between(0, round(Percentage() / 12), 7)
var/charge_level = clamp(round(Percentage() / 12), 0, 7)
add_overlay("charge[charge_level]")
@@ -87,7 +87,7 @@
newmaxcharge /= CELLRATE // Convert to Joules
newmaxcharge *= SMESRATE // And to SMES charge units (which are for some reason different than CELLRATE)
capacity = newmaxcharge
charge = between(0, charge, newmaxcharge)
charge = clamp(charge, 0, newmaxcharge)
// Sets input/output depending on our "mode" var.
@@ -204,7 +204,7 @@
celldiff = (least.maxcharge / 100) * percentdiff
else
celldiff = (most.maxcharge / 100) * percentdiff
celldiff = between(0, celldiff, max_transfer_rate * CELLRATE)
celldiff = clamp(celldiff, 0, max_transfer_rate * CELLRATE)
// Ensure we don't transfer more energy than the most charged cell has, and that the least charged cell can input.
celldiff = min(min(celldiff, most.charge), least.maxcharge - least.charge)
least.give(most.use(celldiff))
@@ -286,7 +286,7 @@
update_io(0)
return 1
else if( href_list["enable"] )
update_io(between(1, text2num(href_list["enable"]), 3))
update_io(clamp(text2num(href_list["enable"]), 1, 3))
return 1
else if( href_list["equaliseon"] )
equalise = 1
@@ -309,4 +309,4 @@
update_icon()
RefreshParts()
update_maxcharge()
return 1
return 1
+2 -2
View File
@@ -211,7 +211,7 @@
//or if it is already above upper_limit, limit the increase to 0.
var/inc_limit = max(upper_limit - temperature, 0)
var/dec_limit = min(temperature - lower_limit, 0)
temperature += between(dec_limit, rand(-7 + bias, 7 + bias), inc_limit)
temperature += clamp(rand(-7 + bias, 7 + bias), dec_limit, inc_limit)
if (temperature > max_temperature)
overheat()
@@ -228,7 +228,7 @@
if(temperature > cooling_temperature)
var/temp_loss = (temperature - cooling_temperature)/TEMPERATURE_DIVISOR
temp_loss = between(2, round(temp_loss, 1), TEMPERATURE_CHANGE_MAX)
temp_loss = clamp(round(temp_loss, 1), 2, TEMPERATURE_CHANGE_MAX)
temperature = max(temperature - temp_loss, cooling_temperature)
updateDialog()
+4 -4
View File
@@ -40,7 +40,7 @@
return max(avail - load, 0)
/datum/powernet/proc/draw_power(var/amount)
var/draw = between(0, amount, avail - load)
var/draw = clamp(amount, 0, avail - load)
load += draw
return draw
@@ -122,7 +122,7 @@
// At this point, all other machines have finished using power. Anything left over may be used up to charge SMESs.
if(inputting.len && smes_demand)
var/smes_input_percentage = between(0, (netexcess / smes_demand) * 100, 100)
var/smes_input_percentage = clamp((netexcess / smes_demand) * 100, 0, 100)
for(var/obj/machinery/power/terminal/T in inputting)
var/obj/machinery/power/smes/S = T.master
if(istype(S))
@@ -152,11 +152,11 @@
var/smes_used = load - (avail - smes_avail) // SMESs are always last to provide power
if(!smes_used || smes_used < 0 || !smes_avail) // SMES power isn't available or being used at all, SMES load is therefore 0%
return 0
return between(0, (smes_used / smes_avail) * 100, 100) // Otherwise return percentage load of SMESs.
return clamp((smes_used / smes_avail) * 100, 0, 100) // Otherwise return percentage load of SMESs.
else
if(!load)
return 0
return between(0, (load / avail) * 100, 100)
return clamp((load / avail) * 100, 0, 100)
/datum/powernet/proc/get_electrocute_damage()
switch(avail)
+1 -1
View File
@@ -256,7 +256,7 @@
adjust_integrity(-1000) // This kills the emitter.
/obj/machinery/power/emitter/proc/adjust_integrity(amount)
integrity = between(0, integrity + amount, initial(integrity))
integrity = clamp(integrity + amount, 0, initial(integrity))
if(integrity == 0)
if(powernet && avail(active_power_usage)) // If it's powered, it goes boom if killed.
visible_message(src, "<span class='danger'>\The [src] explodes violently!</span>", "<span class='danger'>You hear an explosion!</span>")
@@ -48,7 +48,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)
add_overlay("+p[level]")
+2 -2
View File
@@ -126,7 +126,7 @@ GLOBAL_LIST_EMPTY(smeses)
/obj/machinery/power/smes/proc/input_power(var/percentage, var/obj/machinery/power/terminal/term)
var/to_input = target_load * (percentage/100)
to_input = between(0, to_input, target_load)
to_input = clamp(to_input, 0, target_load)
if(percentage == 100)
inputting = 2
else if(percentage)
@@ -193,7 +193,7 @@ GLOBAL_LIST_EMPTY(smeses)
return
var/total_restore = output_used * (percent_load / 100) // First calculate amount of power used from our output
total_restore = between(0, total_restore, output_used) // Now clamp the value between 0 and actual output, just for clarity.
total_restore = clamp(total_restore, 0, output_used) // Now clamp the value between 0 and actual output, just for clarity.
total_restore = output_used - total_restore // And, at last, subtract used power from outputted power, to get amount of power we will give back to the SMES.
// now recharge this amount
+4 -4
View File
@@ -154,7 +154,7 @@
capacity += C.ChargeCapacity
input_level_max += C.IOCapacity
output_level_max += C.IOCapacity
charge = between(0, charge, capacity)
charge = clamp(charge, 0, capacity)
return 1
return 0
@@ -383,12 +383,12 @@
// Parameters: 1 (new_input - New input value in Watts)
// Description: Sets input setting on this SMES. Trims it if limits are exceeded.
/obj/machinery/power/smes/buildable/proc/set_input(var/new_input = 0)
input_level = between(0, new_input, input_level_max)
input_level = clamp(new_input, 0, input_level_max)
update_icon()
// Proc: set_output()
// Parameters: 1 (new_output - New output value in Watts)
// Description: Sets output setting on this SMES. Trims it if limits are exceeded.
/obj/machinery/power/smes/buildable/proc/set_output(var/new_output = 0)
output_level = between(0, new_output, output_level_max)
update_icon()
output_level = clamp(new_output, 0, output_level_max)
update_icon()
@@ -218,8 +218,8 @@
var/explosion_power = min_explosion_power
if(power > 0)
// 0-100% where 0% is at DETONATION_EXPLODE_MIN_POWER or lower and 100% is at DETONATION_EXPLODE_MAX_POWER or higher
var/strength_percentage = between(0, (power - DETONATION_EXPLODE_MIN_POWER) / ((DETONATION_EXPLODE_MAX_POWER - DETONATION_EXPLODE_MIN_POWER) / 100), 100)
explosion_power = between(min_explosion_power, (((max_explosion_power - min_explosion_power) * (strength_percentage / 100)) + min_explosion_power), max_explosion_power)
var/strength_percentage = clamp((power - DETONATION_EXPLODE_MIN_POWER) / ((DETONATION_EXPLODE_MAX_POWER - DETONATION_EXPLODE_MIN_POWER) / 100), 0, 100)
explosion_power = clamp((((max_explosion_power - min_explosion_power) * (strength_percentage / 100)) + min_explosion_power), min_explosion_power, max_explosion_power)
explosion(TS, explosion_power/2, explosion_power, max_explosion_power, explosion_power * 4, 1)
qdel(src)
@@ -377,7 +377,7 @@
visible_message("[src]: Releasing additional [round((heat_capacity_new - heat_capacity)*removed.temperature)] W with exhaust gasses.")
removed.add_thermal_energy(thermal_power)
removed.temperature = between(0, removed.temperature, 10000)
removed.temperature = clamp(removed.temperature, 0, 10000)
env.merge(removed)
+1 -1
View File
@@ -79,7 +79,7 @@
else
// Handle visual projectile turning in flight.
var/arc_progress = between(0, pixels_flown / distance_to_fly, 1)
var/arc_progress = clamp(pixels_flown / distance_to_fly, 0, 1)
var/new_visual_degree = LERP(45, 135, arc_progress)
if(fired_dir & EAST)
+1 -1
View File
@@ -163,7 +163,7 @@
qdel(hotspot)
if (environment && environment.temperature > min_temperature) // Abstracted as steam or something
var/removed_heat = between(0, volume * WATER_LATENT_HEAT, -environment.get_thermal_energy_change(min_temperature))
var/removed_heat = clamp(volume * WATER_LATENT_HEAT, 0, -environment.get_thermal_energy_change(min_temperature))
environment.add_thermal_energy(-removed_heat)
if (prob(5))
T.visible_message("<span class='warning'>The water sizzles as it lands on \the [T]!</span>")
+1 -1
View File
@@ -112,7 +112,7 @@ research holder datum.
if(DesignHasReqs(PD))
AddDesign2Known(PD)
for(var/datum/tech/T in known_tech)
T = between(0, T.level, 20)
T = clamp(T.level, 0, 20)
return
//Refreshes the levels of a given tech.
+2 -2
View File
@@ -48,7 +48,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 (T0C + 70))
health = max(0, health - 1)
if(health <= 0)
@@ -303,4 +303,4 @@
name = "Core R&D Server"
id_with_upload_string = "1"
id_with_download_string = "1"
server_id = 1
server_id = 1
+1 -1
View File
@@ -140,7 +140,7 @@
S.relocate()
/obj/item/shield_projector/proc/adjust_health(amount)
shield_health = between(0, shield_health + amount, max_shield_health)
shield_health = clamp(shield_health + amount, 0, max_shield_health)
if(amount < 0)
if(shield_health <= 0)
destroy_shields()
+2 -3
View File
@@ -90,7 +90,7 @@
/obj/effect/energy_field/proc/adjust_strength(amount, impact = 1)
var/old_density = density
strength = between(0, strength + amount, max_strength)
strength = clamp(strength + amount, 0, max_strength)
//maptext = "[round(strength, 0.1)]/[max_strength]"
@@ -139,7 +139,7 @@
// Small visual effect, makes the shield tiles brighten up by becoming more opaque for a moment, and spreads to nearby shields.
/obj/effect/energy_field/proc/impact_effect(var/i, var/list/affected_shields = list())
i = between(1, i, 10)
i = clamp(1, i, 10)
alpha = 200
animate(src, alpha = initial(alpha), time = 1 SECOND)
affected_shields |= src
@@ -152,4 +152,3 @@
for(var/obj/effect/energy_field/F in T)
if(!(F in affected_shields))
F.impact_effect(i, affected_shields) // Spread the effect to them.
+1 -1
View File
@@ -66,7 +66,7 @@
power = 0
return 0
var/shieldload = between(500, max_stored_power - storedpower, power_draw) //what we try to draw
var/shieldload = clamp(max_stored_power - storedpower, 500, power_draw) //what we try to draw
shieldload = PN.draw_power(shieldload) //what we actually get
storedpower += shieldload
+2 -2
View File
@@ -105,7 +105,7 @@
PN = C.powernet
if (PN)
var/power_draw = between(0, max_charge - stored_charge, charge_rate) //what we are trying to draw
var/power_draw = clamp(max_charge - stored_charge, 0, charge_rate) //what we are trying to draw
power_draw = PN.draw_power(power_draw) //what we actually get
stored_charge += power_draw
@@ -145,4 +145,4 @@
return
src.set_dir(turn(src.dir, 270))
return
return
+1 -1
View File
@@ -348,7 +348,7 @@
"docking_status" = shuttle.shuttle_docking_controller? shuttle.shuttle_docking_controller.get_docking_status() : null,
"docking_override" = shuttle.shuttle_docking_controller? shuttle.shuttle_docking_controller.override_enabled : null,
"is_in_transit" = shuttle.has_arrive_time(),
"travel_progress" = between(0, percent_finished, 100),
"travel_progress" = clamp(percent_finished, 0, 100),
"time_left" = round( (total_time - elapsed_time) / 10),
"can_cloak" = shuttle.can_cloak ? 1 : 0,
"cloaked" = shuttle.cloaked ? 1 : 0,
+1 -1
View File
@@ -137,7 +137,7 @@
healthcheck()
/obj/vehicle/proc/adjust_health(amount)
health = between(0, health + amount, maxhealth)
health = clamp(health + amount, 0, maxhealth)
healthcheck()
/obj/vehicle/ex_act(severity)
+1 -1
View File
@@ -513,7 +513,7 @@
if(protection < 1)
var/cold_factor = abs(protection - 1)
H.bodytemperature = between(50, (H.bodytemperature - ((H.bodytemperature - 50) * cold_factor) ), H.bodytemperature)
H.bodytemperature = clamp((H.bodytemperature - ((H.bodytemperature - 50) * cold_factor)), 50, H.bodytemperature)
if(protection < 0.7)
to_chat(L, "<span class='danger'>A chilling wave of cold overwhelms you!</span>")
+2 -2
View File
@@ -33,7 +33,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 = between(0, M.mutation_chance - 15, 100)
M.mutation_chance = clamp(M.mutation_chance - 15, 0, 100)
playsound(src, 'sound/effects/bubbles.ogg', 50, 1)
qdel(src)
@@ -57,7 +57,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 = between(0, M.mutation_chance + 12, 100)
M.mutation_chance = clamp(M.mutation_chance + 12, 0, 100)
playsound(src, 'sound/effects/bubbles.ogg', 50, 1)
qdel(src)
+1 -1
View File
@@ -230,7 +230,7 @@
/datum/gas_mixture/proc/remove_ratio(ratio, out_group_multiplier = 1)
if(ratio <= 0)
return null
out_group_multiplier = between(1, out_group_multiplier, group_multiplier)
out_group_multiplier = clamp(out_group_multiplier, 1, group_multiplier)
ratio = min(ratio, 1)