/(global) 
Vars | |
| Failsafe | Failsafe |
|---|---|
| Master | StonedMC |
| 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 | |
| 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 | |
| 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 | |
| SSsmoke | The subsystem responsible for processing smoke propagation and effects. |
| SSspatial_grid | |
| SStgui | tgui subsystem |
| SStimer | |
| 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. |
| 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 |
Procs | |
| 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. |
| 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. |
| _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 |
| add_keybinding | Adds an instanced keybinding to the global tracker |
| add_verb | handles adding verbs and updating the stat panel browser |
| 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. |
| admin_jump_link | Generates admin follow links for tracking specific atoms, with special handling for clients, AIs, and observer mobs |
| 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 |
| animate_explode_pixel | Animates an atom exploding outward with random rotation and movement |
| animate_fade_colored | Animates fading an atom from grayscale to normal color |
| animate_fade_grayscale | Animates fading an atom to grayscale |
| animate_fade_to_color_fill | Animates fading to a specific color fill |
| animate_fading_leap_down | Animates an atom leaping downward while appearing and scaling down |
| animate_fading_leap_up | Animates an atom leaping upward while fading and scaling |
| animate_flash_color_fill | Animates flashing between a specific color and white |
| animate_flash_color_fill_inherit | Animates flashing between a specific color and the original color |
| animate_float | Animates an atom floating up and down with rotation |
| animate_ghostly_presence | Animates a ghostly presence effect with floating and rotation |
| animate_levitate | Animates an atom levitating slightly with rotation |
| animate_melt_pixel | Animates an atom melting downward with a bounce effect |
| animate_rainbow_glow | Animates a full rainbow color cycle |
| animate_rainbow_glow_old | Animates a simple rainbow color cycle (red, green, blue) |
| animate_rumble | Animates a rumbling effect by translating the atom in four directions |
| animate_shake | Animates shaking an atom randomly on its tile |
| animate_shockwave | Animates a shockwave effect with rotation and vertical movement |
| animate_spin | Animates spinning an atom in the specified direction |
| animate_teleport | Animates a teleportation effect with scaling and color change |
| animate_teleport_wiz | Animates a wizard-style teleportation effect |
| animate_wiggle_then_reset | Animates wiggling an atom randomly then resetting to original position |
| 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 |
| assertion_message | Generates a formatted assertion message for debugging purposes |
| assoc_to_keys | Converts an associative list into a flat list of keys |
| atmos_scan | Outputs a message to the user describing the target's gasmixes. |
| 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 |
| bang | Creates a flashing effect that blinds and deafens mobs within range |
| between | Ensures a value is between a minimum and maximum, clamping it if necessary |
| bitfield_to_list | Converts a bitfield to a list of numbers (or words if a wordlist is provided) |
| 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 |
| 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. |
| 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. |
| 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 |
| change_english_station_name | Changes the English station name and updates the world name |
| change_station_name | Changes the station name to the specified designation |
| check_active_security_force | |
| check_rights | Check if the current user has admin rights |
| check_rights_all | Requires the holder to have all the rights specified |
| 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 |
| checkpass | Checks if mover is movable atom and has passed pass_flags. |
| 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 |
| convert_pencode_arg | Converts pencode arguments to HTML tags with safety checks Called by admin_pencode_to_html to handle custom tags |
| 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 |
| counterlist_combine | Combines two counter lists by adding values for matching keys |
| counterlist_normalise | Normalizes a counter list by dividing each value by the total sum |
| counterlist_scale | Scales all values in a counter list by a given scalar factor |
| counterlist_sum | Calculates the sum of all values in a counter list |
| 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 |
| 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 |
| declension_ru | Возвращает правильную форму слова, соответствующую русскому склонению числительных. |
| deep_copy_list | Recursively copies a list and all lists contained within it Does not copy any other reference types |
| 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 |
| depower_apcs | Depowers all APCs on the station by draining their cells |
| 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 |
| 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 |
| 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 |
| display_joules | Format an energy value in J, kJ, MJ, or GJ. 1W = 1J/s. |
| display_power | Formats a power value in W, kW, MW, or GW. |
| 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. |
| do_chem_smoke | Helper to quickly create a cloud of reagent smoke |
| do_smoke | A helper proc used to spawn small puffs of smoke. |
| 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. |
| endswith | Returns TRUE if the input_text ends with the ending |
| english_list | Returns a list in plain english as a string |
| 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 |
| expand_weights | Takes a weighted list and expands it into raw entries This eats more memory, but saves time when actually picking from it |
| explosion | Makes a given turf explode. |
| 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 |
| 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 |
| find_stealth_key | Resolves a stealth key to its original ckey |
| 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. |
| flash_color | Flashes a color on the screen of a mob or client for a specified duration |
| 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. |
| 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 |
| genderize_decode | Обрабатывает гендерно-зависимую текстовую разметку в строке. |
| genderize_ru | Возвращает форму слова с учётом грамматического рода в русском языке. |
| 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! |
| 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 |
| 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 |
| get_antag_type_truncated_plaintext_string | A proc that return a string containing all the singled out antags . Empty string if not antag |
| 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 |
| 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. |
| get_atoms_of_type | Returns a list of atoms in a location of a given type. Can be refined to look for pixel-shift. |
| get_bbox_of_atoms | Get a bounding box of a list of atoms. |
| 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. |
| get_client_by_ckey | Finds a client by their ckey, handling stealth keys |
| 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. |
| 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. |
| get_list_count | Counts the number of nested lists within a list, up to a maximum count |
| 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 |
| 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 |
| get_mob_by_key | Finds a mob by their ckey (case-insensitive) |
| 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 |
| 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 |
| 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 |
| get_uplink_items | Proc that generates a list of items, available for certain uplink. |
| get_valid_screen_location | Returns a valid location to place a screen object without overflowing the viewport |
| 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 |
| 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 |
| ghost_follow_link | Generates follow links for ghosts to track specific atoms, with special handling for AIs and observer mobs |
| 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 |
| heat2color | heat2color functions. Adapted from: http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code |
| html_to_pencode | Converts HTML back to pencode format |
| 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 |
| init_emote_list | Initializes and returns an associative list of emote keys to their corresponding emote datums |
| 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 |
| init_subtypes | Creates every subtype of a given prototype (excluding the prototype itself) and adds them to a list |
| init_uplink_items_list | 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 |
| is_file_type | Verifys wether a string or file ends with a given file type |
| is_file_type_in_list | Verifys wether a string or file ends with a given file type. |
| is_guest_key | Returns whether or not a player is a guest using their ckey as an input |
| 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. |
| 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 |
| 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 |
| is_type_in_typecache | Checks if an atom's type is present in a typecache list |
| 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 |
| 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 |
| list_clear_duplicates | Removes all occurrences of a specified element from a list |
| list_clear_empty_weakrefs | Removes any empty weakrefs from the list Returns TRUE if the list had empty refs, FALSE otherwise |
| list_clear_nulls | Removes any null entries from the list Returns TRUE if the list had nulls, FALSE otherwise |
| listgetindex | Returns list element or null. Should prevent "index out of bounds" error. |
| lists_equal_unordered | Checks if two lists contain the same elements, ignoring order |
| 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 |
| locateUID | Locates a datum based off of the UID |
| 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. |
| 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 |
| mobs_in_area | Returns a list of mobs in the specified area, optionally filtering by client presence |
| move_element | Moves a single element from one position to another within a list, preserving associations |
| move_range | Moves a range of elements from one position to another within a list, preserving associations |
| 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 |
| 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. |
| pencode_to_html | Converts pencode to HTML with various formatting options |
| pick_candidates_all_types | Presents admin with choice of candidate selection methods |
| pick_candidates_manually | Manually picks candidates from all available ghosts without a poll |
| 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 |
| pick_n_take | Pick a random element from the list and remove it from the list. |
| 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 |
| pick_weight_n_take | Picks a random element by weight from the list and removes it from the list |
| pick_weight_recursive | Like pick_weight, but allowing for nested lists. |
| 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 |
| 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. |
| playsound | playsound 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_veto | Polls candidates with admin veto selection from a list of willing ghosts |
| pop | Returns the top (last) element from the list, does not remove it from the list. Stack functionality. |
| popleft | Returns the first element from the list and removes it. Queue functionality. |
| power_failure | Causes random APCs to short out with a given probability |
| power_restore | Can recharge APC cells, repair cut wires, or both. Sends station announcement if requested. |
| power_restore_quick | Quickly restores all SMES units to full capacity and maximum output |
| prepare_antag_data | Prepares antagonist data for caching and display |
| prepare_antag_list | Processes a list of antagonists and prepares their data |
| 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 |
| 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 |
| 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. |
| 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 |
| remove_diagonals | Processes a path (list of turfs), removes any diagonal moves |
| 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 |
| 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. |
| 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 |
| 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 |
| 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 |
| safepick | Return either pick(list) or null if list is not of type /list or is empty |
| 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 |
| sanitize_english_string_to_russian | Converts an entire English string to Russian keyboard layout |
| sanitize_filename | Removes characters incompatible with file names. |
| sanitize_filepath | Sanitizes the name of each node in the path. |
| 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 |
| sanitize_hexcolor | Sanitizes a hexadecimal color value to ensure it is valid |
| sanitize_inlist | Sanitizes a value by ensuring it exists in a list |
| sanitize_integer | Sanitizes an integer value to ensure it falls within a specified range |
| sanitize_json | Sanitizes JSON input and returns a decoded list |
| sanitize_russian_key_to_english | Converts a single Russian keyboard character to its English equivalent |
| sanitize_simple | Removes a few problematic characters |
| sanitize_specsymbols_key_to_numbers | Converts special symbols to their number equivalents for keybindings |
| sanitize_text | Sanitizes a text value to ensure it is valid text |
| screen_loc_to_offset | Converts a screen location string to pixel offsets |
| 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 |
| 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 |
| shuffle_inplace | Shuffles a list in place and returns the same list |
| 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 |
| 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 |
| 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 |
| string_list | Caches lists with non-numeric stringify-able values (text or typepath). |
| strings | Get strings array from a JSON string file |
| strings_replacement | Get a random string with nested @pick() replacements |
| strings_subkey_lookup | Callback for regex replacement in strings_replacement |
| 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 |
| 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 |
| tgui_Topic | Middleware for /client/Topic. |
| tgui_alert | Creates a TGUI alert window and returns the user's response. |
| tgui_input_checkbox_list | Creates a TGUI input list window and returns the user's response in a ranked order. |
| tgui_input_color | Creates a TGUI color picker window and returns the user's response. |
| tgui_input_keycombo | Creates a TGUI window with a key input. Returns the user's response as a full key with modifiers, eg ShiftK. |
| tgui_input_list | Creates a TGUI input list window and returns the user's response. |
| tgui_input_number | Creates a TGUI window with a number input. Returns the user's response as num | null. |
| tgui_input_ranked_list | Creates a TGUI input list window and returns the user's response. |
| tgui_input_text | Creates a TGUI window with a text input. Returns the user's response. |
| 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 |
| to_chat | Sends the message to the recipient (target). |
| 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 |
| 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. |
| 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 |
| typecache_filter_list_reverse | Returns a new list with atoms that are not in the provided typecache |
| typecache_filter_multi_list_exclusion | Filters atoms using both inclusion and exclusion typecaches |
| 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 |
| unique_list_in_place | Removes duplicate entries from a list in place, preserving associated values |
| 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 |
| 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 |
| urange | Returns all objects within a specified range of the center atom (no limitations on distance, faster than range for distances > 8) |
| urange_multiz | Returns all objects within a multiz-level range of the center atom |
| valid_build_direction | Checks whether the target turf is in a valid state to accept a directional construction such as windows or railings. |
| 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 |
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:
- mover - The atom that is attempting to move
- start_turf - The turf the mover is starting from
- target_turf - The turf the mover is trying to enter
- forget - List of atoms to ignore when checking for blockers
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:
- skin_list - The list to add the skin to
- skin_data - The item skin datum to add
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:
- target - Who the verb is being added to, client or mob typepath
- verb - typepath to a verb, or a list of verbs, supports lists of lists
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:
- callback the callback to call on timer finish
- wait deciseconds to run the timer for
- flags flags for this timer, see: code__DEFINES\subsystems.dm
- timer_subsystem the subsystem to insert this timer into
admin_jump_link
Generates admin follow links for tracking specific atoms, with special handling for clients, AIs, and observer mobs
Arguments:
- target_atom - The atom to create an admin follow link for
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:
- target - The atom to animate
animate_explode_pixel
Animates an atom exploding outward with random rotation and movement
Arguments:
- target - The atom to animate
animate_fade_colored
Animates fading an atom from grayscale to normal color
Arguments:
- target - The atom or client to animate
- duration - Animation duration in ticks (default: 0.5 SECONDS)
animate_fade_grayscale
Animates fading an atom to grayscale
Arguments:
- target - The atom or client to animate
- duration - Animation duration in ticks (default: 0.5 SECONDS)
animate_fade_to_color_fill
Animates fading to a specific color fill
Arguments:
- target - The atom to animate
- target_color - The color to fade to
- duration - Animation duration in ticks
animate_fading_leap_down
Animates an atom leaping downward while appearing and scaling down
Arguments:
- target - The atom to animate
animate_fading_leap_up
Animates an atom leaping upward while fading and scaling
Arguments:
- target - The atom to animate
animate_flash_color_fill
Animates flashing between a specific color and white
Arguments:
- target - The atom to animate
- flash_color - The color to flash to
- loop_count - Number of flash cycles
- duration - Animation duration per cycle in ticks
animate_flash_color_fill_inherit
Animates flashing between a specific color and the original color
Arguments:
- target - The atom to animate
- flash_color - The color to flash to
- loop_count - Number of flash cycles
- duration - Animation duration per cycle in ticks
animate_float
Animates an atom floating up and down with rotation
Arguments:
- target - The atom to animate
- loop_count - Number of animation loops (default: -1 for infinite)
- float_speed - Animation speed in ticks (default: 2 SECONDS)
- random_rotation - Whether to use random rotation direction (default: TRUE)
animate_ghostly_presence
Animates a ghostly presence effect with floating and rotation
Arguments:
- target - The atom to animate
- loop_count - Number of animation loops (default: -1 for infinite)
- float_speed - Animation speed in ticks (default: 2 SECONDS)
- random_rotation - Whether to use random rotation direction (default: TRUE)
animate_levitate
Animates an atom levitating slightly with rotation
Arguments:
- target - The atom to animate
- loop_count - Number of animation loops (default: -1 for infinite)
- float_speed - Animation speed in ticks (default: 2 SECONDS)
- random_rotation - Whether to use random rotation direction (default: TRUE)
animate_melt_pixel
Animates an atom melting downward with a bounce effect
Arguments:
- target - The atom to animate
animate_rainbow_glow
Animates a full rainbow color cycle
Arguments:
- target - The atom to animate
animate_rainbow_glow_old
Animates a simple rainbow color cycle (red, green, blue)
Arguments:
- target - The atom to animate
animate_rumble
Animates a rumbling effect by translating the atom in four directions
Arguments:
- target - The atom to animate
animate_shake
Animates shaking an atom randomly on its tile
Arguments:
- target - The atom to animate
- shake_count - Number of shake iterations (default: 5)
- x_amplitude - Maximum horizontal shake distance (default: 2)
- y_amplitude - Maximum vertical shake distance (default: 2)
animate_shockwave
Animates a shockwave effect with rotation and vertical movement
Arguments:
- target - The atom to animate
animate_spin
Animates spinning an atom in the specified direction
Arguments:
- target - The atom to animate
- direction - Spin direction "L" for left, "R" for right
- spin_duration - Duration per quarter turn in ticks
- loop_count - Number of spin cycles (default: -1 for infinite)
animate_teleport
Animates a teleportation effect with scaling and color change
Arguments:
- target - The atom to animate
animate_teleport_wiz
Animates a wizard-style teleportation effect
Arguments:
- target - The atom to animate
animate_wiggle_then_reset
Animates wiggling an atom randomly then resetting to original position
Arguments:
- target - The atom to animate
- loop_count - Number of wiggle cycles
- speed - Animation speed in ticks
- x_variance - Maximum horizontal wiggle distance
- y_variance - Maximum vertical wiggle distance
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:
- target_list - The list to check for sorted order
- list_name - The name of the list for error reporting
- cmp - The comparison function to use (default: numeric ascending)
assertion_message
Generates a formatted assertion message for debugging purposes
assoc_to_keys
Converts an associative list into a flat list of keys
Arguments:
- associative_list - The associative list to extract keys from
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:
- input_key - The key to check for duplicates
- used_keys - List of keys already in use
bang
Creates a flashing effect that blinds and deafens mobs within range
Arguments:
- T - The turf to flash
- A - The flashing atom
- range - The range in tiles of the flash
- flash - Whether to flash (blind)
- bang - Whether to bang (deafen)
between
Ensures a value is between a minimum and maximum, clamping it if necessary
Arguments:
- low_bound - The minimum allowed value
- middle_value - The value to clamp
- high_bound - The maximum allowed value
bitfield_to_list
Converts a bitfield to a list of numbers (or words if a wordlist is provided)
Arguments:
- input_bitfield - The bitfield to convert to a list
- word_list - Optional list of words to use instead of numeric bit values
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:
- tcm - The tcomms message datum
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:
- source: The thing that the projectile is being shot from.
- target: (Optional) The thing that the projectile is being shot at.
- If this is not provided the source atom must be a mob with a client.
- modifiers: A list of click parameters used to modify the shot angle.
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:
- source - The starting atom for the line check.
- target - The target atom to draw the line towards.
- max_length - The maximum allowed length of the line (default: 5).
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:
- new_name - The new command name
change_english_station_name
Changes the English station name and updates the world name
Arguments:
- new_designation - The new English station name
change_station_name
Changes the station name to the specified designation
Arguments:
- new_designation - The new station name
check_active_security_force
- checks the security force on station and returns a list of numbers, of the form:
- total, active, dead, antag
- where active is defined as conscious (STAT = 0) and not an antag
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:
- rights_required - Bitflags of required admin rights (FALSE for any admin)
- show_msg - If TRUE, shows a message to the user on failure
- user - The mob to check rights for(defaults to usr)
- all - If TRUE, requires ALL flags in rights_required instead of ANY
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:
- floor_loc - floor tile in front of the wall
- dir_toward_wall - direction from the floor tile in front of the wall towards the wall
- check_external - truthy if we should be checking against items coming out of the wall, rather than visually on top of the wall.
checkpass
Checks if mover is movable atom and has passed pass_flags.
Arguments:
- mover - target to check.
- passflag - flag to check for.
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:
- first_list - The first list to compare
- second_list - The second list to compare
convert_pencode_arg
Converts pencode arguments to HTML tags with safety checks Called by admin_pencode_to_html to handle custom tags
Arguments:
- original_text - The original text that matched the regex
- tag_type - The type of tag (class, style, img)
- tag_arguments - The arguments provided for the tag
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:
- source_list - The list to search through
- target_type - The type to count instances of
counterlist_combine
Combines two counter lists by adding values for matching keys
Arguments:
- base_list - The base list to which values will be added
- additional_list - The list containing additional values to combine
counterlist_normalise
Normalizes a counter list by dividing each value by the total sum
Arguments:
- source_list - The list of key-value pairs to normalize
counterlist_scale
Scales all values in a counter list by a given scalar factor
Arguments:
- source_list - The list of key-value pairs to scale
- scale_factor - The scalar value to multiply each value by
counterlist_sum
Calculates the sum of all values in a counter list
Arguments:
- source_list - The list of key-value pairs to sum
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:
- input_fragment - The screen location fragment to process
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:
- low_bound - The minimum allowed value
- high_bound - The maximum allowed value
- input_number - The number to clamp
declension_ru
Возвращает правильную форму слова, соответствующую русскому склонению числительных.
Учитывает правила русского языка, определяющие окончания числительных, на основе переданного числа. Использует три формы: единственное число (1), двойственное число (2-4) и множественное число (5+).
Аргументы:
- num - Число, для которого необходимо определить форму слова
- single_name - Форма слова для 1 (например, "стол")
- double_name - Форма слова для 2-4 (например, "стола")
- multiple_name - Форма слова для 5+ (например, "столов")
deep_copy_list
Recursively copies a list and all lists contained within it Does not copy any other reference types
Arguments:
- source_list - The list to deep copy
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:
- id a timerid or a /datum/timedevent
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:
- origin_turf - The starting turf for room detection
- break_types - Typecache of turf/area types that will break detection if found
- max_room_size - Maximum number of turfs to include in the room (default: INFINITY)
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:
- first_list - The first list to compare
- second_list - The second list to compare against
- skip_duplicates - If TRUE, repeated elements are treated as one
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:
- original_value - The initial value to adjust
- change_amount - The amount to add to the original value (can be positive or negative)
- lower_bound - The minimum allowed value
- upper_bound - The maximum allowed value
display_joules
Format an energy value in J, kJ, MJ, or GJ. 1W = 1J/s.
Arguments:
- energy_value - The energy value to format in joules
display_power
Formats a power value in W, kW, MW, or GW.
Arguments:
- power_value - The power value to format in watts
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:
- user - The mob performing the action.
- delay - The time in deciseconds. Use the SECONDS define for readability.
1 SECONDSis 10 deciseconds. - target - The target of the action. This is where the progressbar will display.
- timed_action_flags - Flags to control the behavior of the timed action.
- progress - Whether to display a progress bar
TRUEorFALSE. - extra_checks - Additional checks to perform before the action is executed.
- interaction_key - The assoc key under which the do_after is capped, with max_interact_count being the cap. Interaction key will default to target if not set.
- max_interact_count - The maximum amount of interactions allowed.
- cancel_on_max - If
TRUEthis proc will fail after reaching max_interact_count. - cancel_message - Message shown to the user if cancel_on_max is set to
TRUEand they exceeds max interaction count. Use empty string ("") to skip default cancel message. - category - Used to apply proper action speed modifier to passed delay.
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:
- range: The amount of smoke to produce as number of steps from origin covered.
- amount: The amount of smoke to produce as the total desired coverage area. Autofilled from the range arg if not set.
- location: Where to produce the smoke cloud.
- smoke_type: The smoke typepath to spawn.
do_sparks
Arguments:
- number: number of sparks.
- cardinal_only: cardinals, bool, do the sparks only move in cardinal directions?
- source: source of the sparks.
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:
- source - datum storing the cooldown
- index - string index storing the cooldown on the cooldowns associative list
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:
- input_list - The list to convert to a string
- nothing_text - Text to return if the list is empty
- and_text - Text to use before the last item
- comma_text - Text to use between items
- final_comma_text - Text to use before the last item (replaces comma_text for the last comma)
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:
- input_text - The text to escape for regex
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:
- weighted_list - The weighted list to expand
explosion
Makes a given turf explode.
Arguments:
- origin: The turf that's exploding.
- devastation_range: The range at which the effects of the explosion are at their strongest.
- heavy_impact_range: The range at which the effects of the explosion are relatively severe.
- light_impact_range: The range at which the effects of the explosion are relatively weak.
- flash_range: The range at which the explosion flashes people.
- adminlog: Whether to log the explosion/report it to the administration.
- ignorecap: Whether to ignore the relevant bombcap. Defaults to FALSE.
- flame_range: The range at which the explosion should produce hotspots.
- silent: Whether to generate/execute sound effects.
- smoke: Whether to generate a smoke cloud provided the explosion is powerful enough to warrant it.
- cause: [Optional] The turf that caused the explosion, when different to the origin. Used for logging.
- breach: ... (Is it possible that this is a hole formation and the value is Boolean? -- LittleBoobs)
- protect_epicenter: Whether to leave the epicenter turf unaffected by the explosion
- explosion_direction: The angle in which the explosion is pointed (for directional explosions.)
- explosion_arc: The angle of the arc covered by a directional explosion (if 360 the explosion is non-directional.)
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:
- source_atom - The starting atom for line of sight check
- target_atom - The target atom to check visibility to
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:
- source_list - The list to filter
- filter_text - The text to search for in keys and values
find_stealth_key
Resolves a stealth key to its original ckey
Arguments:
- stealth_text - The stealth key to resolve
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:
- holder: the beaker that the reagent is in
- name: name of the reagent / reaction
flash_color
Flashes a color on the screen of a mob or client for a specified duration
Arguments:
- target - The mob or client to flash the color on
- flash_color - The color to flash (default: cult red)
- flash_duration - The duration of the flash in seconds (default: 2 seconds)
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
- A simple rudimentary gasmix to information list converter. Can be used for UIs.
- Args:
-
- gasmix: /datum/gas_mixture
-
- name: String used to name the list, optional.
- Returns: A list parsed_gasmixes with the following structure:
-
- parsed_gasmixes Value: Assoc List Desc: The thing we return
- -- Key: name Value: String Desc: Gasmix Name
- -- Key: temperature Value: Number Desc: Temperature in kelvins
- -- Key: volume Value: Number Desc: Volume in liters
- -- Key: pressure Value: Number Desc: Pressure in kPa
- -- Key: oxygen Value: Number Desc: Amount of mols of O2
- -- Key: carbon_dioxide Value: Number Desc: Amount of mols of CO2
- -- Key: nitrogen Value: Number Desc: Amount of mols of N2
- -- Key: toxins Value: Number Desc: Amount of mols of plasma
- -- Key: sleeping_agent Value: Number Desc: Amount of mols of N2O
- -- Key: agent_b Value: Number Desc: Amount of mols of agent B
- -- Key: total_moles Value: Number Desc: Total amount of mols in the mixture
- Returned list should always be filled with keys even if value are nulls.
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:
- mean - The mean (average) of the normal distribution
- stddev - The standard deviation of the normal distribution
genderize_decode
Обрабатывает гендерно-зависимую текстовую разметку в строке.
Заменяет шаблоны %(SINGLE,PLURAL)% и %(MALE,FEMALE,NEUTER,PLURAL)% в сообщении на соответствующую форму слова в зависимости от пола моба. Используйте * для пропуска конкретной формы рода (например, %(,FEMALE,,PLURAL)%). Обрабатывает все шаблоны до тех пор, пока они полностью не исчезнут.
Аргументы:
- user - Моб, чей пол определяет форму слов (использует NEUTER, если не моб)
- msg - Строка с гендерной разметкой для обработки
genderize_ru
Возвращает форму слова с учётом грамматического рода в русском языке.
Выбирает правильную форму слова в зависимости от его грамматического рода (MALE, FEMALE, NEUTER) или множественного числа (PLURAL). Используется для прилагательных, местоимений и глаголов, изменяющихся по родам.
Аргументы:
- gender - Грамматический род (MALE, FEMALE, NEUTER, PLURAL)
- male_word - Мужская форма (например, "тыкнул")
- female_word - Женская форма (например, "тыкнула")
- neuter_word - Средняя форма (например, "тыкнуло")
- multiple_word - Форма множественного числа (например, "тыкнули")
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:
- starting_position - The starting position of the tracer
- ending_position - The ending position of the tracer
- beam_type - The type of tracer beam to create
- tracer_color - The color of the tracer beam
- deletion_delay - Time in ticks before the tracer is deleted
- lighting_range - The range of the lighting effect
- lighting_color_override - Override color for the lighting effect
- lighting_intensity - The intensity of the lighting effect
- lighting_instance_key - Unique key for the lighting instance
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:
- M - the mob you're checking
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:
- M - the mob you're checking
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:
- target_atom - The atom to get the area name for
- apply_formatting - Whether to apply text formatting to the area name
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
- something_in_turf - a movable within the turf, somewhere.
- stop_type - optional - stops looking if stop_type is found in the turf, returning that type (if found).
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:
- location - The atom to look in.
- target_type - The type to look for.
- check_shift - If true, will exclude atoms whose pixel_x/pixel_y do not match shift_x/shift_y.
- shift_x - If check_shift is true, atoms whose pixel_x is different to this will be excluded.
- shift_y - If check_shift is true, atoms whose pixel_y is different to this will be excluded.
get_bbox_of_atoms
Get a bounding box of a list of atoms.
Arguments:
- atoms - List of atoms. Can accept output of view() and range() procs.
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:
- channel - The channel number.
get_client_by_ckey
Finds a client by their ckey, handling stealth keys
Arguments:
- player_ckey - The ckey to search for
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
- view_radius - what radius search circle we are using, worse performance as this increases but not as much as it used to
- source - object at the center of our search area. everything in get_turf(source) is guaranteed to be part of the search area
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.
- radius - what radius search circle we are using, worse performance as this increases
- source - object at the center of our search area. everything in get_turf(source) is guaranteed to be part of the search area
- contents_type - the type of contents we want to be looking for. defaults to hearing sensitive
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().
- view_radius - what radius search circle we are using, worse performance as this increases
- source - object at the center of our search area. everything in get_turf(source) is guaranteed to be part of the search area
- contents_type - the type of contents we want to be looking for. defaults to hearing sensitive
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:
- target_list - The list to count nested lists in
- max_count - Maximum number of lists to count before returning
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:
- target_atom - The atom to get the area name for
- apply_formatting - Whether to apply text formatting to the area name
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:
- player_key - The ckey to search for
get_mob_by_key
Finds a mob by their ckey (case-insensitive)
Arguments:
- player_key - The ckey to search for
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:
- requester: The movable atom that's trying to find the path
- end: What we're trying to path to. It doesn't matter if this is a turf or some other atom, we're gonna just path to the turf it's on anyway
- max_distance: The maximum number of steps we can take in a given path to search (default: 30, 0 = infinite)
- mintargetdistance: Minimum distance to the target before path returns, could be used to get near a target, but not right to it - for an AI mob with a gun, for example.
- access: A list representing what access we have and what doors we can open.
- simulated_only: Whether we consider tur fs without atmos simulation (AKA do we want to ignore space)
- exclude: If we want to avoid a specific turf, like if we're a mulebot who already got blocked by some turf
- skip_first: Whether or not to delete the first item in the path. This would be done because the first item is the starting tile, which can break movement for some creatures.
- diagonal_handling: defines how we handle diagonal moves. see __DEFINES/path.dm
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:
- requester: The movable atom that's trying to find the path
- end: What we're trying to path to. It doesn't matter if this is a turf or some other atom, we're gonna just path to the turf it's on anyway
- max_distance: The maximum number of steps we can take in a given path to search (default: 30, 0 = infinite)
- mintargetdistance: Minimum distance to the target before path returns, could be used to get near a target, but not right to it - for an AI mob with a gun, for example.
- age: How old a path map can be before we'll avoid reusing it. Use the defines found in code/__DEFINES/path.dm, values larger then MAP_REUSE_SLOWEST will be discarded
- access: A list representing what access we have and what doors we can open.
- simulated_only: Whether we consider tur fs without atmos simulation (AKA do we want to ignore space)
- exclude: If we want to avoid a specific turf, like if we're a mulebot who already got blocked by some turf
- skip_first: Whether or not to delete the first item in the path. This would be done because the first item is the starting tile, which can break movement for some creatures.
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
get_uplink_items
Proc that generates a list of items, available for certain uplink.
Arguments:
- target_uplink - uplink we are checking.
- only_main_operations - skips sales and discounts, used for surplus crates generation.
get_valid_screen_location
Returns a valid location to place a screen object without overflowing the viewport
Arguments:
- target_loc - The target location as a purely number based screen_loc string "+-left-offset:+-pixel,+-bottom-offset:+-pixel"
- offset_distance - The amount we want to offset the target location by. We explicitly don't care about direction here, we will try all 4
- view - The view variable of the client we're doing this for. We use this to get the size of the screen
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:
- unwelded_only - Whether the list should only include vents that are unwelded
- exclude_mobs_nearby - Whether to exclude vents that are near living mobs regardless of visibility
- nearby_mobs_range - The range at which to look for living mobs around the vent for the above argument
- exclude_visible_by_mobs - Whether to exclude vents that are visible to any living mob
- min_network_size - The minimum length (non-inclusive) of the vent's parent network. A smaller number means vents in small networks (Security, Virology) will appear in the list
- station_levels_only - Whether to only consider vents that are in a Z-level with a STATION_LEVEL trait
- z_level - The Z-level number to look for vents in. Defaults to all
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
ghost_follow_link
Generates follow links for ghosts to track specific atoms, with special handling for AIs and observer mobs
Arguments:
- target - The atom to create a follow link for
- ghost - The ghost mob that will use the follow link
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:
- number_list - The list of numbers to find the greatest common factor for
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:
- input_text - The HTML text to convert to pencode
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:
- thing - either a /icon object, or an object that has an appearance (atom, image, mutable_appearance).
- target - either a reference to or a list of references to /client's or mobs with clients
- icon_state - string to force a particular icon_state for the icon to be used
- dir - dir number to force a particular direction for the icon to be used
- frame - what frame of the icon_state's animation for the icon being used
- moving - whether or not to use a moving state for the given icon
- sourceonly - if TRUE, only generate the asset and send back the asset url, instead of tags that display the icon to players
- extra_clases - string of extra css classes to use when returning the icon string
- keyonly - if TRUE, only returns the asset key to use get_asset_url manually. Overrides sourceonly.
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:
- prototype - The prototype type to create subtypes of
- output_list - The list to add the created instances to. If not provided, a new list is created.
- excluded_types - List of types to exclude from creation
- association_variable - The name of the variable to use as the key in the associative list
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:
- uplink_items - List of uplink items to consider for slot machine prizes
init_subtypes
Creates every subtype of a given prototype (excluding the prototype itself) and adds them to a list
Arguments:
- prototype - The prototype type to create subtypes of
- output_list - The list to add the created instances to. If not provided, a new list is created.
init_uplink_items_list
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:
- old_freq - Frequency of the connection
- new_freq - Frequency of the message
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:
- file - A string or file. No checks for if this file ACCTALLY exists
- file_type - A string to check against [e.g. "ogg"]
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:
- file - A string or file. No checks for if this file ACCTALLY exists
- file_types - A list of strings to check against [e.g. list("ogg" = TRUE, "mp3" = TRUE)]
is_guest_key
Returns whether or not a player is a guest using their ckey as an input
Arguments:
- player_key - The player's ckey to check
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:
- source - path start loc.
- target - path end loc.
- flags - additional pass_flags, used to determine passability on each step.
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:
- M - the mob you're checking
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:
- checked_atom - The atom to check the type of
- target_list - The list of types to check against
- check_subtypes - If TRUE, includes subtypes in the check
is_type_in_typecache
Checks if an atom's type is present in a typecache list
Arguments:
- checked_atom - The atom to check the type of
- type_cache - The typecache list to check against
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:
- target_list - The list to check for emptiness
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:
- target_turf - The turf to check pressure on
list_clear_duplicates
Removes all occurrences of a specified element from a list
Arguments:
- element_to_remove - The element to remove from the list
- target_list - The list from which to remove the element
list_clear_empty_weakrefs
Removes any empty weakrefs from the list Returns TRUE if the list had empty refs, FALSE otherwise
Arguments:
- target_list - The list to remove empty weakrefs from
list_clear_nulls
Removes any null entries from the list Returns TRUE if the list had nulls, FALSE otherwise
Arguments:
- target_list - The list to remove null entries from
listgetindex
Returns list element or null. Should prevent "index out of bounds" error.
Arguments:
- source_list - The list to get the element from
- element_index - The index or key of the element to retrieve
lists_equal_unordered
Checks if two lists contain the same elements, ignoring order
Arguments:
- first_list - First list to compare
- second_list - Second list to compare
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:
- filepath - Path to the JSON string file to load
- directory - Directory to look for string files in (default: STRING_DIRECTORY)
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:
- flat_list - the list that it passes to make associative
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):
- type - Message type, must be one of defines in
code/__DEFINES/chat.dm - text - Plain message text
- html - HTML message text
- Optional metadata, can be any key/value pair.
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:
- target_area - The area to search for mobs in
- require_client - If TRUE, only include mobs with clients
- source_mob_list - The list of mobs to search through (default: GLOB.mob_list)
move_element
Moves a single element from one position to another within a list, preserving associations
Arguments:
- target_list - The list to modify
- source_index - The current index of the element to move (1 to list length)
- destination_index - The target index for the element (1 to list length + 1)
move_range
Moves a range of elements from one position to another within a list, preserving associations
Arguments:
- target_list - The list to modify
- source_index - The starting index of the range to move
- destination_index - The target starting index for the range
- range_length - The number of elements to move (default: 1)
movespeed_data_null_check
Checks if a move speed modifier is valid and not missing any data
mutable_appearance
-
Helper similar to image()
-
icon - Our appearance's icon
-
icon_state - Our appearance's icon state
-
layer - Our appearance's layer
-
atom/offset_spokesman - An atom to use as reference for the z position of this appearance. Only required if a plane is passed in. If this is not passed in we accept offset_const as a substitute
-
plane - The plane to use for the appearance. If this is not FLOAT_PLANE we require context for the offset to use
-
alpha - Our appearance's alpha
-
appearance_flags - Our appearance's appearance_flags
-
color - ??? idk, some EM legacy shit?
-
offset_const - A constant to offset our plane by, so it renders on the right "z layer"
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:
- x_offset - The horizontal pixel offset
- y_offset - The vertical pixel offset
- view - Optional view context to clamp the coordinates within bounds
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:
- target_list - The list to peek at
pencode_to_html
Converts pencode to HTML with various formatting options
Arguments:
- input_text - The text containing pencode to convert
- user_mob - The mob using the pen (for signature and species)
- pen_item - The pen item being used (can be null)
- enable_formatting - Whether to enable basic formatting (headings, center, etc.)
- enable_signature - Whether to enable signature replacement
- enable_fields - Whether to enable field replacement
- default_font - The default font to use
- signature_font - The font to use for signatures
- crayon_font - The font to use for crayons
- disable_font - Whether to disable font styling entirely
pick_candidates_all_types
Presents admin with choice of candidate selection methods
Arguments:
- admin_client - The client of the admin making the selection
- max_slots - Maximum number of candidates to select
- question - The poll question presented to ghosts
- be_special_type - The special role type to check for
- antag_age_check - Whether to check antag age restrictions
- poll_time - Duration of the poll in seconds
- ignore_respawnability - Whether to ignore respawnability checks
- min_hours - Minimum hours required to participate
- flashwindow - Whether to flash the window for candidates
- check_antaghud - Whether to check antag HUD visibility
- source - The source of the poll
- role_cleanname - Clean name of the role for display
- reason - Reason for the poll
pick_candidates_manually
Manually picks candidates from all available ghosts without a poll
Arguments:
- admin_client - The client of the admin making the selection
- team_size - Number of team members to select
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:
- listfrom - The list where to pick from
- amount - The amount of elements it tries to pick.
pick_n_take
Pick a random element from the list and remove it from the list.
Arguments:
- source_list - The list to pick and remove from
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:
- weighted_list - The list with weights to pick from
pick_weight_n_take
Picks a random element by weight from the list and removes it from the list
Arguments:
- source_list - The weighted list to pick and remove from
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:
- weighted_list - The list with weights to pick from
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:
- source - Origin of sound.
- soundin - Either a file, or a string that can be used to get an SFX.
- vol - The volume of the sound, excluding falloff and pressure affection.
- vary - bool that determines if the sound changes pitch every time it plays.
- extrarange - modifier for sound range. This gets added on top of SOUND_RANGE.
- falloff_exponent - Rate of falloff for the audio. Higher means quicker drop to low volume. Should generally be over 1 to indicate a quick dive to 0 rather than a slow dive.
- frequency - playback speed of audio.
- channel - The channel the sound is played at.
- pressure_affected - Whether or not difference in pressure affects the sound (E.g. if you can hear in space).
- ignore_walls - Whether or not the sound can pass through walls.
- falloff_distance - Distance at which falloff begins. Sound is at peak volume (in regards to falloff) aslong as it is in this range.
pluralize_ru
Возвращает форму единственного или множественного числа в зависимости от грамматического рода.
Простой инструмент, который помогает легко переключаться между формами единственного и множественного числа, основываясь на указанном роде.
Аргументы:
- gender - Грамматический род (MALE, FEMALE, NEUTER, PLURAL)
- single_word - Форма единственного числа (например, "делает")
- plural_word - Форма множественного числа (например, "делают")
poll_candidates_with_veto
Polls candidates with admin veto selection from a list of willing ghosts
Arguments:
- admin_client - The client of the admin making the selection
- max_slots - Maximum number of candidates to select
- question - The poll question presented to ghosts
- be_special_type - The special role type to check for
- antag_age_check - Whether to check antag age restrictions
- poll_time - Duration of the poll in seconds
- ignore_respawnability - Whether to ignore respawnability checks
- min_hours - Minimum hours required to participate
- flashwindow - Whether to flash the window for candidates
- check_antaghud - Whether to check antag HUD visibility
- source - The source of the poll
- role_cleanname - Clean name of the role for display
- reason - Reason for the poll
pop
Returns the top (last) element from the list, does not remove it from the list. Stack functionality.
Arguments:
- target_list - The list to pop from
popleft
Returns the first element from the list and removes it. Queue functionality.
Arguments:
- target_list - The list to pop from
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:
- announce - If TRUE, sends a station announcement
- probability - Chance for each APC to short out
power_restore
Can recharge APC cells, repair cut wires, or both. Sends station announcement if requested.
Arguments:
- announce - If TRUE, sends a station announcement
- power_type - Type of restoration (POWER_RESTORE_ONLY, APC_REPAIR_ONLY, APC_REPAIR_AND_CHARGE)
power_restore_quick
Quickly restores all SMES units to full capacity and maximum output
Arguments:
- announce - If TRUE, sends a station announcement
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:
- antag_mind - The mind datum of the antagonist
- cached_data - The main cache data structure to update
- antag_name - The type name of the antagonist role
- antagonist_cache - Cache of antagonist data indexed by mind UID
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:
- antags - List of antagonist minds to process
- cached_data - The main cache data structure to update
- antag_name - The type name of the antagonist role
- antagonist_cache - Cache of antagonist data indexed by mind UID
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:
- cached_data - The main cache data structure to update
- antagonist_cache - Cache of antagonist data indexed by mind UID
pretty_string_from_reagent_list
Input a reagent_list, outputs pretty readable text! Default output will be formatted as
-
water, 5 | silicon, 6 | soup, 4 | space lube, 8
-
names_only will remove the amount displays, showing
-
water | silicon | soup | space lube
-
join_text will alter the text between reagents
-
setting to ", " will result in
-
water, 5, silicon, 6, soup, 4, space lube, 8
-
final_and should be combined with the above. will format as
-
water, 5, silicon, 6, soup, 4, and space lube, 8
-
capitalize_names will result in
-
Water, 5 | Silicon, 6 | Soup, 4 | Space lube, 8
-
- use (reagents.reagent_list, names_only, join_text = ", ", final_and, capitalize_names) for the formatting
-
- Water, Silicon, Soup, and Space Lube
print_single_line
Converts a list to a string representation in "list(key => value, ...)" format
Arguments:
- source_list - The list to convert to string
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:
- species - The name of the species to filter valid body accessories.
- is_optional - Whether no body accessory (null) is an option.
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:
- target - Who the verb is being removed from, client or mob typepath
- verb - typepath to a verb, or a list of verbs, supports lists of lists
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:
- source - datum storing the cooldown
- index - string index storing the cooldown on the cooldowns associative list
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:
- target_list - The list to reverse
- start_index - The starting index of the range to reverse (default: 1)
- end_index - The ending index of the range to reverse (default: 0, meaning end of list)
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.
- user - The user of the emote.
- text - The text of the emote.
russian_list
Returns a list in plain russian as a string
Arguments:
- input_list - The list to convert to a string
- nothing_text - Text to return if the list is empty
- and_text - Text to use before the last item
- comma_text - Text to use between items
- final_comma_text - Text to use before the last item (replaces comma_text for the last comma)
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:
- M - Mob to get a safe ckey of
safepick
Return either pick(list) or null if list is not of type /list or is empty
Arguments:
- source_list - The list to pick a random element from
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:
- input_character - The English character to convert
sanitize_english_string_to_russian
Converts an entire English string to Russian keyboard layout
Arguments:
- input_text - The English text to convert to Russian layout
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:
- input_gender - The gender to sanitize
- allow_neuter - Whether to allow neuter gender (default: FALSE)
- allow_plural - Whether to allow plural gender (default: FALSE)
- default_gender - The default gender to return if invalid (default: "male")
sanitize_hexcolor
Sanitizes a hexadecimal color value to ensure it is valid
Arguments:
- input_color - The color string to sanitize
- default_color - The default color to return if invalid (default: "#000000")
sanitize_inlist
Sanitizes a value by ensuring it exists in a list
Arguments:
- input_value - The value to check
- valid_list - The list of valid values
- default_value - The default value to return if input is invalid
sanitize_integer
Sanitizes an integer value to ensure it falls within a specified range
Arguments:
- input_number - The number to sanitize
- minimum_value - The minimum allowed value (default: 0)
- maximum_value - The maximum allowed value (default: 1)
- default_value - The value to return if input is invalid (default: 0)
sanitize_json
Sanitizes JSON input and returns a decoded list
Arguments:
- json_input - The JSON string to decode and sanitize
sanitize_russian_key_to_english
Converts a single Russian keyboard character to its English equivalent
Arguments:
- input_character - The Russian character to convert
sanitize_simple
Removes a few problematic characters
sanitize_specsymbols_key_to_numbers
Converts special symbols to their number equivalents for keybindings
Arguments:
- input_character - The special character to convert
sanitize_text
Sanitizes a text value to ensure it is valid text
Arguments:
- input_text - The text to sanitize
- default_value - The value to return if input is invalid (default: "")
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_loc - The screen location string to parse
- view - The view context to use for relative positioning
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:
- user - The mob making the selection, or null for random selection
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