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
+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 ..()