_HELPERS/unsorted.dm has been sorted (#61882)

bring code up to latest standards, move many procs to named files inside _HELPERS
no idea where to put some of these procs, help is appreciated
made more files to contain some unique code, deleted unsorted.dm, we can rest now
This commit is contained in:
Ghilker
2021-10-05 20:22:57 +01:00
committed by GitHub
parent 51562ac38d
commit b95c0366a4
139 changed files with 1712 additions and 1671 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
#define LANGUAGE_EXTENSION "language specific"
//Message modes. Each one defines a radio channel, more or less.
//if you use ! as a mode key for some ungodly reason, change the first character for ionnum() so get_message_mode() doesn't freak out with state law prompts - shiz.
//if you use ! as a mode key for some ungodly reason, change the first character for ion_num() so get_message_mode() doesn't freak out with state law prompts - shiz.
#define MODE_HEADSET "headset"
#define MODE_ROBOT "robot"
+13
View File
@@ -6,3 +6,16 @@
#define CHANGETURF_RECALC_ADJACENT 32 //Immediately recalc adjacent atmos turfs instead of queuing.
#define IS_OPAQUE_TURF(turf) (turf.directional_opacity == ALL_CARDINALS)
//supposedly the fastest way to do this according to https://gist.github.com/Giacom/be635398926bb463b42a
///Returns a list of turf in a square
#define RANGE_TURFS(RADIUS, CENTER) \
block( \
locate(max(CENTER.x-(RADIUS),1), max(CENTER.y-(RADIUS),1), CENTER.z), \
locate(min(CENTER.x+(RADIUS),world.maxx), min(CENTER.y+(RADIUS),world.maxy), CENTER.z) \
)
///Returns all turfs in a zlevel
#define Z_TURFS(ZLEVEL) block(locate(1,1,ZLEVEL), locate(world.maxx, world.maxy, ZLEVEL))
#define TURF_FROM_COORDS_LIST(List) (locate(List[1], List[2], List[3]))
+10
View File
@@ -618,3 +618,13 @@
? right_list.Copy()\
: null\
)
///Returns a list with items filtered from a list that can call callback
/proc/special_list_filter(list/list_to_filter, datum/callback/condition)
if(!islist(list_to_filter) || !length(list_to_filter) || !istype(condition))
return list()
. = list()
for(var/i in list_to_filter)
if(condition.Invoke(i))
. |= i
+72
View File
@@ -103,3 +103,75 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engineerin
return TRUE
#undef BP_MAX_ROOM_SIZE
//Repopulates sortedAreas list
/proc/repopulate_sorted_areas()
GLOB.sortedAreas = list()
for(var/area/A in world)
GLOB.sortedAreas.Add(A)
sortTim(GLOB.sortedAreas, /proc/cmp_name_asc)
/area/proc/addSorted()
GLOB.sortedAreas.Add(src)
sortTim(GLOB.sortedAreas, /proc/cmp_name_asc)
//Takes: Area type as a text string from a variable.
//Returns: Instance for the area in the world.
/proc/get_area_instance_from_text(areatext)
if(istext(areatext))
areatext = text2path(areatext)
return GLOB.areas_by_type[areatext]
//Takes: Area type as text string or as typepath OR an instance of the area.
//Returns: A list of all areas of that type in the world.
/proc/get_areas(areatype, subtypes=TRUE)
if(istext(areatype))
areatype = text2path(areatype)
else if(isarea(areatype))
var/area/areatemp = areatype
areatype = areatemp.type
else if(!ispath(areatype))
return null
var/list/areas = list()
if(subtypes)
var/list/cache = typecacheof(areatype)
for(var/area/area_to_check as anything in GLOB.sortedAreas)
if(cache[area_to_check.type])
areas += area_to_check
else
for(var/area/area_to_check as anything in GLOB.sortedAreas)
if(area_to_check.type == areatype)
areas += area_to_check
return areas
//Takes: Area type as text string or as typepath OR an instance of the area.
//Returns: A list of all turfs in areas of that type of that type in the world.
/proc/get_area_turfs(areatype, target_z = 0, subtypes=FALSE)
if(istext(areatype))
areatype = text2path(areatype)
else if(isarea(areatype))
var/area/areatemp = areatype
areatype = areatemp.type
else if(!ispath(areatype))
return null
var/list/turfs = list()
if(subtypes)
var/list/cache = typecacheof(areatype)
for(var/area/area_to_check as anything in GLOB.sortedAreas)
if(!cache[area_to_check.type])
continue
for(var/turf/turf_in_area in area_to_check)
if(target_z == 0 || target_z == turf_in_area.z)
turfs += turf_in_area
else
for(var/area/area_to_check as anything in GLOB.sortedAreas)
if(area_to_check.type != areatype)
continue
for(var/turf/turf_in_area in area_to_check)
if(target_z == 0 || target_z == turf_in_area.z)
turfs += turf_in_area
return turfs
+301
View File
@@ -0,0 +1,301 @@
///Returns the src and all recursive contents as a list.
/atom/proc/get_all_contents(ignore_flag_1)
. = list(src)
var/i = 0
while(i < length(.))
var/atom/checked_atom = .[++i]
if(checked_atom.flags_1 & ignore_flag_1)
continue
. += checked_atom.contents
///identical to get_all_contents but returns a list of atoms of the type passed in the argument.
/atom/proc/get_all_contents_type(type)
var/list/processing_list = list(src)
. = list()
while(length(processing_list))
var/atom/checked_atom = processing_list[1]
processing_list.Cut(1, 2)
processing_list += checked_atom.contents
if(istype(checked_atom, type))
. += checked_atom
///Like get_all_contents_type, but uses a typecache list as argument
/atom/proc/get_all_contents_ignoring(list/ignore_typecache)
if(!length(ignore_typecache))
return get_all_contents()
var/list/processing = list(src)
. = list()
var/i = 0
while(i < length(processing))
var/atom/checked_atom = processing[++i]
if(ignore_typecache[checked_atom.type])
continue
processing += checked_atom.contents
. += checked_atom
///Step-towards method of determining whether one atom can see another. Similar to viewers()
/proc/can_see(atom/source, atom/target, length=5) // I couldnt be arsed to do actual raycasting :I This is horribly inaccurate.
var/turf/current = get_turf(source)
var/turf/target_turf = get_turf(target)
if(get_dist(source, target) > length)
return FALSE
var/steps = 1
if(current == target_turf)//they are on the same turf, source can see the target
return TRUE
current = get_step_towards(current, target_turf)
while(current != target_turf)
if(steps > length)
return FALSE
if(IS_OPAQUE_TURF(current))
return FALSE
current = get_step_towards(current, target_turf)
steps++
return TRUE
///Get the cardinal direction between two atoms
/proc/get_cardinal_dir(atom/start, atom/end)
var/dx = abs(end.x - start.x)
var/dy = abs(end.y - start.y)
return get_dir(start, end) & (rand() * (dx+dy) < dy ? 3 : 12)
/**
* Finds the distance between two atoms, in pixels
* centered = FALSE counts from turf edge to edge
* centered = TRUE counts from turf center to turf center
* of course mathematically this is just adding world.icon_size on again
**/
/proc/get_pixel_distance(atom/start, atom/end, centered = TRUE)
if(!istype(start) || !istype(end))
return 0
. = bounds_dist(start, end) + sqrt((((start.pixel_x + end.pixel_x) ** 2) + ((start.pixel_y + end.pixel_y) ** 2)))
if(centered)
. += world.icon_size
///Check if there is already a wall item on the turf loc
/proc/got_wall_item(loc, dir, check_external = 0)
var/locdir = get_step(loc, dir)
for(var/obj/checked_object in loc)
if(is_type_in_typecache(checked_object, GLOB.WALLITEMS) && check_external != 2)
//Direction works sometimes
if(is_type_in_typecache(checked_object, GLOB.WALLITEMS_INVERSE))
if(checked_object.dir == turn(dir, 180))
return TRUE
else if(checked_object.dir == dir)
return TRUE
//Some stuff doesn't use dir properly, so we need to check pixel instead
//That's exactly what get_turf_pixel() does
if(get_turf_pixel(checked_object) == locdir)
return TRUE
if(is_type_in_typecache(checked_object, GLOB.WALLITEMS_EXTERNAL) && check_external)
if(is_type_in_typecache(checked_object, GLOB.WALLITEMS_INVERSE))
if(checked_object.dir == turn(dir, 180))
return TRUE
else if(checked_object.dir == dir)
return TRUE
//Some stuff is placed directly on the wallturf (signs)
for(var/obj/checked_object in locdir)
if(is_type_in_typecache(checked_object, GLOB.WALLITEMS) && check_external != 2)
if(checked_object.pixel_x == 0 && checked_object.pixel_y == 0)
return TRUE
return FALSE
///Forces the atom to take a step in a random direction
/proc/random_step(atom/movable/moving_atom, steps, chance)
var/initial_chance = chance
while(steps > 0)
if(prob(chance))
step(moving_atom, pick(GLOB.alldirs))
chance = max(chance - (initial_chance / steps), 0)
steps--
/**
* Compare source's dir, the clockwise dir of source and the anticlockwise dir of source
* To the opposite dir of the dir returned by get_dir(target,source)
* If one of them is a match, then source is facing target
**/
/proc/is_source_facing_target(atom/source,atom/target)
if(!istype(source) || !istype(target))
return FALSE
if(isliving(source))
var/mob/living/source_mob = source
if(source_mob.body_position == LYING_DOWN)
return FALSE
var/goal_dir = get_dir(source, target)
var/clockwise_source_dir = turn(source.dir, -45)
var/anticlockwise_source_dir = turn(source.dir, 45)
if(source.dir == goal_dir || clockwise_source_dir == goal_dir || anticlockwise_source_dir == goal_dir)
return TRUE
return FALSE
/*
rough example of the "cone" made by the 3 dirs checked
* \
* \
* >
* <
* \
* \
*B --><-- A
* /
* /
* <
* >
* /
* /
*/
///ultra range (no limitations on distance, faster than range for distances > 8); including areas drastically decreases performance
/proc/urange(dist = 0, atom/center = usr, orange = FALSE, areas = FALSE)
if(!dist)
if(!orange)
return list(center)
else
return list()
var/list/turfs = RANGE_TURFS(dist, center)
if(orange)
turfs -= get_turf(center)
. = list()
for(var/turf/checked_turf as anything in turfs)
. += checked_turf
. += checked_turf.contents
if(areas)
. |= checked_turf.loc
///similar function to range(), but with no limitations on the distance; will search spiralling outwards from the center
/proc/spiral_range(dist = 0, center = usr, orange = FALSE)
var/list/atom_list = list()
var/turf/t_center = get_turf(center)
if(!t_center)
return list()
if(!orange)
atom_list += t_center
atom_list += t_center.contents
if(!dist)
return atom_list
var/turf/checked_turf
var/y
var/x
var/c_dist = 1
while( c_dist <= dist )
y = t_center.y + c_dist
x = t_center.x - c_dist + 1
for(x in x to t_center.x + c_dist)
checked_turf = locate(x, y, t_center.z)
if(checked_turf)
atom_list += checked_turf
atom_list += checked_turf.contents
y = t_center.y + c_dist - 1
x = t_center.x + c_dist
for(y in t_center.y - c_dist to y)
checked_turf = locate(x, y, t_center.z)
if(checked_turf)
atom_list += checked_turf
atom_list += checked_turf.contents
y = t_center.y - c_dist
x = t_center.x + c_dist - 1
for(x in t_center.x - c_dist to x)
checked_turf = locate(x, y, t_center.z)
if(checked_turf)
atom_list += checked_turf
atom_list += checked_turf.contents
y = t_center.y - c_dist + 1
x = t_center.x - c_dist
for(y in y to t_center.y + c_dist)
checked_turf = locate(x, y, t_center.z)
if(checked_turf)
atom_list += checked_turf
atom_list += checked_turf.contents
c_dist++
return atom_list
///Returns the closest atom of a specific type in a list from a source
/proc/get_closest_atom(type, list/atom_list, source)
var/closest_atom
var/closest_distance
for(var/atom in atom_list)
if(!istype(atom, type))
continue
var/distance = get_dist(source, atom)
if(!closest_atom)
closest_distance = distance
closest_atom = atom
else
if(closest_distance > distance)
closest_distance = distance
closest_atom = atom
return closest_atom
///Returns a chosen path that is the closest to a list of matches
/proc/pick_closest_path(value, list/matches = get_fancy_list_of_atom_types())
if (value == FALSE) //nothing should be calling us with a number, so this is safe
value = input("Enter type to find (blank for all, cancel to cancel)", "Search for type") as null|text
if (isnull(value))
return
value = trim(value)
var/random = FALSE
if(findtext(value, "?"))
value = replacetext(value, "?", "")
random = TRUE
if(!isnull(value) && value != "")
matches = filter_fancy_list(matches, value)
if(matches.len==0)
return
var/chosen
if(matches.len==1)
chosen = matches[1]
else if(random)
chosen = pick(matches) || null
else
chosen = input("Select a type", "Pick Type", matches[1]) as null|anything in sortList(matches)
if(!chosen)
return
chosen = matches[chosen]
return chosen
///Creates new items inside an atom based on a list
/proc/generate_items_inside(list/items_list, where_to)
for(var/each_item in items_list)
for(var/i in 1 to items_list[each_item])
new each_item(where_to)
///Returns the atom type in the specified loc
/proc/get(atom/loc, type)
while(loc)
if(istype(loc, type))
return loc
loc = loc.loc
return null
///Returns true if the src countain the atom target
/atom/proc/contains(atom/target)
if(!target)
return FALSE
for(var/atom/location = target.loc, location, location = location.loc)
if(location == src)
return TRUE
///A do nothing proc
/proc/pass(...)
return
+12
View File
@@ -0,0 +1,12 @@
///Returns whether or not a player is a guest using their ckey as an input
/proc/is_guest_key(key)
if(findtext(key, "Guest-", 1, 7) != 1) //was findtextEx
return FALSE
var/i, ch, len = length(key)
for(i = 7, i <= len, ++i) //we know the first 6 chars are Guest-
ch = text2ascii(key, i)
if (ch < 48 || ch > 57) //0-9
return FALSE
return TRUE
+46
View File
@@ -17,3 +17,49 @@
final_color += copytext(color, digit, digit + 1)
return final_color
///Returns a random color picked from a list, has 2 modes (0 and 1), mode 1 doesn't pick white, black or gray
/proc/random_colour(mode = 0)
switch(mode)
if(0)
return pick("white","black","gray","red","green","blue","brown","yellow","orange","darkred",
"crimson","lime","darkgreen","cyan","navy","teal","purple","indigo")
if(1)
return pick("red","green","blue","brown","yellow","orange","darkred","crimson",
"lime","darkgreen","cyan","navy","teal","purple","indigo")
else
return "white"
///Inverts the colour of an HTML string
/proc/invert_HTML_colour(HTMLstring)
if(!istext(HTMLstring))
CRASH("Given non-text argument!")
else if(length(HTMLstring) != 7)
CRASH("Given non-HTML argument!")
else if(length_char(HTMLstring) != 7)
CRASH("Given non-hex symbols in argument!")
var/textr = copytext(HTMLstring, 2, 4)
var/textg = copytext(HTMLstring, 4, 6)
var/textb = copytext(HTMLstring, 6, 8)
return rgb(255 - hex2num(textr), 255 - hex2num(textg), 255 - hex2num(textb))
///Flash a color on the client
/proc/flash_color(mob_or_client, flash_color="#960000", flash_time=20)
var/client/flashed_client
if(ismob(mob_or_client))
var/mob/client_mob = mob_or_client
if(client_mob.client)
flashed_client = client_mob.client
else
return
else if(istype(mob_or_client, /client))
flashed_client = mob_or_client
if(!istype(flashed_client))
return
var/animate_color = flashed_client.color
flashed_client.color = flash_color
animate(flashed_client, color = animate_color, time = flash_time)
#define RANDOM_COLOUR (rgb(rand(0,255),rand(0,255),rand(0,255)))
+9
View File
@@ -0,0 +1,9 @@
///Check if a datum has not been deleted and is a valid source
/proc/is_valid_src(datum/source_datum)
if(istype(source_datum))
return !QDELETED(source_datum)
return FALSE
/proc/call_async(datum/source, proc_type, list/arguments)
set waitfor = FALSE
return call(source, proc_type)(arglist(arguments))
-10
View File
@@ -1,13 +1,3 @@
//supposedly the fastest way to do this according to https://gist.github.com/Giacom/be635398926bb463b42a
///Returns a list of turf in a square
#define RANGE_TURFS(RADIUS, CENTER) \
block( \
locate(max(CENTER.x-(RADIUS),1), max(CENTER.y-(RADIUS),1), CENTER.z), \
locate(min(CENTER.x+(RADIUS),world.maxx), min(CENTER.y+(RADIUS),world.maxy), CENTER.z) \
)
///Returns all turfs in a zlevel
#define Z_TURFS(ZLEVEL) block(locate(1,1,ZLEVEL), locate(world.maxx, world.maxy, ZLEVEL))
///Time before being allowed to select a new cult leader again
#define CULT_POLL_WAIT 240 SECONDS
+42
View File
@@ -92,3 +92,45 @@
for(var/path as anything in subtypesof(prototype))
L[path] = new path()
return L
/**
* Checks if that loc and dir has an item on the wall
**/
GLOBAL_LIST_INIT(WALLITEMS, typecacheof(list(
/obj/item/radio/intercom,
/obj/item/storage/secure/safe,
/obj/machinery/airalarm,
/obj/machinery/bounty_board,
/obj/machinery/button,
/obj/machinery/computer/security/telescreen,
/obj/machinery/computer/security/telescreen/entertainment,
/obj/machinery/door_timer,
/obj/machinery/embedded_controller/radio/simple_vent_controller,
/obj/machinery/firealarm,
/obj/machinery/flasher,
/obj/machinery/keycard_auth,
/obj/machinery/light_switch,
/obj/machinery/newscaster,
/obj/machinery/power/apc,
/obj/machinery/requests_console,
/obj/machinery/status_display,
/obj/structure/extinguisher_cabinet,
/obj/structure/fireaxecabinet,
/obj/structure/mirror,
/obj/structure/noticeboard,
/obj/structure/reagent_dispensers/peppertank,
/obj/structure/sign,
/obj/structure/sign/picture_frame
)))
GLOBAL_LIST_INIT(WALLITEMS_EXTERNAL, typecacheof(list(
/obj/machinery/camera,
/obj/machinery/light,
/obj/structure/camera_assembly,
/obj/structure/light_construct
)))
GLOBAL_LIST_INIT(WALLITEMS_INVERSE, typecacheof(list(
/obj/machinery/light,
/obj/structure/light_construct
)))
+19
View File
@@ -0,0 +1,19 @@
/**
* returns a GUID like identifier (using a mostly made up record format)
* guids are not on their own suitable for access or security tokens, as most of their bits are predictable.
* (But may make a nice salt to one)
**/
/proc/GUID()
var/const/GUID_VERSION = "b"
var/const/GUID_VARIANT = "d"
var/node_id = copytext_char(md5("[rand()*rand(1,9999999)][world.name][world.hub][world.hub_password][world.internet_address][world.address][world.contents.len][world.status][world.port][rand()*rand(1,9999999)]"), 1, 13)
var/time_high = "[num2hex(text2num(time2text(world.realtime,"YYYY")), 2)][num2hex(world.realtime, 6)]"
var/time_mid = num2hex(world.timeofday, 4)
var/time_low = num2hex(world.time, 3)
var/time_clock = num2hex(TICK_DELTA_TO_MS(world.tick_usage), 3)
return "{[time_high]-[time_mid]-[GUID_VERSION][time_low]-[GUID_VARIANT][time_clock]-[node_id]}"
+55
View File
@@ -1266,3 +1266,58 @@ GLOBAL_LIST_EMPTY(transformation_animation_objects)
GLOB.transformation_animation_objects -= src
if(filters && length(filters) >= filter_index)
filters -= filters[filter_index]
/**
* Center's an image.
* Requires:
* The Image
* The x dimension of the icon file used in the image
* The y dimension of the icon file used in the image
* eg: center_image(image_to_center, 32,32)
* eg2: center_image(image_to_center, 96,96)
**/
/proc/center_image(image/image_to_center, x_dimension = 0, y_dimension = 0)
if(!image_to_center)
return
if(!x_dimension || !y_dimension)
return
if((x_dimension == world.icon_size) && (y_dimension == world.icon_size))
return image_to_center
//Offset the image so that it's bottom left corner is shifted this many pixels
//This makes it infinitely easier to draw larger inhands/images larger than world.iconsize
//but still use them in game
var/x_offset = -((x_dimension / world.icon_size) - 1) * (world.icon_size * 0.5)
var/y_offset = -((y_dimension / world.icon_size) - 1) * (world.icon_size * 0.5)
//Correct values under world.icon_size
if(x_dimension < world.icon_size)
x_offset *= -1
if(y_dimension < world.icon_size)
y_offset *= -1
image_to_center.pixel_x = x_offset
image_to_center.pixel_y = y_offset
return image_to_center
///Flickers an overlay on an atom
/proc/flick_overlay_static(overlay_image, atom/source, duration)
set waitfor = FALSE
if(!source || !overlay_image)
return
source.add_overlay(overlay_image)
sleep(duration)
source.cut_overlay(overlay_image)
///Perform a shake on an atom, resets its position afterwards
/atom/proc/Shake(pixelshiftx = 15, pixelshifty = 15, duration = 250)
var/initialpixelx = pixel_x
var/initialpixely = pixel_y
var/shiftx = rand(-pixelshiftx,pixelshiftx)
var/shifty = rand(-pixelshifty,pixelshifty)
animate(src, pixel_x = pixel_x + shiftx, pixel_y = pixel_y + shifty, time = 0.2, loop = duration)
pixel_x = initialpixelx
pixel_y = initialpixely
+119
View File
@@ -0,0 +1,119 @@
///Calculate the angle between two points and the west|east coordinate
/proc/get_angle(atom/movable/start, atom/movable/end)//For beams.
if(!start || !end)
return 0
var/dy
var/dx
dy=(32 * end.y + end.pixel_y) - (32 * start.y + start.pixel_y)
dx=(32 * end.x + end.pixel_x) - (32 * start.x + start.pixel_x)
if(!dy)
return (dx >= 0) ? 90 : 270
. = arctan(dx/dy)
if(dy < 0)
. += 180
else if(dx < 0)
. += 360
///for getting the angle when animating something's pixel_x and pixel_y
/proc/get_pixel_angle(y, x)
if(!y)
return (x >= 0) ? 90 : 270
. = arctan(x/y)
if(y < 0)
. += 180
else if(x < 0)
. += 360
/**
* Get a list of turfs in a line from `starting_atom` to `ending_atom`.
*
* Uses the ultra-fast [Bresenham Line-Drawing Algorithm](https://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm).
*/
/proc/get_line(atom/starting_atom, atom/ending_atom)
var/px = starting_atom.x //starting x
var/py = starting_atom.y
var/line[] = list(locate(px, py, starting_atom.z))
var/dx = ending_atom.x - px //x distance
var/dy = ending_atom.y - py
var/dxabs = abs(dx)//Absolute value of x distance
var/dyabs = abs(dy)
var/sdx = SIGN(dx) //Sign of x distance (+ or -)
var/sdy = SIGN(dy)
var/x = dxabs >> 1 //Counters for steps taken, setting to distance/2
var/y = dyabs >> 1 //Bit-shifting makes me l33t. It also makes get_line() unnessecarrily fast.
var/j //Generic integer for counting
if(dxabs >= dyabs) //x distance is greater than y
for(j = 0; j < dxabs; j++)//It'll take dxabs steps to get there
y += dyabs
if(y >= dxabs) //Every dyabs steps, step once in y direction
y -= dxabs
py += sdy
px += sdx //Step on in x direction
line += locate(px, py, starting_atom.z)//Add the turf to the list
else
for(j=0 ;j < dyabs; j++)
x += dxabs
if(x >= dyabs)
x -= dyabs
px += sdx
py += sdy
line += locate(px, py, starting_atom.z)
return line
///Format a power value in W, kW, MW, or GW.
/proc/display_power(powerused)
if(powerused < 1000) //Less than a kW
return "[powerused] W"
else if(powerused < 1000000) //Less than a MW
return "[round((powerused * 0.001),0.01)] kW"
else if(powerused < 1000000000) //Less than a GW
return "[round((powerused * 0.000001),0.001)] MW"
return "[round((powerused * 0.000000001),0.0001)] GW"
///Format an energy value in J, kJ, MJ, or GJ. 1W = 1J/s.
/proc/display_joules(units)
if (units < 1000) // Less than a kJ
return "[round(units, 0.1)] J"
else if (units < 1000000) // Less than a MJ
return "[round(units * 0.001, 0.01)] kJ"
else if (units < 1000000000) // Less than a GJ
return "[round(units * 0.000001, 0.001)] MJ"
return "[round(units * 0.000000001, 0.0001)] GJ"
///Format an energy value measured in Power Cell units.
/proc/display_energy(units)
// APCs process every (SSmachines.wait * 0.1) seconds, and turn 1 W of
// excess power into watts when charging cells.
// With the current configuration of wait=20 and CELLRATE=0.002, this
// means that one unit is 1 kJ.
return display_joules(units * SSmachines.wait * 0.1 WATTS)
///chances are 1:value. anyprob(1) will always return true
/proc/anyprob(value)
return (rand(1,value)==value)
///counts the number of bits in Byond's 16-bit width field, in constant time and memory!
/proc/bit_count(bit_field)
var/temp = bit_field - ((bit_field >> 1) & 46811) - ((bit_field >> 2) & 37449) //0133333 and 0111111 respectively
temp = ((temp + (temp >> 3)) & 29127) % 63 //070707
return temp
/// Returns the name of the mathematical tuple of same length as the number arg (rounded down).
/proc/make_tuple(number)
var/static/list/units_prefix = list("", "un", "duo", "tre", "quattuor", "quin", "sex", "septen", "octo", "novem")
var/static/list/tens_prefix = list("", "decem", "vigin", "trigin", "quadragin", "quinquagin", "sexagin", "septuagin", "octogin", "nongen")
var/static/list/one_to_nine = list("monuple", "double", "triple", "quadruple", "quintuple", "sextuple", "septuple", "octuple", "nonuple")
number = round(number)
switch(number)
if(0)
return "empty tuple"
if(1 to 9)
return one_to_nine[number]
if(10 to 19)
return "[units_prefix[(number%10)+1]]decuple"
if(20 to 99)
return "[units_prefix[(number%10)+1]][tens_prefix[round((number % 100)/10)+1]]tuple"
if(100)
return "centuple"
else //It gets too tedious to use latin prefixes from here.
return "[number]-tuple"
+195
View File
@@ -679,3 +679,198 @@ GLOBAL_LIST_EMPTY(species_list)
/// Gets the client of the mob, allowing for mocking of the client.
/// You only need to use this if you know you're going to be mocking clients somewhere else.
#define GET_CLIENT(mob) (##mob.client || ##mob.mock_client)
///Orders mobs by type then by name. Accepts optional arg to sort a custom list, otherwise copies GLOB.mob_list.
/proc/sort_mobs()
var/list/moblist = list()
var/list/sortmob = sortNames(GLOB.mob_list)
for(var/mob/living/silicon/ai/mob_to_sort in sortmob)
moblist += mob_to_sort
for(var/mob/camera/mob_to_sort in sortmob)
moblist += mob_to_sort
for(var/mob/living/silicon/pai/mob_to_sort in sortmob)
moblist += mob_to_sort
for(var/mob/living/silicon/robot/mob_to_sort in sortmob)
moblist += mob_to_sort
for(var/mob/living/carbon/human/mob_to_sort in sortmob)
moblist += mob_to_sort
for(var/mob/living/brain/mob_to_sort in sortmob)
moblist += mob_to_sort
for(var/mob/living/carbon/alien/mob_to_sort in sortmob)
moblist += mob_to_sort
for(var/mob/dead/observer/mob_to_sort in sortmob)
moblist += mob_to_sort
for(var/mob/dead/new_player/mob_to_sort in sortmob)
moblist += mob_to_sort
for(var/mob/living/simple_animal/slime/mob_to_sort in sortmob)
moblist += mob_to_sort
for(var/mob/living/simple_animal/mob_to_sort in sortmob)
// We've already added slimes.
if(isslime(mob_to_sort))
continue
moblist += mob_to_sort
for(var/mob/living/basic/mob_to_sort in sortmob)
moblist += mob_to_sort
return moblist
///returns a mob type controlled by a specified ckey
/proc/get_mob_by_ckey(key)
if(!key)
return
var/list/mobs = sort_mobs()
for(var/mob/mob in mobs)
if(mob.ckey == key)
return mob
///Return a string for the specified body zone
/proc/parse_zone(zone)
if(zone == BODY_ZONE_PRECISE_R_HAND)
return "right hand"
else if (zone == BODY_ZONE_PRECISE_L_HAND)
return "left hand"
else if (zone == BODY_ZONE_L_ARM)
return "left arm"
else if (zone == BODY_ZONE_R_ARM)
return "right arm"
else if (zone == BODY_ZONE_L_LEG)
return "left leg"
else if (zone == BODY_ZONE_R_LEG)
return "right leg"
else if (zone == BODY_ZONE_PRECISE_L_FOOT)
return "left foot"
else if (zone == BODY_ZONE_PRECISE_R_FOOT)
return "right foot"
else
return zone
///Returns the direction that the initiator and the target are facing
/proc/check_target_facings(mob/living/initiator, mob/living/target)
/*This can be used to add additional effects on interactions between mobs depending on how the mobs are facing each other, such as adding a crit damage to blows to the back of a guy's head.
Given how click code currently works (Nov '13), the initiating mob will be facing the target mob most of the time
That said, this proc should not be used if the change facing proc of the click code is overridden at the same time*/
if(!isliving(target) || target.body_position == LYING_DOWN)
//Make sure we are not doing this for things that can't have a logical direction to the players given that the target would be on their side
return FALSE
if(initiator.dir == target.dir) //mobs are facing the same direction
return FACING_SAME_DIR
if(is_source_facing_target(initiator,target) && is_source_facing_target(target,initiator)) //mobs are facing each other
return FACING_EACHOTHER
if(initiator.dir + 2 == target.dir || initiator.dir - 2 == target.dir || initiator.dir + 6 == target.dir || initiator.dir - 6 == target.dir) //Initating mob is looking at the target, while the target mob is looking in a direction perpendicular to the 1st
return FACING_INIT_FACING_TARGET_TARGET_FACING_PERPENDICULAR
///Returns the occupant mob or brain from a specified input
/proc/get_mob_or_brainmob(occupant)
var/mob/living/mob_occupant
if(isliving(occupant))
mob_occupant = occupant
else if(isbodypart(occupant))
var/obj/item/bodypart/head/head = occupant
mob_occupant = head.brainmob
else if(isorgan(occupant))
var/obj/item/organ/brain/brain = occupant
mob_occupant = brain.brainmob
return mob_occupant
///Generalised helper proc for letting mobs rename themselves. Used to be clname() and ainame()
/mob/proc/apply_pref_name(preference_type, client/requesting_client)
if(!requesting_client)
requesting_client = client
var/oldname = real_name
var/newname
var/loop = 1
var/safety = 0
var/random = CONFIG_GET(flag/force_random_names) || (requesting_client ? is_banned_from(requesting_client.ckey, "Appearance") : FALSE)
while(loop && safety < 5)
if(!safety && !random)
newname = requesting_client?.prefs?.read_preference(preference_type)
else
var/datum/preference/preference = GLOB.preference_entries[preference_type]
newname = preference.create_informed_default_value(requesting_client.prefs)
for(var/mob/living/checked_mob in GLOB.player_list)
if(checked_mob == src)
continue
if(!newname || checked_mob.real_name == newname)
newname = null
loop++ // name is already taken so we roll again
break
loop--
safety++
if(newname)
fully_replace_character_name(oldname, newname)
return TRUE
return FALSE
///Returns the amount of currently living players
/proc/living_player_count()
var/living_player_count = 0
for(var/mob in GLOB.player_list)
if(mob in GLOB.alive_mob_list)
living_player_count += 1
return living_player_count
GLOBAL_DATUM_INIT(dview_mob, /mob/dview, new)
///Version of view() which ignores darkness, because BYOND doesn't have it (I actually suggested it but it was tagged redundant, BUT HEARERS IS A T- /rant).
/proc/dview(range = world.view, center, invis_flags = 0)
if(!center)
return
GLOB.dview_mob.loc = center
GLOB.dview_mob.see_invisible = invis_flags
. = view(range, GLOB.dview_mob)
GLOB.dview_mob.loc = null
/mob/dview
name = "INTERNAL DVIEW MOB"
invisibility = 101
density = FALSE
see_in_dark = 1e6
move_resist = INFINITY
var/ready_to_die = FALSE
/mob/dview/Initialize(mapload) //Properly prevents this mob from gaining huds or joining any global lists
SHOULD_CALL_PARENT(FALSE)
if(flags_1 & INITIALIZED_1)
stack_trace("Warning: [src]([type]) initialized multiple times!")
flags_1 |= INITIALIZED_1
return INITIALIZE_HINT_NORMAL
/mob/dview/Destroy(force = FALSE)
if(!ready_to_die)
stack_trace("ALRIGHT WHICH FUCKER TRIED TO DELETE *MY* DVIEW?")
if (!force)
return QDEL_HINT_LETMELIVE
log_world("EVACUATE THE SHITCODE IS TRYING TO STEAL MUH JOBS")
GLOB.dview_mob = new
return ..()
#define FOR_DVIEW(type, range, center, invis_flags) \
GLOB.dview_mob.loc = center; \
GLOB.dview_mob.see_invisible = invis_flags; \
for(type in view(range, GLOB.dview_mob))
#define FOR_DVIEW_END GLOB.dview_mob.loc = null
///Makes a call in the context of a different usr. Use sparingly
/world/proc/push_usr(mob/user_mob, datum/callback/invoked_callback, ...)
var/temp = usr
usr = user_mob
if (length(args) > 2)
. = invoked_callback.Invoke(arglist(args.Copy(3)))
else
. = invoked_callback.Invoke()
usr = temp
+46
View File
@@ -0,0 +1,46 @@
///Get a random food item exluding the blocked ones
/proc/get_random_food()
var/list/blocked = list(/obj/item/food/bread,
/obj/item/food/breadslice,
/obj/item/food/cake,
/obj/item/food/cakeslice,
/obj/item/food/pie,
/obj/item/food/pieslice,
/obj/item/food/kebab,
/obj/item/food/pizza,
/obj/item/food/pizzaslice,
/obj/item/food/salad,
/obj/item/food/meat,
/obj/item/food/meat/slab,
/obj/item/food/soup,
/obj/item/food/grown,
/obj/item/food/grown/mushroom,
/obj/item/food/deepfryholder,
/obj/item/food/clothing,
/obj/item/food/meat/slab/human/mutant,
/obj/item/food/grown/ash_flora,
/obj/item/food/grown/nettle,
/obj/item/food/grown/shell
)
return pick(subtypesof(/obj/item/food) - blocked)
///Gets a random drink excluding the blocked type
/proc/get_random_drink()
var/list/blocked = list(
/obj/item/reagent_containers/food/drinks/soda_cans,
/obj/item/reagent_containers/food/drinks/bottle
)
return pick(subtypesof(/obj/item/reagent_containers/food/drinks) - blocked)
///Picks a string of symbols to display as the law number for hacked or ion laws
/proc/ion_num() //! is at the start to prevent us from changing say modes via get_message_mode()
return "![pick("!","@","#","$","%","^","&")][pick("!","@","#","$","%","^","&","*")][pick("!","@","#","$","%","^","&","*")][pick("!","@","#","$","%","^","&","*")]"
///Returns a string for a random nuke code
/proc/random_nukecode()
var/val = rand(0, 99999)
var/str = "[val]"
while(length(str) < 5)
str = "0" + str
. = str
+15
View File
@@ -0,0 +1,15 @@
/**
* \ref behaviour got changed in 512 so this is necesary to replicate old behaviour.
* If it ever becomes necesary to get a more performant REF(), this lies here in wait
* #define REF(thing) (thing && istype(thing, /datum) && (thing:datum_flags & DF_USE_TAG) && thing:tag ? "[thing:tag]" : "\ref[thing]")
**/
/proc/REF(input)
if(istype(input, /datum))
var/datum/thing = input
if(thing.datum_flags & DF_USE_TAG)
if(!thing.tag)
stack_trace("A ref was requested of an object with DF_USE_TAG set but no tag: [thing]")
thing.datum_flags &= ~DF_USE_TAG
else
return "\[[url_encode(thing.tag)]\]"
return "\ref[input]"
+43
View File
@@ -0,0 +1,43 @@
/**
* One proc for easy spawning of pods in the code to drop off items before whizzling (please don't proc call this in game, it will destroy you)
*
* Arguments:
* * specifications: special mods to the pod, see non var edit specifications for details on what you should fill this with
* Non var edit specifications:
* * target = where you want the pod to drop
* * path = a special specific pod path if you want, this can save you a lot of var edits
* * style = style of the pod, defaults to the normal pod
* * spawn = spawned path or a list of the paths spawned, what you're sending basically
* Returns the pod spawned, in case you want to spawn items yourself and modify them before putting them in.
*/
/proc/podspawn(specifications)
//get non var edit specifications
var/turf/landing_location = specifications["target"]
var/spawn_type = specifications["path"]
var/style = specifications["style"]
var/list/paths_to_spawn = specifications["spawn"]
//setup pod, add contents
if(!isturf(landing_location))
landing_location = get_turf(landing_location)
if(!spawn_type)
spawn_type = /obj/structure/closet/supplypod/podspawn
var/obj/structure/closet/supplypod/podspawn/pod = new spawn_type(null, style)
if(paths_to_spawn && !islist(paths_to_spawn))
paths_to_spawn = list(paths_to_spawn)
for(var/atom/path as anything in paths_to_spawn)
path = new path(pod)
//remove non var edits from specifications
specifications -= "target"
specifications -= "style"
specifications -= "path"
specifications -= "spawn" //list, we remove the key
//rest of specificiations are edits on the pod
for(var/variable_name in specifications)
var/variable_value = specifications[variable_name]
if(!pod.vv_edit_var(variable_name, variable_value))
stack_trace("WARNING! podspawn vareditting \"[variable_name]\" to \"[variable_value]\" was rejected by the pod!")
new /obj/effect/pod_landingzone(landing_location, pod)
return pod
+11
View File
@@ -0,0 +1,11 @@
///gives us the stack trace from CRASH() without ending the current proc.
/proc/stack_trace(msg)
CRASH(msg)
GLOBAL_REAL_VAR(list/stack_trace_storage)
/proc/gib_stack_trace()
stack_trace_storage = list()
stack_trace()
stack_trace_storage.Cut(1, min(3,stack_trace_storage.len))
. = stack_trace_storage
stack_trace_storage = null
+23
View File
@@ -0,0 +1,23 @@
//Key thing that stops lag. Cornerstone of performance in ss13, Just sitting here, in unsorted.dm. Now with dedicated file!
///Increases delay as the server gets more overloaded, as sleeps aren't cheap and sleeping only to wake up and sleep again is wasteful
#define DELTA_CALC max(((max(TICK_USAGE, world.cpu) / 100) * max(Master.sleep_delta-1,1)), 1)
///returns the number of ticks slept
/proc/stoplag(initial_delay)
if (!Master || !(Master.current_runlevel & RUNLEVELS_DEFAULT))
sleep(world.tick_lag)
return 1
if (!initial_delay)
initial_delay = world.tick_lag
. = 0
var/i = DS2TICKS(initial_delay)
do
. += CEILING(i * DELTA_CALC, 1)
sleep(i * world.tick_lag * DELTA_CALC)
i *= 2
while (TICK_USAGE > min(TICK_LIMIT_TO_RUN, Master.current_ticklimit))
#undef DELTA_CALC
#define UNTIL(X) while(!(X)) stoplag()
+25 -3
View File
@@ -989,12 +989,12 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
return word + "ay"
//otherwise unmutated
return word
/**
* The procedure to check the text of the entered text on ntnrc_client.dm
*
* This procedure is designed to check the text you type into the chat client.
* It checks for invalid characters and the size of the entered text.
* This procedure is designed to check the text you type into the chat client.
* It checks for invalid characters and the size of the entered text.
*/
/proc/reject_bad_chattext(text, max_length = 256)
var/non_whitespace = FALSE
@@ -1013,3 +1013,25 @@ GLOBAL_LIST_INIT(binary, list("0","1"))
non_whitespace = TRUE
if (non_whitespace)
return text
///Properly format a string of text by using replacetext()
/proc/format_text(text)
return replacetext(replacetext(text,"\proper ",""),"\improper ","")
///Returns a string based on the weight class define used as argument
/proc/weight_class_to_text(w_class)
switch(w_class)
if(WEIGHT_CLASS_TINY)
. = "tiny"
if(WEIGHT_CLASS_SMALL)
. = "small"
if(WEIGHT_CLASS_NORMAL)
. = "normal-sized"
if(WEIGHT_CLASS_BULKY)
. = "bulky"
if(WEIGHT_CLASS_HUGE)
. = "huge"
if(WEIGHT_CLASS_GIGANTIC)
. = "gigantic"
else
. = ""
+30
View File
@@ -0,0 +1,30 @@
#define TRAIT_CALLBACK_ADD(target, trait, source) CALLBACK(GLOBAL_PROC, /proc/___TraitAdd, ##target, ##trait, ##source)
#define TRAIT_CALLBACK_REMOVE(target, trait, source) CALLBACK(GLOBAL_PROC, /proc/___TraitRemove, ##target, ##trait, ##source)
///DO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback.
/proc/___TraitAdd(target,trait,source)
if(!target || !trait || !source)
return
if(islist(target))
for(var/i in target)
if(!isatom(i))
continue
var/atom/the_atom = i
ADD_TRAIT(the_atom,trait,source)
else if(isatom(target))
var/atom/the_atom2 = target
ADD_TRAIT(the_atom2,trait,source)
///DO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback.
/proc/___TraitRemove(target,trait,source)
if(!target || !trait || !source)
return
if(islist(target))
for(var/i in target)
if(!isatom(i))
continue
var/atom/the_atom = i
REMOVE_TRAIT(the_atom,trait,source)
else if(isatom(target))
var/atom/the_atom2 = target
REMOVE_TRAIT(the_atom2,trait,source)
+384
View File
@@ -0,0 +1,384 @@
///Returns location. Returns null if no location was found.
/proc/get_teleport_loc(turf/location,mob/target,distance = 1, density = FALSE, errorx = 0, errory = 0, eoffsetx = 0, eoffsety = 0)
/*
Location where the teleport begins, target that will teleport, distance to go, density checking 0/1(yes/no).
Random error in tile placement x, error in tile placement y, and block offset.
Block offset tells the proc how to place the box. Behind teleport location, relative to starting location, forward, etc.
Negative values for offset are accepted, think of it in relation to North, -x is west, -y is south. Error defaults to positive.
Turf and target are separate in case you want to teleport some distance from a turf the target is not standing on or something.
*/
var/dirx = 0//Generic location finding variable.
var/diry = 0
var/xoffset = 0//Generic counter for offset location.
var/yoffset = 0
var/b1xerror = 0//Generic placing for point A in box. The lower left.
var/b1yerror = 0
var/b2xerror = 0//Generic placing for point B in box. The upper right.
var/b2yerror = 0
errorx = abs(errorx)//Error should never be negative.
errory = abs(errory)
switch(target.dir)//This can be done through equations but switch is the simpler method. And works fast to boot.
//Directs on what values need modifying.
if(1)//North
diry += distance
yoffset += eoffsety
xoffset += eoffsetx
b1xerror -= errorx
b1yerror -= errory
b2xerror += errorx
b2yerror += errory
if(2)//South
diry -= distance
yoffset -= eoffsety
xoffset += eoffsetx
b1xerror -= errorx
b1yerror -= errory
b2xerror += errorx
b2yerror += errory
if(4)//East
dirx += distance
yoffset += eoffsetx//Flipped.
xoffset += eoffsety
b1xerror -= errory//Flipped.
b1yerror -= errorx
b2xerror += errory
b2yerror += errorx
if(8)//West
dirx -= distance
yoffset -= eoffsetx//Flipped.
xoffset += eoffsety
b1xerror -= errory//Flipped.
b1yerror -= errorx
b2xerror += errory
b2yerror += errorx
var/turf/destination = locate(location.x+dirx,location.y+diry,location.z)
if(!destination)//If there isn't a destination.
return
if(!errorx && !errory)//If errorx or y were not specified.
if(density&&destination.density)
return
if(destination.x>world.maxx || destination.x<1)
return
if(destination.y>world.maxy || destination.y<1)
return
var/destination_list[] = list()//To add turfs to list.
//destination_list = new()
/*This will draw a block around the target turf, given what the error is.
Specifying the values above will basically draw a different sort of block.
If the values are the same, it will be a square. If they are different, it will be a rectengle.
In either case, it will center based on offset. Offset is position from center.
Offset always calculates in relation to direction faced. In other words, depending on the direction of the teleport,
the offset should remain positioned in relation to destination.*/
var/turf/center = locate((destination.x + xoffset), (destination.y + yoffset), location.z)//So now, find the new center.
//Now to find a box from center location and make that our destination.
for(var/turf/current_turf in block(locate(center.x + b1xerror, center.y + b1yerror, location.z), locate(center.x + b2xerror, center.y + b2yerror, location.z)))
if(density && current_turf.density)
continue//If density was specified.
if(current_turf.x > world.maxx || current_turf.x < 1)
continue//Don't want them to teleport off the map.
if(current_turf.y > world.maxy || current_turf.y < 1)
continue
destination_list += current_turf
if(!destination_list.len)
return
destination = pick(destination_list)
return destination
/**
* Returns the atom sitting on the turf.
* For example, using this on a disk, which is in a bag, on a mob, will return the mob because it's on the turf.
* Optional arg 'type' to stop once it reaches a specific type instead of a turf.
**/
/proc/get_atom_on_turf(atom/movable/atom_on_turf, stop_type)
var/atom/turf_to_check = atom_on_turf
while(turf_to_check?.loc && !isturf(turf_to_check.loc))
turf_to_check = turf_to_check.loc
if(stop_type && istype(turf_to_check, stop_type))
break
return turf_to_check
///Returns a list of all locations (except the area) the movable is within.
/proc/get_nested_locs(atom/movable/atom_on_location, include_turf = FALSE)
. = list()
var/atom/location = atom_on_location.loc
var/turf/turf = get_turf(atom_on_location)
while(location && location != turf)
. += location
location = location.loc
if(location && include_turf) //At this point, only the turf is left, provided it exists.
. += location
///Returns the turf located at the map edge in the specified direction relative to target_atom used for mass driver
/proc/get_edge_target_turf(atom/target_atom, direction)
var/turf/target = locate(target_atom.x, target_atom.y, target_atom.z)
if(!target_atom || !target)
return 0
//since NORTHEAST == NORTH|EAST, etc, doing it this way allows for diagonal mass drivers in the future
//and isn't really any more complicated
var/x = target_atom.x
var/y = target_atom.y
if(direction & NORTH)
y = world.maxy
else if(direction & SOUTH) //you should not have both NORTH and SOUTH in the provided direction
y = 1
if(direction & EAST)
x = world.maxx
else if(direction & WEST)
x = 1
if(ISDIAGONALDIR(direction)) //let's make sure it's accurately-placed for diagonals
var/lowest_distance_to_map_edge = min(abs(x - target_atom.x), abs(y - target_atom.y))
return get_ranged_target_turf(target_atom, direction, lowest_distance_to_map_edge)
return locate(x,y,target_atom.z)
// returns turf relative to target_atom in given direction at set range
// result is bounded to map size
// note range is non-pythagorean
// used for disposal system
/proc/get_ranged_target_turf(atom/target_atom, direction, range)
var/x = target_atom.x
var/y = target_atom.y
if(direction & NORTH)
y = min(world.maxy, y + range)
else if(direction & SOUTH)
y = max(1, y - range)
if(direction & EAST)
x = min(world.maxx, x + range)
else if(direction & WEST) //if you have both EAST and WEST in the provided direction, then you're gonna have issues
x = max(1, x - range)
return locate(x,y,target_atom.z)
/**
* Get ranged target turf, but with direct targets as opposed to directions
*
* Starts at atom starting_atom and gets the exact angle between starting_atom and target
* Moves from starting_atom with that angle, Range amount of times, until it stops, bound to map size
* Arguments:
* * starting_atom - Initial Firer / Position
* * target - Target to aim towards
* * range - Distance of returned target turf from starting_atom
* * offset - Angle offset, 180 input would make the returned target turf be in the opposite direction
*/
/proc/get_ranged_target_turf_direct(atom/starting_atom, atom/target, range, offset)
var/angle = ATAN2(target.x - starting_atom.x, target.y - starting_atom.y)
if(offset)
angle += offset
var/turf/starting_turf = get_turf(starting_atom)
for(var/i in 1 to range)
var/turf/check = locate(starting_atom.x + cos(angle) * i, starting_atom.y + sin(angle) * i, starting_atom.z)
if(!check)
break
starting_turf = check
return starting_turf
/// returns turf relative to target_atom offset in dx and dy tiles, bound to map limits
/proc/get_offset_target_turf(atom/target_atom, dx, dy)
var/x = min(world.maxx, max(1, target_atom.x + dx))
var/y = min(world.maxy, max(1, target_atom.y + dy))
return locate(x, y, target_atom.z)
/**
* Lets the turf this atom's *ICON* appears to inhabit
* it takes into account:
* Pixel_x/y
* Matrix x/y
* NOTE: if your atom has non-standard bounds then this proc
* will handle it, but:
* if the bounds are even, then there are an even amount of "middle" turfs, the one to the EAST, NORTH, or BOTH is picked
* this may seem bad, but you're atleast as close to the center of the atom as possible, better than byond's default loc being all the way off)
* if the bounds are odd, the true middle turf of the atom is returned
**/
/proc/get_turf_pixel(atom/checked_atom)
if(!istype(checked_atom))
return
//Find checked_atom's matrix so we can use it's X/Y pixel shifts
var/matrix/atom_matrix = matrix(checked_atom.transform)
var/pixel_x_offset = checked_atom.pixel_x + atom_matrix.get_x_shift()
var/pixel_y_offset = checked_atom.pixel_y + atom_matrix.get_y_shift()
//Irregular objects
var/icon/checked_atom_icon = icon(checked_atom.icon, checked_atom.icon_state)
var/checked_atom_icon_height = checked_atom_icon.Height()
var/checked_atom_icon_width = checked_atom_icon.Width()
if(checked_atom_icon_height != world.icon_size || checked_atom_icon_width != world.icon_size)
pixel_x_offset += ((checked_atom_icon_width / world.icon_size) - 1) * (world.icon_size * 0.5)
pixel_y_offset += ((checked_atom_icon_height / world.icon_size) - 1) * (world.icon_size * 0.5)
//DY and DX
var/rough_x = round(round(pixel_x_offset, world.icon_size) / world.icon_size)
var/rough_y = round(round(pixel_y_offset, world.icon_size) / world.icon_size)
//Find coordinates
var/turf/atom_turf = get_turf(checked_atom) //use checked_atom's turfs, as it's coords are the same as checked_atom's AND checked_atom's coords are lost if it is inside another atom
if(!atom_turf)
return null
var/final_x = atom_turf.x + rough_x
var/final_y = atom_turf.y + rough_y
if(final_x || final_y)
return locate(final_x, final_y, atom_turf.z)
///Returns a turf based on text inputs, original turf and viewing client
/proc/params_to_turf(scr_loc, turf/origin, client/viewing_client)
if(!scr_loc)
return null
var/tX = splittext(scr_loc, ",")
var/tY = splittext(tX[2], ":")
var/tZ = origin.z
tY = tY[1]
tX = splittext(tX[1], ":")
tX = tX[1]
var/list/actual_view = getviewsize(viewing_client ? viewing_client.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)
return locate(tX, tY, tZ)
///Almost identical to the params_to_turf(), but unused (remove?)
/proc/screen_loc_to_turf(text, turf/origin, client/C)
if(!text)
return null
var/tZ = splittext(text, ",")
var/tX = splittext(tZ[1], "-")
var/tY = text2num(tX[2])
tX = splittext(tZ[2], "-")
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)
return locate(tX, tY, tZ)
///similar function to RANGE_TURFS(), but will search spiralling outwards from the center (like the above, but only turfs)
/proc/spiral_range_turfs(dist = 0, center = usr, orange = FALSE, list/outlist = list(), tick_checked)
outlist.Cut()
if(!dist)
outlist += center
return outlist
var/turf/t_center = get_turf(center)
if(!t_center)
return outlist
var/list/turf_list = outlist
var/turf/checked_turf
var/y
var/x
var/c_dist = 1
if(!orange)
turf_list += t_center
while( c_dist <= dist )
y = t_center.y + c_dist
x = t_center.x - c_dist + 1
for(x in x to t_center.x + c_dist)
checked_turf = locate(x, y, t_center.z)
if(checked_turf)
turf_list += checked_turf
y = t_center.y + c_dist - 1
x = t_center.x + c_dist
for(y in t_center.y - c_dist to y)
checked_turf = locate(x, y, t_center.z)
if(checked_turf)
turf_list += checked_turf
y = t_center.y - c_dist
x = t_center.x + c_dist - 1
for(x in t_center.x - c_dist to x)
checked_turf = locate(x, y, t_center.z)
if(checked_turf)
turf_list += checked_turf
y = t_center.y - c_dist + 1
x = t_center.x - c_dist
for(y in y to t_center.y + c_dist)
checked_turf = locate(x, y, t_center.z)
if(checked_turf)
turf_list += checked_turf
c_dist++
if(tick_checked)
CHECK_TICK
return turf_list
///Returns a random turf on the station
/proc/get_random_station_turf()
var/list/turfs = get_area_turfs(pick(GLOB.the_station_areas))
if (length(turfs))
return pick(turfs)
///Returns a random turf on the station, excludes dense turfs (like walls) and areas that have valid_territory set to FALSE
/proc/get_safe_random_station_turf(list/areas_to_pick_from = GLOB.the_station_areas)
for (var/i in 1 to 5)
var/list/turf_list = get_area_turfs(pick(areas_to_pick_from))
var/turf/target
while (turf_list.len && !target)
var/I = rand(1, turf_list.len)
var/turf/checked_turf = turf_list[I]
var/area/turf_area = get_area(checked_turf)
if(!checked_turf.density && (turf_area.area_flags & VALID_TERRITORY))
var/clear = TRUE
for(var/obj/checked_object in checked_turf)
if(checked_object.density)
clear = FALSE
break
if(clear)
target = checked_turf
if (!target)
turf_list.Cut(I, I + 1)
if (target)
return target
/**
* Checks whether the target turf is in a valid state to accept a directional window
* or other directional pseudo-dense object such as railings.
*
* Returns FALSE if the target turf cannot accept a directional window or railing.
* Returns TRUE otherwise.
*
* Arguments:
* * dest_turf - The destination turf to check for existing windows and railings
* * test_dir - The prospective dir of some atom you'd like to put on this turf.
* * is_fulltile - Whether the thing you're attempting to move to this turf takes up the entire tile or whether it supports multiple movable atoms on its tile.
*/
/proc/valid_window_location(turf/dest_turf, test_dir, is_fulltile = FALSE)
if(!dest_turf)
return FALSE
for(var/obj/turf_content in dest_turf)
if(istype(turf_content, /obj/machinery/door/window))
if((turf_content.dir == test_dir) || is_fulltile)
return FALSE
if(istype(turf_content, /obj/structure/windoor_assembly))
var/obj/structure/windoor_assembly/windoor_assembly = turf_content
if(windoor_assembly.dir == test_dir || is_fulltile)
return FALSE
if(istype(turf_content, /obj/structure/window))
var/obj/structure/window/window_structure = turf_content
if(window_structure.dir == test_dir || window_structure.fulltile || is_fulltile)
return FALSE
if(istype(turf_content, /obj/structure/railing))
var/obj/structure/railing/rail = turf_content
if(rail.dir == test_dir || is_fulltile)
return FALSE
return TRUE
File diff suppressed because it is too large Load Diff
+16
View File
@@ -0,0 +1,16 @@
///datum may be null, but it does need to be a typed var
#define NAMEOF(datum, X) (#X || ##datum.##X)
#define VARSET_LIST_CALLBACK(target, var_name, var_value) CALLBACK(GLOBAL_PROC, /proc/___callbackvarset, ##target, ##var_name, ##var_value)
//dupe code because dm can't handle 3 level deep macros
#define VARSET_CALLBACK(datum, var, var_value) CALLBACK(GLOBAL_PROC, /proc/___callbackvarset, ##datum, NAMEOF(##datum, ##var), ##var_value)
/proc/___callbackvarset(list_or_datum, var_name, var_value)
if(length(list_or_datum))
list_or_datum[var_name] = var_value
return
var/datum/datum = list_or_datum
if(IsAdminAdvancedProcCall())
datum.vv_edit_var(var_name, var_value) //same result generally, unless badmemes
else
datum.vars[var_name] = var_value
+43
View File
@@ -1,2 +1,45 @@
/// Checks if potential_weakref is a weakref of thing.
#define IS_WEAKREF_OF(thing, potential_weakref) (istype(thing, /datum) && !isnull(potential_weakref) && thing.weak_reference == potential_weakref)
//For these two procs refs MUST be ref = TRUE format like typecaches!
/proc/weakref_filter_list(list/things, list/refs)
if(!islist(things) || !islist(refs))
return
if(!refs.len)
return things
if(things.len > refs.len)
var/list/f = list()
for(var/i in refs)
var/datum/weakref/r = i
var/datum/d = r.resolve()
if(d)
f |= d
return things & f
else
. = list()
for(var/i in things)
if(!refs[WEAKREF(i)])
continue
. |= i
/proc/weakref_filter_list_reverse(list/things, list/refs)
if(!islist(things) || !islist(refs))
return
if(!refs.len)
return things
if(things.len > refs.len)
var/list/f = list()
for(var/i in refs)
var/datum/weakref/r = i
var/datum/d = r.resolve()
if(d)
f |= d
return things - f
else
. = list()
for(var/i in things)
if(refs[WEAKREF(i)])
continue
. |= i
+2 -2
View File
@@ -231,7 +231,7 @@
return ..() + contents
/mob/living/DirectAccess(atom/target)
return ..() + GetAllContents()
return ..() + get_all_contents()
/atom/proc/AllowClick()
return FALSE
@@ -513,7 +513,7 @@
var/mob/living/carbon/C = usr
C.swap_hand()
else
var/turf/T = params2turf(LAZYACCESS(modifiers, SCREEN_LOC), get_turf(usr.client ? usr.client.eye : usr), usr.client)
var/turf/T = params_to_turf(LAZYACCESS(modifiers, SCREEN_LOC), get_turf(usr.client ? usr.client.eye : usr), usr.client)
params += "&catcher=1"
if(T)
T.Click(location, control, params)
+1 -1
View File
@@ -536,7 +536,7 @@ or shoot a gun to move around via Newton's 3rd Law of Motion."
desc = "You are currently tracking [real_target.real_name] in [get_area_name(blood_target)]."
else
desc = "You are currently tracking [blood_target] in [get_area_name(blood_target)]."
var/target_angle = Get_Angle(Q, P)
var/target_angle = get_angle(Q, P)
var/target_dist = get_dist(P, Q)
cut_overlays()
switch(target_dist)
+1 -1
View File
@@ -266,7 +266,7 @@
if(!usr)
return
var/mob/dead/new_player/new_player = usr
if(IsGuestKey(new_player.key))
if(is_guest_key(new_player.key))
set_button_status(FALSE)
return
if(!SSdbcore.Connect())
+1 -1
View File
@@ -123,7 +123,7 @@ SUBSYSTEM_DEF(atoms)
else
SEND_SIGNAL(A,COMSIG_ATOM_AFTER_SUCCESSFUL_INITIALIZE)
if(created_atoms && from_template && ispath(the_type, /atom/movable))//we only want to populate the list with movables
created_atoms += A.GetAllContents()
created_atoms += A.get_all_contents()
return qdeleted || QDELING(A)
+1 -1
View File
@@ -416,7 +416,7 @@ SUBSYSTEM_DEF(explosions)
for(var/I in T)
var/atom/A = I
if (length(A.contents) && !(A.flags_1 & PREVENT_CONTENTS_EXPLOSION_1)) //The atom/contents_explosion() proc returns null if the contents ex_acting has been handled by the atom, and TRUE if it hasn't.
items += A.GetAllContents(ignore_flag_1 = PREVENT_CONTENTS_EXPLOSION_1)
items += A.get_all_contents(ignore_flag_1 = PREVENT_CONTENTS_EXPLOSION_1)
for(var/thing in items)
var/atom/movable/movable_thing = thing
if(QDELETED(movable_thing))
+2 -2
View File
@@ -447,11 +447,11 @@
for(var/law in hacked)
if (length(law) > 0)
data += "[show_numbers ? "[ionnum()]:" : ""] [render_html ? "<font color='#660000'>[law]</font>" : law]"
data += "[show_numbers ? "[ion_num()]:" : ""] [render_html ? "<font color='#660000'>[law]</font>" : law]"
for(var/law in ion)
if (length(law) > 0)
data += "[show_numbers ? "[ionnum()]:" : ""] [render_html ? "<font color='#547DFE'>[law]</font>" : law]"
data += "[show_numbers ? "[ion_num()]:" : ""] [render_html ? "<font color='#547DFE'>[law]</font>" : law]"
var/number = 1
for(var/law in inherent)
+1 -1
View File
@@ -79,7 +79,7 @@
* Creates the beam effects and places them in a line from the origin to the target. Sets their rotation to make the beams face the target, too.
*/
/datum/beam/proc/Draw()
var/Angle = round(Get_Angle(origin,target))
var/Angle = round(get_angle(origin,target))
var/matrix/rot_matrix = matrix()
var/turf/origin_turf = get_turf(origin)
rot_matrix.Turn(Angle)
+4 -4
View File
@@ -111,8 +111,8 @@
var/mob/M = W.resolve()
if(M)
if (length(args))
return world.PushUsr(arglist(list(M, src) + args))
return world.PushUsr(M, src)
return world.push_usr(arglist(list(M, src) + args))
return world.push_usr(M, src)
if (!object)
return
@@ -146,8 +146,8 @@
var/mob/M = W.resolve()
if(M)
if (length(args))
return world.PushUsr(arglist(list(M, src) + args))
return world.PushUsr(M, src)
return world.push_usr(arglist(list(M, src) + args))
return world.push_usr(M, src)
if (!object)
return
+2 -2
View File
@@ -120,7 +120,7 @@
if(isnull(location)) //Clicking on a screen object.
if(_target.plane != CLICKCATCHER_PLANE) //The clickcatcher is a special case. We want the click to trigger then, under it.
return //If we click and drag on our worn backpack, for example, we want it to open instead.
_target = params2turf(modifiers["screen-loc"], get_turf(source.eye), source)
_target = params_to_turf(modifiers["screen-loc"], get_turf(source.eye), source)
if(!_target)
CRASH("Failed to get the turf under clickcatcher")
@@ -199,7 +199,7 @@
SIGNAL_HANDLER
if(isnull(over_location)) //This happens when the mouse is over an inventory or screen object, or on entering deep darkness, for example.
var/list/modifiers = params2list(params)
var/new_target = params2turf(modifiers["screen-loc"], get_turf(source.eye), source)
var/new_target = params_to_turf(modifiers["screen-loc"], get_turf(source.eye), source)
mouse_parameters = params
if(!new_target)
if(QDELETED(target)) //No new target acquired, and old one was deleted, get us out of here.
+1 -1
View File
@@ -136,7 +136,7 @@ GLOBAL_LIST_EMPTY(GPS_list)
signal["coords"] = "[pos.x], [pos.y], [pos.z]"
if(pos.z == curr.z) //Distance/Direction calculations for same z-level only
signal["dist"] = max(get_dist(curr, pos), 0) //Distance between the src and remote GPS turfs
signal["degrees"] = round(Get_Angle(curr, pos)) //0-360 degree directional bearing, for more precision.
signal["degrees"] = round(get_angle(curr, pos)) //0-360 degree directional bearing, for more precision.
signals += list(signal) //Add this signal to the list of signals
data["signals"] = signals
return data
@@ -2,7 +2,7 @@
var/atom/A = parent
if(A == W) //don't put yourself into yourself.
return
var/list/obj/item/storage/backpack/holding/matching = typecache_filter_list(W.GetAllContents(), typecacheof(/obj/item/storage/backpack/holding))
var/list/obj/item/storage/backpack/holding/matching = typecache_filter_list(W.get_all_contents(), typecacheof(/obj/item/storage/backpack/holding))
matching -= A
if(istype(W, /obj/item/storage/backpack/holding) || matching.len)
INVOKE_ASYNC(src, .proc/recursive_insertion, W, user)
+1 -1
View File
@@ -25,7 +25,7 @@
var/atom/blocker
out:
for(var/turf/T in getline(tether_target,newloc))
for(var/turf/T in get_line(tether_target,newloc))
if (T.density)
blocker = T
break out
@@ -59,7 +59,7 @@ Bonus
M.emote("sneeze")
if(M.CanSpreadAirborneDisease()) //don't spread germs if they covered their mouth
for(var/mob/living/L in oview(spread_range, M))
if(is_A_facing_B(M, L) && disease_air_spread_walk(get_turf(M), get_turf(L)))
if(is_source_facing_target(M, L) && disease_air_spread_walk(get_turf(M), get_turf(L)))
L.AirborneContractDisease(A, TRUE)
if(cartoon_sneezing) //Yeah, this can fling you around even if you have a space suit helmet on. It's, uh, bluespace snot, yeah.
var/sneeze_distance = rand(2,4) //twice as far as a normal baseball bat strike will fling you
+2 -2
View File
@@ -41,7 +41,7 @@
if(!weapon.chambered || HAS_TRAIT(user, TRAIT_PACIFISM))
return
var/backwards_angle = Get_Angle(target, user)
var/backwards_angle = get_angle(target, user)
var/starting_angle = SIMPLIFY_DEGREES(backwards_angle-(angle_spread * 0.5))
var/iter_offset = angle_spread / plumes // how much we increment the angle for each plume
@@ -57,7 +57,7 @@
if(!weapon.chambered || HAS_TRAIT(user, TRAIT_PACIFISM))
return
var/backwards_angle = Get_Angle(target, user)
var/backwards_angle = get_angle(target, user)
var/turf/target_turf = get_turf_in_angle(backwards_angle, get_turf(user), 10)
INVOKE_ASYNC(src, .proc/pew, target_turf, weapon, user)
+1 -1
View File
@@ -45,7 +45,7 @@ clamping the Knockback_Force value below. */
var/knockback_force = Get_Knockback_Force(clamp(CEILING((I.force / 10), 1), 1, 5))
var/knockback_speed = Get_Knockback_Speed(clamp(knockback_force, 1, 5))
var/target_angle = Get_Angle(attacktarget, usertarget)
var/target_angle = get_angle(attacktarget, usertarget)
var/move_target = get_ranged_target_turf(usertarget, angle2dir(target_angle), knockback_force)
usertarget.throw_at(move_target, knockback_force, knockback_speed)
usertarget.visible_message(span_warning("[usertarget] gets thrown back by the force of \the [I] impacting \the [attacktarget]!"), span_warning("The force of \the [I] impacting \the [attacktarget] sends you flying!"))
+1 -1
View File
@@ -34,7 +34,7 @@
precision = rand(1,100)
var/static/list/bag_cache = typecacheof(/obj/item/storage/backpack/holding)
var/list/bagholding = typecache_filter_list(teleatom.GetAllContents(), bag_cache)
var/list/bagholding = typecache_filter_list(teleatom.get_all_contents(), bag_cache)
if(bagholding.len)
precision = max(rand(1,100)*bagholding.len,100)
if(isliving(teleatom))
+2 -2
View File
@@ -381,7 +381,7 @@
if (!istype(traitor_mob))
return
var/list/all_contents = traitor_mob.GetAllContents()
var/list/all_contents = traitor_mob.get_all_contents()
var/obj/item/pda/PDA = locate() in all_contents
var/obj/item/radio/R = locate() in all_contents
var/obj/item/pen/P
@@ -657,7 +657,7 @@
obj_count++
/datum/mind/proc/find_syndicate_uplink(check_unlocked)
var/list/L = current.GetAllContents()
var/list/L = current.get_all_contents()
for (var/i in L)
var/atom/movable/I = i
var/datum/component/uplink/found_uplink = I.GetComponent(/datum/component/uplink)
+1 -1
View File
@@ -214,7 +214,7 @@
var/obj/family_heirloom = heirloom?.resolve()
if(family_heirloom && (family_heirloom in quirk_holder.GetAllContents()))
if(family_heirloom && (family_heirloom in quirk_holder.get_all_contents()))
SEND_SIGNAL(quirk_holder, COMSIG_CLEAR_MOOD_EVENT, "family_heirloom_missing")
SEND_SIGNAL(quirk_holder, COMSIG_ADD_MOOD_EVENT, "family_heirloom", /datum/mood_event/family_heirloom)
else
+3 -3
View File
@@ -622,7 +622,7 @@ GLOBAL_LIST_EMPTY(possible_items)
if(!isliving(M.current))
continue
var/list/all_items = M.current.GetAllContents() //this should get things in cheesewheels, books, etc.
var/list/all_items = M.current.get_all_contents() //this should get things in cheesewheels, books, etc.
for(var/obj/I in all_items) //Check for items
if(istype(I, steal_target))
@@ -853,7 +853,7 @@ GLOBAL_LIST_EMPTY(possible_items_special)
for(var/datum/mind/M in owners)
if(!isliving(M.current))
continue
var/list/all_items = M.current.GetAllContents() //this should get things in cheesewheels, books, etc.
var/list/all_items = M.current.get_all_contents() //this should get things in cheesewheels, books, etc.
for(var/obj/I in all_items) //Check for wanted items
if(is_type_in_typecache(I, wanted_items))
stolen_count++
@@ -879,7 +879,7 @@ GLOBAL_LIST_EMPTY(possible_items_special)
for(var/datum/mind/M in owners)
if(!isliving(M.current))
continue
var/list/all_items = M.current.GetAllContents() //this should get things in cheesewheels, books, etc.
var/list/all_items = M.current.get_all_contents() //this should get things in cheesewheels, books, etc.
for(var/obj/I in all_items) //Check for wanted items
if(istype(I, /obj/item/book/granter/spell))
var/obj/item/book/granter/spell/spellbook = I
+1 -1
View File
@@ -67,7 +67,7 @@
"name" = A.area.name,
"operating" = A.operating,
"charge" = (has_cell) ? A.cell.percent() : "NOCELL",
"load" = DisplayPower(A.lastused_total),
"load" = display_power(A.lastused_total),
"charging" = A.charging,
"chargeMode" = A.chargemode,
"eqp" = A.equipment,
+1 -1
View File
@@ -120,7 +120,7 @@
if(!isturf(AM0.loc))
return //I don't know how you called Crossed() but stop it.
var/list/to_eat = AM0.GetAllContents()
var/list/to_eat = AM0.get_all_contents()
var/living_detected = FALSE //technically includes silicons as well but eh
var/list/nom = list()
+5 -5
View File
@@ -403,19 +403,19 @@
var/list/things_to_clear = list() //Done this way since using GetAllContents on the SSU itself would include circuitry and such.
if(suit)
things_to_clear += suit
things_to_clear += suit.GetAllContents()
things_to_clear += suit.get_all_contents()
if(helmet)
things_to_clear += helmet
things_to_clear += helmet.GetAllContents()
things_to_clear += helmet.get_all_contents()
if(mask)
things_to_clear += mask
things_to_clear += mask.GetAllContents()
things_to_clear += mask.get_all_contents()
if(storage)
things_to_clear += storage
things_to_clear += storage.GetAllContents()
things_to_clear += storage.get_all_contents()
if(mob_occupant)
things_to_clear += mob_occupant
things_to_clear += mob_occupant.GetAllContents()
things_to_clear += mob_occupant.get_all_contents()
for(var/am in things_to_clear) //Scorches away blood and forensic evidence, although the SSU itself is unaffected
var/atom/movable/dirty_movable = am
dirty_movable.wash(CLEAN_ALL)
+1 -1
View File
@@ -95,7 +95,7 @@
. = ..()
if(!.)
return
for(var/obj/item/gun in target.GetAllContents())
for(var/obj/item/gun in target.get_all_contents())
if(!isgun(gun) && !istype(gun, /obj/item/flamethrower))
continue
SEND_SIGNAL(gun, COMSIG_ITEM_RECHARGED)
@@ -8,7 +8,7 @@
PB.apply_vars(angle_between_points(starting, ending), midpoint.return_px(), midpoint.return_py(), color, pixel_length_between_points(starting, ending) / world.icon_size, midpoint.return_turf(), 0)
. = PB
if(light_range > 0 && light_intensity > 0)
var/list/turf/line = getline(starting.return_turf(), ending.return_turf())
var/list/turf/line = get_line(starting.return_turf(), ending.return_turf())
tracing_line:
for(var/i in line)
var/turf/T = i
+2 -2
View File
@@ -309,7 +309,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e
/obj/item/examine(mob/user) //This might be spammy. Remove?
. = ..()
. += "[gender == PLURAL ? "They are" : "It is"] a [weightclass2text(w_class)] item."
. += "[gender == PLURAL ? "They are" : "It is"] a [weight_class_to_text(w_class)] item."
if(resistance_flags & INDESTRUCTIBLE)
. += "[src] seems extremely robust! It'll probably withstand anything that could happen to it!"
@@ -531,7 +531,7 @@ GLOBAL_DATUM_INIT(fire_overlay, /mutable_appearance, mutable_appearance('icons/e
R.hud_used.update_robot_modules_display()
/obj/item/proc/GetDeconstructableContents()
return GetAllContents() - src
return get_all_contents() - src
// afterattack() and attack() prototypes moved to _onclick/item_attack.dm for consistency
+1 -1
View File
@@ -24,7 +24,7 @@
if(A.always_unpowered)
to_chat(user, span_warning("You cannot place [src] in this area!"))
return
if(gotwallitem(T, ndir, inverse*2))
if(got_wall_item(T, ndir, inverse*2))
to_chat(user, span_warning("There's already an item on this wall!"))
return
+2 -2
View File
@@ -274,7 +274,7 @@ Code:
var/obj/machinery/power/apc/A = term.master
L += A
menu += "<PRE>Location: [get_area_name(powmonitor, TRUE)]<BR>Total power: [DisplayPower(connected_powernet.viewavail)]<BR>Total load: [DisplayPower(connected_powernet.viewload)]<BR>"
menu += "<PRE>Location: [get_area_name(powmonitor, TRUE)]<BR>Total power: [display_power(connected_powernet.viewavail)]<BR>Total load: [display_power(connected_powernet.viewload)]<BR>"
menu += "<FONT SIZE=-1>"
@@ -290,7 +290,7 @@ Code:
//would be to use <span style="width: NNNpx; overflow: none;">[A.area.name]</span>
for(var/obj/machinery/power/apc/A in L)
menu += copytext_char(add_trailing(A.area.name, 30, " "), 1, 30)
menu += " [S[A.equipment+1]] [S[A.lighting+1]] [S[A.environ+1]] [add_leading(DisplayPower(A.lastused_total), 6, " ")] [A.cell ? "[add_leading(round(A.cell.percent()), 3, " ")]% [chg[A.charging+1]]" : " N/C"]<BR>"
menu += " [S[A.equipment+1]] [S[A.lighting+1]] [S[A.environ+1]] [add_leading(display_power(A.lastused_total), 6, " ")] [A.cell ? "[add_leading(round(A.cell.percent()), 3, " ")]% [chg[A.charging+1]]" : " N/C"]<BR>"
menu += "</FONT></PRE>"
@@ -66,7 +66,7 @@
charges--
var/difficulty = 0
if(target.cartridge)
difficulty += BitCount(target.cartridge.access&(CART_MEDICAL | CART_SECURITY | CART_ENGINE | CART_CLOWN | CART_JANITOR | CART_MANIFEST))
difficulty += bit_count(target.cartridge.access&(CART_MEDICAL | CART_SECURITY | CART_ENGINE | CART_CLOWN | CART_JANITOR | CART_MANIFEST))
if(target.cartridge.access & CART_MANIFEST)
difficulty++ //if cartridge has manifest access it has extra snowflake difficulty
if(SEND_SIGNAL(target, COMSIG_PDA_CHECK_DETONATE) & COMPONENT_PDA_NO_DETONATE || prob(difficulty * 15))
@@ -29,7 +29,7 @@
to_chat(R, span_warning("You need a power cell installed for that."))
return
if(!R.cell.use(circuit_cost))
to_chat(R, span_warning("You don't have the energy for that (you need [DisplayEnergy(circuit_cost)].)"))
to_chat(R, span_warning("You don't have the energy for that (you need [display_energy(circuit_cost)].)"))
return
if(recharging)
to_chat(R, span_warning("[src] needs some time to recharge first."))
+1 -1
View File
@@ -83,7 +83,7 @@
if(user && user.get_active_held_item() == src) // Make sure our user is still holding us
var/turf/target_turf = get_turf(target)
if(target_turf)
var/turflist = getline(user, target_turf)
var/turflist = get_line(user, target_turf)
log_combat(user, target, "flamethrowered", src)
flame_turf(turflist)
+1 -1
View File
@@ -159,7 +159,7 @@
/obj/item/inducer/examine(mob/living/M)
. = ..()
if(cell)
. += span_notice("Its display shows: [DisplayEnergy(cell.charge)].")
. += span_notice("Its display shows: [display_energy(cell.charge)].")
else
. += span_notice("Its display is dark.")
if(opened)
+1 -1
View File
@@ -124,7 +124,7 @@
user.put_in_hands(P)
I.forceMove(P)
var/size = round(I.w_class)
P.name = "[weightclass2text(size)] parcel"
P.name = "[weight_class_to_text(size)] parcel"
P.w_class = size
size = min(size, 5)
P.icon_state = "deliverypackage[size]"
+1 -1
View File
@@ -108,7 +108,7 @@
/obj/item/storage/toolbox/mechanical/old/clean/proc/calc_damage()
var/power = 0
for (var/obj/item/stack/telecrystal/TC in GetAllContents())
for (var/obj/item/stack/telecrystal/TC in get_all_contents())
power += TC.amount
force = 19 + power
throwforce = 22 + power
+1 -1
View File
@@ -113,7 +113,7 @@
user_interact_cooldowns[user.real_name] = world.time + COOLDOWN_INTERACT
for(var/obj/item/pinpointer/wayfinding/held_pinpointer in user.GetAllContents())
for(var/obj/item/pinpointer/wayfinding/held_pinpointer in user.get_all_contents())
set_expression("veryhappy", 2 SECONDS)
say("You already have a pinpointer!")
return
@@ -234,7 +234,7 @@
for(var/atom/movable/AM in L)
if(AM != src && insert(AM) == LOCKER_FULL) // limit reached
break
for(var/i in reverseRange(L.GetAllContents()))
for(var/i in reverseRange(L.get_all_contents()))
var/atom/movable/thing = i
SEND_SIGNAL(thing, COMSIG_TRY_STORAGE_HIDE_ALL)
+1 -1
View File
@@ -333,7 +333,7 @@
to_chat(user, span_warning("The case rejects the [W]!"))
return
for(var/a in W.GetAllContents())
for(var/a in W.get_all_contents())
if(is_type_in_typecache(a, GLOB.blacklisted_cargo_types))
to_chat(user, span_warning("The case rejects the [W]!"))
return
+1 -1
View File
@@ -248,7 +248,7 @@ GLOBAL_LIST_EMPTY(crematoriums)
if(locked)
return //don't let you cremate something twice or w/e
// Make sure we don't delete the actual morgue and its tray
var/list/conts = GetAllContents() - src - connected
var/list/conts = get_all_contents() - src - connected
if(!conts.len)
audible_message(span_hear("You hear a hollow crackle."))
+1 -1
View File
@@ -7,7 +7,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
/turf/proc/empty(turf_type=/turf/open/space, baseturf_type, list/ignore_typecache, flags)
// Remove all atoms except observers, landmarks, docking ports
var/static/list/ignored_atoms = typecacheof(list(/mob/dead, /obj/effect/landmark, /obj/docking_port))
var/list/allowed_contents = typecache_filter_list_reverse(GetAllContentsIgnoring(ignore_typecache), ignored_atoms)
var/list/allowed_contents = typecache_filter_list_reverse(get_all_contents_ignoring(ignore_typecache), ignored_atoms)
allowed_contents -= src
for(var/i in 1 to allowed_contents.len)
var/thing = allowed_contents[i]
+1 -1
View File
@@ -46,7 +46,7 @@
return list("reason"="whitelist", "desc" = "\nReason: You are not on the white list for this server")
//Guest Checking
if(!real_bans_only && !C && IsGuestKey(key))
if(!real_bans_only && !C && is_guest_key(key))
if (CONFIG_GET(flag/guest_ban))
log_access("Failed Login: [key] - Guests not allowed")
return list("reason"="guest", "desc"="\nReason: Guests not allowed. Please sign in with a byond account.")
+1 -1
View File
@@ -247,7 +247,7 @@ GLOBAL_PROTECT(LastAdminCalledProc)
if(!lst)
return
if(!A || !IsValidSrc(A))
if(!A || !is_valid_src(A))
to_chat(usr, span_warning("Error: callproc_datum(): owner of proc no longer exists."), confidential = TRUE)
return
log_admin("[key_name(src)] called [A]'s [procname]() with [lst.len ? "the arguments [list2params(lst)]":"no arguments"].")
+1 -1
View File
@@ -216,7 +216,7 @@
<span id='maintable_data_archive'>
<table width='560' align='center' cellspacing='0' cellpadding='5' id='maintable_data'>"}
var/list/mobs = sortmobs()
var/list/mobs = sort_mobs()
var/i = 1
for(var/mob/M in mobs)
if(M.ckey)
+1 -1
View File
@@ -153,7 +153,7 @@
usr.forceMove(M.loc)
SSblackbox.record_feedback("tally", "admin_verb", 1, "Get Key") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/sendmob(mob/M in sortmobs())
/client/proc/sendmob(mob/M in sort_mobs())
set category = "Admin.Game"
set name = "Send Mob"
if(!src.holder)
@@ -278,7 +278,7 @@
radio_off_mob(M)
/obj/item/abductor/silencer/proc/radio_off_mob(mob/living/carbon/human/M)
var/list/all_items = M.GetAllContents()
var/list/all_items = M.get_all_contents()
for(var/obj/I in all_items)
if(istype(I, /obj/item/radio/))
+1 -1
View File
@@ -268,7 +268,7 @@
for(var/datum/mind/M in owners)
if(!isliving(M.current))
continue
var/list/all_items = M.current.GetAllContents() //this should get things in cheesewheels, books, etc.
var/list/all_items = M.current.get_all_contents() //this should get things in cheesewheels, books, etc.
for(var/obj/I in all_items) //Check for wanted items
if(istype(I, /obj/item/photo))
var/obj/item/photo/P = I
+1 -1
View File
@@ -198,7 +198,7 @@
/datum/antagonist/cult/proc/admin_take_all(mob/admin)
var/mob/living/current = owner.current
for(var/o in current.GetAllContents())
for(var/o in current.get_all_contents())
if(istype(o, /obj/item/melee/cultblade/dagger) || istype(o, /obj/item/stack/sheet/runed_metal))
qdel(o)
+3 -3
View File
@@ -674,7 +674,7 @@
to_chat(user, "<span class='cult italic'>[cultist_to_receive] is not a follower of the Geometer!</span>")
log_game("Void torch failed - target was deconverted")
return
if(A in user.GetAllContents())
if(A in user.get_all_contents())
to_chat(user, "<span class='cult italic'>[A] must be on a surface in order to teleport it!</span>")
return
to_chat(user, "<span class='cult italic'>You ignite [A] with \the [src], turning it to ash, but through the torch's flames you see that [A] has reached [cultist_to_receive]!</span>")
@@ -898,7 +898,7 @@
if(firing || charging)
return
if(ishuman(user))
angle = Get_Angle(user, A)
angle = get_angle(user, A)
else
qdel(src)
return
@@ -953,7 +953,7 @@
playsound(src, 'sound/magic/exit_blood.ogg', 75, TRUE)
new /obj/effect/temp_visual/dir_setting/cult/phase(user.loc, user.dir)
var/turf/temp_target = get_turf_in_angle(set_angle, targets_from, 40)
for(var/turf/T in getline(targets_from,temp_target))
for(var/turf/T in get_line(targets_from,temp_target))
if (locate(/obj/effect/blessing, T))
temp_target = T
playsound(T, 'sound/machines/clockcult/ark_damage.ogg', 50, TRUE)
@@ -220,7 +220,7 @@ new /datum/disease_ability/symptom/powerful/youth
var/datum/disease/advance/sentient_disease/SD = D.hosts[L]
for(var/mob/living/M in oview(4, SD.affected_mob))
if(is_A_facing_B(SD.affected_mob, M) && disease_air_spread_walk(get_turf(SD.affected_mob), get_turf(M)))
if(is_source_facing_target(SD.affected_mob, M) && disease_air_spread_walk(get_turf(SD.affected_mob), get_turf(M)))
M.AirborneContractDisease(SD, TRUE)
StartCooldown()
@@ -341,7 +341,7 @@
if(!check)
break
T = check
return (getline(user, T) - get_turf(user))
return (get_line(user, T) - get_turf(user))
/obj/effect/proc_holder/spell/pointed/ash_final/proc/fire_line(atom/source, list/turfs)
var/list/hit_list = list()
@@ -274,7 +274,7 @@
if(turfie in turfs || is_type_in_typecache(turfie,blacklisted_turfs))
continue
for(var/line_turfie_owo in getline(turfie,centre))
for(var/line_turfie_owo in get_line(turfie,centre))
if(get_dist(turfie,line_turfie_owo) <= 1)
edge_turfs += turfie
CHECK_TICK
+1 -1
View File
@@ -115,7 +115,7 @@
if(isturf(target_loc) || (ismob(target_loc) && isturf(target_loc.loc)))
return viewers(range, get_turf(target_loc))
else
return typecache_filter_list(target_loc.GetAllContents(), GLOB.typecache_living)
return typecache_filter_list(target_loc.get_all_contents(), GLOB.typecache_living)
/obj/item/assembly/flash/proc/try_use_flash(mob/user = null)
if(burnt_out || (world.time < last_trigger + cooldown))
+1 -1
View File
@@ -46,7 +46,7 @@
/obj/effect/path_blocker/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(blocked_types.len)
var/list/mover_contents = mover.GetAllContents()
var/list/mover_contents = mover.get_all_contents()
for(var/atom/movable/thing in mover_contents)
if(blocked_types[thing.type])
return reverse
+2 -2
View File
@@ -781,9 +781,9 @@
selector.moveToNullspace() //Otherwise, we move the selector to nullspace until it is needed again
/datum/centcom_podlauncher/proc/clearBay() //Clear all objs and mobs from the selected bay
for (var/obj/O in bay.GetAllContents())
for (var/obj/O in bay.get_all_contents())
qdel(O)
for (var/mob/M in bay.GetAllContents())
for (var/mob/M in bay.get_all_contents())
qdel(M)
for (var/bayturf in bay)
var/turf/turf_to_clear = bayturf
+1 -1
View File
@@ -33,7 +33,7 @@ Then the player gets the profit from selling his own wasted time.
var/profit_ratio = 1 //Percentage that gets sent to the seller, rest goes to cargo.
var/list/contents = AM.GetAllContents()
var/list/contents = AM.get_all_contents()
var/datum/export_report/report = external_report
+1 -1
View File
@@ -618,7 +618,7 @@
var/angle = effectCircle ? rand(0,360) : rand(70,110) //The angle that we can come in from
pod.pixel_x = cos(angle)*32*length(smoke_effects) //Use some ADVANCED MATHEMATICS to set the animated pod's position to somewhere on the edge of a circle with the center being the pod_landingzone
pod.pixel_z = sin(angle)*32*length(smoke_effects)
var/rotation = Get_Pixel_Angle(pod.pixel_z, pod.pixel_x) //CUSTOM HOMEBREWED proc that is just arctan with extra steps
var/rotation = get_pixel_angle(pod.pixel_z, pod.pixel_x) //CUSTOM HOMEBREWED proc that is just arctan with extra steps
setupSmoke(rotation)
pod.transform = matrix().Turn(rotation)
pod.layer = FLY_LAYER
+1 -1
View File
@@ -529,7 +529,7 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
return QDEL_HINT_HARDDEL_NOW
/client/proc/set_client_age_from_db(connectiontopic)
if (IsGuestKey(src.key))
if (is_guest_key(src.key))
return
if(!SSdbcore.Connect())
return
+1 -1
View File
@@ -97,7 +97,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
middleware += new middleware_type(src)
if(istype(C))
if(!IsGuestKey(C.key))
if(!is_guest_key(C.key))
load_path(C.ckey)
unlock_content = !!C.IsByondMember()
if(unlock_content)
+1 -1
View File
@@ -308,7 +308,7 @@
if (pockets.can_hold?.len) // If pocket type can hold anything, vs only specific items
how_cool_are_your_threads += "[src] can store [pockets.max_items] <a href='?src=[REF(src)];show_valid_pocket_items=1'>item\s</a>.\n"
else
how_cool_are_your_threads += "[src] can store [pockets.max_items] item\s that are [weightclass2text(pockets.max_w_class)] or smaller.\n"
how_cool_are_your_threads += "[src] can store [pockets.max_items] item\s that are [weight_class_to_text(pockets.max_w_class)] or smaller.\n"
if(pockets.quickdraw)
how_cool_are_your_threads += "You can quickly remove an item from [src] using Right-Click.\n"
if(pockets.silent)
+1 -1
View File
@@ -36,7 +36,7 @@
to_chat(user, span_warning("You find putting an evidence bag in another evidence bag to be slightly absurd."))
return TRUE //now this is podracing
if(loc in I.GetAllContents()) // fixes tg #39452, evidence bags could store their own location, causing I to be stored in the bag while being present inworld still, and able to be teleported when removed.
if(loc in I.get_all_contents()) // fixes tg #39452, evidence bags could store their own location, causing I to be stored in the bag while being present inworld still, and able to be teleported when removed.
to_chat(user, span_warning("You find putting [I] in [src] while it's still inside it quite difficult!"))
return
+1 -1
View File
@@ -176,7 +176,7 @@ GLOBAL_LIST_INIT(adventure_loot_generator_index,generate_generator_index())
var/turf/start_turf = get_turf(user)
var/turf/last_turf = get_ranged_target_turf(start_turf,user.dir,melt_range)
start_turf.Beam(last_turf,icon_state="solar_beam",time=1 SECONDS)
for(var/turf/turf_to_melt in getline(start_turf,last_turf))
for(var/turf/turf_to_melt in get_line(start_turf,last_turf))
if(turf_to_melt.density)
turf_to_melt.Melt()
inhand_icon_state = initial(inhand_icon_state)
+2 -2
View File
@@ -123,13 +123,13 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars,list(
var/obj/O2 = DuplicateObject(O , perfectcopy=TRUE, newloc = B, nerf=nerf_weapons, holoitem=TRUE)
if(!O2)
continue
copiedobjs += O2.GetAllContents()
copiedobjs += O2.get_all_contents()
for(var/mob/M in T)
if(iscameramob(M))
continue // If we need to check for more mobs, I'll add a variable
var/mob/SM = DuplicateObject(M , perfectcopy=TRUE, newloc = B, holoitem=TRUE)
copiedobjs += SM.GetAllContents()
copiedobjs += SM.get_all_contents()
for(var/V in T.vars - GLOB.duplicate_forbidden_vars)
if(V == "air")
+2 -2
View File
@@ -335,7 +335,7 @@
to_chat(eater, span_notice("You feel energized as you bite into [our_plant]."))
var/batteries_recharged = FALSE
var/obj/item/seeds/our_seed = our_plant.get_plant_seed()
for(var/obj/item/stock_parts/cell/found_cell in eater.GetAllContents())
for(var/obj/item/stock_parts/cell/found_cell in eater.get_all_contents())
var/newcharge = min(our_seed.potency * 0.01 * found_cell.maxcharge, found_cell.maxcharge)
if(found_cell.charge < newcharge)
found_cell.charge = newcharge
@@ -563,7 +563,7 @@
pocell.maxcharge *= (electrical_gene.rate * 100)
pocell.charge = pocell.maxcharge
pocell.name = "[our_plant.name] battery"
pocell.desc = "A rechargeable plant-based power cell. This one has a rating of [DisplayEnergy(pocell.maxcharge)], and you should not swallow it."
pocell.desc = "A rechargeable plant-based power cell. This one has a rating of [display_energy(pocell.maxcharge)], and you should not swallow it."
if(our_plant.reagents.has_reagent(/datum/reagent/toxin/plasma, 2))
pocell.rigged = TRUE
+3 -3
View File
@@ -201,7 +201,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava)
if(!ispath(component_type,/datum/component))
CRASH("Wrong component type in [type] - [component_type] is not a component")
var/turf/T = get_turf(src)
for(var/atom/A in T.GetAllContents())
for(var/atom/A in T.get_all_contents())
if(A == src)
continue
if(target_name && A.name != target_name)
@@ -426,7 +426,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava)
CRASH("Wrong trait in [type] - [trait_name] is not a trait")
var/turf/target_turf = get_turf(src)
var/matches_found = 0
for(var/a in target_turf.GetAllContents())
for(var/a in target_turf.get_all_contents())
var/atom/atom_on_turf = a
if(atom_on_turf == src)
continue
@@ -464,7 +464,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava)
var/I = fetch_icon(icon_url)
var/turf/target_turf = get_turf(src)
var/matches_found = 0
for(var/a in target_turf.GetAllContents())
for(var/a in target_turf.get_all_contents())
var/atom/atom_on_turf = a
if(atom_on_turf == src)
continue
+1 -1
View File
@@ -182,7 +182,7 @@ GLOBAL_LIST_EMPTY(total_extraction_beacons)
var/mob/living/L = A
if(L.stat != DEAD)
return TRUE
for(var/thing in A.GetAllContents())
for(var/thing in A.get_all_contents())
if(isliving(A))
var/mob/living/L = A
if(L.stat != DEAD)
@@ -664,7 +664,7 @@
/obj/item/melee/ghost_sword/proc/ghost_check()
var/ghost_counter = 0
var/turf/T = get_turf(src)
var/list/contents = T.GetAllContents()
var/list/contents = T.get_all_contents()
var/mob/dead/observer/current_spirits = list()
for(var/thing in contents)
var/atom/A = thing
@@ -161,7 +161,7 @@
if(admin_revive)
var/obj/item/bodypart/head/H = loc
var/turf/T = get_turf(owner)
if(H && istype(H) && T && !(H in owner.GetAllContents()))
if(H && istype(H) && T && !(H in owner.get_all_contents()))
H.forceMove(T)
/obj/item/dullahan_relay/Destroy()
@@ -11,7 +11,7 @@
return "data/player_saves/[user.ckey[1]]/[user.ckey]/pai.sav"
/datum/pai_candidate/proc/savefile_save(mob/user)
if(IsGuestKey(user.key))
if(is_guest_key(user.key))
return FALSE
var/savefile/F = new /savefile(src.savefile_path(user))
@@ -32,7 +32,7 @@
// returns 0 if savefile did not exist
/datum/pai_candidate/proc/savefile_load(mob/user, silent = TRUE)
if (IsGuestKey(user.key))
if (is_guest_key(user.key))
return 0
var/path = savefile_path(user)
+4 -4
View File
@@ -210,7 +210,7 @@
for (var/index in 1 to length(lawcache_hacked))
var/law = lawcache_hacked[index]
var/num = ionnum()
var/num = ion_num()
if (length(law) > 0)
if (force || lawcache_hackedcheck[index] == "Yes")
say("[radiomod] [num]. [law]")
@@ -218,7 +218,7 @@
for (var/index in 1 to length(lawcache_ion))
var/law = lawcache_ion[index]
var/num = ionnum()
var/num = ion_num()
if (length(law) > 0)
if (force || lawcache_ioncheck[index] == "Yes")
say("[radiomod] [num]. [law]")
@@ -258,7 +258,7 @@
if (length(law) > 0)
if (!hackedcheck[index])
hackedcheck[index] = "No"
list += {"<A href='byond://?src=[REF(src)];lawh=[index]'>[hackedcheck[index]] [ionnum()]:</A> <font color='#660000'>[law]</font><BR>"}
list += {"<A href='byond://?src=[REF(src)];lawh=[index]'>[hackedcheck[index]] [ion_num()]:</A> <font color='#660000'>[law]</font><BR>"}
hackedcheck.len += 1
for (var/index = 1, index <= laws.ion.len, index++)
@@ -267,7 +267,7 @@
if (length(law) > 0)
if (!ioncheck[index])
ioncheck[index] = "Yes"
list += {"<A href='byond://?src=[REF(src)];lawi=[index]'>[ioncheck[index]] [ionnum()]:</A> <font color='#547DFE'>[law]</font><BR>"}
list += {"<A href='byond://?src=[REF(src)];lawi=[index]'>[ioncheck[index]] [ion_num()]:</A> <font color='#547DFE'>[law]</font><BR>"}
ioncheck.len += 1
var/number = 1
@@ -397,7 +397,7 @@
/mob/living/simple_animal/hostile/proc/CheckFriendlyFire(atom/A)
if(check_friendly_fire)
for(var/turf/T in getline(src,A)) // Not 100% reliable but this is faster than simulating actual trajectory
for(var/turf/T in get_line(src,A)) // Not 100% reliable but this is faster than simulating actual trajectory
for(var/mob/living/L in T)
if(L == src || L == A)
continue
@@ -95,7 +95,7 @@
return ..()
/datum/status_effect/seedling_beam_indicator/tick()
var/target_angle = Get_Angle(owner, target)
var/target_angle = get_angle(owner, target)
var/matrix/final = matrix()
final.Turn(target_angle)
seedling_screen_object.transform = final
@@ -221,7 +221,7 @@ Difficulty: Medium
turf_dist_to_target += get_dist(dash_target, O)
if(get_dist(src, O) >= MINER_DASH_RANGE && turf_dist_to_target <= self_dist_to_target && !islava(O) && !ischasm(O))
var/valid = TRUE
for(var/turf/T in getline(own_turf, O))
for(var/turf/T in get_line(own_turf, O))
if(T.is_blocked_turf(TRUE))
valid = FALSE
continue
@@ -201,7 +201,7 @@
var/turf/target_turf = get_turf(target)
playsound(src, 'sound/magic/clockwork/invoke_general.ogg', 200, TRUE, 2)
newtonian_move(get_dir(target_turf, src))
var/angle_to_target = Get_Angle(src, target_turf)
var/angle_to_target = get_angle(src, target_turf)
if(isnum(set_angle))
angle_to_target = set_angle
var/static/list/colossus_shotgun_shot_angles = list(12.5, 7.5, 2.5, -2.5, -7.5, -12.5)
@@ -271,7 +271,7 @@
if(!at)
return
var/turf/T = get_ranged_target_turf_direct(src, at, range, offset)
return (getline(src, T) - get_turf(src))
return (get_line(src, T) - get_turf(src))
/mob/living/simple_animal/hostile/megafauna/dragon/proc/fire_line(list/turfs)
SLEEP_CHECK_DEATH(0)
@@ -296,7 +296,7 @@
if(!T || !T1)
return
//Now we generate the tracer.
var/angle = Get_Angle(T1, T)
var/angle = get_angle(T1, T)
var/datum/point/vector/V = new(T1.x, T1.y, T1.z, 0, 0, angle)
generate_tracer_between_points(V, V.return_vector_after_increments(6), /obj/effect/projectile/tracer/legion/tracer, 0, shot_delay, 0, 0, 0, null)
playsound(src, 'sound/machines/airlockopen.ogg', 100, TRUE)
@@ -235,7 +235,7 @@ Difficulty: Hard
SLEEP_CHECK_DEATH(6 - WENDIGO_ENRAGED * 2)
if("Spiral")
var/shots_spiral = WENDIGO_SPIRAL_SHOTCOUNT
var/angle_to_target = Get_Angle(src, target)
var/angle_to_target = get_angle(src, target)
var/spiral_direction = pick(-1, 1)
for(var/shot in 1 to shots_spiral)
var/shots_per_tick = 5 - WENDIGO_ENRAGED * 3
@@ -143,7 +143,7 @@
ranged_cooldown = world.time + 30
playsound(get_turf(src), 'sound/magic/clockwork/invoke_general.ogg', 20, TRUE)
var/target_turf = get_turf(target)
var/angle_to_target = Get_Angle(src, target_turf)
var/angle_to_target = get_angle(src, target_turf)
shoot_projectile(target_turf, angle_to_target, FALSE, TRUE)
addtimer(CALLBACK(src, .proc/shoot_projectile, target_turf, angle_to_target, FALSE, TRUE), 2)
addtimer(CALLBACK(src, .proc/shoot_projectile, target_turf, angle_to_target, FALSE, TRUE), 4)
@@ -178,7 +178,7 @@
ranged_cooldown = world.time + 30
playsound(get_turf(src), 'sound/magic/clockwork/invoke_general.ogg', 20, TRUE)
var/target_turf = get_turf(target)
var/angle_to_target = Get_Angle(src, target_turf)
var/angle_to_target = get_angle(src, target_turf)
shoot_projectile(target_turf, angle_to_target, TRUE, FALSE)
/mob/living/simple_animal/hostile/asteroid/elite/herald/proc/herald_mirror()

Some files were not shown because too many files have changed in this diff Show More