Merge pull request #11985 from Ghommie/Ghommie-cit701
Removal of backward 512 compatibility.
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
|
||||
#if DM_VERSION < 513
|
||||
|
||||
#define ismovableatom(A) (istype(A, /atom/movable))
|
||||
|
||||
#define islist(L) (istype(L, /list))
|
||||
|
||||
#define CLAMP01(x) (CLAMP(x, 0, 1))
|
||||
|
||||
#define CLAMP(CLVALUE,CLMIN,CLMAX) ( max( (CLMIN), min((CLVALUE), (CLMAX)) ) )
|
||||
|
||||
#define ATAN2(x, y) ( !(x) && !(y) ? 0 : (y) >= 0 ? arccos((x) / sqrt((x)*(x) + (y)*(y))) : -arccos((x) / sqrt((x)*(x) + (y)*(y))) )
|
||||
|
||||
#define TAN(x) (sin(x) / cos(x))
|
||||
|
||||
#define arctan(x) (arcsin(x/sqrt(1+x*x)))
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
#else
|
||||
|
||||
#define ismovableatom(A) ismovable(A)
|
||||
|
||||
#define CLAMP01(x) clamp(x, 0, 1)
|
||||
|
||||
#define CLAMP(CLVALUE, CLMIN, CLMAX) clamp(CLVALUE, CLMIN, CLMAX)
|
||||
|
||||
#define TAN(x) tan(x)
|
||||
|
||||
#define ATAN2(x, y) arctan(x, y)
|
||||
|
||||
#endif
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
#define PERCENT(val) (round((val)*100, 0.1))
|
||||
|
||||
#define CLAMP01(x) clamp(x, 0, 1)
|
||||
|
||||
//time of day but automatically adjusts to the server going into the next day within the same round.
|
||||
//for when you need a reliable time number that doesn't depend on byond time.
|
||||
#define REALTIMEOFDAY (world.timeofday + (MIDNIGHT_ROLLOVER * MIDNIGHT_ROLLOVER_CHECK))
|
||||
@@ -30,13 +32,13 @@
|
||||
#define FLOOR(x, y) ( round((x) / (y)) * (y) )
|
||||
|
||||
// Similar to clamp but the bottom rolls around to the top and vice versa. min is inclusive, max is exclusive
|
||||
#define WRAP(val, min, max) CLAMP(( min == max ? min : (val) - (round(((val) - (min))/((max) - (min))) * ((max) - (min))) ),min,max-1)
|
||||
#define WRAP(val, min, max) clamp(( min == max ? min : (val) - (round(((val) - (min))/((max) - (min))) * ((max) - (min))) ),min,max-1)
|
||||
|
||||
// Real modulus that handles decimals
|
||||
#define MODULUS(x, y) ( (x) - (y) * round((x) / (y)) )
|
||||
|
||||
// Cotangent
|
||||
#define COT(x) (1 / TAN(x))
|
||||
#define COT(x) (1 / tan(x))
|
||||
|
||||
// Secant
|
||||
#define SEC(x) (1 / cos(x))
|
||||
@@ -169,8 +171,8 @@
|
||||
while(pixel_y < -16)
|
||||
pixel_y += 32
|
||||
new_y--
|
||||
new_x = CLAMP(new_x, 0, world.maxx)
|
||||
new_y = CLAMP(new_y, 0, world.maxy)
|
||||
new_x = clamp(new_x, 0, world.maxx)
|
||||
new_y = clamp(new_y, 0, world.maxy)
|
||||
return locate(new_x, new_y, starting.z)
|
||||
|
||||
// Returns a list where [1] is all x values and [2] is all y values that overlap between the given pair of rectangles
|
||||
@@ -195,7 +197,7 @@
|
||||
|
||||
#define EXP_DISTRIBUTION(desired_mean) ( -(1/(1/desired_mean)) * log(rand(1, 1000) * 0.001) )
|
||||
|
||||
#define LORENTZ_DISTRIBUTION(x, s) ( s*TAN(TODEGREES(PI*(rand()-0.5))) + x )
|
||||
#define LORENTZ_DISTRIBUTION(x, s) ( s*tan(TODEGREES(PI*(rand()-0.5))) + x )
|
||||
#define LORENTZ_CUMULATIVE_DISTRIBUTION(x, y, s) ( (1/PI)*TORADIANS(arctan((x-y)/s)) + 1/2 )
|
||||
|
||||
#define RULE_OF_THREE(a, b, x) ((a*x)/b)
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
var/adjacencies = 0
|
||||
|
||||
var/atom/movable/AM
|
||||
if(ismovableatom(A))
|
||||
if(ismovable(A))
|
||||
AM = A
|
||||
if(AM.can_be_unanchored && !AM.anchored)
|
||||
return 0
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
var/screenviewY = screenview[2] * world.icon_size
|
||||
var/ox = round(screenviewX/2) - client.pixel_x //"origin" x
|
||||
var/oy = round(screenviewY/2) - client.pixel_y //"origin" y
|
||||
var/angle = SIMPLIFY_DEGREES(ATAN2(y - oy, x - ox))
|
||||
var/angle = SIMPLIFY_DEGREES(arctan(y - oy, x - ox))
|
||||
return angle
|
||||
|
||||
//Wow, specific name!
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
/proc/sanitize_frequency(frequency, free = FALSE)
|
||||
frequency = round(frequency)
|
||||
if(free)
|
||||
. = CLAMP(frequency, MIN_FREE_FREQ, MAX_FREE_FREQ)
|
||||
. = clamp(frequency, MIN_FREE_FREQ, MAX_FREE_FREQ)
|
||||
else
|
||||
. = CLAMP(frequency, MIN_FREQ, MAX_FREQ)
|
||||
. = clamp(frequency, MIN_FREQ, MAX_FREQ)
|
||||
if(!(. % 2)) // Ensure the last digit is an odd number
|
||||
. += 1
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
/proc/sanitize_num_clamp(number, min=0, max=1, default=0, quantize=0)
|
||||
if(!isnum(number))
|
||||
return default
|
||||
. = CLAMP(number, min, max)
|
||||
. = clamp(number, min, max)
|
||||
if(quantize)
|
||||
. = round(number, quantize)
|
||||
|
||||
|
||||
@@ -777,8 +777,8 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
|
||||
tX = splittext(tX[1], ":")
|
||||
tX = tX[1]
|
||||
var/list/actual_view = getviewsize(C ? C.view : world.view)
|
||||
tX = CLAMP(origin.x + text2num(tX) - round(actual_view[1] / 2) - 1, 1, world.maxx)
|
||||
tY = CLAMP(origin.y + text2num(tY) - round(actual_view[2] / 2) - 1, 1, world.maxy)
|
||||
tX = clamp(origin.x + text2num(tX) - round(actual_view[1] / 2) - 1, 1, world.maxx)
|
||||
tY = clamp(origin.y + text2num(tY) - round(actual_view[2] / 2) - 1, 1, world.maxy)
|
||||
return locate(tX, tY, tZ)
|
||||
|
||||
/proc/screen_loc2turf(text, turf/origin, client/C)
|
||||
@@ -791,8 +791,8 @@ GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
|
||||
tX = text2num(tX[2])
|
||||
tZ = origin.z
|
||||
var/list/actual_view = getviewsize(C ? C.view : world.view)
|
||||
tX = CLAMP(origin.x + round(actual_view[1] / 2) - tX, 1, world.maxx)
|
||||
tY = CLAMP(origin.y + round(actual_view[2] / 2) - tY, 1, world.maxy)
|
||||
tX = clamp(origin.x + round(actual_view[1] / 2) - tX, 1, world.maxx)
|
||||
tY = clamp(origin.y + round(actual_view[2] / 2) - tY, 1, world.maxy)
|
||||
return locate(tX, tY, tZ)
|
||||
|
||||
/proc/IsValidSrc(datum/D)
|
||||
@@ -1568,7 +1568,7 @@ GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
|
||||
/proc/blood_sucking_checks(var/mob/living/carbon/target, check_neck, check_blood)
|
||||
//Bypass this if the target isnt carbon.
|
||||
if(!iscarbon(target))
|
||||
return TRUE
|
||||
return TRUE
|
||||
if(check_neck)
|
||||
if(istype(target.get_item_by_slot(SLOT_NECK), /obj/item/clothing/neck/garlic_necklace))
|
||||
return FALSE
|
||||
|
||||
@@ -32,31 +32,12 @@
|
||||
#endif
|
||||
|
||||
//Update this whenever you need to take advantage of more recent byond features
|
||||
#define MIN_COMPILER_VERSION 512
|
||||
#if DM_VERSION < MIN_COMPILER_VERSION
|
||||
#define MIN_COMPILER_VERSION 513
|
||||
#define MIN_COMPILER_BUILD 1508
|
||||
#if DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD
|
||||
//Don't forget to update this part
|
||||
#error Your version of BYOND is too out-of-date to compile this project. Go to https://secure.byond.com/download and update.
|
||||
#error You need version 512 or higher
|
||||
#endif
|
||||
|
||||
//Compatability -- These procs were added in 513.1493, not 513.1490
|
||||
//Which really shoulda bumped us up to 514 right then and there but instead Lummox is a dumb dumb
|
||||
#if DM_BUILD < 1493
|
||||
#define length_char(args...) length(args)
|
||||
#define text2ascii_char(args...) text2ascii(args)
|
||||
#define copytext_char(args...) copytext(args)
|
||||
#define splittext_char(args...) splittext(args)
|
||||
#define spantext_char(args...) spantext(args)
|
||||
#define nonspantext_char(args...) nonspantext(args)
|
||||
#define findtext_char(args...) findtext(args)
|
||||
#define findtextEx_char(args...) findtextEx(args)
|
||||
#define findlasttext_char(args...) findlasttext(args)
|
||||
#define findlasttextEx_char(args...) findlasttextEx(args)
|
||||
#define replacetext_char(args...) replacetext(args)
|
||||
#define replacetextEx_char(args...) replacetextEx(args)
|
||||
// /regex procs
|
||||
#define Find_char(args...) Find(args)
|
||||
#define Replace_char(args...) Replace(args)
|
||||
#error You need version 513.1508 or higher
|
||||
#endif
|
||||
|
||||
//Additional code for the above flags.
|
||||
|
||||
@@ -102,8 +102,8 @@
|
||||
add_overlay(standard_background)
|
||||
|
||||
/obj/screen/movable/pic_in_pic/proc/set_view_size(width, height, do_refresh = TRUE)
|
||||
width = CLAMP(width, 0, max_dimensions)
|
||||
height = CLAMP(height, 0, max_dimensions)
|
||||
width = clamp(width, 0, max_dimensions)
|
||||
height = clamp(height, 0, max_dimensions)
|
||||
src.width = width
|
||||
src.height = height
|
||||
|
||||
|
||||
@@ -155,9 +155,9 @@
|
||||
/obj/item/proc/get_clamped_volume()
|
||||
if(w_class)
|
||||
if(force)
|
||||
return CLAMP((force + w_class) * 4, 30, 100)// Add the item's force to its weight class and multiply by 4, then clamp the value between 30 and 100
|
||||
return clamp((force + w_class) * 4, 30, 100)// Add the item's force to its weight class and multiply by 4, then clamp the value between 30 and 100
|
||||
else
|
||||
return CLAMP(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100
|
||||
return clamp(w_class * 6, 10, 100) // Multiply the item's weight class by 6, then clamp the value between 10 and 100
|
||||
|
||||
/mob/living/proc/send_item_attack_message(obj/item/I, mob/living/user, hit_area)
|
||||
var/message_verb = "attacked"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
return // seems legit.
|
||||
|
||||
// Things you might plausibly want to follow
|
||||
if(ismovableatom(A))
|
||||
if(ismovable(A))
|
||||
ManualFollow(A)
|
||||
|
||||
// Otherwise jump
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
return FALSE
|
||||
var/temp = text2num(trim(str_val))
|
||||
if(!isnull(temp))
|
||||
config_entry_value = CLAMP(integer ? round(temp) : temp, min_val, max_val)
|
||||
config_entry_value = clamp(integer ? round(temp) : temp, min_val, max_val)
|
||||
if(config_entry_value != temp && !(datum_flags & DF_VAR_EDITED))
|
||||
log_config("Changing [name] from [temp] to [config_entry_value]!")
|
||||
return TRUE
|
||||
|
||||
@@ -5,7 +5,7 @@ SUBSYSTEM_DEF(profiler)
|
||||
init_order = INIT_ORDER_PROFILER
|
||||
runlevels = RUNLEVELS_DEFAULT | RUNLEVEL_LOBBY
|
||||
wait = 3000
|
||||
flags = SS_NO_TICK_CHECK
|
||||
flags = SS_NO_TICK_CHECK
|
||||
var/fetch_cost = 0
|
||||
var/write_cost = 0
|
||||
|
||||
@@ -31,23 +31,12 @@ SUBSYSTEM_DEF(profiler)
|
||||
return ..()
|
||||
|
||||
/datum/controller/subsystem/profiler/proc/StartProfiling()
|
||||
#if DM_BUILD < 1506 || DM_VERSION < 513
|
||||
stack_trace("Auto profiling unsupported on this byond version")
|
||||
CONFIG_SET(flag/auto_profile, FALSE)
|
||||
#else
|
||||
world.Profile(PROFILE_START)
|
||||
#endif
|
||||
|
||||
/datum/controller/subsystem/profiler/proc/StopProfiling()
|
||||
#if DM_BUILD >= 1506 && DM_VERSION >= 513
|
||||
world.Profile(PROFILE_STOP)
|
||||
#endif
|
||||
|
||||
/datum/controller/subsystem/profiler/proc/DumpFile()
|
||||
#if DM_BUILD < 1506 || DM_VERSION < 513
|
||||
stack_trace("Auto profiling unsupported on this byond version")
|
||||
CONFIG_SET(flag/auto_profile, FALSE)
|
||||
#else
|
||||
var/timer = TICK_USAGE_REAL
|
||||
var/current_profile_data = world.Profile(PROFILE_REFRESH,format="json")
|
||||
fetch_cost = MC_AVERAGE(fetch_cost, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
|
||||
@@ -60,4 +49,3 @@ SUBSYSTEM_DEF(profiler)
|
||||
timer = TICK_USAGE_REAL
|
||||
WRITE_FILE(json_file, current_profile_data)
|
||||
write_cost = MC_AVERAGE(write_cost, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
var/list/bounce_signals = list(COMSIG_MOVABLE_IMPACT, COMSIG_ITEM_HIT_REACT, COMSIG_ITEM_ATTACK)
|
||||
|
||||
/datum/component/bouncy/Initialize(_bouncy_mod, list/_bounce_signals)
|
||||
if(!ismovableatom(parent))
|
||||
if(!ismovable(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
if(_bouncy_mod)
|
||||
bouncy_mod = _bouncy_mod
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
log_combat(user, H, "starts slicing the throat of")
|
||||
|
||||
playsound(H.loc, butcher_sound, 50, TRUE, -1)
|
||||
if(do_mob(user, H, CLAMP(500 / source.force, 30, 100)) && H.Adjacent(source))
|
||||
if(do_mob(user, H, clamp(500 / source.force, 30, 100)) && H.Adjacent(source))
|
||||
if(H.has_status_effect(/datum/status_effect/neck_slice))
|
||||
user.show_message("<span class='warning'>[H]'s neck has already been already cut, you can't make the bleeding any worse!</span>", 1, \
|
||||
"<span class='warning'>Their neck has already been already cut, you can't make the bleeding any worse!</span>")
|
||||
@@ -65,7 +65,7 @@
|
||||
"<span class='userdanger'>[user] slits your throat...</span>")
|
||||
log_combat(user, H, "finishes slicing the throat of")
|
||||
H.apply_damage(source.force, BRUTE, BODY_ZONE_HEAD)
|
||||
H.bleed_rate = CLAMP(H.bleed_rate + 20, 0, 30)
|
||||
H.bleed_rate = clamp(H.bleed_rate + 20, 0, 30)
|
||||
H.apply_status_effect(/datum/status_effect/neck_slice)
|
||||
|
||||
/datum/component/butchering/proc/Butcher(mob/living/butcher, mob/living/meat)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
var/list/say_lines
|
||||
|
||||
/datum/component/edit_complainer/Initialize(list/text)
|
||||
if(!ismovableatom(parent))
|
||||
if(!ismovable(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
var/static/list/default_lines = list(
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
RegisterSignal(parent, COMSIG_PARENT_ATTACKBY, .proc/explodable_attack)
|
||||
RegisterSignal(parent, COMSIG_TRY_STORAGE_INSERT, .proc/explodable_insert_item)
|
||||
RegisterSignal(parent, COMSIG_ATOM_EX_ACT, .proc/detonate)
|
||||
if(ismovableatom(parent))
|
||||
if(ismovable(parent))
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_IMPACT, .proc/explodable_impact)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_BUMP, .proc/explodable_bump)
|
||||
if(isitem(parent))
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
/datum/fantasy_affix/pyromantic/apply(datum/component/fantasy/comp, newName)
|
||||
var/obj/item/master = comp.parent
|
||||
comp.appliedComponents += master.AddComponent(/datum/component/igniter, CLAMP(comp.quality, 1, 10))
|
||||
comp.appliedComponents += master.AddComponent(/datum/component/igniter, clamp(comp.quality, 1, 10))
|
||||
return "pyromantic [newName]"
|
||||
|
||||
/datum/fantasy_affix/vampiric
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
expire_time = world.time + expire_in
|
||||
QDEL_IN(src, expire_in)
|
||||
|
||||
if(!ismovableatom(parent))
|
||||
if(!ismovable(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
RegisterSignal(parent, COMSIG_COMPONENT_CLEAN_ACT, .proc/clean)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_BUCKLE, .proc/try_infect_buckle)
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
do_knockback(target, null, angle2dir(Angle))
|
||||
|
||||
/datum/component/knockback/proc/do_knockback(atom/target, mob/thrower, throw_dir)
|
||||
if(!ismovableatom(target) || throw_dir == null)
|
||||
if(!ismovable(target) || throw_dir == null)
|
||||
return
|
||||
var/atom/movable/throwee = target
|
||||
if(throwee.anchored && !throw_anchored)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
if(!isatom(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/examine)
|
||||
if(ismovableatom(parent))
|
||||
if(ismovable(parent))
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_CROSSED, .proc/crossed_react)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_UNCROSSED, .proc/uncrossed_react)
|
||||
for(var/i in get_turf(parent))
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
var/x = target.x
|
||||
var/y = target.y
|
||||
var/z = target.z
|
||||
var/turf/southwest = locate(CLAMP(x - (direction & WEST ? range : 0), 1, world.maxx), CLAMP(y - (direction & SOUTH ? range : 0), 1, world.maxy), CLAMP(z, 1, world.maxz))
|
||||
var/turf/northeast = locate(CLAMP(x + (direction & EAST ? range : 0), 1, world.maxx), CLAMP(y + (direction & NORTH ? range : 0), 1, world.maxy), CLAMP(z, 1, world.maxz))
|
||||
var/turf/southwest = locate(clamp(x - (direction & WEST ? range : 0), 1, world.maxx), clamp(y - (direction & SOUTH ? range : 0), 1, world.maxy), clamp(z, 1, world.maxz))
|
||||
var/turf/northeast = locate(clamp(x + (direction & EAST ? range : 0), 1, world.maxx), clamp(y + (direction & NORTH ? range : 0), 1, world.maxy), clamp(z, 1, world.maxz))
|
||||
//holder.vis_contents += block(southwest, northeast) // This doesnt work because of beta bug memes
|
||||
for(var/i in block(southwest, northeast))
|
||||
holder.vis_contents += i
|
||||
|
||||
@@ -175,7 +175,7 @@
|
||||
return (nanite_volume > 0)
|
||||
|
||||
/datum/component/nanites/proc/adjust_nanites(datum/source, amount)
|
||||
nanite_volume = CLAMP(nanite_volume + amount, 0, max_nanites)
|
||||
nanite_volume = clamp(nanite_volume + amount, 0, max_nanites)
|
||||
if(nanite_volume <= 0) //oops we ran out
|
||||
qdel(src)
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
if(remove || stealth)
|
||||
return //bye icon
|
||||
var/nanite_percent = (nanite_volume / max_nanites) * 100
|
||||
nanite_percent = CLAMP(CEILING(nanite_percent, 10), 10, 100)
|
||||
nanite_percent = clamp(CEILING(nanite_percent, 10), 10, 100)
|
||||
holder.icon_state = "nanites[nanite_percent]"
|
||||
|
||||
/datum/component/nanites/proc/on_emp(datum/source, severity)
|
||||
@@ -249,13 +249,13 @@
|
||||
return FALSE
|
||||
|
||||
/datum/component/nanites/proc/set_volume(datum/source, amount)
|
||||
nanite_volume = CLAMP(amount, 0, max_nanites)
|
||||
nanite_volume = clamp(amount, 0, max_nanites)
|
||||
|
||||
/datum/component/nanites/proc/set_max_volume(datum/source, amount)
|
||||
max_nanites = max(1, max_nanites)
|
||||
|
||||
/datum/component/nanites/proc/set_cloud(datum/source, amount)
|
||||
cloud_id = CLAMP(amount, 0, 100)
|
||||
cloud_id = clamp(amount, 0, 100)
|
||||
|
||||
/datum/component/nanites/proc/set_cloud_sync(datum/source, method)
|
||||
switch(method)
|
||||
@@ -267,7 +267,7 @@
|
||||
cloud_active = TRUE
|
||||
|
||||
/datum/component/nanites/proc/set_safety(datum/source, amount)
|
||||
safety_threshold = CLAMP(amount, 0, max_nanites)
|
||||
safety_threshold = clamp(amount, 0, max_nanites)
|
||||
|
||||
/datum/component/nanites/proc/set_regen(datum/source, amount)
|
||||
regen_rate = amount
|
||||
|
||||
@@ -22,14 +22,14 @@
|
||||
/datum/component/orbiter/RegisterWithParent()
|
||||
. = ..()
|
||||
var/atom/target = parent
|
||||
while(ismovableatom(target))
|
||||
while(ismovable(target))
|
||||
RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/move_react)
|
||||
target = target.loc
|
||||
|
||||
/datum/component/orbiter/UnregisterFromParent()
|
||||
. = ..()
|
||||
var/atom/target = parent
|
||||
while(ismovableatom(target))
|
||||
while(ismovable(target))
|
||||
UnregisterSignal(target, COMSIG_MOVABLE_MOVED)
|
||||
target = target.loc
|
||||
|
||||
@@ -111,12 +111,12 @@
|
||||
// These are prety rarely activated, how often are you following something in a bag?
|
||||
if(oldloc && !isturf(oldloc)) // We used to be registered to it, probably
|
||||
var/atom/target = oldloc
|
||||
while(ismovableatom(target))
|
||||
while(ismovable(target))
|
||||
UnregisterSignal(target, COMSIG_MOVABLE_MOVED)
|
||||
target = target.loc
|
||||
if(orbited?.loc && orbited.loc != newturf) // We want to know when anything holding us moves too
|
||||
var/atom/target = orbited.loc
|
||||
while(ismovableatom(target))
|
||||
while(ismovable(target))
|
||||
RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/move_react, TRUE)
|
||||
target = target.loc
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
var/list/offhands = list() // keyed list containing all the current riding offsets associated by mob
|
||||
|
||||
/datum/component/riding/Initialize()
|
||||
if(!ismovableatom(parent))
|
||||
if(!ismovable(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_BUCKLE, .proc/vehicle_mob_buckle)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_UNBUCKLE, .proc/vehicle_mob_unbuckle)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
var/default_rotation_direction = ROTATION_CLOCKWISE
|
||||
|
||||
/datum/component/simple_rotation/Initialize(rotation_flags = NONE ,can_user_rotate,can_be_rotated,after_rotation)
|
||||
if(!ismovableatom(parent))
|
||||
if(!ismovable(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
|
||||
//throw if no rotation direction is specificed ?
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
if(world.time < last_time_used && !dissipating)
|
||||
return
|
||||
var/old_charges = charges
|
||||
charges = CLAMP(charges + recharge_rate, 0, max_charges)
|
||||
charges = clamp(charges + recharge_rate, 0, max_charges)
|
||||
if(round(old_charges) >= round(charges)) //only send outputs if it effectively gained at least one charge
|
||||
return
|
||||
var/sound = recharge_sound
|
||||
@@ -85,7 +85,7 @@
|
||||
|
||||
/datum/component/shielded/proc/adjust_charges(amount)
|
||||
var/old_charges = charges
|
||||
charges = CLAMP(charges + amount, 0, max_charges)
|
||||
charges = clamp(charges + amount, 0, max_charges)
|
||||
if(recharge_delay && recharge_rate && (dissipating ? !charges : charges == max_charges))
|
||||
STOP_PROCESSING(SSdcs, src)
|
||||
if(charges < 1 && del_on_overload)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
if(!isatom(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
RegisterSignal(parent, list(COMSIG_ATOM_ENTERED, COMSIG_ATOM_BLOB_ACT, COMSIG_ATOM_HULK_ATTACK, COMSIG_PARENT_ATTACKBY), .proc/play_squeak)
|
||||
if(ismovableatom(parent))
|
||||
if(ismovable(parent))
|
||||
RegisterSignal(parent, list(COMSIG_MOVABLE_BUMP, COMSIG_MOVABLE_IMPACT), .proc/play_squeak)
|
||||
RegisterSignal(parent, list(COMSIG_MOVABLE_CROSSED, COMSIG_ITEM_WEARERCROSSED), .proc/play_squeak_crossed)
|
||||
RegisterSignal(parent, COMSIG_MOVABLE_DISPOSING, .proc/disposing_react)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
var/allow_death = FALSE
|
||||
|
||||
/datum/component/stationloving/Initialize(inform_admins = FALSE, allow_death = FALSE)
|
||||
if(!ismovableatom(parent))
|
||||
if(!ismovable(parent))
|
||||
return COMPONENT_INCOMPATIBLE
|
||||
RegisterSignal(parent, list(COMSIG_MOVABLE_Z_CHANGED), .proc/check_in_bounds)
|
||||
RegisterSignal(parent, list(COMSIG_MOVABLE_SECLUDED_LOCATION), .proc/relocate)
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
numbered_contents = _process_numerical_display()
|
||||
adjusted_contents = numbered_contents.len
|
||||
|
||||
var/columns = CLAMP(max_items, 1, maxcolumns ? maxcolumns : screen_max_columns)
|
||||
var/rows = CLAMP(CEILING(adjusted_contents / columns, 1), 1, screen_max_rows)
|
||||
var/columns = clamp(max_items, 1, maxcolumns ? maxcolumns : screen_max_columns)
|
||||
var/rows = clamp(CEILING(adjusted_contents / columns, 1), 1, screen_max_rows)
|
||||
|
||||
// First, boxes.
|
||||
ui_boxes = get_ui_boxes()
|
||||
@@ -105,7 +105,7 @@
|
||||
// after this point we are sure we can somehow fit all items into our max number of rows.
|
||||
|
||||
// determine rows
|
||||
var/rows = CLAMP(CEILING(min_pixels / horizontal_pixels, 1), 1, screen_max_rows)
|
||||
var/rows = clamp(CEILING(min_pixels / horizontal_pixels, 1), 1, screen_max_rows)
|
||||
|
||||
var/overrun = FALSE
|
||||
if(used > our_volume)
|
||||
|
||||
@@ -181,7 +181,7 @@
|
||||
/datum/component/wet_floor/proc/_do_add_wet(type, duration_minimum, duration_add, duration_maximum)
|
||||
var/time = 0
|
||||
if(LAZYACCESS(time_left_list, "[type]"))
|
||||
time = CLAMP(LAZYACCESS(time_left_list, "[type]") + duration_add, duration_minimum, duration_maximum)
|
||||
time = clamp(LAZYACCESS(time_left_list, "[type]") + duration_add, duration_minimum, duration_maximum)
|
||||
else
|
||||
time = min(duration_minimum, duration_maximum)
|
||||
LAZYSET(time_left_list, "[type]", time)
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
addtimer(CALLBACK(src, .proc/charge), charge_rate)
|
||||
|
||||
/datum/action/innate/dash/proc/charge()
|
||||
current_charges = CLAMP(current_charges + 1, 0, max_charges)
|
||||
current_charges = clamp(current_charges + 1, 0, max_charges)
|
||||
holder.update_action_buttons_icon()
|
||||
if(recharge_sound)
|
||||
playsound(dashing_item, recharge_sound, 50, 1)
|
||||
|
||||
@@ -246,10 +246,10 @@
|
||||
else
|
||||
visibility_flags &= ~HIDDEN_SCANNER
|
||||
|
||||
SetSpread(CLAMP(2 ** (properties["transmittable"] - symptoms.len), DISEASE_SPREAD_BLOOD, DISEASE_SPREAD_AIRBORNE))
|
||||
SetSpread(clamp(2 ** (properties["transmittable"] - symptoms.len), DISEASE_SPREAD_BLOOD, DISEASE_SPREAD_AIRBORNE))
|
||||
|
||||
permeability_mod = max(CEILING(0.4 * properties["transmittable"], 1), 1)
|
||||
cure_chance = 15 - CLAMP(properties["resistance"], -5, 5) // can be between 10 and 20
|
||||
cure_chance = 15 - clamp(properties["resistance"], -5, 5) // can be between 10 and 20
|
||||
stage_prob = max(properties["stage_rate"], 2)
|
||||
SetSeverity(properties["severity"])
|
||||
GenerateCure(properties)
|
||||
@@ -304,7 +304,7 @@
|
||||
// Will generate a random cure, the less resistance the symptoms have, the harder the cure.
|
||||
/datum/disease/advance/proc/GenerateCure()
|
||||
if(properties && properties.len)
|
||||
var/res = CLAMP(properties["resistance"] - (symptoms.len / 2), 1, advance_cures.len)
|
||||
var/res = clamp(properties["resistance"] - (symptoms.len / 2), 1, advance_cures.len)
|
||||
if(res == oldres)
|
||||
return
|
||||
cures = list(pick(advance_cures[res]))
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/datum/element/cleaning/Attach(datum/target)
|
||||
. = ..()
|
||||
if(!ismovableatom(target))
|
||||
if(!ismovable(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
RegisterSignal(target, COMSIG_MOVABLE_MOVED, .proc/Clean)
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
/datum/element/firestacker/Attach(datum/target, amount)
|
||||
. = ..()
|
||||
|
||||
if(!ismovableatom(target))
|
||||
if(!ismovable(target))
|
||||
return ELEMENT_INCOMPATIBLE
|
||||
|
||||
src.amount = amount
|
||||
|
||||
@@ -121,14 +121,14 @@ GLOBAL_LIST_EMPTY(explosions)
|
||||
if(dist <= round(max_range + world.view - 2, 1))
|
||||
M.playsound_local(epicenter, null, 100, 1, frequency, falloff = 5, S = explosion_sound)
|
||||
if(baseshakeamount > 0)
|
||||
shake_camera(M, 25, CLAMP(baseshakeamount, 0, 10))
|
||||
shake_camera(M, 25, clamp(baseshakeamount, 0, 10))
|
||||
// You hear a far explosion if you're outside the blast radius. Small bombs shouldn't be heard all over the station.
|
||||
else if(dist <= far_dist)
|
||||
var/far_volume = CLAMP(far_dist, 30, 50) // Volume is based on explosion size and dist
|
||||
var/far_volume = clamp(far_dist, 30, 50) // Volume is based on explosion size and dist
|
||||
far_volume += (dist <= far_dist * 0.5 ? 50 : 0) // add 50 volume if the mob is pretty close to the explosion
|
||||
M.playsound_local(epicenter, null, far_volume, 1, frequency, falloff = 5, S = far_explosion_sound)
|
||||
if(baseshakeamount > 0)
|
||||
shake_camera(M, 10, CLAMP(baseshakeamount*0.25, 0, 2.5))
|
||||
shake_camera(M, 10, clamp(baseshakeamount*0.25, 0, 2.5))
|
||||
EX_PREPROCESS_CHECK_TICK
|
||||
|
||||
//postpone processing for a bit
|
||||
|
||||
@@ -116,7 +116,7 @@
|
||||
"<span class='userdanger'>[A] slams your chest! You can't breathe!</span>")
|
||||
playsound(get_turf(A), 'sound/effects/hit_punch.ogg', 50, 1, -1)
|
||||
if(D.losebreath <= 10)
|
||||
D.losebreath = CLAMP(D.losebreath + 5, 0, 10)
|
||||
D.losebreath = clamp(D.losebreath + 5, 0, 10)
|
||||
D.adjustOxyLoss(damage + 5)
|
||||
log_combat(A, D, "quickchoked")
|
||||
return TRUE
|
||||
@@ -128,7 +128,7 @@
|
||||
playsound(get_turf(A), 'sound/effects/hit_punch.ogg', 50, 1, -1)
|
||||
D.apply_damage(damage, BRUTE)
|
||||
if(D.silent <= 10)
|
||||
D.silent = CLAMP(D.silent + 10, 0, 10)
|
||||
D.silent = clamp(D.silent + 10, 0, 10)
|
||||
log_combat(A, D, "neck chopped")
|
||||
return TRUE
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
if(damage >= stunthreshold)
|
||||
D.visible_message("<span class='warning'>[D] sputters and recoils in pain!</span>", "<span class='userdanger'>You recoil in pain as you are jabbed in a nerve!</span>")
|
||||
D.drop_all_held_items()
|
||||
|
||||
|
||||
return TRUE
|
||||
|
||||
//Krav Maga Gloves
|
||||
|
||||
@@ -92,7 +92,7 @@ Unless you know what you're doing, only use the first three numbers. They're in
|
||||
|
||||
/datum/material/plasma/on_applied(atom/source, amount, material_flags)
|
||||
. = ..()
|
||||
if(ismovableatom(source))
|
||||
if(ismovable(source))
|
||||
source.AddElement(/datum/element/firestacker, amount=1)
|
||||
source.AddComponent(/datum/component/explodable, 0, 0, amount / 2500, amount / 1250)
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
return sqrt(((b.x - a.x) ** 2) + ((b.y - a.y) ** 2))
|
||||
|
||||
/proc/angle_between_points(datum/point/a, datum/point/b)
|
||||
return ATAN2((b.y - a.y), (b.x - a.x))
|
||||
return arctan((b.y - a.y), (b.x - a.x))
|
||||
|
||||
/datum/position //For positions with map x/y/z and pixel x/y so you don't have to return lists. Could use addition/subtraction in the future I guess.
|
||||
var/x = 0
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
if (user.client)
|
||||
user.client.images += bar
|
||||
|
||||
progress = CLAMP(progress, 0, goal)
|
||||
progress = clamp(progress, 0, goal)
|
||||
bar.icon_state = "prog_bar_[round(((progress / goal) * 100), 5)]"
|
||||
if (!shown)
|
||||
user.client.images += bar
|
||||
|
||||
@@ -336,7 +336,7 @@
|
||||
if(prob(severity * 0.15))
|
||||
to_chat(owner, "<span class='sevtug[span_part]'>\"[text2ratvar(pick(mania_messages))]\"</span>")
|
||||
owner.playsound_local(get_turf(motor), hum, severity, 1)
|
||||
owner.adjust_drugginess(CLAMP(max(severity * 0.075, 1), 0, max(0, 50 - owner.druggy))) //7.5% of severity per second, minimum 1
|
||||
owner.adjust_drugginess(clamp(max(severity * 0.075, 1), 0, max(0, 50 - owner.druggy))) //7.5% of severity per second, minimum 1
|
||||
if(owner.hallucination < 50)
|
||||
owner.hallucination = min(owner.hallucination + max(severity * 0.075, 1), 50) //7.5% of severity per second, minimum 1
|
||||
if(owner.dizziness < 50)
|
||||
@@ -594,7 +594,7 @@
|
||||
old_health = owner.health
|
||||
if(!old_oxyloss)
|
||||
old_oxyloss = owner.getOxyLoss()
|
||||
var/health_difference = old_health - owner.health - CLAMP(owner.getOxyLoss() - old_oxyloss,0, owner.getOxyLoss())
|
||||
var/health_difference = old_health - owner.health - clamp(owner.getOxyLoss() - old_oxyloss,0, owner.getOxyLoss())
|
||||
if(!health_difference)
|
||||
return
|
||||
owner.visible_message("<span class='warning'>The light in [owner]'s eyes dims as [owner.p_theyre()] harmed!</span>", \
|
||||
|
||||
+2
-2
@@ -192,7 +192,7 @@
|
||||
reagents = new()
|
||||
reagents.reagent_list.Add(A)
|
||||
reagents.conditional_update()
|
||||
else if(ismovableatom(A))
|
||||
else if(ismovable(A))
|
||||
var/atom/movable/M = A
|
||||
if(isliving(M.loc))
|
||||
var/mob/living/L = M.loc
|
||||
@@ -692,7 +692,7 @@
|
||||
/atom/vv_get_dropdown()
|
||||
. = ..()
|
||||
VV_DROPDOWN_OPTION("", "---------")
|
||||
if(!ismovableatom(src))
|
||||
if(!ismovable(src))
|
||||
var/turf/curturf = get_turf(src)
|
||||
if(curturf)
|
||||
. += "<option value='?_src_=holder;[HrefToken()];adminplayerobservecoodjump=1;X=[curturf.x];Y=[curturf.y];Z=[curturf.z]'>Jump To</option>"
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
restricted_jobs += "Assistant"
|
||||
|
||||
// Set number of Vamps
|
||||
recommended_enemies = CLAMP(round(num_players()/10), 1, 6);
|
||||
recommended_enemies = clamp(round(num_players()/10), 1, 6);
|
||||
|
||||
// Select Antags
|
||||
for(var/i = 0, i < recommended_enemies, i++)
|
||||
@@ -195,7 +195,7 @@
|
||||
return FALSE
|
||||
if(target.stat > UNCONSCIOUS)
|
||||
return FALSE
|
||||
|
||||
|
||||
// Check Overdose: Am I even addicted to blood? Do I even have any in me?
|
||||
//if (!target.reagents.addiction_list || !target.reagents.reagent_list)
|
||||
//message_admins("DEBUG2: can_make_vassal() Abort: No reagents")
|
||||
|
||||
@@ -105,7 +105,7 @@
|
||||
if (M.mind && M.mind.assigned_role && (M.mind.assigned_role in enemy_roles) && (!(M in candidates) || (M.mind.assigned_role in restricted_roles)))
|
||||
job_check++ // Checking for "enemies" (such as sec officers). To be counters, they must either not be candidates to that rule, or have a job that restricts them from it
|
||||
|
||||
var/threat = CLAMP(round(mode.threat_level/10),1,10)
|
||||
var/threat = clamp(round(mode.threat_level/10),1,10)
|
||||
if (job_check < required_enemies[threat])
|
||||
SSblackbox.record_feedback("tally","dynamic",1,"Times rulesets rejected due to not enough enemy roles")
|
||||
return FALSE
|
||||
@@ -671,7 +671,7 @@
|
||||
message_admins("[ADMIN_LOOKUPFLW(Ninja)] has been made into a ninja by dynamic.")
|
||||
log_game("[key_name(Ninja)] was spawned as a ninja by dynamic.")
|
||||
return Ninja
|
||||
|
||||
|
||||
/datum/dynamic_ruleset/midround/from_ghosts/ninja/finish_setup(mob/new_character, index)
|
||||
return
|
||||
|
||||
|
||||
@@ -789,7 +789,7 @@
|
||||
if (prob(meteorminutes/2))
|
||||
wavetype = GLOB.meteors_catastrophic
|
||||
|
||||
var/ramp_up_final = CLAMP(round(meteorminutes/rampupdelta), 1, 10)
|
||||
var/ramp_up_final = clamp(round(meteorminutes/rampupdelta), 1, 10)
|
||||
|
||||
spawn_meteors(ramp_up_final, wavetype)
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
WAROPS_ALWAYS_ALLOWED: Can always do warops, regardless of threat level.
|
||||
USE_PREF_WEIGHTS: Will use peoples' preferences to change the threat centre.
|
||||
FORCE_IF_WON: If this mode won the vote, forces it
|
||||
USE_PREV_ROUND_WEIGHTS: Changes its threat centre based on the average chaos of previous rounds.
|
||||
USE_PREV_ROUND_WEIGHTS: Changes its threat centre based on the average chaos of previous rounds.
|
||||
*/
|
||||
var/flags = 0
|
||||
var/dead_player_weight = 1 // How much dead players matter for threat calculation
|
||||
@@ -22,11 +22,11 @@
|
||||
var/datum/game_mode/dynamic/mode = null // Cached as soon as it's made, by dynamic.
|
||||
|
||||
/**
|
||||
Property weights are:
|
||||
Property weights are:
|
||||
"story_potential" -- essentially how many different ways the antag can be played.
|
||||
"trust" -- How much it makes the crew trust each other. Negative values means they're suspicious. Team antags are like this.
|
||||
"chaos" -- How chaotic it makes the round. Has some overlap with "valid" and somewhat contradicts "extended".
|
||||
"valid" -- How likely the non-antag-enemy crew are to get involved, e.g. nukies encouraging the warden to
|
||||
"valid" -- How likely the non-antag-enemy crew are to get involved, e.g. nukies encouraging the warden to
|
||||
let everyone into the armory, wizard moving around and being a nuisance, nightmare busting lights.
|
||||
"extended" -- How much the antag is conducive to a long round. Nukies and cults are bad for this; Wizard is less bad; and so on.
|
||||
"conversion" -- Basically a bool. Conversion antags, well, convert. It's its own class for a good reason.
|
||||
@@ -34,13 +34,13 @@ Property weights are:
|
||||
|
||||
/datum/dynamic_storyteller/proc/start_injection_cooldowns()
|
||||
var/latejoin_injection_cooldown_middle = 0.5*(GLOB.dynamic_first_latejoin_delay_max + GLOB.dynamic_first_latejoin_delay_min)
|
||||
mode.latejoin_injection_cooldown = round(CLAMP(EXP_DISTRIBUTION(latejoin_injection_cooldown_middle), GLOB.dynamic_first_latejoin_delay_min, GLOB.dynamic_first_latejoin_delay_max)) + world.time
|
||||
mode.latejoin_injection_cooldown = round(clamp(EXP_DISTRIBUTION(latejoin_injection_cooldown_middle), GLOB.dynamic_first_latejoin_delay_min, GLOB.dynamic_first_latejoin_delay_max)) + world.time
|
||||
|
||||
var/midround_injection_cooldown_middle = 0.5*(GLOB.dynamic_first_midround_delay_min + GLOB.dynamic_first_midround_delay_max)
|
||||
mode.midround_injection_cooldown = round(CLAMP(EXP_DISTRIBUTION(midround_injection_cooldown_middle), GLOB.dynamic_first_midround_delay_min, GLOB.dynamic_first_midround_delay_max)) + world.time
|
||||
|
||||
mode.midround_injection_cooldown = round(clamp(EXP_DISTRIBUTION(midround_injection_cooldown_middle), GLOB.dynamic_first_midround_delay_min, GLOB.dynamic_first_midround_delay_max)) + world.time
|
||||
|
||||
var/event_injection_cooldown_middle = 0.5*(GLOB.dynamic_event_delay_max + GLOB.dynamic_event_delay_min)
|
||||
mode.event_injection_cooldown = (round(CLAMP(EXP_DISTRIBUTION(event_injection_cooldown_middle), GLOB.dynamic_event_delay_min, GLOB.dynamic_event_delay_max)) + world.time)
|
||||
mode.event_injection_cooldown = (round(clamp(EXP_DISTRIBUTION(event_injection_cooldown_middle), GLOB.dynamic_event_delay_min, GLOB.dynamic_event_delay_max)) + world.time)
|
||||
|
||||
/datum/dynamic_storyteller/proc/calculate_threat()
|
||||
var/threat = 0
|
||||
@@ -99,15 +99,15 @@ Property weights are:
|
||||
|
||||
/datum/dynamic_storyteller/proc/get_midround_cooldown()
|
||||
var/midround_injection_cooldown_middle = 0.5*(GLOB.dynamic_midround_delay_max + GLOB.dynamic_midround_delay_min)
|
||||
return round(CLAMP(EXP_DISTRIBUTION(midround_injection_cooldown_middle), GLOB.dynamic_midround_delay_min, GLOB.dynamic_midround_delay_max))
|
||||
return round(clamp(EXP_DISTRIBUTION(midround_injection_cooldown_middle), GLOB.dynamic_midround_delay_min, GLOB.dynamic_midround_delay_max))
|
||||
|
||||
/datum/dynamic_storyteller/proc/get_event_cooldown()
|
||||
var/event_injection_cooldown_middle = 0.5*(GLOB.dynamic_event_delay_max + GLOB.dynamic_event_delay_min)
|
||||
return round(CLAMP(EXP_DISTRIBUTION(event_injection_cooldown_middle), GLOB.dynamic_event_delay_min, GLOB.dynamic_event_delay_max))
|
||||
return round(clamp(EXP_DISTRIBUTION(event_injection_cooldown_middle), GLOB.dynamic_event_delay_min, GLOB.dynamic_event_delay_max))
|
||||
|
||||
/datum/dynamic_storyteller/proc/get_latejoin_cooldown()
|
||||
var/latejoin_injection_cooldown_middle = 0.5*(GLOB.dynamic_latejoin_delay_max + GLOB.dynamic_latejoin_delay_min)
|
||||
return round(CLAMP(EXP_DISTRIBUTION(latejoin_injection_cooldown_middle), GLOB.dynamic_latejoin_delay_min, GLOB.dynamic_latejoin_delay_max))
|
||||
return round(clamp(EXP_DISTRIBUTION(latejoin_injection_cooldown_middle), GLOB.dynamic_latejoin_delay_min, GLOB.dynamic_latejoin_delay_max))
|
||||
|
||||
/datum/dynamic_storyteller/proc/get_injection_chance(dry_run = FALSE)
|
||||
if(mode.forced_injection)
|
||||
@@ -144,7 +144,7 @@ Property weights are:
|
||||
if(!(rule.flags & MINOR_RULESET)) // makes the traitor rulesets always possible anyway
|
||||
var/cost_difference = abs(rule.cost-(mode.threat_level-mode.threat))
|
||||
/* Basically, the closer the cost is to the current threat-level-away-from-threat, the more likely it is to
|
||||
pick this particular ruleset.
|
||||
pick this particular ruleset.
|
||||
Let's use a toy example: there's 60 threat level and 10 threat spent.
|
||||
We want to pick a ruleset that's close to that, so we run the below equation, on two rulesets.
|
||||
Ruleset 1 has 30 cost, ruleset 2 has 5 cost.
|
||||
@@ -212,7 +212,7 @@ Property weights are:
|
||||
flags = WAROPS_ALWAYS_ALLOWED
|
||||
min_players = 40
|
||||
var/refund_cooldown = 0
|
||||
|
||||
|
||||
/datum/dynamic_storyteller/chaotic/do_process()
|
||||
if(refund_cooldown < world.time)
|
||||
mode.create_threat(20)
|
||||
@@ -221,7 +221,7 @@ Property weights are:
|
||||
|
||||
/datum/dynamic_storyteller/chaotic/get_midround_cooldown()
|
||||
return ..() / 4
|
||||
|
||||
|
||||
/datum/dynamic_storyteller/chaotic/get_latejoin_cooldown()
|
||||
return ..() / 4
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
if (prob(meteorminutes/2))
|
||||
wavetype = GLOB.meteors_catastrophic
|
||||
|
||||
var/ramp_up_final = CLAMP(round(meteorminutes/rampupdelta), 1, 10)
|
||||
var/ramp_up_final = clamp(round(meteorminutes/rampupdelta), 1, 10)
|
||||
|
||||
spawn_meteors(ramp_up_final, wavetype)
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
/datum/game_mode/revolution/post_setup()
|
||||
var/list/heads = SSjob.get_living_heads()
|
||||
var/list/sec = SSjob.get_living_sec()
|
||||
var/weighted_score = CLAMP(round(heads.len - ((3 - sec.len) / 3)), 1, max_headrevs)
|
||||
var/weighted_score = clamp(round(heads.len - ((3 - sec.len) / 3)), 1, max_headrevs)
|
||||
|
||||
for(var/datum/mind/rev_mind in headrev_candidates) //People with return to lobby may still be in the lobby. Let's pick someone else in that case.
|
||||
if(isnewplayer(rev_mind.current))
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
|
||||
var/multiplier = text2num(href_list["multiplier"])
|
||||
var/is_stack = ispath(being_built.build_path, /obj/item/stack)
|
||||
multiplier = CLAMP(multiplier,1,50)
|
||||
multiplier = clamp(multiplier,1,50)
|
||||
|
||||
/////////////////
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
for(var/obj/item/stock_parts/manipulator/P in component_parts)
|
||||
speed_coeff += (P.rating / 2)
|
||||
speed_coeff = max(1, speed_coeff)
|
||||
heal_level = CLAMP((efficiency * 10) + 10, MINIMUM_HEAL_LEVEL, 100)
|
||||
heal_level = clamp((efficiency * 10) + 10, MINIMUM_HEAL_LEVEL, 100)
|
||||
|
||||
//The return of data disks?? Just for transferring between genetics machine/cloning machine.
|
||||
//TO-DO: Make the genetics machine accept them.
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
return
|
||||
log_activity("changed greater than charge filter to \"[new_filter]\"")
|
||||
if(new_filter)
|
||||
new_filter = CLAMP(new_filter, 0, 100)
|
||||
new_filter = clamp(new_filter, 0, 100)
|
||||
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
|
||||
result_filters["Charge Above"] = new_filter
|
||||
if(href_list["below_filter"])
|
||||
@@ -160,7 +160,7 @@
|
||||
return
|
||||
log_activity("changed lesser than charge filter to \"[new_filter]\"")
|
||||
if(new_filter)
|
||||
new_filter = CLAMP(new_filter, 0, 100)
|
||||
new_filter = clamp(new_filter, 0, 100)
|
||||
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, 0)
|
||||
result_filters["Charge Below"] = new_filter
|
||||
if(href_list["access_filter"])
|
||||
|
||||
@@ -308,12 +308,12 @@
|
||||
var/new_rows = input(user, "How many rows do you want? (Minimum: 4, Maximum: 30)", "Minesweeper Rows") as null|num
|
||||
if(!new_rows || !user.canUseTopic(src, !hasSiliconAccessInArea(user)))
|
||||
return FALSE
|
||||
new_rows = CLAMP(new_rows + 1, 4, 30)
|
||||
new_rows = clamp(new_rows + 1, 4, 30)
|
||||
playsound(loc, 'sound/arcade/minesweeper_menuselect.ogg', 50, 0, extrarange = -3, falloff = 10)
|
||||
var/new_columns = input(user, "How many columns do you want? (Minimum: 4, Maximum: 50)", "Minesweeper Squares") as null|num
|
||||
if(!new_columns || !user.canUseTopic(src, !hasSiliconAccessInArea(user)))
|
||||
return FALSE
|
||||
new_columns = CLAMP(new_columns + 1, 4, 50)
|
||||
new_columns = clamp(new_columns + 1, 4, 50)
|
||||
playsound(loc, 'sound/arcade/minesweeper_menuselect.ogg', 50, 0, extrarange = -3, falloff = 10)
|
||||
var/grid_area = (new_rows - 1) * (new_columns - 1)
|
||||
var/lower_limit = round(grid_area*0.156)
|
||||
@@ -324,7 +324,7 @@
|
||||
playsound(loc, 'sound/arcade/minesweeper_menuselect.ogg', 50, 0, extrarange = -3, falloff = 10)
|
||||
rows = new_rows
|
||||
columns = new_columns
|
||||
mine_limit = CLAMP(new_mine_limit, lower_limit, upper_limit)
|
||||
mine_limit = clamp(new_mine_limit, lower_limit, upper_limit)
|
||||
return TRUE
|
||||
|
||||
/obj/machinery/computer/arcade/minesweeper/proc/make_mines(var/reset_everything)
|
||||
|
||||
@@ -296,7 +296,7 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers)
|
||||
if("rate")
|
||||
var/target = text2num(params["rate"])
|
||||
if(!isnull(target))
|
||||
target = CLAMP(target, 0, MAX_TRANSFER_RATE)
|
||||
target = clamp(target, 0, MAX_TRANSFER_RATE)
|
||||
signal.data += list("tag" = input_tag, "set_volume_rate" = target)
|
||||
. = TRUE
|
||||
if("output")
|
||||
@@ -305,7 +305,7 @@ GLOBAL_LIST_EMPTY(atmos_air_controllers)
|
||||
if("pressure")
|
||||
var/target = text2num(params["pressure"])
|
||||
if(!isnull(target))
|
||||
target = CLAMP(target, 0, MAX_OUTPUT_PRESSURE)
|
||||
target = clamp(target, 0, MAX_OUTPUT_PRESSURE)
|
||||
signal.data += list("tag" = output_tag, "set_internal_pressure" = target)
|
||||
. = TRUE
|
||||
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
|
||||
|
||||
@@ -604,13 +604,13 @@
|
||||
if("setbufferlabel")
|
||||
var/text = sanitize(input(usr, "Input a new label:", "Input a Text", null) as text|null)
|
||||
if(num && text)
|
||||
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||
num = clamp(num, 1, NUMBER_OF_BUFFERS)
|
||||
var/list/buffer_slot = buffer[num]
|
||||
if(istype(buffer_slot))
|
||||
buffer_slot["label"] = text
|
||||
if("setbuffer")
|
||||
if(num && viable_occupant)
|
||||
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||
num = clamp(num, 1, NUMBER_OF_BUFFERS)
|
||||
buffer[num] = list(
|
||||
"label"="Buffer[num]:[viable_occupant.real_name]",
|
||||
"UI"=viable_occupant.dna.uni_identity,
|
||||
@@ -620,7 +620,7 @@
|
||||
)
|
||||
if("clearbuffer")
|
||||
if(num)
|
||||
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||
num = clamp(num, 1, NUMBER_OF_BUFFERS)
|
||||
var/list/buffer_slot = buffer[num]
|
||||
if(istype(buffer_slot))
|
||||
buffer_slot.Cut()
|
||||
@@ -635,7 +635,7 @@
|
||||
apply_buffer(SCANNER_ACTION_MIXED,num)
|
||||
if("injector")
|
||||
if(num && injectorready < world.time)
|
||||
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||
num = clamp(num, 1, NUMBER_OF_BUFFERS)
|
||||
var/list/buffer_slot = buffer[num]
|
||||
if(istype(buffer_slot))
|
||||
var/obj/item/dnainjector/timed/I
|
||||
@@ -662,11 +662,11 @@
|
||||
injectorready = world.time + INJECTOR_TIMEOUT
|
||||
if("loaddisk")
|
||||
if(num && diskette && diskette.fields)
|
||||
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||
num = clamp(num, 1, NUMBER_OF_BUFFERS)
|
||||
buffer[num] = diskette.fields.Copy()
|
||||
if("savedisk")
|
||||
if(num && diskette && !diskette.read_only)
|
||||
num = CLAMP(num, 1, NUMBER_OF_BUFFERS)
|
||||
num = clamp(num, 1, NUMBER_OF_BUFFERS)
|
||||
var/list/buffer_slot = buffer[num]
|
||||
if(istype(buffer_slot))
|
||||
diskette.name = "data disk \[[buffer_slot["label"]]\]"
|
||||
@@ -953,7 +953,7 @@
|
||||
return viable_occupant
|
||||
|
||||
/obj/machinery/computer/scan_consolenew/proc/apply_buffer(action,buffer_num)
|
||||
buffer_num = CLAMP(buffer_num, 1, NUMBER_OF_BUFFERS)
|
||||
buffer_num = clamp(buffer_num, 1, NUMBER_OF_BUFFERS)
|
||||
var/list/buffer_slot = buffer[buffer_num]
|
||||
var/mob/living/carbon/viable_occupant = get_viable_occupant()
|
||||
if(istype(buffer_slot))
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
return
|
||||
if(!new_goal)
|
||||
new_goal = default_goal
|
||||
contained_id.goal = CLAMP(new_goal, 0, 1000) //maximum 1000 points
|
||||
contained_id.goal = clamp(new_goal, 0, 1000) //maximum 1000 points
|
||||
return TRUE
|
||||
if("toggle_open")
|
||||
if(teleporter.locked)
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
to_chat(user, "<span class='notice'>You begin repairing [src]...</span>")
|
||||
if(I.use_tool(src, user, 40, volume=40))
|
||||
obj_integrity = CLAMP(obj_integrity + 20, 0, max_integrity)
|
||||
obj_integrity = clamp(obj_integrity + 20, 0, max_integrity)
|
||||
else
|
||||
return ..()
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@
|
||||
. /= 10
|
||||
|
||||
/obj/machinery/door_timer/proc/set_timer(value)
|
||||
var/new_time = CLAMP(value,0,MAX_TIMER)
|
||||
var/new_time = clamp(value,0,MAX_TIMER)
|
||||
. = new_time == timer_duration //return 1 on no change
|
||||
timer_duration = new_time
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@
|
||||
if(teleporting)
|
||||
return
|
||||
if(!isnull(x))
|
||||
x_offset = CLAMP(x, -range, range)
|
||||
x_offset = clamp(x, -range, range)
|
||||
if(!isnull(y))
|
||||
y_offset = CLAMP(y, -range, range)
|
||||
y_offset = clamp(y, -range, range)
|
||||
|
||||
/obj/machinery/launchpad/proc/doteleport(mob/user, sending)
|
||||
if(teleporting)
|
||||
|
||||
@@ -55,9 +55,9 @@
|
||||
new /obj/item/pipe_meter(loc)
|
||||
wait = world.time + 15
|
||||
if(href_list["layer_up"])
|
||||
piping_layer = CLAMP(++piping_layer, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||
piping_layer = clamp(++piping_layer, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||
if(href_list["layer_down"])
|
||||
piping_layer = CLAMP(--piping_layer, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||
piping_layer = clamp(--piping_layer, PIPING_LAYER_MIN, PIPING_LAYER_MAX)
|
||||
return
|
||||
|
||||
/obj/machinery/pipedispenser/attackby(obj/item/W, mob/user, params)
|
||||
|
||||
@@ -270,7 +270,7 @@
|
||||
use_stored_power(50)
|
||||
|
||||
/obj/machinery/shieldwallgen/proc/use_stored_power(amount)
|
||||
power = CLAMP(power - amount, 0, maximum_stored_power)
|
||||
power = clamp(power - amount, 0, maximum_stored_power)
|
||||
update_activity()
|
||||
|
||||
/obj/machinery/shieldwallgen/proc/update_activity()
|
||||
|
||||
@@ -127,7 +127,7 @@
|
||||
settableTemperatureRange = cap * 30
|
||||
efficiency = (cap + 1) * 10000
|
||||
|
||||
targetTemperature = CLAMP(targetTemperature,
|
||||
targetTemperature = clamp(targetTemperature,
|
||||
max(settableTemperatureMedian - settableTemperatureRange, TCMB),
|
||||
settableTemperatureMedian + settableTemperatureRange)
|
||||
|
||||
@@ -230,7 +230,7 @@
|
||||
target= text2num(target) + T0C
|
||||
. = TRUE
|
||||
if(.)
|
||||
targetTemperature = CLAMP(round(target),
|
||||
targetTemperature = clamp(round(target),
|
||||
max(settableTemperatureMedian - settableTemperatureRange, TCMB),
|
||||
settableTemperatureMedian + settableTemperatureRange)
|
||||
if("eject")
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
/obj/machinery/syndicatebomb/proc/settings(mob/user)
|
||||
var/new_timer = input(user, "Please set the timer.", "Timer", "[timer_set]") as num
|
||||
if(in_range(src, user) && isliving(user)) //No running off and setting bombs from across the station
|
||||
timer_set = CLAMP(new_timer, minimum_timer, maximum_timer)
|
||||
timer_set = clamp(new_timer, minimum_timer, maximum_timer)
|
||||
loc.visible_message("<span class='notice'>[icon2html(src, viewers(src))] timer set for [timer_set] seconds.</span>")
|
||||
if(alert(user,"Would you like to start the countdown now?",,"Yes","No") == "Yes" && in_range(src, user) && isliving(user))
|
||||
if(defused || active)
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
com.target = null
|
||||
visible_message("<span class='alert'>Cannot authenticate locked on coordinates. Please reinstate coordinate matrix.</span>")
|
||||
return
|
||||
if (ismovableatom(M))
|
||||
if (ismovable(M))
|
||||
if(do_teleport(M, com.target, channel = TELEPORT_CHANNEL_BLUESPACE))
|
||||
use_power(5000)
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@
|
||||
|
||||
var/multiplier = text2num(href_list["multiplier"])
|
||||
var/is_stack = ispath(being_built.build_path, /obj/item/stack)
|
||||
multiplier = CLAMP(multiplier,1,50)
|
||||
multiplier = clamp(multiplier,1,50)
|
||||
|
||||
/////////////////
|
||||
|
||||
@@ -240,7 +240,7 @@
|
||||
T=1.2
|
||||
for(var/obj/item/stock_parts/manipulator/M in component_parts)
|
||||
T -= M.rating*0.2
|
||||
prod_coeff = CLAMP(T,1,0) // Coeff going 1 -> 0,8 -> 0,6 -> 0,4
|
||||
prod_coeff = clamp(T,1,0) // Coeff going 1 -> 0,8 -> 0,6 -> 0,4
|
||||
|
||||
/obj/machinery/autoylathe/proc/main_win(mob/user)
|
||||
var/dat = "<div class='statusDisplay'><h3>Autoylathe Menu:</h3><br>"
|
||||
|
||||
@@ -484,7 +484,7 @@
|
||||
|
||||
/obj/item/punching_glove/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum)
|
||||
if(!..())
|
||||
if(ismovableatom(hit_atom))
|
||||
if(ismovable(hit_atom))
|
||||
var/atom/movable/AM = hit_atom
|
||||
AM.safe_throw_at(get_edge_target_turf(AM,get_dir(src, AM)), 7, 2)
|
||||
qdel(src)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
target = get_turf(src)
|
||||
|
||||
if(acid_amt)
|
||||
acid_level = min( (CLAMP(round(acid_amt, 1), 0, INFINITY)) *acid_pwr, 12000) //capped so the acid effect doesn't last a half hour on the floor.
|
||||
acid_level = min( (clamp(round(acid_amt, 1), 0, INFINITY)) *acid_pwr, 12000) //capped so the acid effect doesn't last a half hour on the floor.
|
||||
|
||||
//handle APCs and newscasters and stuff nicely
|
||||
pixel_x = target.pixel_x + rand(-4,4)
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
var/list/affecting = list()
|
||||
|
||||
/obj/effect/step_trigger/thrower/Trigger(atom/A)
|
||||
if(!A || !ismovableatom(A))
|
||||
if(!A || !ismovable(A))
|
||||
return
|
||||
var/atom/movable/AM = A
|
||||
var/curtiles = 0
|
||||
|
||||
@@ -193,7 +193,7 @@
|
||||
|
||||
/obj/effect/chrono_field/update_icon()
|
||||
var/ttk_frame = 1 - (tickstokill / initial(tickstokill))
|
||||
ttk_frame = CLAMP(CEILING(ttk_frame * CHRONO_FRAME_COUNT, 1), 1, CHRONO_FRAME_COUNT)
|
||||
ttk_frame = clamp(CEILING(ttk_frame * CHRONO_FRAME_COUNT, 1), 1, CHRONO_FRAME_COUNT)
|
||||
if(ttk_frame != RPpos)
|
||||
RPpos = ttk_frame
|
||||
mob_underlay.icon_state = "frame[RPpos]"
|
||||
|
||||
@@ -804,7 +804,7 @@
|
||||
var/new_cloud = input("Set the public nanite chamber's Cloud ID (1-100).", "Cloud ID", cloud_id) as num|null
|
||||
if(new_cloud == null)
|
||||
return
|
||||
cloud_id = CLAMP(round(new_cloud, 1), 1, 100)
|
||||
cloud_id = clamp(round(new_cloud, 1), 1, 100)
|
||||
|
||||
/obj/item/circuitboard/machine/public_nanite_chamber/examine(mob/user)
|
||||
. = ..()
|
||||
|
||||
@@ -346,8 +346,8 @@
|
||||
var/clicky
|
||||
|
||||
if(click_params && click_params["icon-x"] && click_params["icon-y"])
|
||||
clickx = CLAMP(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
clicky = CLAMP(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
clickx = clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
clicky = clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
|
||||
if(!instant)
|
||||
to_chat(user, "<span class='notice'>You start drawing a [temp] on the [target.name]...</span>")
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
var/new_duration = input(user, "Set the duration (5-300):", "Desynchronizer", duration / 10) as null|num
|
||||
if(new_duration)
|
||||
new_duration = new_duration SECONDS
|
||||
new_duration = CLAMP(new_duration, 50, max_duration)
|
||||
new_duration = clamp(new_duration, 50, max_duration)
|
||||
duration = new_duration
|
||||
to_chat(user, "<span class='notice'>You set the duration to [DisplayTimeText(duration)].</span>")
|
||||
return TRUE
|
||||
|
||||
@@ -75,7 +75,7 @@ GLOBAL_LIST_EMPTY(GPS_list)
|
||||
if(!ui)
|
||||
// Variable window height, depending on how many GPS units there are
|
||||
// to show, clamped to relatively safe range.
|
||||
var/gps_window_height = CLAMP(325 + GLOB.GPS_list.len * 14, 325, 700)
|
||||
var/gps_window_height = clamp(325 + GLOB.GPS_list.len * 14, 325, 700)
|
||||
ui = new(user, src, ui_key, "gps", "Global Positioning System", 470, gps_window_height, master_ui, state) //width, height
|
||||
ui.open()
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
|
||||
// Negative numbers will subtract
|
||||
/obj/item/lightreplacer/proc/AddUses(amount = 1)
|
||||
uses = CLAMP(uses + amount, 0, max_uses)
|
||||
uses = clamp(uses + amount, 0, max_uses)
|
||||
|
||||
/obj/item/lightreplacer/proc/AddShards(amount = 1, user)
|
||||
bulb_shards += amount
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
if(!usr.canUseTopic(src, BE_CLOSE))
|
||||
return
|
||||
new_code = round(new_code)
|
||||
new_code = CLAMP(new_code, 1, 100)
|
||||
new_code = clamp(new_code, 1, 100)
|
||||
code = new_code
|
||||
|
||||
if(href_list["set"] == "power")
|
||||
|
||||
@@ -232,7 +232,7 @@ effective or pretty fucking useless.
|
||||
charge = max(0,charge - 25)//Quick decrease in light
|
||||
else
|
||||
charge = min(max_charge,charge + 50) //Charge in the dark
|
||||
animate(user,alpha = CLAMP(255 - charge,0,255),time = 10)
|
||||
animate(user,alpha = clamp(255 - charge,0,255),time = 10)
|
||||
|
||||
|
||||
/obj/item/jammer
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
/obj/item/dice/proc/diceroll(mob/user)
|
||||
result = roll(sides)
|
||||
if(rigged && result != rigged)
|
||||
if(prob(CLAMP(1/(sides - 1) * 100, 25, 80)))
|
||||
if(prob(clamp(1/(sides - 1) * 100, 25, 80)))
|
||||
result = rigged
|
||||
var/fake_result = roll(sides)//Daredevil isn't as good as he used to be
|
||||
var/comment = ""
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
return
|
||||
var/newtime = input(usr, "Please set the timer.", "Timer", 10) as num
|
||||
if(user.get_active_held_item() == src)
|
||||
newtime = CLAMP(newtime, 10, 60000)
|
||||
newtime = clamp(newtime, 10, 60000)
|
||||
det_time = newtime
|
||||
to_chat(user, "Timer set for [det_time] seconds.")
|
||||
|
||||
|
||||
@@ -197,9 +197,9 @@
|
||||
/obj/item/his_grace/proc/adjust_bloodthirst(amt)
|
||||
prev_bloodthirst = bloodthirst
|
||||
if(prev_bloodthirst < HIS_GRACE_CONSUME_OWNER && !ascended)
|
||||
bloodthirst = CLAMP(bloodthirst + amt, HIS_GRACE_SATIATED, HIS_GRACE_CONSUME_OWNER)
|
||||
bloodthirst = clamp(bloodthirst + amt, HIS_GRACE_SATIATED, HIS_GRACE_CONSUME_OWNER)
|
||||
else if(!ascended)
|
||||
bloodthirst = CLAMP(bloodthirst + amt, HIS_GRACE_CONSUME_OWNER, HIS_GRACE_FALL_ASLEEP)
|
||||
bloodthirst = clamp(bloodthirst + amt, HIS_GRACE_CONSUME_OWNER, HIS_GRACE_FALL_ASLEEP)
|
||||
update_stats()
|
||||
|
||||
/obj/item/his_grace/proc/update_stats()
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
L.SetAllImmobility(0)
|
||||
L.SetSleeping(0)
|
||||
L.SetUnconscious(0)
|
||||
L.reagents.add_reagent(/datum/reagent/medicine/muscle_stimulant, CLAMP(5 - L.reagents.get_reagent_amount(/datum/reagent/medicine/muscle_stimulant), 0, 5)) //If you don't have legs or get bola'd, tough luck!
|
||||
L.reagents.add_reagent(/datum/reagent/medicine/muscle_stimulant, clamp(5 - L.reagents.get_reagent_amount(/datum/reagent/medicine/muscle_stimulant), 0, 5)) //If you don't have legs or get bola'd, tough luck!
|
||||
colorize(L)
|
||||
|
||||
/obj/item/hot_potato/examine(mob/user)
|
||||
|
||||
@@ -201,8 +201,8 @@
|
||||
return target
|
||||
var/x_o = (target.x - starting.x)
|
||||
var/y_o = (target.y - starting.y)
|
||||
var/new_x = CLAMP((starting.x + (x_o * range_multiplier)), 0, world.maxx)
|
||||
var/new_y = CLAMP((starting.y + (y_o * range_multiplier)), 0, world.maxy)
|
||||
var/new_x = clamp((starting.x + (x_o * range_multiplier)), 0, world.maxx)
|
||||
var/new_y = clamp((starting.y + (y_o * range_multiplier)), 0, world.maxy)
|
||||
var/turf/newtarget = locate(new_x, new_y, starting.z)
|
||||
return newtarget
|
||||
|
||||
|
||||
@@ -649,7 +649,7 @@
|
||||
continue
|
||||
usage += projectile_tick_speed_ecost
|
||||
usage += (tracked[I] * projectile_damage_tick_ecost_coefficient)
|
||||
energy = CLAMP(energy - usage, 0, maxenergy)
|
||||
energy = clamp(energy - usage, 0, maxenergy)
|
||||
if(energy <= 0)
|
||||
deactivate_field()
|
||||
visible_message("<span class='warning'>[src] blinks \"ENERGY DEPLETED\".</span>")
|
||||
@@ -659,7 +659,7 @@
|
||||
if(iscyborg(host.loc))
|
||||
host = host.loc
|
||||
else
|
||||
energy = CLAMP(energy + energy_recharge, 0, maxenergy)
|
||||
energy = clamp(energy + energy_recharge, 0, maxenergy)
|
||||
return
|
||||
if(host.cell && (host.cell.charge >= (host.cell.maxcharge * cyborg_cell_critical_percentage)) && (energy < maxenergy))
|
||||
host.cell.use(energy_recharge*energy_recharge_cyborg_drain_coefficient)
|
||||
|
||||
@@ -35,14 +35,14 @@
|
||||
if(TH.force_wielded > initial(TH.force_wielded))
|
||||
to_chat(user, "<span class='warning'>[TH] has already been refined before. It cannot be sharpened further!</span>")
|
||||
return
|
||||
TH.force_wielded = CLAMP(TH.force_wielded + increment, 0, max)//wieldforce is increased since normal force wont stay
|
||||
TH.force_wielded = clamp(TH.force_wielded + increment, 0, max)//wieldforce is increased since normal force wont stay
|
||||
if(I.force > initial(I.force))
|
||||
to_chat(user, "<span class='warning'>[I] has already been refined before. It cannot be sharpened further!</span>")
|
||||
return
|
||||
user.visible_message("<span class='notice'>[user] sharpens [I] with [src]!</span>", "<span class='notice'>You sharpen [I], making it much more deadly than before.</span>")
|
||||
I.sharpness = IS_SHARP_ACCURATE
|
||||
I.force = CLAMP(I.force + increment, 0, max)
|
||||
I.throwforce = CLAMP(I.throwforce + increment, 0, max)
|
||||
I.force = clamp(I.force + increment, 0, max)
|
||||
I.throwforce = clamp(I.throwforce + increment, 0, max)
|
||||
I.name = "[prefix] [I.name]"
|
||||
name = "worn out [name]"
|
||||
desc = "[desc] At least, it used to."
|
||||
|
||||
@@ -169,7 +169,7 @@
|
||||
max_integrity = 75
|
||||
|
||||
/obj/item/shield/run_block(mob/living/owner, atom/object, damage, attack_text, attack_type, armour_penetration, mob/attacker, def_zone, final_block_chance, list/block_return)
|
||||
if(ismovableatom(object))
|
||||
if(ismovable(object))
|
||||
var/atom/movable/AM = object
|
||||
if(CHECK_BITFIELD(shield_flags, SHIELD_TRANSPARENT) && (AM.pass_flags & PASSGLASS))
|
||||
return BLOCK_NONE
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
/obj/item/twohanded/singularityhammer/proc/vortex(turf/pull, mob/wielder)
|
||||
for(var/atom/X in orange(5,pull))
|
||||
if(ismovableatom(X))
|
||||
if(ismovable(X))
|
||||
var/atom/movable/A = X
|
||||
if(A == wielder)
|
||||
continue
|
||||
|
||||
@@ -71,9 +71,9 @@
|
||||
|
||||
/obj/item/stack/proc/update_weight()
|
||||
if(amount <= (max_amount * (1/3)))
|
||||
w_class = CLAMP(full_w_class-2, WEIGHT_CLASS_TINY, full_w_class)
|
||||
w_class = clamp(full_w_class-2, WEIGHT_CLASS_TINY, full_w_class)
|
||||
else if (amount <= (max_amount * (2/3)))
|
||||
w_class = CLAMP(full_w_class-1, WEIGHT_CLASS_TINY, full_w_class)
|
||||
w_class = clamp(full_w_class-1, WEIGHT_CLASS_TINY, full_w_class)
|
||||
else
|
||||
w_class = full_w_class
|
||||
|
||||
|
||||
@@ -204,7 +204,7 @@
|
||||
pressure = text2num(pressure)
|
||||
. = TRUE
|
||||
if(.)
|
||||
distribute_pressure = CLAMP(round(pressure), TANK_MIN_RELEASE_PRESSURE, TANK_MAX_RELEASE_PRESSURE)
|
||||
distribute_pressure = clamp(round(pressure), TANK_MIN_RELEASE_PRESSURE, TANK_MAX_RELEASE_PRESSURE)
|
||||
|
||||
/obj/item/tank/remove_air(amount)
|
||||
return air_contents.remove(amount)
|
||||
|
||||
@@ -256,7 +256,7 @@
|
||||
. = ..()
|
||||
if(!sliver)
|
||||
return
|
||||
if(proximity && ismovableatom(O) && O != sliver)
|
||||
if(proximity && ismovable(O) && O != sliver)
|
||||
Consume(O, user)
|
||||
|
||||
/obj/item/hemostat/supermatter/throw_impact(atom/hit_atom, datum/thrownthing/throwingdatum) // no instakill supermatter javelins
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
if(damage_flag)
|
||||
armor_protection = armor.getRating(damage_flag)
|
||||
if(armor_protection) //Only apply weak-against-armor/hollowpoint effects if there actually IS armor.
|
||||
armor_protection = CLAMP(armor_protection - armour_penetration, 0, 100)
|
||||
armor_protection = clamp(armor_protection - armour_penetration, 0, 100)
|
||||
return round(damage_amount * (100 - armor_protection)*0.01, DAMAGE_PRECISION)
|
||||
|
||||
//the sound played when the obj is damaged.
|
||||
@@ -213,7 +213,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e
|
||||
if(T.intact && level == 1) //fire can't damage things hidden below the floor.
|
||||
return
|
||||
if(exposed_temperature && !(resistance_flags & FIRE_PROOF))
|
||||
take_damage(CLAMP(0.02 * exposed_temperature, 0, 20), BURN, "fire", 0)
|
||||
take_damage(clamp(0.02 * exposed_temperature, 0, 20), BURN, "fire", 0)
|
||||
if(!(resistance_flags & ON_FIRE) && (resistance_flags & FLAMMABLE))
|
||||
resistance_flags |= ON_FIRE
|
||||
SSfire_burning.processing[src] = src
|
||||
@@ -244,7 +244,7 @@ GLOBAL_DATUM_INIT(acid_overlay, /mutable_appearance, mutable_appearance('icons/e
|
||||
if(has_buckled_mobs())
|
||||
for(var/m in buckled_mobs)
|
||||
var/mob/living/buckled_mob = m
|
||||
buckled_mob.electrocute_act((CLAMP(round(strength/400), 10, 90) + rand(-5, 5)), src, flags = SHOCK_TESLA)
|
||||
buckled_mob.electrocute_act((clamp(round(strength/400), 10, 90) + rand(-5, 5)), src, flags = SHOCK_TESLA)
|
||||
|
||||
/obj/proc/reset_shocked()
|
||||
obj_flags &= ~BEING_SHOCKED
|
||||
|
||||
@@ -505,7 +505,7 @@
|
||||
/obj/structure/closet/container_resist(mob/living/user)
|
||||
if(opened)
|
||||
return
|
||||
if(ismovableatom(loc))
|
||||
if(ismovable(loc))
|
||||
user.changeNext_move(CLICK_CD_BREAKOUT)
|
||||
user.last_special = world.time + CLICK_CD_BREAKOUT
|
||||
var/atom/movable/AM = loc
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
if(burn_time_remaining() < MAXIMUM_BURN_TIMER)
|
||||
flame_expiry_timer = world.time + MAXIMUM_BURN_TIMER
|
||||
else
|
||||
fuel_added = CLAMP(fuel_added + amount, 0, MAXIMUM_BURN_TIMER)
|
||||
fuel_added = clamp(fuel_added + amount, 0, MAXIMUM_BURN_TIMER)
|
||||
|
||||
/obj/structure/fireplace/proc/burn_time_remaining()
|
||||
if(lit)
|
||||
|
||||
@@ -294,7 +294,7 @@
|
||||
|
||||
/obj/structure/girder/CanAStarPass(ID, dir, caller)
|
||||
. = !density
|
||||
if(ismovableatom(caller))
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || (mover.pass_flags & PASSGRILLE)
|
||||
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
|
||||
/obj/structure/grille/CanAStarPass(ID, dir, caller)
|
||||
. = !density
|
||||
if(ismovableatom(caller))
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || (mover.pass_flags & PASSGRILLE)
|
||||
|
||||
|
||||
@@ -333,7 +333,7 @@ GLOBAL_LIST_EMPTY(crematoriums)
|
||||
to_chat(user, "<span class='warning'>That's not connected to anything!</span>")
|
||||
|
||||
/obj/structure/tray/MouseDrop_T(atom/movable/O as mob|obj, mob/user)
|
||||
if(!ismovableatom(O) || O.anchored || !Adjacent(user) || !user.Adjacent(O) || O.loc == user)
|
||||
if(!ismovable(O) || O.anchored || !Adjacent(user) || !user.Adjacent(O) || O.loc == user)
|
||||
return
|
||||
if(!ismob(O))
|
||||
if(!istype(O, /obj/structure/closet/body_bag))
|
||||
@@ -375,6 +375,6 @@ GLOBAL_LIST_EMPTY(crematoriums)
|
||||
|
||||
/obj/structure/tray/m_tray/CanAStarPass(ID, dir, caller)
|
||||
. = !density
|
||||
if(ismovableatom(caller))
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || (mover.pass_flags & PASSTABLE)
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
|
||||
/obj/structure/table/CanAStarPass(ID, dir, caller)
|
||||
. = !density
|
||||
if(ismovableatom(caller))
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || (mover.pass_flags & PASSTABLE)
|
||||
|
||||
@@ -175,8 +175,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)
|
||||
I.pixel_x = CLAMP(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
I.pixel_y = CLAMP(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
I.pixel_x = clamp(text2num(click_params["icon-x"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
I.pixel_y = clamp(text2num(click_params["icon-y"]) - 16, -(world.icon_size/2), world.icon_size/2)
|
||||
return 1
|
||||
else
|
||||
return ..()
|
||||
@@ -610,7 +610,7 @@
|
||||
|
||||
/obj/structure/rack/CanAStarPass(ID, dir, caller)
|
||||
. = !density
|
||||
if(ismovableatom(caller))
|
||||
if(ismovable(caller))
|
||||
var/atom/movable/mover = caller
|
||||
. = . || (mover.pass_flags & PASSTABLE)
|
||||
|
||||
|
||||
@@ -256,9 +256,9 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
|
||||
if(depth)
|
||||
var/list/target_baseturfs
|
||||
if(length(copytarget.baseturfs))
|
||||
// with default inputs this would be Copy(CLAMP(2, -INFINITY, baseturfs.len))
|
||||
// with default inputs this would be Copy(clamp(2, -INFINITY, baseturfs.len))
|
||||
// Don't forget a lower index is lower in the baseturfs stack, the bottom is baseturfs[1]
|
||||
target_baseturfs = copytarget.baseturfs.Copy(CLAMP(1 + ignore_bottom, 1 + copytarget.baseturfs.len - depth, copytarget.baseturfs.len))
|
||||
target_baseturfs = copytarget.baseturfs.Copy(clamp(1 + ignore_bottom, 1 + copytarget.baseturfs.len - depth, copytarget.baseturfs.len))
|
||||
else if(!ignore_bottom)
|
||||
target_baseturfs = list(copytarget.baseturfs)
|
||||
if(target_baseturfs)
|
||||
|
||||
@@ -441,7 +441,7 @@
|
||||
for(var/V in contents)
|
||||
var/atom/A = V
|
||||
if(!QDELETED(A) && A.level >= affecting_level)
|
||||
if(ismovableatom(A))
|
||||
if(ismovable(A))
|
||||
var/atom/movable/AM = A
|
||||
if(!AM.ex_check(explosion_id))
|
||||
continue
|
||||
|
||||
@@ -10,9 +10,7 @@ GLOBAL_LIST(topic_status_cache)
|
||||
/world/New()
|
||||
enable_debugger()
|
||||
|
||||
#if DM_VERSION >= 513 && DM_BUILD >= 1506
|
||||
world.Profile(PROFILE_START)
|
||||
#endif
|
||||
|
||||
log_world("World loaded at [TIME_STAMP("hh:mm:ss", FALSE)]!")
|
||||
|
||||
|
||||
@@ -95,7 +95,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"])
|
||||
@@ -118,7 +118,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)
|
||||
|
||||
@@ -2363,7 +2363,7 @@
|
||||
return
|
||||
|
||||
var/list/offset = splittext(href_list["offset"],",")
|
||||
var/number = CLAMP(text2num(href_list["object_count"]), 1, 100)
|
||||
var/number = clamp(text2num(href_list["object_count"]), 1, 100)
|
||||
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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user