SS1984 - Modules - TypesVar Details - Proc Details

/(global)

Vars

FailsafeFailsafe
MasterStonedMC
SSai_behaviorsThe subsystem used to tick /datum/ai_behavior instances. Handling the individual actions an AI can take like punching someone in the fucking NUTS
SSai_controllersThe subsystem used to tick /datum/ai_controllers instances. Handling the re-checking of plans.
SSai_movementThe subsystem used to tick /datum/ai_movement instances. Handling the movement of individual AI instances
SSambienceThe subsystem used to play ambience to users every now and then, makes them real excited.
SSarea_contentsResponsible for managing the sizes of area.contained_turfs and area.turfs_to_uncontain These lists do not check for duplicates, which is fine, but it also means they can balloon in size over time as a consequence of repeated changes in area in a space They additionally may not always resolve often enough to avoid memory leaks This is annoying, so lets keep an eye on them and cut them down to size if needed
SSasset_loadingAllows us to lazyload asset datums Anything inserted here will fully load if directly gotten So this just serves to remove the requirement to load assets fully during init
SSaura_healingThe subsystem used to tick /datum/component/aura_healing instances.
SSchatCopyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT
SScleanup
SSclock_componentThe subsystem used to tick /datum/component/acid instances.
SSearly_assetsInitializes any assets that need to be loaded ASAP. This houses preference menu assets, since they can be loaded at any time, most dangerously before the atoms SS initializes. Thus, we want it to fail consistently in CI as if it would've if a player opened it up early.
SSfluids
SSfoamThe subsystem responsible for processing foam propagation and effects.
SSgame_eventsThis is a subsystem, which helps to process game modes through time.
SSlootingQueues image generation for search objects without icons
SSmouse_enteredDefers MouseEntered inputs to only apply to the most recently hovered over atom in the tick
SSpersistent_data
SSsmokeThe subsystem responsible for processing smoke propagation and effects.
SSspatial_grid
SStguitgui subsystem
SStimer
SSverb_managerSSverb_manager, a subsystem that runs every tick and runs through its entire queue without yielding like SSinput. this exists because of how the byond tick works and where user inputted verbs are put within it.
SSweatherUsed for all kinds of weather, ex. lavaland ash storms.
SSwiremod_compositeThis subsystem is to handle creating and storing composite templates that are used to create composite datatypes for integrated circuits

Procs

