mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-12 15:45:25 +01:00
Moves to BYOND 513 (#13650)
* Fixes Orbiting * moves to 513 * travis update * check for minor version too
This commit is contained in:
@@ -430,7 +430,7 @@
|
||||
else if(expression[start + 1] == "\[" && islist(v))
|
||||
var/list/L = v
|
||||
var/index = SDQL_expression(source, expression[start + 2])
|
||||
if(isnum(index) && (!IsInteger(index) || L.len < index))
|
||||
if(isnum(index) && (!ISINTEGER(index) || L.len < index))
|
||||
to_chat(world, "<span class='danger'>Invalid list index: [index]</span>")
|
||||
return null
|
||||
return L[index]
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
var/matrix/mat = matrix()
|
||||
mat.Translate(0, 16)
|
||||
mat.Scale(1, sqrt((x_offset * x_offset) + (y_offset * y_offset)) / 32)
|
||||
mat.Turn(90 - Atan2(x_offset, y_offset)) // So... You pass coords in order x,y to this version of atan2. It should be called acsc2.
|
||||
mat.Turn(90 - ATAN2(x_offset, y_offset)) // So... You pass coords in order x,y to this version of atan2. It should be called acsc2.
|
||||
mat.Translate(atom_a.pixel_x, atom_a.pixel_y)
|
||||
|
||||
transform = mat
|
||||
|
||||
@@ -22,6 +22,6 @@
|
||||
if(stored)
|
||||
DuplicateObject(stored, perfectcopy=1, sameloc=0,newloc=T)
|
||||
else if(right_click)
|
||||
if(ismovableatom(object)) // No copying turfs for now.
|
||||
if(ismovable(object)) // No copying turfs for now.
|
||||
to_chat(user, "<span class='notice'>[object] set as template.</span>")
|
||||
stored = object
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
UI_style_alpha='[UI_style_alpha]',
|
||||
be_role='[sanitizeSQL(list2params(be_special))]',
|
||||
default_slot='[default_slot]',
|
||||
toggles='[num2text(toggles, Ceiling(log(10, (TOGGLES_TOTAL))))]',
|
||||
toggles='[num2text(toggles, CEILING(log(10, (TOGGLES_TOTAL)), 1))]',
|
||||
atklog='[atklog]',
|
||||
sound='[sound]',
|
||||
randomslot='[randomslot]',
|
||||
|
||||
@@ -531,7 +531,7 @@
|
||||
|
||||
/obj/item/clothing/suit/space/hardsuit/shielded/process()
|
||||
if(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)
|
||||
|
||||
@@ -552,7 +552,7 @@
|
||||
|
||||
data["charge"] = cell ? round(cell.charge,1) : 0
|
||||
data["maxcharge"] = cell ? cell.maxcharge : 0
|
||||
data["chargestatus"] = cell ? Floor((cell.charge/cell.maxcharge)*50) : 0
|
||||
data["chargestatus"] = cell ? FLOOR((cell.charge/cell.maxcharge)*50, 1) : 0
|
||||
|
||||
data["emagged"] = subverted
|
||||
data["coverlock"] = locked
|
||||
|
||||
@@ -159,7 +159,7 @@ GLOBAL_VAR(current_date_string)
|
||||
var/account_name = href_list["holder_name"]
|
||||
var/starting_funds = max(text2num(href_list["starting_funds"]), 0)
|
||||
|
||||
starting_funds = Clamp(starting_funds, 0, GLOB.station_account.money) // Not authorized to put the station in debt.
|
||||
starting_funds = clamp(starting_funds, 0, GLOB.station_account.money) // Not authorized to put the station in debt.
|
||||
starting_funds = min(starting_funds, fund_cap) // Not authorized to give more than the fund cap.
|
||||
|
||||
var/datum/money_account/M = create_account(account_name, starting_funds, src)
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
if(!newAnomaly)
|
||||
kill()
|
||||
return
|
||||
if(IsMultiple(activeFor, 5))
|
||||
if(ISMULTIPLE(activeFor, 5))
|
||||
newAnomaly.anomalyEffect()
|
||||
|
||||
/datum/event/anomaly/anomaly_pyro/end()
|
||||
|
||||
@@ -55,12 +55,12 @@
|
||||
kill()
|
||||
return
|
||||
|
||||
if(IsMultiple(activeFor, 4))
|
||||
if(ISMULTIPLE(activeFor, 4))
|
||||
var/obj/machinery/vending/rebel = pick(vendingMachines)
|
||||
vendingMachines.Remove(rebel)
|
||||
infectedMachines.Add(rebel)
|
||||
rebel.shut_up = 0
|
||||
rebel.shoot_inventory = 1
|
||||
|
||||
if(IsMultiple(activeFor, 8))
|
||||
if(ISMULTIPLE(activeFor, 8))
|
||||
originMachine.speak(pick(rampant_speeches))
|
||||
|
||||
@@ -438,7 +438,7 @@
|
||||
overlays += I
|
||||
return
|
||||
|
||||
var/offset = Floor(20/cards.len + 1)
|
||||
var/offset = FLOOR(20/cards.len + 1, 1)
|
||||
|
||||
var/matrix/M = matrix()
|
||||
if(direction)
|
||||
|
||||
@@ -327,7 +327,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/datum/design/D = locate(href_list["create"])
|
||||
create_product(D, amount)
|
||||
updateUsrDialog()
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
|
||||
for(var/obj/item/stock_parts/micro_laser/ML in component_parts)
|
||||
var/wratemod = ML.rating * 2.5
|
||||
min_wrate = Floor(10-wratemod) // 7,5,2,0 Clamps at 0 and 10 You want this low
|
||||
min_wrate = FLOOR(10-wratemod, 1) // 7,5,2,0 Clamps at 0 and 10 You want this low
|
||||
min_wchance = 67-(ML.rating*16) // 48,35,19,3 Clamps at 0 and 67 You want this low
|
||||
for(var/obj/item/circuitboard/plantgenes/vaultcheck in component_parts)
|
||||
if(istype(vaultcheck, /obj/item/circuitboard/plantgenes/vault)) // TRAIT_DUMB BOTANY TUTS
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
for(var/datum/plant_gene/trait/T in seed.genes)
|
||||
T.on_new(src, newloc)
|
||||
seed.prepare_result(src)
|
||||
transform *= TransformUsingVariable(seed.potency, 100, 0.5) //Makes the resulting produce's sprite larger or smaller based on potency!
|
||||
transform *= TRANSFORM_USING_VARIABLE(seed.potency, 100) + 0.5 //Makes the resulting produce's sprite larger or smaller based on potency!
|
||||
add_juice()
|
||||
|
||||
/obj/item/reagent_containers/food/snacks/grown/Destroy()
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
if(istype(src, seed.product)) // no adding reagents if it is just a trash item
|
||||
seed.prepare_result(src)
|
||||
transform *= TransformUsingVariable(seed.potency, 100, 0.5)
|
||||
transform *= TRANSFORM_USING_VARIABLE(seed.potency, 100) + 0.5
|
||||
add_juice()
|
||||
|
||||
/obj/item/grown/Destroy()
|
||||
|
||||
@@ -949,30 +949,30 @@
|
||||
|
||||
/// 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)
|
||||
plant_hud_set_nutrient()
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustWater(adjustamt)
|
||||
waterlevel = Clamp(waterlevel + adjustamt, 0, maxwater)
|
||||
waterlevel = clamp(waterlevel + adjustamt, 0, maxwater)
|
||||
plant_hud_set_water()
|
||||
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)
|
||||
plant_hud_set_health()
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustToxic(adjustamt)
|
||||
toxic = Clamp(toxic + adjustamt, 0, 100)
|
||||
toxic = clamp(toxic + adjustamt, 0, 100)
|
||||
plant_hud_set_toxin()
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustPests(adjustamt)
|
||||
pestlevel = Clamp(pestlevel + adjustamt, 0, 10)
|
||||
pestlevel = clamp(pestlevel + adjustamt, 0, 10)
|
||||
plant_hud_set_pest()
|
||||
|
||||
/obj/machinery/hydroponics/proc/adjustWeeds(adjustamt)
|
||||
weedlevel = Clamp(weedlevel + adjustamt, 0, 10)
|
||||
weedlevel = clamp(weedlevel + adjustamt, 0, 10)
|
||||
plant_hud_set_weed()
|
||||
|
||||
/obj/machinery/hydroponics/proc/spawnplant() // why would you put strange reagent in a hydro tray you monster I bet you also feed them blood
|
||||
|
||||
@@ -182,7 +182,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.
|
||||
@@ -191,39 +191,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
|
||||
@@ -232,7 +232,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.
|
||||
@@ -241,39 +241,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
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
dat += "<font color=red><b>ERROR</b>: Unable to contact External Archive. Please contact your system administrator for assistance.</font>"
|
||||
else
|
||||
num_results = src.get_num_results()
|
||||
num_pages = Ceiling(num_results/LIBRARY_BOOKS_PER_PAGE)
|
||||
num_pages = CEILING(num_results/LIBRARY_BOOKS_PER_PAGE, 1)
|
||||
dat += {"<ul>
|
||||
<li><A href='?src=[UID()];id=-1'>(Order book by SS<sup>13</sup>BN)</A></li>
|
||||
</ul>"}
|
||||
@@ -224,13 +224,13 @@
|
||||
else
|
||||
var/pn = text2num(href_list["pagenum"])
|
||||
if(!isnull(pn))
|
||||
page_num = Clamp(pn, 1, num_pages)
|
||||
page_num = clamp(pn, 1, num_pages)
|
||||
|
||||
if(href_list["page"])
|
||||
if(num_pages == 0)
|
||||
page_num = 1
|
||||
else
|
||||
page_num = Clamp(text2num(href_list["page"]), 1, num_pages)
|
||||
page_num = clamp(text2num(href_list["page"]), 1, num_pages)
|
||||
if(href_list["settitle"])
|
||||
var/newtitle = input("Enter a title to search for:") as text|null
|
||||
if(newtitle)
|
||||
@@ -252,7 +252,7 @@
|
||||
|
||||
if(href_list["search"])
|
||||
num_results = src.get_num_results()
|
||||
num_pages = Ceiling(num_results/LIBRARY_BOOKS_PER_PAGE)
|
||||
num_pages = CEILING(num_results/LIBRARY_BOOKS_PER_PAGE, 1)
|
||||
page_num = 1
|
||||
|
||||
screenstate = 4
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
else
|
||||
var/pn = text2num(href_list["pagenum"])
|
||||
if(!isnull(pn))
|
||||
page_num = Clamp(pn, 1, num_pages)
|
||||
page_num = clamp(pn, 1, num_pages)
|
||||
|
||||
if(href_list["settitle"])
|
||||
var/newtitle = input("Enter a title to search for:") as text|null
|
||||
@@ -100,11 +100,11 @@
|
||||
if(num_pages == 0)
|
||||
page_num = 1
|
||||
else
|
||||
page_num = Clamp(text2num(href_list["page"]), 1, num_pages)
|
||||
page_num = clamp(text2num(href_list["page"]), 1, num_pages)
|
||||
|
||||
if(href_list["search"])
|
||||
num_results = src.get_num_results()
|
||||
num_pages = Ceiling(num_results/LIBRARY_BOOKS_PER_PAGE)
|
||||
num_pages = CEILING(num_results/LIBRARY_BOOKS_PER_PAGE, 1)
|
||||
page_num = 1
|
||||
|
||||
screenstate = 1
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
if(!light_power || !light_range) // We won't emit light anyways, destroy the light source.
|
||||
QDEL_NULL(light)
|
||||
else
|
||||
if(!ismovableatom(loc)) // We choose what atom should be the top atom of the light here.
|
||||
if(!ismovable(loc)) // We choose what atom should be the top atom of the light here.
|
||||
. = src
|
||||
else
|
||||
. = loc
|
||||
|
||||
@@ -97,13 +97,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 ..()
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
if(materials.materials[href_list["choose"]])
|
||||
chosen = href_list["choose"]
|
||||
if(href_list["chooseAmt"])
|
||||
coinsToProduce = Clamp(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000)
|
||||
coinsToProduce = clamp(coinsToProduce + text2num(href_list["chooseAmt"]), 0, 1000)
|
||||
if(href_list["makeCoins"])
|
||||
var/temp_coins = coinsToProduce
|
||||
processing = TRUE
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
for(var/i = 0;i<name_count;i++)
|
||||
new_name = ""
|
||||
for(var/x = rand(Floor(syllable_count/2),syllable_count);x>0;x--)
|
||||
for(var/x = rand(FLOOR(syllable_count/2, 1),syllable_count);x>0;x--)
|
||||
new_name += pick(syllables)
|
||||
full_name += " [capitalize(lowertext(new_name))]"
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
if(dna.species && amount > 0)
|
||||
if(use_brain_mod)
|
||||
amount = amount * dna.species.brain_mod
|
||||
sponge.damage = Clamp(sponge.damage + amount, 0, 120)
|
||||
sponge.damage = clamp(sponge.damage + amount, 0, 120)
|
||||
if(sponge.damage >= 120)
|
||||
visible_message("<span class='alert'><B>[src]</B> goes limp, [p_their()] facial expression utterly blank.</span>")
|
||||
death()
|
||||
@@ -48,7 +48,7 @@
|
||||
if(dna.species && amount > 0)
|
||||
if(use_brain_mod)
|
||||
amount = amount * dna.species.brain_mod
|
||||
sponge.damage = Clamp(amount, 0, 120)
|
||||
sponge.damage = clamp(amount, 0, 120)
|
||||
if(sponge.damage >= 120)
|
||||
visible_message("<span class='alert'><B>[src]</B> goes limp, [p_their()] facial expression utterly blank.</span>")
|
||||
death()
|
||||
|
||||
@@ -185,19 +185,19 @@ emp_act
|
||||
var/block_chance_modifier = round(damage / -3)
|
||||
|
||||
if(l_hand && !istype(l_hand, /obj/item/clothing))
|
||||
var/final_block_chance = l_hand.block_chance - (Clamp((armour_penetration-l_hand.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 = l_hand.block_chance - (clamp((armour_penetration-l_hand.armour_penetration)/2,0,100)) + block_chance_modifier //So armour piercing blades can still be parried by other blades, for example
|
||||
if(l_hand.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
|
||||
return 1
|
||||
if(r_hand && !istype(r_hand, /obj/item/clothing))
|
||||
var/final_block_chance = r_hand.block_chance - (Clamp((armour_penetration-r_hand.armour_penetration)/2,0,100)) + block_chance_modifier //Need to reset the var so it doesn't carry over modifications between attempts
|
||||
var/final_block_chance = r_hand.block_chance - (clamp((armour_penetration-r_hand.armour_penetration)/2,0,100)) + block_chance_modifier //Need to reset the var so it doesn't carry over modifications between attempts
|
||||
if(r_hand.hit_reaction(src, AM, attack_text, final_block_chance, damage, attack_type))
|
||||
return 1
|
||||
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 1
|
||||
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 1
|
||||
return 0
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
|
||||
if(!(RADIMMUNE in dna.species.species_traits))
|
||||
if(radiation)
|
||||
radiation = Clamp(radiation, 0, 200)
|
||||
radiation = clamp(radiation, 0, 200)
|
||||
|
||||
var/autopsy_damage = 0
|
||||
switch(radiation)
|
||||
|
||||
@@ -162,7 +162,7 @@
|
||||
//TOXINS/PLASMA
|
||||
if(Toxins_partialpressure > safe_tox_max)
|
||||
var/ratio = (breath.toxins/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")
|
||||
@@ -243,7 +243,7 @@
|
||||
adjustToxLoss(3)
|
||||
updatehealth("handle mutations and radiation(75-100)")
|
||||
|
||||
radiation = Clamp(radiation, 0, 100)
|
||||
radiation = clamp(radiation, 0, 100)
|
||||
|
||||
|
||||
/mob/living/carbon/handle_chemicals_in_body()
|
||||
|
||||
@@ -79,9 +79,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
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
return
|
||||
|
||||
/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()
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
if(is_component_functioning("power 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()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
if(status_flags & GODMODE)
|
||||
return FALSE
|
||||
var/oldbruteloss = bruteloss
|
||||
bruteloss = Clamp(bruteloss + amount, 0, maxHealth)
|
||||
bruteloss = clamp(bruteloss + amount, 0, maxHealth)
|
||||
if(oldbruteloss == bruteloss)
|
||||
updating_health = FALSE
|
||||
. = STATUS_UPDATE_NONE
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
icon_dead = "maid_dead"
|
||||
|
||||
/mob/living/simple_animal/hostile/alien/maid/AttackingTarget()
|
||||
if(ismovableatom(target))
|
||||
if(ismovable(target))
|
||||
if(istype(target, /obj/effect/decal/cleanable))
|
||||
visible_message("<span class='notice'>\The [src] cleans up \the [target].</span>")
|
||||
qdel(target)
|
||||
|
||||
@@ -116,8 +116,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)
|
||||
|
||||
@@ -83,7 +83,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)
|
||||
|
||||
@@ -103,7 +103,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)
|
||||
@@ -254,7 +254,7 @@ Difficulty: Medium
|
||||
/mob/living/simple_animal/hostile/megafauna/dragon/proc/line_target(var/offset, var/range, var/atom/at = target)
|
||||
if(!at)
|
||||
return
|
||||
var/angle = Atan2(at.x - src.x, at.y - src.y) + offset
|
||||
var/angle = ATAN2(at.x - src.x, at.y - src.y) + offset
|
||||
var/turf/T = get_turf(src)
|
||||
for(var/i in 1 to range)
|
||||
var/turf/check = locate(src.x + cos(angle) * i, src.y + sin(angle) * i, src.z)
|
||||
@@ -344,10 +344,10 @@ Difficulty: Medium
|
||||
|
||||
//ensure swoop direction continuity.
|
||||
if(negative)
|
||||
if(IsInRange(x, initial_x + 1, initial_x + DRAKE_SWOOP_DIRECTION_CHANGE_RANGE))
|
||||
if(ISINRANGE(x, initial_x + 1, initial_x + DRAKE_SWOOP_DIRECTION_CHANGE_RANGE))
|
||||
negative = FALSE
|
||||
else
|
||||
if(IsInRange(x, initial_x - DRAKE_SWOOP_DIRECTION_CHANGE_RANGE, initial_x - 1))
|
||||
if(ISINRANGE(x, initial_x - DRAKE_SWOOP_DIRECTION_CHANGE_RANGE, initial_x - 1))
|
||||
negative = TRUE
|
||||
new /obj/effect/temp_visual/dragon_flight/end(loc, negative)
|
||||
new /obj/effect/temp_visual/dragon_swoop(loc)
|
||||
|
||||
@@ -482,7 +482,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)
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
neststep = 4
|
||||
else
|
||||
spider_lastspawn = world.time
|
||||
var/spiders_left_to_spawn = Clamp( (spider_max_per_nest - CountSpiders()), 1, 10)
|
||||
var/spiders_left_to_spawn = clamp( (spider_max_per_nest - CountSpiders()), 1, 10)
|
||||
DoLayTerrorEggs(pick(spider_types_standard), spiders_left_to_spawn)
|
||||
if(4)
|
||||
// Nest should be full. Otherwise, start replenishing nest (stage 5).
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
|
||||
/mob/living/simple_animal/updatehealth(reason = "none given")
|
||||
..(reason)
|
||||
health = Clamp(health, 0, maxHealth)
|
||||
health = clamp(health, 0, maxHealth)
|
||||
med_hud_set_health()
|
||||
|
||||
/mob/living/simple_animal/StartResting(updating = 1)
|
||||
|
||||
@@ -190,7 +190,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)
|
||||
feedback_add_details("slime_babies_born", "slimebirth_[replacetext(M.colour," ","_")]")
|
||||
|
||||
var/mob/living/simple_animal/slime/new_slime = pick(babies)
|
||||
|
||||
@@ -207,4 +207,4 @@
|
||||
|
||||
/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)
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
if(href_list["change_supplied_law_position"])
|
||||
var/new_position = input(usr, "Enter new supplied law position between 1 and [MAX_SUPPLIED_LAW_NUMBER], inclusive. Inherent laws at the same index as a supplied law will not be stated.", "Law Position", supplied_law_position) as num|null
|
||||
if(isnum(new_position) && can_still_topic())
|
||||
supplied_law_position = Clamp(new_position, 1, MAX_SUPPLIED_LAW_NUMBER)
|
||||
supplied_law_position = clamp(new_position, 1, MAX_SUPPLIED_LAW_NUMBER)
|
||||
return 1
|
||||
|
||||
if(href_list["edit_law"])
|
||||
|
||||
@@ -177,7 +177,7 @@
|
||||
/obj/machinery/power/apc/Destroy()
|
||||
GLOB.apcs -= 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 = 0
|
||||
area.power_equip = 0
|
||||
area.power_environ = 0
|
||||
@@ -1333,7 +1333,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)
|
||||
stat |= BROKEN
|
||||
operating = 0
|
||||
if(occupier)
|
||||
|
||||
@@ -125,7 +125,7 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
|
||||
/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
|
||||
|
||||
@@ -141,7 +141,7 @@ By design, d1 is the smallest direction and d2 is the highest
|
||||
|
||||
/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
|
||||
|
||||
|
||||
@@ -160,7 +160,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
|
||||
|
||||
|
||||
@@ -42,7 +42,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
|
||||
|
||||
@@ -58,7 +58,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
|
||||
|
||||
|
||||
@@ -97,6 +97,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
|
||||
|
||||
@@ -218,7 +218,7 @@
|
||||
damage = max(0, damage + between(-DAMAGE_RATE_LIMIT, (removed.temperature - CRITICAL_TEMPERATURE) / 150, damage_inc_limit))
|
||||
|
||||
//Maxes out at 100% oxygen pressure
|
||||
oxygen = Clamp((removed.oxygen - (removed.nitrogen * NITROGEN_RETARDATION_FACTOR)) / removed.total_moles(), 0, 1)
|
||||
oxygen = clamp((removed.oxygen - (removed.nitrogen * NITROGEN_RETARDATION_FACTOR)) / removed.total_moles(), 0, 1)
|
||||
|
||||
var/temp_factor
|
||||
var/equilibrium_power
|
||||
|
||||
@@ -51,7 +51,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, TRUE)
|
||||
else
|
||||
energy = 0 // ensure we dont have miniballs of miniballs
|
||||
@@ -271,7 +271,7 @@
|
||||
closest_grounding_rod.tesla_act(power, explosive)
|
||||
|
||||
else if(closest_mob)
|
||||
var/shock_damage = Clamp(round(power/400), 10, 90) + rand(-5, 5)
|
||||
var/shock_damage = clamp(round(power/400), 10, 90) + rand(-5, 5)
|
||||
closest_mob.electrocute_act(shock_damage, source, 1, tesla_shock = TRUE)
|
||||
if(issilicon(closest_mob))
|
||||
var/mob/living/silicon/S = closest_mob
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
update_icon()
|
||||
return
|
||||
|
||||
speed = Clamp(speed - friction, 0, MAX_SPEED)
|
||||
speed = clamp(speed - friction, 0, MAX_SPEED)
|
||||
for(var/A in (loc.contents - src))
|
||||
var/atom/movable/AM = A
|
||||
if(AM.anchored)
|
||||
|
||||
@@ -383,7 +383,7 @@
|
||||
|
||||
/obj/item/ammo_box/magazine/m12g/update_icon()
|
||||
..()
|
||||
icon_state = "[initial(icon_state)]-[Ceiling(ammo_count(0)/8)*8]"
|
||||
icon_state = "[initial(icon_state)]-[CEILING(ammo_count(0)/8, 1)*8]"
|
||||
|
||||
/obj/item/ammo_box/magazine/m12g/buckshot
|
||||
name = "shotgun magazine (12g buckshot slugs)"
|
||||
@@ -494,7 +494,7 @@
|
||||
|
||||
/obj/item/ammo_box/magazine/laser/update_icon()
|
||||
..()
|
||||
icon_state = "[initial(icon_state)]-[Ceiling(ammo_count(0)/20)*20]"
|
||||
icon_state = "[initial(icon_state)]-[CEILING(ammo_count(0)/20, 1)*20]"
|
||||
|
||||
/obj/item/ammo_box/magazine/toy/smgm45
|
||||
name = "donksoft SMG magazine"
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
var/ox = round(screenview/2) //"origin" x
|
||||
var/oy = round(screenview/2) //"origin" y
|
||||
var/angle = Atan2(y - oy, x - ox)
|
||||
var/angle = ATAN2(y - oy, x - ox)
|
||||
Angle = angle
|
||||
if(spread)
|
||||
Angle += spread
|
||||
|
||||
@@ -136,7 +136,7 @@
|
||||
|
||||
/obj/item/gun/energy/update_icon()
|
||||
overlays.Cut()
|
||||
var/ratio = Ceiling((cell.charge / cell.maxcharge) * charge_sections)
|
||||
var/ratio = CEILING((cell.charge / cell.maxcharge) * charge_sections, 1)
|
||||
var/obj/item/ammo_casing/energy/shot = ammo_type[select]
|
||||
var/iconState = "[icon_state]_charge"
|
||||
var/itemState = null
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
/obj/item/gun/magic/wand/New()
|
||||
if(prob(75) && variable_charges) //25% chance of listed max charges, 50% chance of 1/2 max charges, 25% chance of 1/3 max charges
|
||||
if(prob(33))
|
||||
max_charges = Ceiling(max_charges / 3)
|
||||
max_charges = CEILING(max_charges / 3, 1)
|
||||
else
|
||||
max_charges = Ceiling(max_charges / 2)
|
||||
max_charges = CEILING(max_charges / 2, 1)
|
||||
..()
|
||||
|
||||
/obj/item/gun/magic/wand/examine(mob/user)
|
||||
|
||||
@@ -112,7 +112,7 @@
|
||||
|
||||
/obj/item/gun/projectile/automatic/c20r/update_icon()
|
||||
..()
|
||||
icon_state = "c20r[magazine ? "-[Ceiling(get_ammo(0)/4)*4]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
|
||||
icon_state = "c20r[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""][chambered ? "" : "-e"][suppressed ? "-suppressed" : ""]"
|
||||
|
||||
//WT550//
|
||||
/obj/item/gun/projectile/automatic/wt550
|
||||
@@ -134,7 +134,7 @@
|
||||
|
||||
/obj/item/gun/projectile/automatic/wt550/update_icon()
|
||||
..()
|
||||
icon_state = "wt550[magazine ? "-[Ceiling(get_ammo(0)/4)*4]" : ""]"
|
||||
icon_state = "wt550[magazine ? "-[CEILING(get_ammo(0)/4, 1)*4]" : ""]"
|
||||
|
||||
//Type-U3 Uzi//
|
||||
/obj/item/gun/projectile/automatic/mini_uzi
|
||||
@@ -194,8 +194,8 @@
|
||||
overlays += "[initial(icon_state)]gren"
|
||||
icon_state = "[initial(icon_state)][magazine ? "" : "-e"]"
|
||||
if(magazine)
|
||||
overlays += image(icon = icon, icon_state = "m90-[Ceiling(get_ammo(0)/6)*6]")
|
||||
item_state = "m90-[Ceiling(get_ammo(0)/7.5)]"
|
||||
overlays += image(icon = icon, icon_state = "m90-[CEILING(get_ammo(0)/6, 1)*6]")
|
||||
item_state = "m90-[CEILING(get_ammo(0)/7.5, 1)]"
|
||||
else
|
||||
item_state = "m90-0"
|
||||
return
|
||||
@@ -303,4 +303,4 @@
|
||||
|
||||
/obj/item/gun/projectile/automatic/lasercarbine/update_icon()
|
||||
..()
|
||||
icon_state = "lasercarbine[magazine ? "-[Ceiling(get_ammo(0)/5)*5]" : ""]"
|
||||
icon_state = "lasercarbine[magazine ? "-[CEILING(get_ammo(0)/5, 1)*5]" : ""]"
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
update_icon()
|
||||
|
||||
/obj/item/gun/projectile/automatic/l6_saw/update_icon()
|
||||
icon_state = "l6[cover_open ? "open" : "closed"][magazine ? Ceiling(get_ammo(0)/12.5)*25 : "-empty"][suppressed ? "-suppressed" : ""]"
|
||||
icon_state = "l6[cover_open ? "open" : "closed"][magazine ? CEILING(get_ammo(0)/12.5, 1)*25 : "-empty"][suppressed ? "-suppressed" : ""]"
|
||||
item_state = "l6[cover_open ? "openmag" : "closedmag"]"
|
||||
|
||||
/obj/item/gun/projectile/automatic/l6_saw/afterattack(atom/target as mob|obj|turf, mob/living/user as mob|obj, flag, params) //what I tried to do here is just add a check to see if the cover is open or not and add an icon_state change because I can't figure out how c-20rs do it with overlays
|
||||
|
||||
@@ -132,13 +132,13 @@
|
||||
|
||||
switch(choice)
|
||||
if(XBOW_TENSION_20)
|
||||
drawtension = Ceiling(0.2 * maxtension)
|
||||
drawtension = CEILING(0.2 * maxtension, 1)
|
||||
if(XBOW_TENSION_40)
|
||||
drawtension = Ceiling(0.4 * maxtension)
|
||||
drawtension = CEILING(0.4 * maxtension, 1)
|
||||
if(XBOW_TENSION_60)
|
||||
drawtension = Ceiling(0.6 * maxtension)
|
||||
drawtension = CEILING(0.6 * maxtension, 1)
|
||||
if(XBOW_TENSION_80)
|
||||
drawtension = Ceiling(0.8 * maxtension)
|
||||
drawtension = CEILING(0.8 * maxtension, 1)
|
||||
if(XBOW_TENSION_FULL)
|
||||
drawtension = maxtension
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
|
||||
/obj/item/projectile/proc/vol_by_damage()
|
||||
if(damage)
|
||||
return Clamp((damage) * 0.67, 30, 100)// Multiply projectile damage by 0.67, then clamp the value between 30 and 100
|
||||
return clamp((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
|
||||
|
||||
@@ -199,7 +199,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, 1, -1)
|
||||
@@ -239,7 +239,7 @@
|
||||
while(loc)
|
||||
if(!paused)
|
||||
if((!( current ) || loc == current))
|
||||
current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z)
|
||||
current = locate(clamp(x+xo,1,world.maxx),clamp(y+yo,1,world.maxy),z)
|
||||
if(isnull(Angle))
|
||||
Angle=round(Get_Angle(src,current))
|
||||
if(spread)
|
||||
@@ -292,7 +292,7 @@
|
||||
while(loc)
|
||||
if(!paused)
|
||||
if((!( current ) || loc == current))
|
||||
current = locate(Clamp(x+xo,1,world.maxx),Clamp(y+yo,1,world.maxy),z)
|
||||
current = locate(clamp(x+xo,1,world.maxx),clamp(y+yo,1,world.maxy),z)
|
||||
step_towards(src, current)
|
||||
if(original && (original.layer>=2.75) || ismob(original))
|
||||
if(loc == get_turf(original))
|
||||
@@ -311,7 +311,7 @@ obj/item/projectile/proc/reflect_back(atom/source, list/position_modifiers = lis
|
||||
firer = source // The reflecting mob will be the new firer
|
||||
else
|
||||
firer = null // Reflected by something other than a mob so firer will be null
|
||||
|
||||
|
||||
// redirect the projectile
|
||||
original = locate(new_x, new_y, z)
|
||||
starting = curloc
|
||||
|
||||
@@ -182,7 +182,7 @@
|
||||
return amount
|
||||
|
||||
/datum/reagents/proc/set_reagent_temp(new_temp = T0C, react = TRUE)
|
||||
chem_temp = Clamp(new_temp, temperature_min, temperature_max)
|
||||
chem_temp = clamp(new_temp, temperature_min, temperature_max)
|
||||
if(react)
|
||||
temperature_react()
|
||||
handle_reactions()
|
||||
@@ -623,7 +623,7 @@
|
||||
if(total_volume + amount > maximum_volume) amount = (maximum_volume - total_volume) //Doesnt fit in. Make it disappear. Shouldnt happen. Will happen.
|
||||
if(amount <= 0)
|
||||
return 0
|
||||
chem_temp = Clamp((chem_temp * total_volume + reagtemp * amount) / (total_volume + amount), temperature_min, temperature_max) //equalize with new chems
|
||||
chem_temp = clamp((chem_temp * total_volume + reagtemp * amount) / (total_volume + amount), temperature_min, temperature_max) //equalize with new chems
|
||||
|
||||
for(var/A in reagent_list)
|
||||
|
||||
|
||||
@@ -118,10 +118,10 @@
|
||||
if(href_list["adjust_temperature"])
|
||||
var/val = href_list["adjust_temperature"]
|
||||
if(isnum(val))
|
||||
desired_temp = Clamp(desired_temp+val, 0, 1000)
|
||||
desired_temp = clamp(desired_temp+val, 0, 1000)
|
||||
else if(val == "input")
|
||||
var/target = input("Please input the target temperature", name) as num
|
||||
desired_temp = Clamp(target, 0, 1000)
|
||||
desired_temp = clamp(target, 0, 1000)
|
||||
else
|
||||
return FALSE
|
||||
. = 1
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
|
||||
/datum/reagent/blob/proc/reagent_vortex(mob/living/M, setting_type, volume)
|
||||
var/turf/pull = get_turf(M)
|
||||
var/range_power = Clamp(round(volume/5, 1), 1, 5)
|
||||
var/range_power = clamp(round(volume/5, 1), 1, 5)
|
||||
for(var/atom/movable/X in range(range_power,pull))
|
||||
if(istype(X, /obj/effect))
|
||||
continue
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
cut_overlays()
|
||||
var/rounded_vol
|
||||
if(reagents && reagents.total_volume)
|
||||
rounded_vol = Clamp(round((reagents.total_volume / volume * 15), 5), 1, 15)
|
||||
rounded_vol = clamp(round((reagents.total_volume / volume * 15), 5), 1, 15)
|
||||
var/image/filling_overlay = mutable_appearance('icons/obj/reagentfillings.dmi', "syringe[rounded_vol]")
|
||||
filling_overlay.icon += mix_color_from_reagents(reagents.reagent_list)
|
||||
add_overlay(filling_overlay)
|
||||
|
||||
@@ -272,7 +272,7 @@
|
||||
/obj/machinery/disposal/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state)
|
||||
var/data[0]
|
||||
|
||||
var/pressure = Clamp(100* air_contents.return_pressure() / (SEND_PRESSURE), 0, 100)
|
||||
var/pressure = clamp(100* air_contents.return_pressure() / (SEND_PRESSURE), 0, 100)
|
||||
var/pressure_round = round(pressure,1)
|
||||
|
||||
data["isAI"] = isAI(user)
|
||||
|
||||
@@ -117,7 +117,7 @@ research holder datum.
|
||||
AddDesign2Known(PD)
|
||||
for(var/v in known_tech)
|
||||
var/datum/tech/T = known_tech[v]
|
||||
T.level = Clamp(T.level, 0, 20)
|
||||
T.level = clamp(T.level, 0, 20)
|
||||
|
||||
//Refreshes the levels of a given tech.
|
||||
//Input: Tech's ID and Level; Output: null
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
if(0 to T0C)
|
||||
health = min(100, health + 1)
|
||||
if(T0C to (T20C + 20))
|
||||
health = Clamp(health, 0, 100)
|
||||
health = clamp(health, 0, 100)
|
||||
if((T20C + 20) to (T0C + 70))
|
||||
health = max(0, health - 1)
|
||||
if(health <= 0)
|
||||
|
||||
@@ -319,7 +319,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
|
||||
@@ -343,7 +343,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)
|
||||
|
||||
|
||||
@@ -463,7 +463,7 @@
|
||||
var/rotation = dir2angle(S1.dir)-dir2angle(dir)
|
||||
if((rotation % 90) != 0)
|
||||
rotation += (rotation % 90) //diagonal rotations not allowed, round up
|
||||
rotation = SimplifyDegrees(rotation)
|
||||
rotation = SIMPLIFY_DEGREES(rotation)
|
||||
|
||||
//remove area surrounding docking port
|
||||
if(areaInstance.contents.len)
|
||||
|
||||
@@ -487,7 +487,7 @@
|
||||
var/num_input = input(usr, "Amount:", "How many crates?") as null|num
|
||||
if(!num_input || ..())
|
||||
return 1
|
||||
crates = Clamp(round(num_input), 1, 20)
|
||||
crates = clamp(round(num_input), 1, 20)
|
||||
|
||||
var/timeout = world.time + 600
|
||||
var/reason = input(usr,"Reason:","Why do you require this item?","") as null|text
|
||||
@@ -668,7 +668,7 @@
|
||||
var/num_input = input(usr, "Amount:", "How many crates?") as null|num
|
||||
if(!num_input || !is_authorized(usr) || ..())
|
||||
return 1
|
||||
crates = Clamp(round(num_input), 1, 20)
|
||||
crates = clamp(round(num_input), 1, 20)
|
||||
|
||||
var/timeout = world.time + 600
|
||||
var/reason = input(usr,"Reason:","Why do you require this item?","") as null|text
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
bleed_rate = max(bleed_rate - 0.5, temp_bleed)//if no wounds, other bleed effects naturally decreases
|
||||
|
||||
var/additional_bleed = round(Clamp((reagents.get_reagent_amount("heparin") / 10), 0, 2), 1) //Heparin worsens existing bleeding
|
||||
var/additional_bleed = round(clamp((reagents.get_reagent_amount("heparin") / 10), 0, 2), 1) //Heparin worsens existing bleeding
|
||||
|
||||
if(internal_bleeding_rate && !(status_flags & FAKEDEATH))
|
||||
bleed_internal(internal_bleeding_rate + additional_bleed)
|
||||
|
||||
@@ -169,15 +169,15 @@
|
||||
|
||||
if(telepad)
|
||||
|
||||
var/truePower = Clamp(power + power_off, 1, 1000)
|
||||
var/truePower = clamp(power + power_off, 1, 1000)
|
||||
var/trueRotation = rotation + rotation_off
|
||||
var/trueAngle = Clamp(angle, 1, 90)
|
||||
var/trueAngle = clamp(angle, 1, 90)
|
||||
|
||||
var/datum/projectile_data/proj_data = projectile_trajectory(telepad.x, telepad.y, trueRotation, trueAngle, truePower)
|
||||
last_tele_data = proj_data
|
||||
|
||||
var/trueX = Clamp(round(proj_data.dest_x, 1), 1, world.maxx)
|
||||
var/trueY = Clamp(round(proj_data.dest_y, 1), 1, world.maxy)
|
||||
var/trueX = clamp(round(proj_data.dest_x, 1), 1, world.maxx)
|
||||
var/trueY = clamp(round(proj_data.dest_y, 1), 1, world.maxy)
|
||||
var/spawn_time = round(proj_data.time) * 10
|
||||
|
||||
var/turf/target = locate(trueX, trueY, z_co)
|
||||
@@ -291,12 +291,12 @@
|
||||
return
|
||||
|
||||
|
||||
var/truePower = Clamp(power + power_off, 1, 1000)
|
||||
var/truePower = clamp(power + power_off, 1, 1000)
|
||||
var/trueRotation = rotation + rotation_off
|
||||
var/trueAngle = Clamp(angle, 1, 90)
|
||||
var/trueAngle = clamp(angle, 1, 90)
|
||||
|
||||
var/datum/projectile_data/proj_data = projectile_trajectory(telepad.x, telepad.y, trueRotation, trueAngle, truePower)
|
||||
var/turf/target = locate(Clamp(round(proj_data.dest_x, 1), 1, world.maxx), Clamp(round(proj_data.dest_y, 1), 1, world.maxy), z_co)
|
||||
var/turf/target = locate(clamp(round(proj_data.dest_x, 1), 1, world.maxx), clamp(round(proj_data.dest_y, 1), 1, world.maxy), z_co)
|
||||
var/area/A = get_area(target)
|
||||
|
||||
if(A.tele_proof == 1)
|
||||
@@ -336,14 +336,14 @@
|
||||
var/new_rot = input("Please input desired bearing in degrees.", name, rotation) as num
|
||||
if(..()) // Check after we input a value, as they could've moved after they entered something
|
||||
return
|
||||
rotation = Clamp(new_rot, -900, 900)
|
||||
rotation = clamp(new_rot, -900, 900)
|
||||
rotation = round(rotation, 0.01)
|
||||
|
||||
if(href_list["setangle"])
|
||||
var/new_angle = input("Please input desired elevation in degrees.", name, angle) as num
|
||||
if(..())
|
||||
return
|
||||
angle = Clamp(round(new_angle, 0.1), 1, 9999)
|
||||
angle = clamp(round(new_angle, 0.1), 1, 9999)
|
||||
|
||||
if(href_list["setpower"])
|
||||
var/index = href_list["setpower"]
|
||||
@@ -356,7 +356,7 @@
|
||||
var/new_z = input("Please input desired sector.", name, z_co) as num
|
||||
if(..())
|
||||
return
|
||||
z_co = Clamp(round(new_z), 1, 10)
|
||||
z_co = clamp(round(new_z), 1, 10)
|
||||
|
||||
if(href_list["ejectGPS"])
|
||||
if(inserted_gps)
|
||||
|
||||
Reference in New Issue
Block a user