CallTechNameA simple helper proc to find the name of a tech with a given ID.
CreateBansDEBUG
CreateRandomVirusCreates and returns a random virus with properties independent of symptoms properties
DisplayTimeTextTakes a value of time in deciseconds. Returns a text value of that number in hours, minutes, or seconds.
GenerateKeyGenerates a random key by combining words and numbers
IsFrozenChecks if an atom is currently frozen
LinkBlockedAmong other things, used by flamethrower and boiler spray to calculate if flame/spray can pass through. Returns an atom for specific effects (primarily flames and acid spray) that damage things upon contact.
RoundDiagBarDiagnostic HUDs!
RoundHealthHelper for getting the appropriate health status
SQLtimeReturns timestamp in a sql and ISO 8601 friendly format
SolveQuadraticThe quadratic formula. Returns a list with the solutions, or an empty list if they are imaginary.
TextPreviewUsed in preferences' SetFlavorText and human's set_flavor verb Previews a string of len or less length
WEAKREFCreates a weakref to the given input. See /datum/weakref's documentation for more information.
___TraitAddDO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback.
___TraitRemoveDO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback.
______qdel_list_wrapperThe underscores are to encourage people not to use this directly.
_queue_verbqueue a callback for the given verb/verblike proc and any given arguments to the specified verb subsystem, so that they process in the next tick. intended to only work with verbs or verblike procs called directly from client input, use as part of TRY_QUEUE_VERB() and co.
_stack_traceGives us the stack trace from CRASH() without ending the current proc. Do not call directly, use the stack_trace macro instead.
active_aisReturns a list of all active AIs that can be slaved to
add_image_to_clientAdds an image to a client's .images. Useful as a callback.
add_image_to_clientsLike add_image_to_client, but will add the image from a list of clients
add_item_skinAdds an item skin to the skins list, organizing by item path
add_keybindingAdds an instanced keybinding to the global tracker
add_verbhandles adding verbs and updating the stat panel browser
add_zeroAdds 'u' number of zeros ahead of the text 't'
addtimerCreate a new timer and insert it in the queue. You should not call this directly, and should instead use the addtimer macro, which includes source information.
admin_jump_linkGenerates admin follow links for tracking specific atoms, with special handling for clients, AIs, and observer mobs
admin_pencode_to_htmlConverts pencode to HTML with additional admin-specific formatting Handles custom classes, styles, and images in pencode
adminscrubRuns byond's sanitization proc along-side strip_html_simple I believe strip_html_simple() is required to run first to prevent '<' from displaying as '<' that html_encode() would cause
alone_in_areaChecks if the mob provided (must_be_alone) is alone in an area
angle2textReturns the angle in english
animate_clownspellAnimates a clown spell effect with scaling and color change
animate_explode_pixelAnimates an atom exploding outward with random rotation and movement
animate_fade_coloredAnimates fading an atom from grayscale to normal color
animate_fade_grayscaleAnimates fading an atom to grayscale
animate_fade_to_color_fillAnimates fading to a specific color fill
animate_fading_leap_downAnimates an atom leaping downward while appearing and scaling down
animate_fading_leap_upAnimates an atom leaping upward while fading and scaling
animate_flash_color_fillAnimates flashing between a specific color and white
animate_flash_color_fill_inheritAnimates flashing between a specific color and the original color
animate_floatAnimates an atom floating up and down with rotation
animate_ghostly_presenceAnimates a ghostly presence effect with floating and rotation
animate_levitateAnimates an atom levitating slightly with rotation
animate_melt_pixelAnimates an atom melting downward with a bounce effect
animate_rainbow_glowAnimates a full rainbow color cycle
animate_rainbow_glow_oldAnimates a simple rainbow color cycle (red, green, blue)
animate_rumbleAnimates a rumbling effect by translating the atom in four directions
animate_shakeAnimates shaking an atom randomly on its tile
animate_shockwaveAnimates a shockwave effect with rotation and vertical movement
animate_spinAnimates spinning an atom in the specified direction
animate_teleportAnimates a teleportation effect with scaling and color change
animate_teleport_wizAnimates a wizard-style teleportation effect
animate_wiggle_then_resetAnimates wiggling an atom randomly then resetting to original position
apply_text_macrosUsed for applying byonds text macros to strings that are loaded at runtime
are_zs_connectedChecks if both atoms are in same z or in connected z-levels.
assert_sortedVerifies that a list is sorted according to the given comparator function Throws a runtime error if the list is not sorted
assertion_messageGenerates a formatted assertion message for debugging purposes
assoc_to_keysConverts an associative list into a flat list of keys
atmos_scanOutputs a message to the user describing the target's gasmixes.
avoid_assoc_duplicate_keysTakes an input_key, as text, and the list of keys already used, outputting a replacement key in the format of "[input_key] ([number_of_duplicates])" if it finds a duplicate Use this for lists of things that might have the same name, like mobs or objects, that you plan on giving to a player as input
bangCreates a flashing effect that blinds and deafens mobs within range
betweenEnsures a value is between a minimum and maximum, clamping it if necessary
bitfield_to_listConverts a bitfield to a list of numbers (or words if a wordlist is provided)
blendMode2iconModeConverts a blend_mode constant to one acceptable to icon.Blend()
border_diamond_range_turfsReturns the list of turfs around the outside of a center based on RANGE_TURFS()
broadcast_messageMessage Broadcast Proc
build_planeed_apperance_queueTakes a list of mutable appearances Returns a list in the form: 1 - a list of all mutable appearances that would need to be updated to change planes in the event of a z layer change, alnongside the commands required to properly track parents to update 2 - a list of all parents that will require updating
byondapi_stack_traceExists by default in 516, but needs to be defined for 515 or byondapi-rs doesn't like it.
calculate_projectile_angle_and_pixel_offsetsCalculates the pixel offsets and angle that a projectile should be launched at.
can_lineChecks if a straight line can be drawn from source to target without hitting dense turfs within a specified length. Similar to can_line but only checks density and does not support other atoms.
capitalizeReturns a string with the first element of the string capitalized.
center_imageCenter's an image. Only run this on float overlays and not physical 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)
change_command_nameChanges the command name to the specified value
change_english_station_nameChanges the English station name and updates the world name
change_station_nameChanges the station name to the specified designation
check_active_security_force
check_rightsCheck if the current user has admin rights
check_rights_allRequires the holder to have all the rights specified
check_rights_ckeyCheck if a ckey has admin rights
check_rights_clientCheck if a /client has admin rights
check_target_facingsReturns the direction that the initiator and the target are facing
check_wall_itemCheck if there is already a wall item on the turf loc
checkpassChecks if mover is movable atom and has passed pass_flags.
church_nameReturns the current church name, generating one if not set
circle_rangeReturns all atoms present in a circle around the center
circle_range_turfsReturns a list of turfs around a center based on RANGE_TURFS()
circle_viewReturns all atoms present in a circle around the center but uses view() instead of range() (Currently not used)
circle_view_turfsReturns a list of turfs around a center based on view()
classic_worldtime2textThis proc should only be used for world/Topic. If you want to display the time for which dream daemon has been running ("round time") use worldtime2text. If you want to display the canonical station "time" (aka the in-character time of the station) use station_time_timestamp
closer_angle_differenceFinds the shortest angle that angle A has to change to get to angle B. Aka, whether to move clock or counterclockwise.
cmp_camera_ctag_ascOrders cameras by their c_tag ascending
cmp_port_order_ascOrders by integrated circuit weight
color2BReturns an integer value for B of R/G/B given a hex color input.
color2GReturns an integer value for G of R/G/B given a hex color input.
color2RReturns an integer value for R of R/G/B given a hex color input.
command_nameReturns the current command name, falling back to the map's dock name if not set
compare_listCompare two lists, returns TRUE if they are the same
convert_pencode_argConverts pencode arguments to HTML tags with safety checks Called by admin_pencode_to_html to handle custom tags
copytext_preserve_htmlalternative copytext() for encoded text, doesn't break html entities (" and other)
count_by_typeCounts the number of items of a specified type in a list
counterlist_combineCombines two counter lists by adding values for matching keys
counterlist_normaliseNormalizes a counter list by dividing each value by the total sum
counterlist_scaleScales all values in a counter list by a given scalar factor
counterlist_sumCalculates the sum of all values in a counter list
create_strippable_listCreates an assoc list of keys to /datum/strippable_item
cut_relative_directionTakes a screen_loc string and removes any directions like NORTH or SOUTH
dd_hasprefix_caseChecks the beginning of a string for a specified sub-string. This proc is case sensitive Returns the position of the substring or 0 if it was not found
dd_hassuffixChecks the end of a string for a specified substring. Returns the position of the substring or 0 if it was not found
dd_limittextLimits the length of the text. Note: MAX_MESSAGE_LEN and MAX_NAME_LEN are widely used for this purpose
dd_rangeClamps a number to the specified range
declension_ruВозвращает правильную форму слова, соответствующую русскому склонению числительных.
deep_copy_listRecursively copies a list and all lists contained within it Does not copy any other reference types
delete_all_SS_and_recreate_masterDelete all existing SS to basically start over
delta_to_angleCalculate the angle produced by a pair of x and y deltas
deltimerDelete a timer
depower_apcsDepowers all APCs on the station by draining their cells
detect_roomDetects a room of connected turfs starting from an origin point Returns an associative list of turf|dirs pairs where dirs are connected turfs in the same space
diagonally_blockedcheck if 2 diagonal turfs are blocked by dense objects
diff_appearancesTakes two appearances as args, prints out, logs, and returns a text representation of their differences Including suboverlays
difflistReturns list containing all the entries from first list that are not present in second. If skiprep = TRUE, repeated elements are treated as one. If either of arguments is not a list, returns null
dir2anglereturns the north-zero clockwise angle in degrees, given a direction
dir2rustextTurns a direction into ru text
dir2textTurns a direction into eng text
directional_bounded_sumAdjusts a value by a given amount while respecting specified bounds Prevents inadvertently increasing the value in the wrong direction when at bounds
display_joulesFormat an energy value in J, kJ, MJ, or GJ. 1W = 1J/s.
display_powerFormats a power value in W, kW, MW, or GW.
display_roundstart_logout_reportReports player logouts.
do_afterTimed action involving one mob user. Target is optional. Checks that user does not move, change hands, get stunned, etc. for the given delay.
do_chem_smokeHelper to quickly create a cloud of reagent smoke
do_smokeA helper proc used to spawn small puffs of smoke.
do_sparksArguments:
dump_in_spaceDump a movable in a random valid spacetile
dviewVersion of view() which ignores darkness, because BYOND doesn't have it.
emissive_appearanceProduces a mutable appearance glued to the EMISSIVE_PLANE dyed to be the EMISSIVE_COLOR. Order of application matters: Default generated blockers are overlays, and will block its own emissive underlays. If you want an object to be both a blocker, and have their own emissive, it has to be an overlay instead. Grayscale lightmasks are visible in the BYOND right-click and Examine pane, unless they're covered up by another overlay.
emissive_blockerProduces a mutable appearance glued to the EMISSIVE_PLANE dyed to be the EM_BLOCK_COLOR.
end_cooldownCallback called by a timer to end an associative-list-indexed cooldown.
endswithReturns TRUE if the input_text ends with the ending
english_listReturns a list in plain english as a string
english_station_nameReturns the English station name, falling back to appropriate defaults if not set
escape_regex_smartEscapes regex special characters in a string for safe use in regular expressions
expand_weightsTakes a weighted list and expands it into raw entries This eats more memory, but saves time when actually picking from it
explosionMakes a given turf explode.
fast_emissive_blockerThis is a semi hot proc, so we micro it. saves maybe 150ms
ff_canseeChecks if there is a clear line of sight between two atoms using field of view algorithm
filename_sanitizeGut ANYTHING that isnt alphanumeric, or brackets
fill_with_onesGiven a list, return a copy where values without defined weights are given weight 1. For example, fill_with_ones(list(A, B=2, C)) = list(A=1, B=2, C=1) Useful for weighted random choices (loot tables, syllables in languages, etc.)
filter_fancy_listFilters a fancy list by a given search term
find_stealth_keyResolves a stealth key to its original ckey
finish_unequip_mobA utility function for /datum/strippable_items to finish unequipping an item from a mob.
fire_flash_logFlashfire is a proc used to log fire causing chemical reactions.
flash_colorFlashes a color on the screen of a mob or client for a specified duration
flick_overlayAdd an image to a list of clients and calls a proc to remove it after a duration
flop_animationThis animation should be applied to actual parent atom instead of vc_object.
format_frequencyFormat frequency by moving the decimal.
format_si_suffixFormats num with an SI prefix.
format_textProperly format a string of text by using replacetext()
freeborgWhen an AI is activated, it can choose from a list of non-slaved borgs to have as a slave.
gas_mixture_parser
gaussianConverts a uniformly distributed random number into a normally distributed one using the Box-Muller transform Since this method produces two random numbers, one is saved for subsequent calls (making the cost negligible for every second call) This will return +/- decimals, situated about mean with standard deviation stddev 68% chance that the number is within 1stddev 95% chance that the number is within 2stddev 98% chance that the number is within 3stddev...etc
genderize_decodeОбрабатывает гендерно-зависимую текстовую разметку в строке.
genderize_ruВозвращает форму слова с учётом грамматического рода в русском языке.
generate_and_hash_rsc_fileGenerates a filename for a given asset. Like generate_asset_name(), except returns the rsc reference and the rsc file hash as well as the asset name (sans extension) Used so that certain asset files dont have to be hashed twice
generate_asset_nameGenerate a filename for this asset The same asset will always lead to the same asset name (Generated names do not include file extention.)
generate_bitfieldsTurns /datum/bitfield subtypes into a list for use in debugging
generate_space_underlayGenerates a space underlay for a turf This provides proper lighting support alongside just looking nice Accepts the appearance to make "spaceish", and the turf we're doing this for
generate_tracer_between_pointsGenerates a tracer beam between two points Do not pass z-crossing points as that will not be properly (and likely will never be properly until it's absolutely needed) supported!
getReturns the atom type in the specified loc
getRelativeDirectionGet the direction of startObj relative to endObj. Return values: To the right, 1. Below, 2. To the left, 3. Above, 4. Not found adjacent in cardinal directions, 0.
get_adjacent_areasReturns a list of all areas that are adjacent to the center atom's area, clear the list of nulls at the end.
get_adjacent_open_areasReturns a list with all the adjacent areas by getting the adjacent open turfs
get_adjacent_open_turfsReturns a list with all the adjacent open turfs. Clears the list of nulls in the end.
get_all_linked_levels_zposProc to get a list of all the linked-together Z-Levels
get_allowed_instrument_idsGet all non admin_only instruments as a list of text ids.
get_angleCalculate the angle between two movables and the west|east coordinate
get_angle_rawAngle between two arbitrary points and horizontal line same as /proc/get_angle
get_antag_type_strings_listA proc that return an array of capitalized strings containing name of the antag types they are
get_antag_type_truncated_plaintext_stringA proc that return a string containing all the singled out antags . Empty string if not antag
get_anticlockwise_dirGet the dir to the LEFT of dir if they were on a clock NORTH --> NORTHWEST
get_area_nameReturns the name of the area the atom is in, with optional formatting
get_area_turfsTakes: 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.
get_areasTakes: 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.
get_areas_in_rangeReturns a list with the names of the areas around a center at a certain distance Returns the local area if no distance is indicated Returns an empty list if the center is null
get_atom_on_turfReturns the top-most 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.
get_atoms_of_typeReturns a list of atoms in a location of a given type. Can be refined to look for pixel-shift.
get_bbox_of_atomsGet a bounding box of a list of atoms.
get_cached_actionspeed_modifierGrabs a STATIC MODIFIER datum from cache. YOU MUST NEVER EDIT THESE DATUMS, OR IT WILL AFFECT ANYTHING ELSE USING IT TOO!
get_cached_movespeed_modifierGrabs a STATIC MODIFIER datum from cache. YOU MUST NEVER EDIT THESE DATUMS, OR IT WILL AFFECT ANYTHING ELSE USING IT TOO!
get_cardinal_dirGet the cardinal direction between two atoms
get_channel_nameReturns the clean name of an audio channel.
get_client_by_ckeyFinds a client by their ckey, handling stealth keys
get_clockwise_dirGet the dir to the RIGHT of dir if they were on a clock NORTH --> NORTHEAST
get_closest_atomReturns the closest atom of a specific type in a list from a source
get_colored_rankReturns colored rank representation.
get_compass_dirget_dir() only considers an object to be north/south/east/west if there is zero deviation. This uses rounding instead. Ported from CM-SS13
get_config_multiplicative_speed_by_pathSame as above but search by passed path
get_dist_euclideanReturns the distance between two atoms
get_dummy_savefileGets a dummy savefile for usage in icon generation. Savefiles generated from this proc will be empty.
get_edge_target_turfReturns the turf located at the map edge in the specified direction relative to target_atom used for mass driver
get_fancy_list_of_atom_typesReturns a pre-generated fancy list of all atom types
get_fancy_list_of_datum_typesReturns a pre-generated fancy list of all datum types (excluding atoms)
get_hearLike view but bypasses luminosity check
get_hearers_in_LOSReturns a list of movable atoms that are hearing sensitive in view_radius and line of sight to source the majority of the work is passed off to the spatial grid if view_radius > 0 because view() isnt a raycasting algorithm, this does not hold symmetry to it. something in view might not be hearable with this. if you want that use get_hearers_in_view() - however thats significantly more expensive
get_hearers_in_rangeThe exact same as get_hearers_in_view, but not limited by visibility. Does no filtering for traits, line of sight, or any other such criteria. Filtering is intended to be done by whatever calls this function.
get_hearers_in_viewreturns every hearaing movable in view to the turf of source not taking into account lighting useful when you need to maintain always being able to hear something if a sound is emitted from it and you can see it (and youre in range). otherwise this is just a more expensive version of get_hearers_in_LOS().
get_icon_dimensionsReturns a list containing the width and height of an icon file
get_icon_dmi_pathGiven an icon object, dmi file path, or atom/image/mutable_appearance, attempts to find and return an associated dmi file path. A weird quirk about dm is that /icon objects represent both compile-time or dynamic icons in the rsc, But stringifying rsc references returns a dmi file path ONLY if that icon represents a completely unchanged dmi file from when the game was compiled. So if the given object is associated with an icon that was in the rsc when the game was compiled, this returns a path. otherwise it returns ""
get_lineGet a list of turfs in a line from starting_atom to ending_atom.
get_list_countCounts the number of nested lists within a list, up to a maximum count
get_location_accessibleThis proc is made to check if we can interact or use (directly or in the other way) the specific bodypart Not to check if one clothing blocks access to the other clothing for that we have flags_inv var
get_location_nameReturns the name of the area the atom is in, with optional formatting
get_mindGets the mind from a variable, whether it be a mob, or a mind itself. Also works on brains - it will try to fetch the brainmob's mind. If [include_last] is true, then it will also return last_mind for carbons if there isn't a current mind.
get_mob_by_ckeyReturns a mob type controlled by a specified ckey
get_mob_by_keyFinds a mob by their ckey (case-insensitive)
get_mob_in_atom_with_warningGets the first mob contained in an atom, and warns the user if there's not exactly one
get_mob_with_client_listReturns a list of all mobs that have an active client
get_mobs_in_viewThe old system would loop through lists for a total of 5000 per function call, in an empty server. This new system will loop at around 1000 in an empty server. Returns a list of mobs in range from source. Used in radio and say code.
get_nested_locsReturns a list of all locations (except the area) the movable is within.
get_observersReturns a list of all observer mobs in the player list
get_offset_target_turfReturns turf relative to target_atom offset in dx and dy tiles, bound to map limits
get_open_turf_in_dirReturns the open turf next to the center in a specific direction
get_overlapReturns a list where [1] is all x values and [2] is all y values that overlap between the given pair of rectangles
get_pain_modifierreturns modfier to make surgery harder if patient is conscious and feels pain
get_path_toThis is the proc you use whenever you want to have pathfinding more complex than "try stepping towards the thing". If no path was found, returns an empty list, which is important for bots like medibots who expect an empty list rather than nothing. It will yield until a path is returned, using magic
get_rand_frequencyget a random frequency.
get_rand_frequency_low_rangeget_rand_frequency but lower range.
get_random_station_turfReturns a random turf on the station
get_ranged_target_turfReturns turf relative to A in given direction at set range Result is bounded to map size Note range is non-pythagorean Used for disposal system
get_runechat_languageGets language for runechat message. Will return first found language if more than one is present, cause I have no time to remake this for now.
get_safe_random_station_turfReturns a random turf on the station, excludes dense turfs (like walls) and areas that have valid_territory set to FALSE
get_sfxUsed to convert a SFX define into a .ogg so we can add some variance to sounds. If soundin is already a .ogg, we simply return it
get_small_overlayFikou's fix for making toast alerts look nice - resets offsets, transforms to fit
get_sorted_areasReturns a sorted version of GLOB.areas, by name
get_sorted_mobsReturns a sorted list of mobs by category and status
get_spawnpanel_for_adminReturns a spawnpanel instance belonging to this user, or creates and registers a new one
get_swarm_path_toPOTENTIALLY cheaper version of get_path_to This proc generates a path map for the end atom's turf, which allows us to cheaply do pathing operations "at" it Generation is significantly SLOWER then get_path_to, but if many things are/might be pathing at something then it is much faster Runs the risk of returning an suboptimal or INVALID PATH if the delay between map creation and use is too long
get_teleport_locReturns location. Returns null if no location was found.
get_turf_pixelLets 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 at least 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
get_uplink_itemsProc that generates a list of items, available for certain uplink.
get_valid_screen_locationReturns a valid location to place a screen object without overflowing the viewport
get_valid_vent_spawnsReturns a list of vents that can be used as a potential spawn if they meet the criteria set by the arguments
get_visual_offsetReturns how visually "off" the atom is from its source turf as a list of x, y (in pixel steps) it takes into account: Pixel_x/y Matrix x/y Icon width/height
getmobsReturns a list of all mobs with their display names as keys
getpoisThis proc gets a list of all "points of interest" (poi's) that can be used by admins to track valuable mobs or atoms (such as the nuke disk). @param mobs_only if set to TRUE it won't include locations to the returned list @param skip_mindless if set to TRUE it will skip mindless mobs @param force_include_bots if set to TRUE it will include bots even if skip_mindless is set to TRUE @param force_include_cameras if set to TRUE it will include camera eyes even if skip_mindless is set to TRUE @return returns a list with the found points of interest
ghost_follow_linkGenerates follow links for ghosts to track specific atoms, with special handling for AIs and observer mobs
greatest_common_factorTakes a list of numbers and returns the highest value that cleanly divides them all Note: this implementation is expensive for large numbers, intended for small lists
heat2colorheat2color functions. Adapted from: http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code
html_to_pencodeConverts HTML back to pencode format
icon2base64Converts an icon to base64. Operates by putting the icon in the iconCache savefile, exporting it as text, and then parsing the base64 from that. (This relies on byond automatically storing icons in savefiles as base64)
icon2htmlgenerate an asset for the given icon or the icon of the given appearance for [thing], and send it to any clients in target. Arguments:
icon_existsChecks if the given iconstate exists in the given file, caching the result. Setting scream to TRUE will print a stack trace ONCE.
inLineOfSightCalculate if two atoms are in sight, returns TRUE or FALSE
init_datum_subtypesCreates every subtype of a given prototype (excluding the prototype itself and specified exceptions) and adds them to an associative list using a specified variable as the key
init_emote_listInitializes and returns an associative list of emote keys to their corresponding emote datums
init_item_skinsInitializes and returns a list of all item skins by creating instances of each item skin subtype that has a defined name.
init_keybindingsCreates and sorts all the keybinding datums
init_slotmachine_prizesInitializes the list of slot machine prizes by filtering uplink items and creating prize datums
init_subtypesCreates every subtype of a given prototype (excluding the prototype itself) and adds them to a list
init_uplink_items_listInitializes and returns a list of all uplink items by creating instances of each uplink item subtype that has a defined initial item.
ionnumPicks a string of symbols to display as the law number for hacked or ion laws
is_bad_connectionConnection checker
is_file_typeVerifys wether a string or file ends with a given file type
is_file_type_in_listVerifys wether a string or file ends with a given file type.
is_guest_keyReturns whether or not a player is a guest using their ckey as an input
is_in_teleport_proof_areaChecks if an atom is in a teleport-proof area or z-level
is_location_within_transition_boundariesProc that returns if selected loc, or atom is within boundaries of playable area. (non-transitional space)
is_path_existChecks line path from source to target, using dummy with passed flags. Returns TRUE if path exist, FALSE otherwise.
is_player_station_relevantAll the checks required to find baseline human being
is_source_facing_targetCompare 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
is_special_characterA proc that return whether the mob is a "Special Character" aka Antagonist
is_type_in_UID_listIf the list L contains a datum UID who's type matches D's type, returns the UID of that datum in the list. Otherwise returns null.
is_type_in_listChecks if an atom is of a type present in the given list
is_type_in_typecacheChecks if an atom's type is present in a typecache list
is_valid_dmi_filegiven a text string, returns whether it is a valid dmi icons folder path
is_valid_srcCheck if a datum has not been deleted and is a valid source
isblobinfectedTakes any datum source and checks it for blob_infected datum.
isblobminionTakes any datum source and checks it for blob_minion datum.
isblobovermindTakes any datum source and checks it for blob_overmind datum.
ischangelingTakes any datum source and checks it for changeling datum.
isdevilantagTakes any datum source and checks it for devil datum.
isemptylistChecks if the list is empty
ismalfAITakes any datum source and checks it for malf AI datum.
isninjaTakes any datum source and checks it for ninja datum.
istraitorTakes any datum source and checks it for traitor datum.
isvampireTakes any datum source and checks it for vampire datum.
isvampirethrallTakes any datum source and checks it for vampire thrall datum.
lavaland_equipment_pressure_checkChecks if the pressure at a given turf is low enough for lavaland equipment effects
list_clear_duplicatesRemoves all occurrences of a specified element from a list
list_clear_empty_weakrefsRemoves any empty weakrefs from the list Returns TRUE if the list had empty refs, FALSE otherwise
list_clear_nullsRemoves any null entries from the list Returns TRUE if the list had nulls, FALSE otherwise
listgetindexReturns list element or null. Should prevent "index out of bounds" error.
lists_equal_unorderedChecks if two lists contain the same elements, ignoring order
load_poll_dataLoads all current and future server polls and their options to store both as datums.
load_strings_fileLoad and cache a JSON string file
locateUIDLocates a datum based off of the UID
log_played_namesAdds the new names to the player's played_names list on their /datum/persistent_client for use of admins. ckey should be their ckey, and data should be an associative list with the keys being the names they played under and the values being the unique mob ID tied to that name.
log_startup_progress_globalStandardized method for tracking startup times.
make_associativeA proc for turning a list into an associative list.
make_bit_tripletGenerates a bit triplet by selecting three unique numbers from 1 to 9 and setting corresponding bits Returns a number with three bits set based on the selected numbers
md5asfileSave file as an external file then md5 it. Used because md5ing files stored in the rsc sometimes gives incorrect md5 results.
md5filepathReturns the md5 of a file at a given path.
message_adminTicketSends a message to the staff able to see admin tickets Arguments: msg - The message being send important - If the message is important. If TRUE it will ignore the CHAT_NO_TICKETLOGS preferences, send a sound and flash the window. Defaults to FALSE
message_mentorTicketSends a message to the staff able to see mentor tickets Arguments: msg - The message being send important - If the message is important. If TRUE it will ignore the CHAT_NO_TICKETLOGS preferences, send a sound and flash the window. Defaults to FALSE
message_to_htmlMessage-related procs
mobs_in_areaReturns a list of mobs in the specified area, optionally filtering by client presence
move_elementMoves a single element from one position to another within a list, preserving associations
move_rangeMoves a range of elements from one position to another within a list, preserving associations
movespeed_data_null_checkChecks if a move speed modifier is valid and not missing any data
mutable_appearance
new_station_nameGenerates a new random station name.
normalize_angleGet normalized angle (for fix rotation animation bug near 90 and -90 degrees)
numeric_endingReturns a string depending on number it receives
offset_to_screen_locConverts pixel offsets to a screen location string
on_operable_surfacecheck if mob is lying down on something we can operate on.
overlays2textConverts an overlay list into text for debug printing Of note: overlays aren't actually mutable appearances, they're just appearances Don't have access to that type tho, so this is the best you're gonna get
paranoid_sanitizeGut ANYTHING that isnt alphanumeric, or brackets
parse_caught_click_modifiersReturns a turf based on text inputs, original turf and viewing client
passA do nothing proc
path_map_passalongWe generate a path for the passed in callbacks, and then pipe it over
pathfinding_finishedUses funny pass by reference bullshit to take the output created by pathfinding, and insert it into a return list We'll be able to use this return list to tell a sleeping proc to continue execution
pathwalkTakes a directory and returns every file within every sub directory. If extensions_filter is provided then only files that end in that extension are given back. If extensions_filter is a list, any file that matches at least one entry is given back.
peekReturns the top (last) element from the list, does not remove it from the list. Stack functionality.
pencode_to_htmlConverts pencode to HTML with various formatting options
pick_candidates_all_typesPresents admin with choice of candidate selection methods
pick_candidates_manuallyManually picks candidates from all available ghosts without a poll
pick_closest_pathReturns a chosen path that is the closest to a list of matches
pick_multiple_uniquePicks multiple unique elements from the suplied list. If the given list has a length less than the amount given then it will return a list with an equal amount
pick_n_takePick a random element from the list and remove it from the list.
pick_weight_classicPicks a random element from a list based on a weighting system. All keys with zero or non integer weight will be considered as zero For example, given the following list: A = 6, B = 3, C = 1, D = 0 A would have a 60% chance of being picked, B would have a 30% chance of being picked, C would have a 10% chance of being picked, and D would have a 0% chance of being picked. This proc not modify input list
pick_weight_n_takePicks a random element by weight from the list and removes it from the list
pick_weight_recursiveLike pick_weight, but allowing for nested lists.
pickweightPicks a random element from a list based on a weighting system. All keys with zero or non integer weight will be considered as one For example, given the following list: A = 5, B = 3, C = 1, D = 0 A would have a 50% chance of being picked, B would have a 30% chance of being picked, C would have a 10% chance of being picked, and D would have a 10% chance of being picked. This proc not modify input list
pixel_offset_turfTakes a turf, and a list of x and y pixel offsets and returns the turf that the offset position best lands in
pixel_shift_dirReturns a list with pixel_shift values that will shift an object's icon one tile in the direction passed.
play_cinematicPlays a cinematic, duh. Can be to a select few people, or everyone.
playsoundplaysound is a proc used to play a 3D sound in a specific range. This uses SOUND_RANGE + extra_range to determine that.
pluralize_ruВозвращает форму единственного или множественного числа в зависимости от грамматического рода.
poll_candidates_with_vetoPolls candidates with admin veto selection from a list of willing ghosts
popReturns the top (last) element from the list, does not remove it from the list. Stack functionality.
popleftReturns the first element from the list and removes it. Queue functionality.
power_failureCauses random APCs to short out with a given probability
power_restoreCan recharge APC cells, repair cut wires, or both. Sends station announcement if requested.
power_restore_quickQuickly restores all SMES units to full capacity and maximum output
prepare_antag_dataPrepares antagonist data for caching and display
prepare_antag_listProcesses a list of antagonists and prepares their data
prepare_explosion_turfsReturns a list of turfs in X range from the epicenter Returns in a unique order, spiraling outwards This is done to ensure our progressive cache of blast resistance is always valid This is quite fast
prepare_nodatum_antagsCollects data for all non-datum based antagonist types
pretty_string_from_reagent_listInput a reagent_list, outputs pretty readable text! Default output will be formatted as
print_single_lineConverts a list to a string representation in "list(key => value, ...)" format
prof_initStarts Tracy
prof_stopStops Tracy
qdelShould be treated as a replacement for the 'del' keyword. Datums passed to this will be given a chance to clean up references to allow the GC to collect them.
randmutGives random mutation
random_body_accessoryReturns a random body accessory for a given species name. Can be null based on is_optional argument.
random_stepForces the atom to take a step in a random direction
realize_appearance_queueTakes a list of appearnces, makes them mutable so they can be properly vv'd and inspected
recover_all_SS_and_recreate_masterRecreate all SSs which will still cause data survive due to Recover(), the new Master will then find and take them from global.vars
recursive_mob_checkWill recursively loop through an atom's contents and check for mobs, then it will loop through every atom in that atom's contents. It will keep doing this until it checks every content possible. This will fix any problems with mobs, that are inside objects, being unable to hear people due to being in a box within a bag.
reject_bad_nameFilters out undesirable characters from names
reject_bad_textReturns null if there is any bad text in the string
relay_to_list_and_observersSends a message to everyone within the list, as well as all observers.
religion_nameReturns the current religion name, generating one if not set
remove_changeling_mutationsRemoves all mutated items on owner: armblade, tentacle, chitin suit etc. Global proc since we might need to delete mutated parts on any user.
remove_clunky_diagonalsProcesses a path (list of turfs), removes any diagonal moves that would lead to a weird bump
remove_diagonalsProcesses a path (list of turfs), removes any diagonal moves
remove_image_from_clientRemoves an image from a client's .images. Useful as a callback.
remove_image_from_clientsLike remove_image_from_client, but will remove the image from a list of clients
remove_verbhandles removing verb and sending it to browser to update, use this for removing verbs
render_statsFor use with the stopwatch defines
request_z_pillarReturns a z pillar to insert turfs into
reset_cooldownProc used by stoppable timers to end a cooldown before the time has ran out.
return_file_textchecks if a file exists and contains text returns text as a string if these conditions are met
return_typenamesSplits a type path into its component names
reverse_rangeReverses the order of elements in a list within the specified range Replaces reverseList ~Carnie
rgb2hslcolour formats
rights2textConverts a rights bitfield into a string
rot13Returns the rot13'ed text
round_downMARK: THIS DONT WORK!
roundtime2textReturns the world time in english
runechat_emoteSend an emote to runechat for all (listening) users in the vicinity.
russian_listReturns a list in plain russian as a string
rustg_get_versionGets the version of rust_g
rustg_git_commit_dateReturns the date of the given revision using the provided format. Defaults to returning %F which is YYYY-MM-DD.
rustg_git_commit_date_headReturns the formatted datetime string of HEAD using the provided format. Defaults to returning %F which is YYYY-MM-DD. This is different to rustg_git_commit_date because it only needs the logs directory.
rustg_redis_disconnect_rqDisconnects from a previously connected redis server
rustg_unix_timestampReturns the timestamp as a string
safe_get_ckeySafe ckey getter
safepickReturn either pick(list) or null if list is not of type /list or is empty
sanitizeRuns byond's sanitization proc along-side sanitize_simple
sanitize_english_key_to_russianConverts a single English keyboard character to its Russian equivalent
sanitize_english_string_to_russianConverts an entire English string to Russian keyboard layout
sanitize_filenameRemoves characters incompatible with file names.
sanitize_filepathSanitizes the name of each node in the path.
sanitize_frequencyEnsure the frequency is within bounds of what it should be sending/receiving at
sanitize_genderSanitizes a gender value to ensure it is valid
sanitize_hexcolorSanitizes a hexadecimal color value to ensure it is valid
sanitize_inlistSanitizes a value by ensuring it exists in a list
sanitize_integerSanitizes an integer value to ensure it falls within a specified range
sanitize_jsonSanitizes JSON input and returns a decoded list
sanitize_russian_key_to_englishConverts a single Russian keyboard character to its English equivalent
sanitize_simpleRemoves a few problematic characters
sanitize_specsymbols_key_to_numbersConverts special symbols to their number equivalents for keybindings
sanitize_textSanitizes a text value to ensure it is valid text
screen_loc_to_offsetConverts a screen location string to pixel offsets
screen_textReturn an object with a new maptext (not currently in use)
seconds_to_clockTake a value in seconds and makes it display like a clock
seconds_to_timeTake a value in seconds and returns a string of minutes and seconds in the format X minute(s) and X seconds.
select_active_aiPresents a list of active AIs for selection, or picks one randomly if no user is provided
select_active_ai_with_fewest_borgsFind an active AI with the least number of borgs
send_random_fake_pmSends a random fake PM from a randomly selected fake administrator
send_to_observersSends a message to all dead and observing players, if a source is provided a follow link will be attached.
send_to_playing_playersSends a whatever to all playing players; use instead of to_chat(world, where needed)
shake_cameraShake the camera of the person viewing the mob SO REAL! Takes the mob to shake, the time span to shake for, and the amount of tiles we're allowed to shake by in tiles Duration isn't taken as a strict limit, since we don't trust our coders to not make things feel shitty. So it's more like a soft cap.
show_blurbShows a ticker reading out the given text on a client's screen. targets = mob or list of mobs to show it to. duration = how long it lingers after it finishes ticking. message = the message to display. Due to using maptext it isn't very flexible format-wise. 11px font, up to 480 pixels per line. Use \n for line breaks. Single-character HTML tags (, , etc.) are handled correctly but others display strangely. Note that maptext can display text macros in strange ways, ex. \improper showing as "ÿ". Lines containing only spaces, including ones only containing "\improper ", don't display. scroll_down = by default each line pushes the previous line upwards - this tells it to start high and scroll down. Ticks on \n - does not autodetect line breaks in long strings. screen_position = screen loc for the bottom-left corner of the blurb. text_alignment = "right", "left", or "center" text_color = colour of the text. blurb_key = a key used for specific blurb types so they are not shown repeatedly. ignore_key = used to skip key checks. text_limit = limit in characters of the message.
show_generic_antag_textAnnounces objectives/generic antag text.
show_radial_menuPresents radial menu to user anchored to anchor (or user if the anchor is currently in users screen) Choices should be a list where list keys are movables or text used for element names and return value and list values are movables/icons/images used for element icons
shuffleReturns a new list with the elements in random order
shuffle_inplaceShuffles a list in place and returns the same list
slice_off_turfsReturns a slice of a list of turfs, defined by the ones that are inside the inner/outer angle's bounds
sort_listsort any value in a list
sort_mobsOrders mobs by type then by name
sort_namesuses sort_list() but uses the var's name specifically
spanning_screen_locReturns a screen_loc format for a tiling screen objects from start and end positions Start should be bottom left corner, and end top right corner
spiral_range_turfssimilar function to RANGE_TURFS(), but will search spiralling outwards from the center (like the above, but only turfs)
sqrtor0Calculates the square root of a number, returning 0 for negative inputs to avoid runtime errors
start_unequip_mobA utility function for /datum/strippable_items to start unequipping an item from a mob.
start_watchReturns "watch handle" (really just a timestamp :V)
station_nameReturns the current station name, falling back to the map's station name if not set
station_timeThis is used for displaying the "station time" equivelent of a world.time value Calling it with no args will give you the current time, but you can specify a world.time-based value as an argument
stop_watchReturns number of seconds elapsed. @param wh number The "Watch Handle" from start_watch(). (timestamp)
stoplagReturns the number of ticks slept
string2listofvarsThis is a weird one: It returns a list of all var names found in the string These vars must be in the [var_name] format It's only a proc because it's used in more than one place
string_listCaches lists with non-numeric stringify-able values (text or typepath).
stringsGet strings array from a JSON string file
strings_replacementGet a random string with nested @pick() replacements
strings_subkey_lookupCallback for regex replacement in strings_replacement
strip_htmlRuns sanitize and strip_html_simple I believe strip_html_simple() is required to run first to prevent '<' from displaying as '<' after sanitize() calls byond's html_encode()
strip_html_properlyThis proc strips html properly, but it's not lazy like the other procs. This means that it doesn't just remove < and > and call it a day. Also limit the size of the input, if specified.
strip_html_simpleSimply removes < and > and limits the length of the message
stripped_inputUsed to get a sanitized input.
stripped_multiline_inputUsed to get a properly sanitized multiline input, of max_length
subtypesofReturns a list containing all subtypes of the given path, but not the given path itself.
swap_rangeSwaps two ranges of elements within a list, preserving order of overwritten elements Note: If ranges overlap, only the destination order will be fully preserved
system_nameReturns the system name from the map datum
text2dirTurns text into proper directions
text2dir_rusTurns text into proper directions
text2matrixArgument: Give this a space-separated string consisting of 6 numbers. Returns null if you don't
tgalertDEPRECATED: USE tgui_alert(...) INSTEAD
tgui_TopicMiddleware for /client/Topic.
tgui_alertCreates a TGUI alert window and returns the user's response.
tgui_input_checkbox_listCreates a TGUI input list window and returns the user's response in a ranked order.
tgui_input_colorCreates a TGUI color picker window and returns the user's response.
tgui_input_keycomboCreates a TGUI window with a key input. Returns the user's response as a full key with modifiers, eg ShiftK.
tgui_input_listCreates a TGUI input list window and returns the user's response.
tgui_input_numberCreates a TGUI window with a number input. Returns the user's response as num | null.
tgui_input_ranked_listCreates a TGUI input list window and returns the user's response.
tgui_input_textCreates a TGUI window with a text input. Returns the user's response.
time_to_twelve_hourConverts a time expressed in deciseconds (like world.time) to the 12-hour time format. the format arg is the format passed down to time2text() (e.g. "hh:mm" is hours and minutes but not seconds). the timezone is the time value offset from the local time. It's to be applied outside time2text() to get the AM/PM right.
timeleftGet the remaining deciseconds on a timer
to_chatSends the message to the recipient (target).
to_chat_immediateCircumvents the message queue and sends the message to the recipient (target) as soon as possible. trailing_newline, confidential, and handle_whitespace currently have no effect, please fix this in the future or remove the arguments to lower cache!
trimReturns a string with reserved characters and spaces before the first word and after the last word removed.
trim_leftReturns a string with reserved characters and spaces before the first letter removed
trim_lengthReturns a string that does not exceed max_length characters in size
trim_rightReturns a string with reserved characters and spaces after the last letter removed
try_move_adjacentAttempts to move a movable atom to an adjacent tile in a random cardinal direction
turf_peelBehaves like the orange() proc, but only looks in the outer range of the function (The "peel" of the orange). This is useful for things like checking if a mob is in a certain range, but not within a smaller range.
type2topReturns a string the last bit of a type, without the preceeding '/'
typecache_filter_listReturns a new list with only atoms that are in the provided typecache
typecache_filter_list_reverseReturns a new list with atoms that are not in the provided typecache
typecache_filter_multi_list_exclusionFilters atoms using both inclusion and exclusion typecaches
typecacheofLike typesof() or subtypesof(), but returns a typecache instead of a list
typing_inputUses client.typing to check if the popup should appear or not
unique_listReturns a new list with no duplicate entries
unique_list_in_placeRemoves duplicate entries from a list in place, preserving associated values
update_config_movespeed_type_lookupUpdates the global mob type to movespeed multiplier lookup table from configuration and optionally updates all existing mobs with the new movespeeds
update_mob_config_movespeedsUpdates the movement speed for all mobs in the game based on current configuration settings. This iterates through all mobs in the mob list and updates their movement speed.
update_world_nameUpdates the world name based on server configuration and station name.
updatetimedelayUpdate the delay on an existing LOOPING timer Will come into effect on the next process
urangeReturns all objects within a specified range of the center atom (no limitations on distance, faster than range for distances > 8)
urange_multizReturns all objects within a multiz-level range of the center atom
valid_build_directionChecks whether the target turf is in a valid state to accept a directional construction such as windows or railings.
view_to_pixelsTakes a string or num view, and converts it to pixel width/height in a list(pixel_width, pixel_height)
window_flashFlash the window of a player
worldtime2textReturns the world time in english
wrap_fileSecurity helpers to ensure you cant arbitrarily load stuff from disk

Var Details

Failsafe

Failsafe

Pretty much pokes the MC to make sure it's still alive.

Master

StonedMC

Designed to properly split up a given tick among subsystems Note: if you read parts of this code and think "why is it doing it that way" Odds are, there is a reason

SSai_behaviors

The subsystem used to tick /datum/ai_behavior instances. Handling the individual actions an AI can take like punching someone in the fucking NUTS

SSai_controllers

The subsystem used to tick /datum/ai_controllers instances. Handling the re-checking of plans.

SSai_movement

The subsystem used to tick /datum/ai_movement instances. Handling the movement of individual AI instances

SSambience

The subsystem used to play ambience to users every now and then, makes them real excited.

SSarea_contents

Responsible for managing the sizes of area.contained_turfs and area.turfs_to_uncontain These lists do not check for duplicates, which is fine, but it also means they can balloon in size over time as a consequence of repeated changes in area in a space They additionally may not always resolve often enough to avoid memory leaks This is annoying, so lets keep an eye on them and cut them down to size if needed

SSasset_loading

Allows us to lazyload asset datums Anything inserted here will fully load if directly gotten So this just serves to remove the requirement to load assets fully during init

SSaura_healing

The subsystem used to tick /datum/component/aura_healing instances.

SSchat

Copyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT

SScleanup

Cleanup Subsystem

For now, all it does is periodically clean the supplied global lists of any null values they may contain.

Why is this important?

Sometimes, these lists can gain nulls due to errors. For example, when a dead player trasitions from the dead_mob_list to the alive_mob_list, a null value may get stuck in the dead mob list. This can cause issues when other code tries to do things with the values in the list, but are instead met with null values. These problems are incredibly hard to track down and fix, so this subsystem is a solution to that.

SSclock_component

The subsystem used to tick /datum/component/acid instances.

SSearly_assets

Initializes any assets that need to be loaded ASAP. This houses preference menu assets, since they can be loaded at any time, most dangerously before the atoms SS initializes. Thus, we want it to fail consistently in CI as if it would've if a player opened it up early.

SSfluids

Fluid Subsystem

A subsystem that processes the propagation and effects of a particular fluid.

Both fluid spread and effect processing are handled through a carousel system. Fluids being spread and fluids being processed are organized into buckets. Each fresh (non-resumed) fire one bucket of each is selected to be processed. These selected buckets are then fully processed. The next fresh fire selects the next bucket in each set for processing. If this would walk off the end of a carousel list we wrap back to the first element. This effectively makes each set a circular list, hence a carousel.

SSfoam

The subsystem responsible for processing foam propagation and effects.

SSgame_events

This is a subsystem, which helps to process game modes through time.

SSlooting

Queues image generation for search objects without icons

SSmouse_entered

Defers MouseEntered inputs to only apply to the most recently hovered over atom in the tick

SSpersistent_data

Persistent Data Subsystem

Provides a centralised handler for persistent data reading and writing. The subsystem does not do any actual spawning itself, as this focuses on objects and mobs Should anything that is turf persistence related added in, that can be chucked into this SS Its quite a simple subsystem. For now, anyways.

SSsmoke

The subsystem responsible for processing smoke propagation and effects.

SSspatial_grid

Spatial Grid

a gamewide grid of spatial_grid_cell datums, each "covering" SPATIAL_GRID_CELLSIZE ^ 2 turfs. each spatial_grid_cell datum stores information about what is inside its covered area, so that searches through that area dont have to literally search through all turfs themselves to know what is within it since view() calls are expensive, and so is iterating through stuff you dont want. this allows you to only go through lists of what you want very cheaply.

you can also register to objects entering and leaving a spatial cell, this allows you to do things like stay idle until a player enters, so you wont have to use expensive view() calls or iteratite over the global list of players and call get_dist() on every one. which is fineish for a few things, but is k * n operations for k objects iterating through n players.

currently this system is only designed for searching for relatively uncommon things, small subsets of /atom/movable. dont add stupid shit to the cells please, keep the information that the cells store to things that need to be searched for often

The system currently implements two different "classes" of spatial type

The first exists to support important_recursive_contents. So if a client is inside a locker and the locker crosses a boundary, you'll still get a signal from the spatial grid. These types are SPATIAL_GRID_CONTENTS_TYPE_HEARING and SPATIAL_GRID_CONTENTS_TYPE_CLIENTS

The second pattern is more paired down, and supports more wide use. Rather then the object and anything the object is in being sensitive, it's limited to just the object itself Currently only SPATIAL_GRID_CONTENTS_TYPE_ATMOS uses this pattern. This is because it's far more common, and so worth optimizing

SStgui

tgui subsystem

Contains all tgui state and subsystem code.

Copyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT

SStimer

Timer Subsystem

Handles creation, callbacks, and destruction of timed events.

It is important to understand the buckets used in the timer subsystem are just a series of circular doubly-linked lists. The object at a given index in bucket_list is a /datum/timedevent, the head of a circular list, which has prev and next references for the respective elements in that bucket's circular list.

SSverb_manager

SSverb_manager, a subsystem that runs every tick and runs through its entire queue without yielding like SSinput. this exists because of how the byond tick works and where user inputted verbs are put within it.

see TICK_ORDER.md for more info on how the byond tick is structured.

The way the MC allots its time is via TICK_LIMIT_RUNNING, it simply subtracts the cost of SendMaps (MAPTICK_LAST_INTERNAL_TICK_USAGE) plus TICK_BYOND_RESERVE from the tick and uses up to that amount of time (minus the percentage of the tick used by the time it executes subsystems) on subsystems running cool things like atmospherics or Life or SSInput or whatever.

Without this subsystem, verbs are likely to cause overtime if the MC uses all of the time it has alloted for itself in the tick, and SendMaps uses as much as its expected to, and an expensive verb ends up executing that tick. This is because the MC is completely blind to the cost of verbs, it can't account for it at all. The only chance for verbs to not cause overtime in a tick where the MC used as much of the tick as it alloted itself and where SendMaps costed as much as it was expected to is if the verb(s) take less than TICK_BYOND_RESERVE percent of the tick, which isnt much. Not to mention if SendMaps takes more than 30% of the tick and the MC forces itself to take at least 70% of the normal tick duration which causes ticks to naturally overrun even in the absence of verbs.

With this subsystem, the MC can account for the cost of verbs and thus stop major overruns of ticks. This means that the most important subsystems like SSinput can start at the same time they were supposed to, leading to a smoother experience for the player since ticks arent riddled with minor hangs over and over again.

SSweather

Used for all kinds of weather, ex. lavaland ash storms.

SSwiremod_composite

This subsystem is to handle creating and storing composite templates that are used to create composite datatypes for integrated circuits

See: https://en.wikipedia.org/wiki/Composite_data_type

Proc Details

CallTechName

A simple helper proc to find the name of a tech with a given ID.

CreateBans

DEBUG

CreateRandomVirus

Creates and returns a random virus with properties independent of symptoms properties

DisplayTimeText

Takes a value of time in deciseconds. Returns a text value of that number in hours, minutes, or seconds.

GenerateKey

Generates a random key by combining words and numbers

IsFrozen

Checks if an atom is currently frozen

LinkBlocked

Among other things, used by flamethrower and boiler spray to calculate if flame/spray can pass through. Returns an atom for specific effects (primarily flames and acid spray) that damage things upon contact.

This is a copy-and-paste of the Enter() proc for turfs with tweaks related to the applications of LinkBlocked

Arguments:

RoundDiagBar

Diagnostic HUDs!

RoundHealth

Helper for getting the appropriate health status

SQLtime

Returns timestamp in a sql and ISO 8601 friendly format

SolveQuadratic

The quadratic formula. Returns a list with the solutions, or an empty list if they are imaginary.

TextPreview

Used in preferences' SetFlavorText and human's set_flavor verb Previews a string of len or less length

WEAKREF

Creates a weakref to the given input. See /datum/weakref's documentation for more information.

___TraitAdd

DO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback.

___TraitRemove

DO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback.

______qdel_list_wrapper

The underscores are to encourage people not to use this directly.

_queue_verb

queue a callback for the given verb/verblike proc and any given arguments to the specified verb subsystem, so that they process in the next tick. intended to only work with verbs or verblike procs called directly from client input, use as part of TRY_QUEUE_VERB() and co.

returns TRUE if the queuing was successful, FALSE otherwise.

_stack_trace

Gives us the stack trace from CRASH() without ending the current proc. Do not call directly, use the stack_trace macro instead.

active_ais

Returns a list of all active AIs that can be slaved to

add_image_to_client

Adds an image to a client's .images. Useful as a callback.

add_image_to_clients

Like add_image_to_client, but will add the image from a list of clients

add_item_skin

Adds an item skin to the skins list, organizing by item path

Arguments:

add_keybinding

Adds an instanced keybinding to the global tracker

add_verb

handles adding verbs and updating the stat panel browser

pass the verb type path to this instead of adding it directly to verbs so the statpanel can update Arguments:

add_zero

Adds 'u' number of zeros ahead of the text 't'

addtimer

Create a new timer and insert it in the queue. You should not call this directly, and should instead use the addtimer macro, which includes source information.

Arguments:

Generates admin follow links for tracking specific atoms, with special handling for clients, AIs, and observer mobs

Arguments:

admin_pencode_to_html

Converts pencode to HTML with additional admin-specific formatting Handles custom classes, styles, and images in pencode

adminscrub

Runs byond's sanitization proc along-side strip_html_simple I believe strip_html_simple() is required to run first to prevent '<' from displaying as '<' that html_encode() would cause

alone_in_area

Checks if the mob provided (must_be_alone) is alone in an area

angle2text

Returns the angle in english

animate_clownspell

Animates a clown spell effect with scaling and color change

Arguments:

animate_explode_pixel

Animates an atom exploding outward with random rotation and movement

Arguments:

animate_fade_colored

Animates fading an atom from grayscale to normal color

Arguments:

animate_fade_grayscale

Animates fading an atom to grayscale

Arguments:

animate_fade_to_color_fill

Animates fading to a specific color fill

Arguments:

animate_fading_leap_down

Animates an atom leaping downward while appearing and scaling down

Arguments:

animate_fading_leap_up

Animates an atom leaping upward while fading and scaling

Arguments:

animate_flash_color_fill

Animates flashing between a specific color and white

Arguments:

animate_flash_color_fill_inherit

Animates flashing between a specific color and the original color

Arguments:

animate_float

Animates an atom floating up and down with rotation

Arguments:

animate_ghostly_presence

Animates a ghostly presence effect with floating and rotation

Arguments:

animate_levitate

Animates an atom levitating slightly with rotation

Arguments:

animate_melt_pixel

Animates an atom melting downward with a bounce effect

Arguments:

animate_rainbow_glow

Animates a full rainbow color cycle

Arguments:

animate_rainbow_glow_old

Animates a simple rainbow color cycle (red, green, blue)

Arguments:

animate_rumble

Animates a rumbling effect by translating the atom in four directions

Arguments:

animate_shake

Animates shaking an atom randomly on its tile

Arguments:

animate_shockwave

Animates a shockwave effect with rotation and vertical movement

Arguments:

animate_spin

Animates spinning an atom in the specified direction

Arguments:

animate_teleport

Animates a teleportation effect with scaling and color change

Arguments:

animate_teleport_wiz

Animates a wizard-style teleportation effect

Arguments:

animate_wiggle_then_reset

Animates wiggling an atom randomly then resetting to original position

Arguments:

apply_text_macros

Used for applying byonds text macros to strings that are loaded at runtime

are_zs_connected

Checks if both atoms are in same z or in connected z-levels.

assert_sorted

Verifies that a list is sorted according to the given comparator function Throws a runtime error if the list is not sorted

Arguments:

assertion_message

Generates a formatted assertion message for debugging purposes

assoc_to_keys

Converts an associative list into a flat list of keys

Arguments:

atmos_scan

Outputs a message to the user describing the target's gasmixes.

Gets called by analyzer_act, which in turn is called by tool_act. Also used in other chat-based gas scans.

avoid_assoc_duplicate_keys

Takes an input_key, as text, and the list of keys already used, outputting a replacement key in the format of "[input_key] ([number_of_duplicates])" if it finds a duplicate Use this for lists of things that might have the same name, like mobs or objects, that you plan on giving to a player as input

Arguments:

bang

Creates a flashing effect that blinds and deafens mobs within range

Arguments:

between

Ensures a value is between a minimum and maximum, clamping it if necessary

Arguments:

bitfield_to_list

Converts a bitfield to a list of numbers (or words if a wordlist is provided)

Arguments:

blendMode2iconMode

Converts a blend_mode constant to one acceptable to icon.Blend()

border_diamond_range_turfs

Returns the list of turfs around the outside of a center based on RANGE_TURFS()

broadcast_message

Message Broadcast Proc

This big fat disaster is responsible for sending the message out to all headsets and radios on the station It is absolutely disgusting, but used to take about 20 arguments before I slimmed it down to just one Arguments:

build_planeed_apperance_queue

Takes a list of mutable appearances Returns a list in the form: 1 - a list of all mutable appearances that would need to be updated to change planes in the event of a z layer change, alnongside the commands required to properly track parents to update 2 - a list of all parents that will require updating

byondapi_stack_trace

Exists by default in 516, but needs to be defined for 515 or byondapi-rs doesn't like it.

calculate_projectile_angle_and_pixel_offsets

Calculates the pixel offsets and angle that a projectile should be launched at.

Arguments:

can_line

Checks if a straight line can be drawn from source to target without hitting dense turfs within a specified length. Similar to can_line but only checks density and does not support other atoms.

Arguments:

capitalize

Returns a string with the first element of the string capitalized.

center_image

Center's an image. Only run this on float overlays and not physical 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)

change_command_name

Changes the command name to the specified value

Arguments:

change_english_station_name

Changes the English station name and updates the world name

Arguments:

change_station_name

Changes the station name to the specified designation

Arguments:

check_active_security_force

check_rights

Check if the current user has admin rights

Checks if usr is an admin with at least ONE of the flags in rights_required. If rights_required == FALSE, simply checks if they are an admin. If the check fails and show_msg is TRUE, prints a message explaining why.

Note: This checks usr, not src. To check someone else's rank in a proc they didn't call, use if(client.holder.rights & R_ADMIN) directly.

Arguments:

check_rights_all

Requires the holder to have all the rights specified

rights_required = R_ADMIN|R_EVENT means they must have both flags, or it will return false

check_rights_ckey

Check if a ckey has admin rights

check_rights_client

Check if a /client has admin rights

check_target_facings

Returns the direction that the initiator and the target are facing

check_wall_item

Check if there is already a wall item on the turf loc

Arguments:

checkpass

Checks if mover is movable atom and has passed pass_flags.

Arguments:

church_name

Returns the current church name, generating one if not set

circle_range

Returns all atoms present in a circle around the center

circle_range_turfs

Returns a list of turfs around a center based on RANGE_TURFS()

circle_view

Returns all atoms present in a circle around the center but uses view() instead of range() (Currently not used)

circle_view_turfs

Returns a list of turfs around a center based on view()

classic_worldtime2text

This proc should only be used for world/Topic. If you want to display the time for which dream daemon has been running ("round time") use worldtime2text. If you want to display the canonical station "time" (aka the in-character time of the station) use station_time_timestamp

closer_angle_difference

Finds the shortest angle that angle A has to change to get to angle B. Aka, whether to move clock or counterclockwise.

cmp_camera_ctag_asc

Orders cameras by their c_tag ascending

cmp_port_order_asc

Orders by integrated circuit weight

color2B

Returns an integer value for B of R/G/B given a hex color input.

color2G

Returns an integer value for G of R/G/B given a hex color input.

color2R

Returns an integer value for R of R/G/B given a hex color input.

command_name

Returns the current command name, falling back to the map's dock name if not set

compare_list

Compare two lists, returns TRUE if they are the same

Arguments:

convert_pencode_arg

Converts pencode arguments to HTML tags with safety checks Called by admin_pencode_to_html to handle custom tags

Arguments:

copytext_preserve_html

alternative copytext() for encoded text, doesn't break html entities (" and other)

count_by_type

Counts the number of items of a specified type in a list

Arguments:

counterlist_combine

Combines two counter lists by adding values for matching keys

Arguments:

counterlist_normalise

Normalizes a counter list by dividing each value by the total sum

Arguments:

counterlist_scale

Scales all values in a counter list by a given scalar factor

Arguments:

counterlist_sum

Calculates the sum of all values in a counter list

Arguments:

create_strippable_list

Creates an assoc list of keys to /datum/strippable_item

cut_relative_direction

Takes a screen_loc string and removes any directions like NORTH or SOUTH

Arguments:

dd_hasprefix_case

Checks the beginning of a string for a specified sub-string. This proc is case sensitive Returns the position of the substring or 0 if it was not found

dd_hassuffix

Checks the end of a string for a specified substring. Returns the position of the substring or 0 if it was not found

dd_limittext

Limits the length of the text. Note: MAX_MESSAGE_LEN and MAX_NAME_LEN are widely used for this purpose

dd_range

Clamps a number to the specified range

Arguments:

declension_ru

Возвращает правильную форму слова, соответствующую русскому склонению числительных.

Учитывает правила русского языка, определяющие окончания числительных, на основе переданного числа. Использует три формы: единственное число (1), двойственное число (2-4) и множественное число (5+).

Аргументы:

deep_copy_list

Recursively copies a list and all lists contained within it Does not copy any other reference types

Arguments:

delete_all_SS_and_recreate_master

Delete all existing SS to basically start over

delta_to_angle

Calculate the angle produced by a pair of x and y deltas

deltimer

Delete a timer

Arguments:

depower_apcs

Depowers all APCs on the station by draining their cells

Sends a station announcement and sets the charge of all APC cells to 0, except for critical areas.

detect_room

Detects a room of connected turfs starting from an origin point Returns an associative list of turf|dirs pairs where dirs are connected turfs in the same space

Arguments:

diagonally_blocked

check if 2 diagonal turfs are blocked by dense objects

diff_appearances

Takes two appearances as args, prints out, logs, and returns a text representation of their differences Including suboverlays

difflist

Returns list containing all the entries from first list that are not present in second. If skiprep = TRUE, repeated elements are treated as one. If either of arguments is not a list, returns null

Arguments:

dir2angle

returns the north-zero clockwise angle in degrees, given a direction

dir2rustext

Turns a direction into ru text

dir2text

Turns a direction into eng text

directional_bounded_sum

Adjusts a value by a given amount while respecting specified bounds Prevents inadvertently increasing the value in the wrong direction when at bounds

Arguments:

display_joules

Format an energy value in J, kJ, MJ, or GJ. 1W = 1J/s.

Arguments:

display_power

Formats a power value in W, kW, MW, or GW.

Arguments:

display_roundstart_logout_report

Reports player logouts.

do_after

Timed action involving one mob user. Target is optional. Checks that user does not move, change hands, get stunned, etc. for the given delay.

Arguments:

Returns TRUE on success, FALSE on failure.

do_chem_smoke

Helper to quickly create a cloud of reagent smoke

do_smoke

A helper proc used to spawn small puffs of smoke.

Arguments:

do_sparks

Arguments:

dump_in_space

Dump a movable in a random valid spacetile

dview

Version of view() which ignores darkness, because BYOND doesn't have it.

emissive_appearance

Produces a mutable appearance glued to the EMISSIVE_PLANE dyed to be the EMISSIVE_COLOR. Order of application matters: Default generated blockers are overlays, and will block its own emissive underlays. If you want an object to be both a blocker, and have their own emissive, it has to be an overlay instead. Grayscale lightmasks are visible in the BYOND right-click and Examine pane, unless they're covered up by another overlay.

emissive_blocker

Produces a mutable appearance glued to the EMISSIVE_PLANE dyed to be the EM_BLOCK_COLOR.

end_cooldown

Callback called by a timer to end an associative-list-indexed cooldown.

Arguments:

This sends a signal reporting the cooldown end.

endswith

Returns TRUE if the input_text ends with the ending

english_list

Returns a list in plain english as a string

Arguments:

english_station_name

Returns the English station name, falling back to appropriate defaults if not set

escape_regex_smart

Escapes regex special characters in a string for safe use in regular expressions

Arguments:

expand_weights

Takes a weighted list and expands it into raw entries This eats more memory, but saves time when actually picking from it

Arguments:

explosion

Makes a given turf explode.

Arguments:

fast_emissive_blocker

This is a semi hot proc, so we micro it. saves maybe 150ms

ff_cansee

Checks if there is a clear line of sight between two atoms using field of view algorithm

Arguments:

filename_sanitize

Gut ANYTHING that isnt alphanumeric, or brackets

fill_with_ones

Given a list, return a copy where values without defined weights are given weight 1. For example, fill_with_ones(list(A, B=2, C)) = list(A=1, B=2, C=1) Useful for weighted random choices (loot tables, syllables in languages, etc.)

filter_fancy_list

Filters a fancy list by a given search term

Arguments:

find_stealth_key

Resolves a stealth key to its original ckey

Arguments:

finish_unequip_mob

A utility function for /datum/strippable_items to finish unequipping an item from a mob.

fire_flash_log

Flashfire is a proc used to log fire causing chemical reactions.

Call this whenever you have a chemical reaction that makes fire flashes. Arguments:

flash_color

Flashes a color on the screen of a mob or client for a specified duration

Arguments:

flick_overlay

Add an image to a list of clients and calls a proc to remove it after a duration

flop_animation

This animation should be applied to actual parent atom instead of vc_object.

format_frequency

Format frequency by moving the decimal.

format_si_suffix

Formats num with an SI prefix.

Returns a string formatted with a multiple of num and an SI prefix corresponding to an exponent of 10. Only considers exponents that are multiples of 3 (deca, deci, hecto, and centi are not included). A unit is not included in the string, the prefix is placed after the number with no spacing added anywhere. Listing of prefixes: https://en.wikipedia.org/wiki/Metric_prefix#List_of_SI_prefixes

format_text

Properly format a string of text by using replacetext()

freeborg

When an AI is activated, it can choose from a list of non-slaved borgs to have as a slave.

gas_mixture_parser

gaussian

Converts a uniformly distributed random number into a normally distributed one using the Box-Muller transform Since this method produces two random numbers, one is saved for subsequent calls (making the cost negligible for every second call) This will return +/- decimals, situated about mean with standard deviation stddev 68% chance that the number is within 1stddev 95% chance that the number is within 2stddev 98% chance that the number is within 3stddev...etc

Arguments:

genderize_decode

Обрабатывает гендерно-зависимую текстовую разметку в строке.

Заменяет шаблоны %(SINGLE,PLURAL)% и %(MALE,FEMALE,NEUTER,PLURAL)% в сообщении на соответствующую форму слова в зависимости от пола моба. Используйте * для пропуска конкретной формы рода (например, %(,FEMALE,,PLURAL)%). Обрабатывает все шаблоны до тех пор, пока они полностью не исчезнут.

Аргументы:

genderize_ru

Возвращает форму слова с учётом грамматического рода в русском языке.

Выбирает правильную форму слова в зависимости от его грамматического рода (MALE, FEMALE, NEUTER) или множественного числа (PLURAL). Используется для прилагательных, местоимений и глаголов, изменяющихся по родам.

Аргументы:

generate_and_hash_rsc_file

Generates a filename for a given asset. Like generate_asset_name(), except returns the rsc reference and the rsc file hash as well as the asset name (sans extension) Used so that certain asset files dont have to be hashed twice

generate_asset_name

Generate a filename for this asset The same asset will always lead to the same asset name (Generated names do not include file extention.)

generate_bitfields

Turns /datum/bitfield subtypes into a list for use in debugging

generate_space_underlay

Generates a space underlay for a turf This provides proper lighting support alongside just looking nice Accepts the appearance to make "spaceish", and the turf we're doing this for

generate_tracer_between_points

Generates a tracer beam between two points Do not pass z-crossing points as that will not be properly (and likely will never be properly until it's absolutely needed) supported!

Arguments:

get

Returns the atom type in the specified loc

getRelativeDirection

Get the direction of startObj relative to endObj. Return values: To the right, 1. Below, 2. To the left, 3. Above, 4. Not found adjacent in cardinal directions, 0.

get_adjacent_areas

Returns a list of all areas that are adjacent to the center atom's area, clear the list of nulls at the end.

get_adjacent_open_areas

Returns a list with all the adjacent areas by getting the adjacent open turfs

get_adjacent_open_turfs

Returns a list with all the adjacent open turfs. Clears the list of nulls in the end.

get_all_linked_levels_zpos

Proc to get a list of all the linked-together Z-Levels

Returns a list of zlevel numbers which can be accessed from travelling space naturally ignores Taipan tho

get_allowed_instrument_ids

Get all non admin_only instruments as a list of text ids.

get_angle

Calculate the angle between two movables and the west|east coordinate

get_angle_raw

Angle between two arbitrary points and horizontal line same as /proc/get_angle

get_antag_type_strings_list

A proc that return an array of capitalized strings containing name of the antag types they are

Arguments:

get_antag_type_truncated_plaintext_string

A proc that return a string containing all the singled out antags . Empty string if not antag

Usually, you'd return a FALSE, but since this is consumed by javascript you're in for a world of hurt if you pass a byond FALSE which get converted into a fucking string anyway and pass for TRUE in check. Fuck. It always append "(May be other antag)" Arguments:

get_anticlockwise_dir

Get the dir to the LEFT of dir if they were on a clock NORTH --> NORTHWEST

get_area_name

Returns the name of the area the atom is in, with optional formatting

Arguments:

get_area_turfs

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.

get_areas

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.

get_areas_in_range

Returns a list with the names of the areas around a center at a certain distance Returns the local area if no distance is indicated Returns an empty list if the center is null

get_atom_on_turf

Returns the top-most 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.

Arguments

get_atoms_of_type

Returns a list of atoms in a location of a given type. Can be refined to look for pixel-shift.

Arguments:

get_bbox_of_atoms

Get a bounding box of a list of atoms.

Arguments:

Returns: list(x1, y1, x2, y2)

get_cached_actionspeed_modifier

Grabs a STATIC MODIFIER datum from cache. YOU MUST NEVER EDIT THESE DATUMS, OR IT WILL AFFECT ANYTHING ELSE USING IT TOO!

get_cached_movespeed_modifier

Grabs a STATIC MODIFIER datum from cache. YOU MUST NEVER EDIT THESE DATUMS, OR IT WILL AFFECT ANYTHING ELSE USING IT TOO!

get_cardinal_dir

Get the cardinal direction between two atoms

get_channel_name

Returns the clean name of an audio channel.

Arguments:

get_client_by_ckey

Finds a client by their ckey, handling stealth keys

Arguments:

get_clockwise_dir

Get the dir to the RIGHT of dir if they were on a clock NORTH --> NORTHEAST

get_closest_atom

Returns the closest atom of a specific type in a list from a source

get_colored_rank

Returns colored rank representation.

get_compass_dir

get_dir() only considers an object to be north/south/east/west if there is zero deviation. This uses rounding instead. Ported from CM-SS13

get_config_multiplicative_speed_by_path

Same as above but search by passed path

get_dist_euclidean

Returns the distance between two atoms

get_dummy_savefile

Gets a dummy savefile for usage in icon generation. Savefiles generated from this proc will be empty.

get_edge_target_turf

Returns the turf located at the map edge in the specified direction relative to target_atom used for mass driver

get_fancy_list_of_atom_types

Returns a pre-generated fancy list of all atom types

get_fancy_list_of_datum_types

Returns a pre-generated fancy list of all datum types (excluding atoms)

get_hear

Like view but bypasses luminosity check

get_hearers_in_LOS

Returns a list of movable atoms that are hearing sensitive in view_radius and line of sight to source the majority of the work is passed off to the spatial grid if view_radius > 0 because view() isnt a raycasting algorithm, this does not hold symmetry to it. something in view might not be hearable with this. if you want that use get_hearers_in_view() - however thats significantly more expensive

get_hearers_in_range

The exact same as get_hearers_in_view, but not limited by visibility. Does no filtering for traits, line of sight, or any other such criteria. Filtering is intended to be done by whatever calls this function.

This function exists to allow for mobs to hear speech without line of sight, if such a thing is needed.

get_hearers_in_view

returns every hearaing movable in view to the turf of source not taking into account lighting useful when you need to maintain always being able to hear something if a sound is emitted from it and you can see it (and youre in range). otherwise this is just a more expensive version of get_hearers_in_LOS().

get_icon_dimensions

Returns a list containing the width and height of an icon file

get_icon_dmi_path

Given an icon object, dmi file path, or atom/image/mutable_appearance, attempts to find and return an associated dmi file path. A weird quirk about dm is that /icon objects represent both compile-time or dynamic icons in the rsc, But stringifying rsc references returns a dmi file path ONLY if that icon represents a completely unchanged dmi file from when the game was compiled. So if the given object is associated with an icon that was in the rsc when the game was compiled, this returns a path. otherwise it returns ""

get_line

Get a list of turfs in a line from starting_atom to ending_atom.

Uses the ultra-fast Bresenham Line-Drawing Algorithm.

get_list_count

Counts the number of nested lists within a list, up to a maximum count

Arguments:

get_location_accessible

This proc is made to check if we can interact or use (directly or in the other way) the specific bodypart Not to check if one clothing blocks access to the other clothing for that we have flags_inv var

get_location_name

Returns the name of the area the atom is in, with optional formatting

Arguments:

get_mind

Gets the mind from a variable, whether it be a mob, or a mind itself. Also works on brains - it will try to fetch the brainmob's mind. If [include_last] is true, then it will also return last_mind for carbons if there isn't a current mind.

get_mob_by_ckey

Returns a mob type controlled by a specified ckey

Arguments:

get_mob_by_key

Finds a mob by their ckey (case-insensitive)

Arguments:

get_mob_in_atom_with_warning

Gets the first mob contained in an atom, and warns the user if there's not exactly one

get_mob_with_client_list

Returns a list of all mobs that have an active client

get_mobs_in_view

The old system would loop through lists for a total of 5000 per function call, in an empty server. This new system will loop at around 1000 in an empty server. Returns a list of mobs in range from source. Used in radio and say code.

get_nested_locs

Returns a list of all locations (except the area) the movable is within.

get_observers

Returns a list of all observer mobs in the player list

get_offset_target_turf

Returns turf relative to target_atom offset in dx and dy tiles, bound to map limits

get_open_turf_in_dir

Returns the open turf next to the center in a specific direction

get_overlap

Returns a list where [1] is all x values and [2] is all y values that overlap between the given pair of rectangles

get_pain_modifier

returns modfier to make surgery harder if patient is conscious and feels pain

get_path_to

This is the proc you use whenever you want to have pathfinding more complex than "try stepping towards the thing". If no path was found, returns an empty list, which is important for bots like medibots who expect an empty list rather than nothing. It will yield until a path is returned, using magic

Arguments:

get_rand_frequency

get a random frequency.

get_rand_frequency_low_range

get_rand_frequency but lower range.

get_random_station_turf

Returns a random turf on the station

get_ranged_target_turf

Returns turf relative to A in given direction at set range Result is bounded to map size Note range is non-pythagorean Used for disposal system

get_runechat_language

Gets language for runechat message. Will return first found language if more than one is present, cause I have no time to remake this for now.

get_safe_random_station_turf

Returns a random turf on the station, excludes dense turfs (like walls) and areas that have valid_territory set to FALSE

get_sfx

Used to convert a SFX define into a .ogg so we can add some variance to sounds. If soundin is already a .ogg, we simply return it

get_small_overlay

Fikou's fix for making toast alerts look nice - resets offsets, transforms to fit

get_sorted_areas

Returns a sorted version of GLOB.areas, by name

get_sorted_mobs

Returns a sorted list of mobs by category and status

get_spawnpanel_for_admin

Returns a spawnpanel instance belonging to this user, or creates and registers a new one

get_swarm_path_to

POTENTIALLY cheaper version of get_path_to This proc generates a path map for the end atom's turf, which allows us to cheaply do pathing operations "at" it Generation is significantly SLOWER then get_path_to, but if many things are/might be pathing at something then it is much faster Runs the risk of returning an suboptimal or INVALID PATH if the delay between map creation and use is too long

If no path was found, returns an empty list, which is important for bots like medibots who expect an empty list rather than nothing. It will yield until a path is returned, using magic

Arguments:

get_teleport_loc

Returns location. Returns null if no location was found.

get_turf_pixel

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 at least 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 that generates a list of items, available for certain uplink.

Arguments:

get_valid_screen_location

Returns a valid location to place a screen object without overflowing the viewport

Arguments:

Returns a screen loc representing the valid location

get_valid_vent_spawns

Returns a list of vents that can be used as a potential spawn if they meet the criteria set by the arguments

Will not include parent-less vents to the returned list. Arguments:

get_visual_offset

Returns how visually "off" the atom is from its source turf as a list of x, y (in pixel steps) it takes into account: Pixel_x/y Matrix x/y Icon width/height

getmobs

Returns a list of all mobs with their display names as keys

getpois

This proc gets a list of all "points of interest" (poi's) that can be used by admins to track valuable mobs or atoms (such as the nuke disk). @param mobs_only if set to TRUE it won't include locations to the returned list @param skip_mindless if set to TRUE it will skip mindless mobs @param force_include_bots if set to TRUE it will include bots even if skip_mindless is set to TRUE @param force_include_cameras if set to TRUE it will include camera eyes even if skip_mindless is set to TRUE @return returns a list with the found points of interest

Generates follow links for ghosts to track specific atoms, with special handling for AIs and observer mobs

Arguments:

greatest_common_factor

Takes a list of numbers and returns the highest value that cleanly divides them all Note: this implementation is expensive for large numbers, intended for small lists

Arguments:

heat2color

heat2color functions. Adapted from: http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code

html_to_pencode

Converts HTML back to pencode format

Arguments:

icon2base64

Converts an icon to base64. Operates by putting the icon in the iconCache savefile, exporting it as text, and then parsing the base64 from that. (This relies on byond automatically storing icons in savefiles as base64)

icon2html

generate an asset for the given icon or the icon of the given appearance for [thing], and send it to any clients in target. Arguments:

icon_exists

Checks if the given iconstate exists in the given file, caching the result. Setting scream to TRUE will print a stack trace ONCE.

inLineOfSight

Calculate if two atoms are in sight, returns TRUE or FALSE

init_datum_subtypes

Creates every subtype of a given prototype (excluding the prototype itself and specified exceptions) and adds them to an associative list using a specified variable as the key

Arguments:

init_emote_list

Initializes and returns an associative list of emote keys to their corresponding emote datums

The list is structured as: key -> list of emotes with that key Also includes third-person keys if defined

init_item_skins

Initializes and returns a list of all item skins by creating instances of each item skin subtype that has a defined name.

init_keybindings

Creates and sorts all the keybinding datums

init_slotmachine_prizes

Initializes the list of slot machine prizes by filtering uplink items and creating prize datums

Arguments:

init_subtypes

Creates every subtype of a given prototype (excluding the prototype itself) and adds them to a list

Arguments:

Initializes and returns a list of all uplink items by creating instances of each uplink item subtype that has a defined initial item.

ionnum

Picks a string of symbols to display as the law number for hacked or ion laws

is_bad_connection

Connection checker

Checks the connection frequency against the intended frequency for the message NOTE: I barely know what on earth this does, but it works and it scares me Arguments:

is_file_type

Verifys wether a string or file ends with a given file type

this does not at all check the actual type of the file, a user could just rename it

Arguments:

is_file_type_in_list

Verifys wether a string or file ends with a given file type.

this does not at all check the actual type of the file, a user could just rename it

Arguments:

is_guest_key

Returns whether or not a player is a guest using their ckey as an input

Arguments:

is_in_teleport_proof_area

Checks if an atom is in a teleport-proof area or z-level

is_location_within_transition_boundaries

Proc that returns if selected loc, or atom is within boundaries of playable area. (non-transitional space)

is_path_exist

Checks line path from source to target, using dummy with passed flags. Returns TRUE if path exist, FALSE otherwise.

Arguments:

is_player_station_relevant

All the checks required to find baseline human being

is_source_facing_target

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

is_special_character

A proc that return whether the mob is a "Special Character" aka Antagonist

Arguments:

is_type_in_UID_list

If the list L contains a datum UID who's type matches D's type, returns the UID of that datum in the list. Otherwise returns null.

is_type_in_list

Checks if an atom is of a type present in the given list

Arguments:

is_type_in_typecache

Checks if an atom's type is present in a typecache list

Arguments:

is_valid_dmi_file

given a text string, returns whether it is a valid dmi icons folder path

is_valid_src

Check if a datum has not been deleted and is a valid source

isblobinfected

Takes any datum source and checks it for blob_infected datum.

isblobminion

Takes any datum source and checks it for blob_minion datum.

isblobovermind

Takes any datum source and checks it for blob_overmind datum.

ischangeling

Takes any datum source and checks it for changeling datum.

isdevilantag

Takes any datum source and checks it for devil datum.

isemptylist

Checks if the list is empty

Arguments:

ismalfAI

Takes any datum source and checks it for malf AI datum.

isninja

Takes any datum source and checks it for ninja datum.

istraitor

Takes any datum source and checks it for traitor datum.

isvampire

Takes any datum source and checks it for vampire datum.

isvampirethrall

Takes any datum source and checks it for vampire thrall datum.

lavaland_equipment_pressure_check

Checks if the pressure at a given turf is low enough for lavaland equipment effects

Arguments:

list_clear_duplicates

Removes all occurrences of a specified element from a list

Arguments:

list_clear_empty_weakrefs

Removes any empty weakrefs from the list Returns TRUE if the list had empty refs, FALSE otherwise

Arguments:

list_clear_nulls

Removes any null entries from the list Returns TRUE if the list had nulls, FALSE otherwise

Arguments:

listgetindex

Returns list element or null. Should prevent "index out of bounds" error.

Arguments:

lists_equal_unordered

Checks if two lists contain the same elements, ignoring order

Arguments:

load_poll_data

Loads all current and future server polls and their options to store both as datums.

load_strings_file

Load and cache a JSON string file

Loads the specified JSON file into the global string cache if not already loaded. Throws a runtime error if the file doesn't exist.

Arguments:

locateUID

Locates a datum based off of the UID

Replacement for locate() which takes a UID instead of a ref Returns the datum, if found

log_played_names

Adds the new names to the player's played_names list on their /datum/persistent_client for use of admins. ckey should be their ckey, and data should be an associative list with the keys being the names they played under and the values being the unique mob ID tied to that name.

log_startup_progress_global

Standardized method for tracking startup times.

make_associative

A proc for turning a list into an associative list.

A simple proc for turning all things in a list into an associative list, instead Each item in the list will have an associative value of TRUE

Arguments:

make_bit_triplet

Generates a bit triplet by selecting three unique numbers from 1 to 9 and setting corresponding bits Returns a number with three bits set based on the selected numbers

md5asfile

Save file as an external file then md5 it. Used because md5ing files stored in the rsc sometimes gives incorrect md5 results.

md5filepath

Returns the md5 of a file at a given path.

message_adminTicket

Sends a message to the staff able to see admin tickets Arguments: msg - The message being send important - If the message is important. If TRUE it will ignore the CHAT_NO_TICKETLOGS preferences, send a sound and flash the window. Defaults to FALSE

message_mentorTicket

Sends a message to the staff able to see mentor tickets Arguments: msg - The message being send important - If the message is important. If TRUE it will ignore the CHAT_NO_TICKETLOGS preferences, send a sound and flash the window. Defaults to FALSE

message_to_html

Message-related procs

Message format (/list):

Copyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT

mobs_in_area

Returns a list of mobs in the specified area, optionally filtering by client presence

Arguments:

move_element

Moves a single element from one position to another within a list, preserving associations

Arguments:

move_range

Moves a range of elements from one position to another within a list, preserving associations

Arguments:

movespeed_data_null_check

Checks if a move speed modifier is valid and not missing any data

mutable_appearance

new_station_name

Generates a new random station name.

normalize_angle

Get normalized angle (for fix rotation animation bug near 90 and -90 degrees)

numeric_ending

Returns a string depending on number it receives

offset_to_screen_loc

Converts pixel offsets to a screen location string

Takes a list in the form (x_offset, y_offset) and converts it to a screen loc string. Accepts an optional view string/size to force the screen_loc within bounds.

Arguments:

on_operable_surface

check if mob is lying down on something we can operate on.

overlays2text

Converts an overlay list into text for debug printing Of note: overlays aren't actually mutable appearances, they're just appearances Don't have access to that type tho, so this is the best you're gonna get

paranoid_sanitize

Gut ANYTHING that isnt alphanumeric, or brackets

parse_caught_click_modifiers

Returns a turf based on text inputs, original turf and viewing client

pass

A do nothing proc

path_map_passalong

We generate a path for the passed in callbacks, and then pipe it over

pathfinding_finished

Uses funny pass by reference bullshit to take the output created by pathfinding, and insert it into a return list We'll be able to use this return list to tell a sleeping proc to continue execution

pathwalk

Takes a directory and returns every file within every sub directory. If extensions_filter is provided then only files that end in that extension are given back. If extensions_filter is a list, any file that matches at least one entry is given back.

peek

Returns the top (last) element from the list, does not remove it from the list. Stack functionality.

Arguments:

pencode_to_html

Converts pencode to HTML with various formatting options

Arguments:

pick_candidates_all_types

Presents admin with choice of candidate selection methods

Arguments:

pick_candidates_manually

Manually picks candidates from all available ghosts without a poll

Arguments:

pick_closest_path

Returns a chosen path that is the closest to a list of matches

pick_multiple_unique

Picks multiple unique elements from the suplied list. If the given list has a length less than the amount given then it will return a list with an equal amount

Arguments:

pick_n_take

Pick a random element from the list and remove it from the list.

Arguments:

pick_weight_classic

Picks a random element from a list based on a weighting system. All keys with zero or non integer weight will be considered as zero For example, given the following list: A = 6, B = 3, C = 1, D = 0 A would have a 60% chance of being picked, B would have a 30% chance of being picked, C would have a 10% chance of being picked, and D would have a 0% chance of being picked. This proc not modify input list

Arguments:

pick_weight_n_take

Picks a random element by weight from the list and removes it from the list

Arguments:

pick_weight_recursive

Like pick_weight, but allowing for nested lists.

For example, given the following list: list(A = 1, list(B = 1, C = 1)) A would have a 50% chance of being picked, and list(B, C) would have a 50% chance of being picked. If list(B, C) was picked, B and C would then each have a 50% chance of being picked. So the final probabilities would be 50% for A, 25% for B, and 25% for C.

Weights should be integers. Entries without weights are assigned weight 1 (so unweighted lists can be used as well)

pickweight

Picks a random element from a list based on a weighting system. All keys with zero or non integer weight will be considered as one For example, given the following list: A = 5, B = 3, C = 1, D = 0 A would have a 50% chance of being picked, B would have a 30% chance of being picked, C would have a 10% chance of being picked, and D would have a 10% chance of being picked. This proc not modify input list

Arguments:

pixel_offset_turf

Takes a turf, and a list of x and y pixel offsets and returns the turf that the offset position best lands in

pixel_shift_dir

Returns a list with pixel_shift values that will shift an object's icon one tile in the direction passed.

play_cinematic

Plays a cinematic, duh. Can be to a select few people, or everyone.

cinematic_type - datum typepath to what cinematic you wish to play. watchers - a list of all mobs you are playing the cinematic to. If world, the cinematical will play globally to all players. special_callback - optional callback to be invoked mid-cinematic.

playsound

playsound is a proc used to play a 3D sound in a specific range. This uses SOUND_RANGE + extra_range to determine that.

Arguments:

pluralize_ru

Возвращает форму единственного или множественного числа в зависимости от грамматического рода.

Простой инструмент, который помогает легко переключаться между формами единственного и множественного числа, основываясь на указанном роде.

Аргументы:

poll_candidates_with_veto

Polls candidates with admin veto selection from a list of willing ghosts

Arguments:

pop

Returns the top (last) element from the list, does not remove it from the list. Stack functionality.

Arguments:

popleft

Returns the first element from the list and removes it. Queue functionality.

Arguments:

power_failure

Causes random APCs to short out with a given probability

Sends a station announcement and randomly cuts main power wires in APCs, toggling their breaker if they were operating. Skips critical areas.

Arguments:

power_restore

Can recharge APC cells, repair cut wires, or both. Sends station announcement if requested.

Arguments:

power_restore_quick

Quickly restores all SMES units to full capacity and maximum output

Arguments:

prepare_antag_data

Prepares antagonist data for caching and display

Collects various antagonist status information including name, status, objectives, and stores it in the antagonist cache for later use in round-end reports or admin tools.

Arguments:

prepare_antag_list

Processes a list of antagonists and prepares their data

Iterates through a list of antagonist minds and calls prepare_antag_data for each one. Used to batch process multiple antagonists of the same type.

Arguments:

prepare_explosion_turfs

Returns a list of turfs in X range from the epicenter Returns in a unique order, spiraling outwards This is done to ensure our progressive cache of blast resistance is always valid This is quite fast

prepare_nodatum_antags

Collects data for all non-datum based antagonist types

Processes various antagonist lists from the game mode and prepares their data for caching. Covers most standard antagonist types in the game.

Arguments:

pretty_string_from_reagent_list

Input a reagent_list, outputs pretty readable text! Default output will be formatted as

print_single_line

Converts a list to a string representation in "list(key => value, ...)" format

Arguments:

prof_init

Starts Tracy

prof_stop

Stops Tracy

qdel

Should be treated as a replacement for the 'del' keyword. Datums passed to this will be given a chance to clean up references to allow the GC to collect them.

randmut

Gives random mutation

random_body_accessory

Returns a random body accessory for a given species name. Can be null based on is_optional argument.

Arguments:

random_step

Forces the atom to take a step in a random direction

realize_appearance_queue

Takes a list of appearnces, makes them mutable so they can be properly vv'd and inspected

recover_all_SS_and_recreate_master

Recreate all SSs which will still cause data survive due to Recover(), the new Master will then find and take them from global.vars

recursive_mob_check

Will recursively loop through an atom's contents and check for mobs, then it will loop through every atom in that atom's contents. It will keep doing this until it checks every content possible. This will fix any problems with mobs, that are inside objects, being unable to hear people due to being in a box within a bag.

reject_bad_name

Filters out undesirable characters from names

reject_bad_text

Returns null if there is any bad text in the string

relay_to_list_and_observers

Sends a message to everyone within the list, as well as all observers.

religion_name

Returns the current religion name, generating one if not set

remove_changeling_mutations

Removes all mutated items on owner: armblade, tentacle, chitin suit etc. Global proc since we might need to delete mutated parts on any user.

remove_clunky_diagonals

Processes a path (list of turfs), removes any diagonal moves that would lead to a weird bump

path - The path to process down pass_info - Holds all the info about what this path attempt can go through simulated_only - If we are not allowed to pass space turfs avoid - A turf to be avoided

remove_diagonals

Processes a path (list of turfs), removes any diagonal moves

path - The path to process down pass_info - Holds all the info about what this path attempt can go through simulated_only - If we are not allowed to pass space turfs avoid - A turf to be avoided

remove_image_from_client

Removes an image from a client's .images. Useful as a callback.

remove_image_from_clients

Like remove_image_from_client, but will remove the image from a list of clients

remove_verb

handles removing verb and sending it to browser to update, use this for removing verbs

pass the verb type path to this instead of removing it from verbs so the statpanel can update Arguments:

render_stats

For use with the stopwatch defines

request_z_pillar

Returns a z pillar to insert turfs into

reset_cooldown

Proc used by stoppable timers to end a cooldown before the time has ran out.

Arguments:

This sends a signal reporting the cooldown end, passing the time left as an argument.

return_file_text

checks if a file exists and contains text returns text as a string if these conditions are met

return_typenames

Splits a type path into its component names

reverse_range

Reverses the order of elements in a list within the specified range Replaces reverseList ~Carnie

Arguments:

rgb2hsl

colour formats

rights2text

Converts a rights bitfield into a string

rot13

Returns the rot13'ed text

round_down

MARK: THIS DONT WORK!

roundtime2text

Returns the world time in english

runechat_emote

Send an emote to runechat for all (listening) users in the vicinity.

russian_list

Returns a list in plain russian as a string

Arguments:

rustg_get_version

Gets the version of rust_g

rustg_git_commit_date

Returns the date of the given revision using the provided format. Defaults to returning %F which is YYYY-MM-DD.

rustg_git_commit_date_head

Returns the formatted datetime string of HEAD using the provided format. Defaults to returning %F which is YYYY-MM-DD. This is different to rustg_git_commit_date because it only needs the logs directory.

rustg_redis_disconnect_rq

Disconnects from a previously connected redis server

rustg_unix_timestamp

Returns the timestamp as a string

safe_get_ckey

Safe ckey getter

Should be used whenever broadcasting public information about a mob, as this proc will make a best effort to hide the users ckey if they request it. It will first check the mob for a client, then use the mobs last ckey as a directory lookup. If a client cant be found to check preferences on, it will just show as DC'd. This proc should only be used for public facing stuff, not administration related things.

Arguments:

safepick

Return either pick(list) or null if list is not of type /list or is empty

Arguments:

sanitize

Runs byond's sanitization proc along-side sanitize_simple

sanitize_english_key_to_russian

Converts a single English keyboard character to its Russian equivalent

Arguments:

sanitize_english_string_to_russian

Converts an entire English string to Russian keyboard layout

Arguments:

sanitize_filename

Removes characters incompatible with file names.

sanitize_filepath

Sanitizes the name of each node in the path.

Im case you are wondering when to use this proc and when to use SANITIZE_FILENAME,

You use SANITIZE_FILENAME to sanitize the name of a file [e.g. example.txt]

You use sanitize_filepath sanitize the path of a file [e.g. root/node/example.txt]

If you use SANITIZE_FILENAME to sanitize a file path things will break.

sanitize_frequency

Ensure the frequency is within bounds of what it should be sending/receiving at

sanitize_gender

Sanitizes a gender value to ensure it is valid

Arguments:

sanitize_hexcolor

Sanitizes a hexadecimal color value to ensure it is valid

Arguments:

sanitize_inlist

Sanitizes a value by ensuring it exists in a list

Arguments:

sanitize_integer

Sanitizes an integer value to ensure it falls within a specified range

Arguments:

sanitize_json

Sanitizes JSON input and returns a decoded list

Arguments:

sanitize_russian_key_to_english

Converts a single Russian keyboard character to its English equivalent

Arguments:

sanitize_simple

Removes a few problematic characters

sanitize_specsymbols_key_to_numbers

Converts special symbols to their number equivalents for keybindings

Arguments:

sanitize_text

Sanitizes a text value to ensure it is valid text

Arguments:

screen_loc_to_offset

Converts a screen location string to pixel offsets

Takes a screen loc string in the format "+-left-offset:+-pixel,+-bottom-offset:+-pixel" Where the :pixel is optional, and returns a list in the format (x_offset, y_offset) Requires context to get info out of screen locs that contain relative info (NORTH, SOUTH, etc)

Arguments:

screen_text

Return an object with a new maptext (not currently in use)

seconds_to_clock

Take a value in seconds and makes it display like a clock

seconds_to_time

Take a value in seconds and returns a string of minutes and seconds in the format X minute(s) and X seconds.

select_active_ai

Presents a list of active AIs for selection, or picks one randomly if no user is provided

Arguments:

select_active_ai_with_fewest_borgs

Find an active AI with the least number of borgs

send_random_fake_pm

Sends a random fake PM from a randomly selected fake administrator

send_to_observers

Sends a message to all dead and observing players, if a source is provided a follow link will be attached.

send_to_playing_players

Sends a whatever to all playing players; use instead of to_chat(world, where needed)

shake_camera

Shake the camera of the person viewing the mob SO REAL! Takes the mob to shake, the time span to shake for, and the amount of tiles we're allowed to shake by in tiles Duration isn't taken as a strict limit, since we don't trust our coders to not make things feel shitty. So it's more like a soft cap.

show_blurb

Shows a ticker reading out the given text on a client's screen. targets = mob or list of mobs to show it to. duration = how long it lingers after it finishes ticking. message = the message to display. Due to using maptext it isn't very flexible format-wise. 11px font, up to 480 pixels per line. Use \n for line breaks. Single-character HTML tags (, , etc.) are handled correctly but others display strangely. Note that maptext can display text macros in strange ways, ex. \improper showing as "ÿ". Lines containing only spaces, including ones only containing "\improper ", don't display. scroll_down = by default each line pushes the previous line upwards - this tells it to start high and scroll down. Ticks on \n - does not autodetect line breaks in long strings. screen_position = screen loc for the bottom-left corner of the blurb. text_alignment = "right", "left", or "center" text_color = colour of the text. blurb_key = a key used for specific blurb types so they are not shown repeatedly. ignore_key = used to skip key checks. text_limit = limit in characters of the message.

show_generic_antag_text

Announces objectives/generic antag text.

show_radial_menu

Presents radial menu to user anchored to anchor (or user if the anchor is currently in users screen) Choices should be a list where list keys are movables or text used for element names and return value and list values are movables/icons/images used for element icons

shuffle

Returns a new list with the elements in random order

Arguments:

  • source_list - The list to shuffle

shuffle_inplace

Shuffles a list in place and returns the same list

Arguments:

  • target_list - The list to shuffle

slice_off_turfs

Returns a slice of a list of turfs, defined by the ones that are inside the inner/outer angle's bounds

sort_list

sort any value in a list

sort_mobs

Orders mobs by type then by name

sort_names

uses sort_list() but uses the var's name specifically

spanning_screen_loc

Returns a screen_loc format for a tiling screen objects from start and end positions Start should be bottom left corner, and end top right corner

Arguments:

  • start_x_pixel - Starting X position in pixels
  • start_y_pixel - Starting Y position in pixels
  • end_x_pixel - Ending X position in pixels
  • end_y_pixel - Ending Y position in pixels

spiral_range_turfs

similar function to RANGE_TURFS(), but will search spiralling outwards from the center (like the above, but only turfs)

sqrtor0

Calculates the square root of a number, returning 0 for negative inputs to avoid runtime errors

start_unequip_mob

A utility function for /datum/strippable_items to start unequipping an item from a mob.

start_watch

Returns "watch handle" (really just a timestamp :V)

station_name

Returns the current station name, falling back to the map's station name if not set

station_time

This is used for displaying the "station time" equivelent of a world.time value Calling it with no args will give you the current time, but you can specify a world.time-based value as an argument

  • You can use this, for example, to do "This will expire at [station_time_at(world.time + 500)]" to display a "station time" expiration date which is much more useful for a player)

stop_watch

Returns number of seconds elapsed. @param wh number The "Watch Handle" from start_watch(). (timestamp)

stoplag

Returns the number of ticks slept

string2listofvars

This is a weird one: It returns a list of all var names found in the string These vars must be in the [var_name] format It's only a proc because it's used in more than one place

Takes a string and a datum The string is well, obviously the string being checked The datum is used as a source for var names, to check validity Otherwise every single word could technically be a variable!

string_list

Caches lists with non-numeric stringify-able values (text or typepath).

Arguments:

  • input_list - The list to cache or retrieve from cache

strings

Get strings array from a JSON string file

Loads the specified file if not already cached and returns the array of strings for the given key. Throws a runtime error if file or key not found.

Arguments:

  • filepath - Path to the JSON string file
  • key - Key in the JSON file to get strings from
  • directory - Directory to look for string files in (default: STRING_DIRECTORY)

strings_replacement

Get a random string with nested @pick() replacements

Retrieves a random string from the string cache and processes any @pick(KEY) patterns by replacing them with random strings from the specified KEY in the same file.

Arguments:

  • filepath - Path to the JSON string file
  • key - Key in the JSON file to get strings from

strings_subkey_lookup

Callback for regex replacement in strings_replacement

Used to replace @pick(KEY) patterns with random strings from the specified KEY in the current string file being processed.

Arguments:

  • full_match - The full regex match including the @pick() pattern
  • captured_key - The captured key name from the @pick() pattern

strip_html

Runs sanitize and strip_html_simple I believe strip_html_simple() is required to run first to prevent '<' from displaying as '<' after sanitize() calls byond's html_encode()

strip_html_properly

This proc strips html properly, but it's not lazy like the other procs. This means that it doesn't just remove < and > and call it a day. Also limit the size of the input, if specified.

strip_html_simple

Simply removes < and > and limits the length of the message

stripped_input

Used to get a sanitized input.

stripped_multiline_input

Used to get a properly sanitized multiline input, of max_length

subtypesof

Returns a list containing all subtypes of the given path, but not the given path itself.

swap_range

Swaps two ranges of elements within a list, preserving order of overwritten elements Note: If ranges overlap, only the destination order will be fully preserved

Arguments:

  • target_list - The list to modify
  • first_range_start - The starting index of the first range
  • second_range_start - The starting index of the second range
  • range_length - The length of the ranges to swap (default: 1)

system_name

Returns the system name from the map datum

text2dir

Turns text into proper directions

text2dir_rus

Turns text into proper directions

text2matrix

Argument: Give this a space-separated string consisting of 6 numbers. Returns null if you don't

tgalert

DEPRECATED: USE tgui_alert(...) INSTEAD

Designed as a drop in replacement for alert(); functions the same. (outside of needing User specified) Arguments:

  • User - The user to show the alert to.
  • Message - The textual body of the alert.
  • Title - The title of the alert's window.
  • Button1 - The first button option.
  • Button2 - The second button option.
  • Button3 - The third button option.
  • StealFocus - Boolean operator controlling if the alert will steal the user's window focus.
  • Timeout - The timeout of the window, after which no responses will be valid.

tgui_Topic

Middleware for /client/Topic.

return bool If TRUE, prevents propagation of the topic call.

tgui_alert

Creates a TGUI alert window and returns the user's response.

This proc should be used to create alerts that the caller will wait for a response from. Arguments:

  • user - The user to show the alert to.
  • message - The content of the alert, shown in the body of the TGUI window.
  • title - The of the alert modal, shown on the top of the TGUI window.
  • buttons - The options that can be chosen by the user, each string is assigned a button on the UI.
  • timeout - The timeout of the alert, after which the modal will close and qdel itself. Set to zero for no timeout.
  • autofocus - The bool that controls if this alert should grab window focus.

tgui_input_checkbox_list

Creates a TGUI input list window and returns the user's response in a ranked order.

Arguments:

  • user - The user to show the input box to.
  • message - The content of the input box, shown in the body of the TGUI window.
  • title - The title of the input box, shown on the top of the TGUI window.
  • items - The options that can be chosen by the user, each string is assigned a button on the UI.
  • default - If an option is already preselected on the UI. Current values, etc.
  • timeout - The timeout of the input box, after which the menu will close and qdel itself. Set to zero for no timeout.

tgui_input_color

Creates a TGUI color picker window and returns the user's response.

This proc should be used to create a color picker that the caller will wait for a response from. Arguments:

  • user - The user to show the picker to.
  • title - The of the picker modal, shown on the top of the TGUI window.
  • timeout - The timeout of the picker, after which the modal will close and qdel itself. Set to zero for no timeout.
  • autofocus - The bool that controls if this picker should grab window focus.

tgui_input_keycombo

Creates a TGUI window with a key input. Returns the user's response as a full key with modifiers, eg ShiftK.

This proc should be used to create windows for key entry that the caller will wait for a response from. If tgui fancy chat is turned off: Will return a normal input.

Arguments:

  • user - The user to show the number input to.
  • message - The content of the number input, shown in the body of the TGUI window.
  • title - The title of the number input modal, shown on the top of the TGUI window.
  • default - The default (or current) key, shown as a placeholder.

tgui_input_list

Creates a TGUI input list window and returns the user's response.

This proc should be used to create alerts that the caller will wait for a response from. Arguments:

  • user - The user to show the input box to.
  • message - The content of the input box, shown in the body of the TGUI window.
  • title - The title of the input box, shown on the top of the TGUI window.
  • items - The options that can be chosen by the user, each string is assigned a button on the UI.
  • default - If an option is already preselected on the UI. Current values, etc.
  • timeout - The timeout of the input box, after which the menu will close and qdel itself. Set to zero for no timeout.

tgui_input_number

Creates a TGUI window with a number input. Returns the user's response as num | null.

This proc should be used to create windows for number entry that the caller will wait for a response from. If tgui fancy chat is turned off: Will return a normal input. If a max or min value is specified, will validate the input inside the UI and ui_act.

Arguments:

  • user - The user to show the number input to.
  • message - The content of the number input, shown in the body of the TGUI window.
  • title - The title of the number input modal, shown on the top of the TGUI window.
  • default - The default (or current) value, shown as a placeholder. Users can press refresh with this.
  • max_value - Specifies a maximum value. If none is set, any number can be entered. Pressing "max" defaults to 1000.
  • min_value - Specifies a minimum value. Often 0.
  • timeout - The timeout of the number input, after which the modal will close and qdel itself. Set to zero for no timeout.
  • round_value - whether the inputted number is rounded down into an integer.

tgui_input_ranked_list

Creates a TGUI input list window and returns the user's response.

This proc should be used to create alerts that the caller will wait for a response from. Arguments:

  • user - The user to show the input box to.
  • message - The content of the input box, shown in the body of the TGUI window.
  • title - The title of the input box, shown on the top of the TGUI window.
  • items - The options that can be chosen by the user, each string is assigned a button on the UI.
  • default - If an option is already preselected on the UI. Current values, etc.
  • timeout - The timeout of the input box, after which the menu will close and qdel itself. Set to zero for no timeout.

tgui_input_text

Creates a TGUI window with a text input. Returns the user's response.

This proc should be used to create windows for text entry that the caller will wait for a response from. If tgui fancy chat is turned off: Will return a normal input. If max_length is specified, will return stripped_multiline_input.

Arguments:

  • user - The user to show the text input to.
  • message - The content of the text input, shown in the body of the TGUI window.
  • title - The title of the text input modal, shown on the top of the TGUI window.
  • default - The default (or current) value, shown as a placeholder.
  • max_length - Specifies a max length for input. MAX_MESSAGE_LEN is default (1024)
  • multiline - Bool that determines if the input box is much larger. Good for large messages, laws, etc.
  • encode - Toggling this determines if input is filtered via html_encode. Setting this to FALSE gives raw input.
  • timeout - The timeout of the textbox, after which the modal will close and qdel itself. Set to zero for no timeout.

time_to_twelve_hour

Converts a time expressed in deciseconds (like world.time) to the 12-hour time format. the format arg is the format passed down to time2text() (e.g. "hh:mm" is hours and minutes but not seconds). the timezone is the time value offset from the local time. It's to be applied outside time2text() to get the AM/PM right.

timeleft

Get the remaining deciseconds on a timer

Arguments:

  • id a timerid or a /datum/timedevent

to_chat

Sends the message to the recipient (target).

Recommended way to write to_chat calls:

to_chat(client, "You have found <strong>[object]</strong>", MESSAGE_TYPE_INFO,

Always remember to close spans! TARGET: Refers to the target of the to_chat message. Valid targets include clients, mobs, and the static world controller HTML: The Message to be sent to the TARGET. Converted to a string if not already one in this function TYPE: The chat tab that this message will be sent to, a list of all valid types can be found in chat.dm TEXT: Unused AVOID_HIGHLIGHTING: Unused trailing_newline, confidential, and handle_whitespace currently have no effect, please fix this in the future or remove the arguments to lower cache!

to_chat_immediate

Circumvents the message queue and sends the message to the recipient (target) as soon as possible. trailing_newline, confidential, and handle_whitespace currently have no effect, please fix this in the future or remove the arguments to lower cache!

trim

Returns a string with reserved characters and spaces before the first word and after the last word removed.

trim_left

Returns a string with reserved characters and spaces before the first letter removed

trim_length

Returns a string that does not exceed max_length characters in size

trim_right

Returns a string with reserved characters and spaces after the last letter removed

try_move_adjacent

Attempts to move a movable atom to an adjacent tile in a random cardinal direction

Arguments:

  • movable_atom - The movable atom to relocate

turf_peel

Behaves like the orange() proc, but only looks in the outer range of the function (The "peel" of the orange). This is useful for things like checking if a mob is in a certain range, but not within a smaller range.

@params outer_range - The outer range of the cicle to pull from. @params inner_range - The inner range of the circle to NOT pull from. @params center - The center of the circle to pull from, can be an atom (we'll apply get_turf() to it within circle_x_turfs procs.) @params view_based - If TRUE, we'll use circle_view_turfs instead of circle_range_turfs procs.

type2top

Returns a string the last bit of a type, without the preceeding '/'

typecache_filter_list

Returns a new list with only atoms that are in the provided typecache

Arguments:

  • source_atoms - The list of atoms to filter
  • filter_typecache - The typecache used for filtering

typecache_filter_list_reverse

Returns a new list with atoms that are not in the provided typecache

Arguments:

  • source_atoms - The list of atoms to filter
  • filter_typecache - The typecache used for filtering

typecache_filter_multi_list_exclusion

Filters atoms using both inclusion and exclusion typecaches

Arguments:

  • source_atoms - The list of atoms to filter
  • inclusion_typecache - The typecache of types to include
  • exclusion_typecache - The typecache of types to exclude

typecacheof

Like typesof() or subtypesof(), but returns a typecache instead of a list

typing_input

Uses client.typing to check if the popup should appear or not

unique_list

Returns a new list with no duplicate entries

Arguments:

  • source_list - The list to remove duplicates from

unique_list_in_place

Removes duplicate entries from a list in place, preserving associated values

Arguments:

  • target_list - The list to remove duplicates from (modified in place)

update_config_movespeed_type_lookup

Updates the global mob type to movespeed multiplier lookup table from configuration and optionally updates all existing mobs with the new movespeeds

Arguments:

  • update_mobs - If TRUE, updates all existing mobs with the new movespeeds

update_mob_config_movespeeds

Updates the movement speed for all mobs in the game based on current configuration settings. This iterates through all mobs in the mob list and updates their movement speed.

update_world_name

Updates the world name based on server configuration and station name.

updatetimedelay

Update the delay on an existing LOOPING timer Will come into effect on the next process

Arguments:

  • id a timerid or a /datum/timedevent
  • new_wait the new wait to give this looping timer

urange

Returns all objects within a specified range of the center atom (no limitations on distance, faster than range for distances > 8)

Note: including areas drastically decreases performance.

Arguments:

  • range_distance - maximum distance in tiles from center
  • center - the central atom to measure distance from
  • exclude_center - if TRUE, excludes the center atom from results
  • include_areas - if TRUE, includes area objects in results

urange_multiz

Returns all objects within a multiz-level range of the center atom

Arguments:

  • max_distance - maximum distance in tiles (including vertical levels)
  • center - the central atom to measure distance from
  • exclude_center - if TRUE, excludes the center atom from results
  • include_areas - if TRUE, includes area objects in results

valid_build_direction

Checks whether the target turf is in a valid state to accept a directional construction such as windows or railings.

Returns FALSE if the target turf cannot accept a directional construction. Returns TRUE otherwise.

Arguments:

  • dest_turf - The destination turf to check for existing directional constructions
  • 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.

view_to_pixels

Takes a string or num view, and converts it to pixel width/height in a list(pixel_width, pixel_height)

window_flash

Flash the window of a player

worldtime2text

Returns the world time in english

wrap_file

Security helpers to ensure you cant arbitrarily load stuff from disk