Space Station 13 - Modules - TypesVar Details - Proc Details

/(global)

Vars

FailsafeFailsafe
MasterStonedMC
SSai_behaviorsThe subsystem used to tick /datum/ai_behavior instances. Handling the individual actions an AI can take like punching someone in the fucking NUTS
SSai_controllersThe subsystem used to tick /datum/ai_controllers instances. Handling the re-checking of plans.
SSai_movementThe subsystem used to tick /datum/ai_movement instances. Handling the movement of individual AI instances
SSambienceThe subsystem used to play ambience to users every now and then, makes them real excited.
SSauraThe subsystem used to tick auras (/datum/component/aura_healing and /datum/component/damage_aura).
SSdiscord
SSescape_menuSubsystem for controlling anything related to the escape menu
SSmove_managerActs as a namespace for movement packet/type related procs
SSpoints_of_interestSubsystem for managing all POIs.
SSrunechat
SStguitgui subsystem
SSticket_pingPings admins every (time chosen in config) for all open tickets/OPFOR applications
SStimer

Procs

CreateBansDEBUG
GetJobNameGets the job title, if the job name is an alt title, locates the original title using a prebuilt cache
HeapPathWeightCompareTODO: Macro this to reduce proc overhead
WrapAdminProcCallWrapper for proccalls where the datum is flagged as vareditted
___TraitAddDO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback.
___TraitRemoveDO NOT USE ___TraitAdd OR ___TraitRemove as a replacement for ADD_TRAIT / REMOVE_TRAIT defines. To be used explicitly for callback.
_addtimerCreate a new timer and insert it in the queue. You should not call this directly, and should instead use the addtimer macro, which includes source information.
_turf_in_offsetLocating turfs
actionspeed_data_null_checkChecks if a action speed modifier is valid and not missing any data
add_keybindingAdds an instanced keybinding to the global tracker
add_verbhandles adding verbs and updating the stat panel browser
alert_to_permissions_elevation_attemptSends a message in the event that someone attempts to elevate their permissions through invoking a certain proc.
announce_arrivalSend a message in common radio when a player arrives
assign_random_nameGenerate a name devices
assoc_to_keysTurns an associative list into a flat list of keys
block_calculate_resultant_damageConsiders a block return_list and calculates damage to use from that.
callHook@file hooks.dm Implements hooks, a simple way to run code on pre-defined events.
call_emergency_meetingSummon the crew for an emergency meeting
callback_selectRuns a list of callbacks asyncronously, returning only when all have finished
check_admin_pingsChecks a given message to see if any of the words contain an active admin's ckey with an @ before it
cleanup_ghostsGives a farewell message and deletes the ghosts produced by a ghost portal structure.
color_matrix_contrast_percentExxagerates or removes brightness
color_matrix_hsvBuilds a color matrix that transforms the hue, saturation, and value, all in one operation.
color_matrix_rotationMoves all colors angle degrees around the color wheel while maintaining intensity of the color and not affecting whites TODO: Need a version that only affects one color (ie shift red to blue but leave greens and blues alone)
color_matrix_saturation_percentExxagerates or removes colors
create_delusionHelper to give the passed mob the ability to create a delusion hallucination (even a custom one). Returns a list of arguments - pass these to _cause_hallucination to cause the desired hallucination
create_mafia_gameCreates the global datum for playing mafia games, destroys the last if that's required and returns the new.
create_strippable_listCreates an assoc list of keys to /datum/strippable_item
cultslurMakes you talk like you got cult stunned, which is slurring but with some dark messages
cut_relative_directionTakes a screen_loc string and cut out any directions like NORTH or SOUTH
dd_file2listReading files
dd_hasprefixPrefix checking
dd_hassuffixSuffix checking
dd_replacetextReplacing text
dd_text2listTurning text into lists
debug_variableGet displayed variable in VV variable list
default_ui_stateThe sane defaults for a UI such as a computer or a machine.
delete_all_SS_and_recreate_masterDelete all existing SS to basically start over
delta_to_angleCalculate the angle produced by a pair of x and y deltas
deltimerDelete a timer
diff_appearancesTakes two appearances as args, prints out, logs, and returns a text representation of their differences Including suboverlays
dump_in_spaceDump a movable in a random valid spacetile
emissive_appearanceProduces a mutable appearance glued to the [EMISSIVE_PLANE] dyed to be the EMISSIVE_COLOR.
end_cooldownCallback called by a timer to end an associative-list-indexed cooldown.
english_list_assocEnglish_list but associative supporting. Higher overhead. @depricated
find_recordReturns datum/data/record
finish_unequip_mobA utility function for /datum/strippable_items to finish unequipping an item from a mob.
firing_squadfiring_squad is a proc for the :B:erforate smite to shoot each individual bullet at them, so that we can add actual delays without sleep() nonsense
force_apc_arcingSet all APCs to start (or stop) arcing
format_frequencyFormat frequency by moving the decimal.
generate_asset_nameGenerate a filename for this asset The same asset will always lead to the same asset name (Generated names do not include file extention.)
generate_bitfieldsTurns /datum/bitfield subtypes into a list for use in debugging
generate_changeling_meteorRecieves a mob candidate, transforms them into a changeling, and hurls them at the station inside of a changeling meteor
generate_icon_alpha_maskHelper proc to generate a cutout alpha mask out of an icon.
generate_selectable_speciesGenerates species available to choose in character setup at roundstart
get_allowed_instrument_idsGet all non admin_only instruments.
get_atom_on_turfReturns the top-most atom sitting on the turf. For example, using this on a disk, which is in a bag, on a mob, will return the mob because it's on the turf.
get_base_areaReturns the base area the target is located in if there is one. Alternatively, returns the area as is.
get_bbox_of_atomsGet a bounding box of a list of atoms.
get_cached_actionspeed_modifierGrabs a STATIC MODIFIER datum from cache. YOU MUST NEVER EDIT THESE DATUMS, OR IT WILL AFFECT ANYTHING ELSE USING IT TOO!
get_cached_movespeed_modifierGrabs a STATIC MODIFIER datum from cache. YOU MUST NEVER EDIT THESE DATUMS, OR IT WILL AFFECT ANYTHING ELSE USING IT TOO!
get_chat_togglesGet the given client's chat toggle prefs.
get_lineGet a list of turfs in a line from starting_atom to ending_atom.
get_path_toThis file contains the stuff you need for using JPS (Jump Point Search) pathing, an alternative to A* that skips over large numbers of uninteresting tiles resulting in much quicker pathfinding solutions. Mind that diagonals cost the same as cardinal moves currently, so paths may look a bit strange, but should still be optimal.
get_rand_frequency_low_rangeget_rand_frequency but lower range.
get_ranged_target_turf_directGet ranged target turf, but with direct targets as opposed to directions
get_sub_areasReturns either null, or a list containing every sub area associated with our base area. If include_base is TRUE, the base area will also be added to the return list.
get_sub_areas_contentsSimple proc that returns a sum of all contents from every sub area, Think of the above but for all contents, not just turfs, and without target z.
get_sub_areas_turfsProc used for purposes similar to get_areas_turfs(), but aimed to include associated areas. Only accepts area instances and paths for the first arg, no text strings. Returns a list of all turfs found in the sub areas (including the base's if include_base is TRUE) and located in a z level matching target_z, or anywhere if target_z is 0
get_teleport_locReturns location. Returns null if no location was found.
get_thirstDon't blame me if they have negative thirst, admeme.
get_valid_screen_locationReturns a valid location to place a screen object without overflowing the viewport
get_vog_specialget special role multiplier for voice of god. No double dipping.
getleftblocksDNA HELPER-PROCS
give_admin_popupTries to give the target an admin popup. If it fails, will send the error to the passed admin.
give_escape_menu_detailsProvides a singleton for the escape menu details screen.
give_escape_menu_titleProvides a singleton for the escape menu details screen.
haunt_outburstTakes a given area and chance, applying the haunted_item component to objects in the area.
hull_shielding_get_tiles_around_areaHELPER FILE FOR SHIELDING Gets hull exterior adjacent tiles of a certain area Area method. EXPENSIVE. If the area itself is already considered exterior, it'll find all tiles inside it that's next to an interior area.
hull_shielding_get_tiles_in_zGets hull adjacent exterior tiles of an entire zlevel EXPENSIVE. Gets the tiles in the exterior area touching to a non-exterior area
icon2base64Converts an icon to base64. Operates by putting the icon in the iconCache savefile, exporting it as text, and then parsing the base64 from that. (This relies on byond automatically storing icons in savefiles as base64)
immerse_player"Immerse", or how I made the entire playerbase quit the game.
init_keybindingsCreates and sorts all the keybinding datums
init_language_holder_prototypesInits the global list of language holder prototypes.
is_adminReturns if the given client is an admin, REGARDLESS of if they're deadminned or not.
is_energy_reflectable_projectile//// MISC HELPERS //////// Is this atom reflectable with ""standardized"" reflection methods like you know eshields and deswords and similar
is_guest_keyReturns whether or not a player is a guest using their ckey as an input
is_type_in_UID_listIf the list L contains a datum UID who's type matches D's type, returns the UID of that datum in the list. Otherwise returns null.
isemptylist@depricated
jaro_similarityCalculate Jaro similarity between two strings.
jaro_winkler_similarityCalculate Jaro-Winkler similarity between two strings.
json_deserialize_datumConvert a list of json to datum
json_serialize_datumConvert a datum into a json blob
lightningboltthis is the actual bolt effect and damage, made into its own proc because it is used elsewhere
listgetindex@depricated
load_mapShortcut function to parse a map and apply it to the world.
locateUIDLocates a datum based off of the UID
log_combatLog a combat message in the attack log
log_suspicious_loginWrites to a special log file if the log_suspicious_login config flag is set, which is intended to contain all logins that failed under suspicious circumstances.
log_tguiAppends a tgui-related log entry. All arguments are optional.
log_woundlog_wound() is for when someone is attacked and suffers a wound. Note that this only captures wounds from damage, so smites/forced wounds aren't logged, as well as demotions like cuts scabbing over
machine_slurSlur proc for robotic humans
make_datum_references_listsInitial Building
md5asfileSave file as an external file then md5 it. Used because md5ing files stored in the rsc sometimes gives incorrect md5 results.
md5filepathReturns the md5 of a file at a given path.
message_centcomUsed by communications consoles to message CentCom
message_inteqUsed by communications consoles to message the Syndicate
message_syndicateUsed by communications consoles to message the Syndicate
message_to_htmlMessage-related procs
movespeed_data_null_checkChecks if a move speed modifier is valid and not missing any data
nuke_requestUsed by communications consoles to request the nuclear launch codes
offset_to_screen_locTakes 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 around, so it can't go out of scope
overlays2textConverts an overlay list into text for debug printing Of note: overlays aren't actually mutable appearances, they're just appearances Don't have access to that type tho, so this is the best you're gonna get
parse_caught_click_modifiersReturns a turf based on text inputs, original turf and viewing client
pick_n_takePick a random element from the list and remove it from the list.
play_fov_effectPlays a visual effect representing a sound cue for people with vision obstructed by FOV or blindness
podspawnOne proc for easy spawning of pods in the code to drop off items before whizzling (please don't proc call this in game, it will destroy you)
process_teleport_locsGenerate a list of turfs you can teleport to from the areas list
qdelShould be treated as a replacement for the 'del' keyword.
realize_appearance_queueTakes a list of appearnces, makes them mutable so they can be properly vv'd and inspected
recover_all_SS_and_recreate_masterRecreate all SSs which will still cause data survive due to Recover(), the new Master will then find and take them from global.vars
recursive_organ_check
release_gas_toReleases gas from src to output air. This means that it can not transfer air to gas mixture with higher pressure. a global proc due to rustmos
remove_image_from_clientRemoves an image from a client's .images. Useful as a callback.
remove_verbhandles removing verb and sending it to browser to update, use this for removing verbs
reset_cooldownProc used by stoppable timers to end a cooldown before the time has ran out.
return_unused_frequencyreturns a random unused frequency between MIN_FREE_FREQ & MAX_FREE_FREQ if free = TRUE, and MIN_FREQ & MAX_FREQ if FALSE
rgb_construct_color_matrixAssembles a color matrix, defaulting to identity
rgba_construct_color_matrixAssembles a color matrix, defaulting to identity
rustg_get_versionGets the version of rust_g
rustg_redis_disconnect_rqDisconnects from a previously connected redis server
rustg_unix_timestampReturns the timestamp as a string
safepick@depricated
sanitize_css_class_nameRemoves all non-alphanumerics from the text, keep in mind this can lead to id conflicts
sanitize_frequencyEnsure the frequency is within bounds of what it should be sending/receiving at
sanitize_hexcolorSanitizes a hexadecimal color. Always outputs lowercase.
sanitize_ooccolorMakes sure the input color is text with a # at the start followed by 6 hexadecimal characters. Examples: "#ff1234", "#A38321", COLOR_GREEN_GRAY
scramble_message_replace_charsSlightly expensive proc to scramble a message using equal probabilities of character replacement from a list. DOES NOT SUPPORT HTML!
screen_loc_to_offsetTakes 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) We require context to get info out of screen locs that contain relative info, so NORTH, SOUTH, etc
seedifyFinds and extracts seeds from an object
select_hallucination_typeHelper to give the passed mob the ability to select a hallucination from the list of all hallucination subtypes.
send2adminchatSends a message to TGS admin chat channels.
send2chatSends a message to TGS chat channels.
send2otherserverSends a message to a set of cross-communications-enabled servers using world topic calls
send_fax_to_areaSends a fax to a fax machine in an area! fax_area is a type, where all subtypes are also queried. If multiple machines, one is randomly picked If force is TRUE, we send a droppod with a fax machine and fax the message to that fax machine
send_supply_pod_to_areaEasily send a supplypod to an area
setup_mod_themesGlobal proc that sets up all MOD themes as singletons in a list and returns it.
single_path_typecache_immutableMakes a typecache of a single typecache
slurMakes you speak like you're drunk
starsConvert random parts of a passed in message to stars
start_unequip_mobA utility function for /datum/strippable_items to start unequipping an item from a mob.
stoplagreturns the number of ticks slept
stripped_multiline_input_or_reflectstripped_multiline_input but reflects to the user instead if it's too big and returns null.
stutterAdds stuttering to the message passed in
tgalertDEPRECATED: USE tgui_alert(...) INSTEAD
tgui_TopicMiddleware for /client/Topic.
tgui_alertCreates a TGUI alert window and returns the user's response.
tgui_alert_asyncCreates an asynchronous TGUI alert window with an associated callback.
tgui_input_checkboxes
tgui_input_listCreates a TGUI input list window and returns the user's response.
tgui_input_list_asyncCreates an asynchronous TGUI input list window with an associated callback.
tgui_input_numberCreates a TGUI window with a number input. Returns the user's response as num | null.
tgui_input_number_asyncCreates an asynchronous TGUI input num window with an associated callback.
tgui_input_textCreates a TGUI window with a text input. Returns the user's response.
tgui_input_text_asyncCreates an asynchronous TGUI input text window with an associated callback.
timeleftGet the remaining deciseconds on a timer
to_chatSends the message to the recipient (target).
to_chat_immediateCircumvents the message queue and sends the message to the recipient (target) as soon as possible.
tool_behaviour_namereturns an ic name of the tool needed Arguments:
transform_matrix_constructconstructs a transform matrix, defaulting to identity
typecacheofLike typesof() or subtypesof(), but returns a typecache instead of a list
ui_status_only_livingReturns a UI status such that the dead will be able to watch, but not interact.
ui_status_silicon_has_accessReturns a UI status such that silicons will be able to interact with whatever they would have access to if this was a machine. For example, AIs can interact if there's cameras with wireless control is enabled.
ui_status_user_has_free_handsReturns a UI status such that those without blocked hands will be able to interact, but everyone else can only watch.
ui_status_user_is_abledReturns a UI status such that users with debilitating conditions, such as being dead or not having power for silicons, will not be able to interact. Being dead will disable UI, being incapacitated will continue updating it, and anything else will make it interactive.
ui_status_user_is_adjacentReturns a UI status such that users adjacent to source will be able to interact, far away users will be able to see, and anyone farther won't see anything. Dead users will receive updates no matter what, though you likely want to add a [ui_status_only_living] check for finer observer interactions.
ui_status_user_is_advanced_tool_userReturns a UI status such that advanced tool users will be able to interact, but everyone else can only watch.
ui_status_user_is_conscious_and_lying_downReturns UI_INTERACTIVE if the user is conscious and lying down. Returns UI_UPDATE otherwise.
ui_status_user_strictly_adjacentReturn UI_INTERACTIVE if the user is strictly adjacent to the target atom, whether they can see it or not. Return UI_CLOSE otherwise.
unformat_frequencyOpposite of format, returns as a number
url2htmlloaderReturn html to load a url. for use inside of browse() calls to html assets that might be loaded on a cdn.
valid_build_directionChecks whether the target turf is in a valid state to accept a directional construction such as windows or railings.
valid_window_locationChecks whether the target turf is in a valid state to accept a directional window or other directional pseudo-dense object such as railings.
velvetspeechFermiChem
view_to_pixelsTakes a string or num view, and converts it to pixel width/height in a list(pixel_width, pixel_height)
voice_of_godVOICE OF GOD
wave_explosionCreates a wave explosion at a certain place
web_soundTakes an input from either proc/play_web_sound or the request manager and runs it through youtube-dl and prompts the user before playing it to the server.
weight_class_to_textReturns a string based on the weight class define used as argument
woundscanDisplays wounds with extended information on their status vs medscanners
zone2body_parts_coveredFor finding out what body parts a body zone covers, the inverse of the below basically

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.

SSaura

The subsystem used to tick auras (/datum/component/aura_healing and /datum/component/damage_aura).

SSdiscord

Discord Subsystem

This subsystem handles some integrations with discord

NOTES:

HOW NOTIFYING WORKS

ROUNDSTART:

  1. The file is loaded and the discord IDs are extracted
  2. A ping is sent to the discord with the IDs of people who wished to be notified
  3. The file is emptied

MIDROUND:

  1. Someone usees the notify verb, it adds their discord ID to the list.
  2. On fire, it will write that to the disk, as long as conditions above are correct

END ROUND:

  1. The file is force-saved, incase it hasn't fired at end round

This is an absolute clusterfuck, but its my clusterfuck -aa07

SSescape_menu

Subsystem for controlling anything related to the escape menu

SSmove_manager

Acts as a namespace for movement packet/type related procs

Exists to provide an in code implementation of movement looping Replaces things like walk() or walk_to(), among others

Because we're doing things in engine, we have a lot more control over how different operations are performed We also get more say in when things happen, so we can subject movements to the whims of the master controller Rather then using a fuck ton of cpu just moving mobs or meteors

The goal is to keep the loops themselves reasonably barebone, and implement more advanced behavior and control via the signals

This may be bypassed in cases where snowflakes are nessesary, or where performance is important. S not a hard and fast thing

Every atom can have a movement packet, which contains information and behavior about currently active loops, and queuing info Loops control how movement actually happens. So there's a "move in this direction" loop, a "move randomly" loop

You can find the logic for this control in this file

Specifics of how different loops operate can be found in the movement_types.dm file, alongside the add to loop helper procs that use them

SSpoints_of_interest

Subsystem for managing all POIs.

SSrunechat

Runechat Subsystem

Maintains a timer-like system to handle destruction of runechat messages. Much of this code is modeled after or adapted from the timer subsystem.

Note that this has the same structure for storing and queueing messages as the timer subsystem does for handling timers: the bucket_list is a list of chatmessage datums, each of which are the head of a circularly linked list. Any given index in bucket_list could be null, representing an empty bucket.

SStgui

tgui subsystem

Contains all tgui state and subsystem code.

SSticket_ping

Pings admins every (time chosen in config) for all open tickets/OPFOR applications

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.

Proc Details

CreateBans

DEBUG

GetJobName

Gets the job title, if the job name is an alt title, locates the original title using a prebuilt cache

HeapPathWeightCompare

TODO: Macro this to reduce proc overhead

WrapAdminProcCall

Wrapper for proccalls where the datum is flagged as vareditted

___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.

_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:

_turf_in_offset

Locating turfs

actionspeed_data_null_check

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

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:

alert_to_permissions_elevation_attempt

Sends a message in the event that someone attempts to elevate their permissions through invoking a certain proc.

announce_arrival

Send a message in common radio when a player arrives

assign_random_name

Generate a name devices

Creates a randomly generated tag or name for devices or anything really it keeps track of a special list that makes sure no name is used more than once

args:

assoc_to_keys

Turns an associative list into a flat list of keys

block_calculate_resultant_damage

Considers a block return_list and calculates damage to use from that.

callHook

@file hooks.dm Implements hooks, a simple way to run code on pre-defined events.

Calls a hook, executing every piece of code that's attached to it. @param hook Identifier of the hook to call. @returns 1 if all hooked code runs successfully, 0 otherwise.

call_emergency_meeting

Summon the crew for an emergency meeting

Teleports the crew to a specified area, and tells everyone (via an announcement) who called the meeting. Should only be used during april fools! Arguments:

callback_select

Runs a list of callbacks asyncronously, returning only when all have finished

Callbacks can be repeated, to call it multiple times

Arguments:

check_admin_pings

Checks a given message to see if any of the words contain an active admin's ckey with an @ before it

Returns nothing if no pings are found, otherwise returns an associative list with ckey -> client Also modifies msg to underline the pings, then stores them in the key ADMINSAY_PING_UNDERLINE_NAME_INDEX for returning

Arguments:

cleanup_ghosts

Gives a farewell message and deletes the ghosts produced by a ghost portal structure.

Handles cleanup of all ghost mobs spawned a ghost portal. Iterates through the list and calls qdel on its contents, gives a short message, and leaves behind some goop. Stored as a global, as it is called immediately after the portal deletes itself.

color_matrix_contrast_percent

Exxagerates or removes brightness

color_matrix_hsv

Builds a color matrix that transforms the hue, saturation, and value, all in one operation.

color_matrix_rotation

Moves all colors angle degrees around the color wheel while maintaining intensity of the color and not affecting whites TODO: Need a version that only affects one color (ie shift red to blue but leave greens and blues alone)

color_matrix_saturation_percent

Exxagerates or removes colors

create_delusion

Helper to give the passed mob the ability to create a delusion hallucination (even a custom one). Returns a list of arguments - pass these to _cause_hallucination to cause the desired hallucination

create_mafia_game

Creates the global datum for playing mafia games, destroys the last if that's required and returns the new.

create_strippable_list

Creates an assoc list of keys to /datum/strippable_item

cultslur

Makes you talk like you got cult stunned, which is slurring but with some dark messages

cut_relative_direction

Takes a screen_loc string and cut out any directions like NORTH or SOUTH

dd_file2list

Reading files

dd_hasprefix

Prefix checking

dd_hassuffix

Suffix checking

dd_replacetext

Replacing text

dd_text2list

Turning text into lists

debug_variable

Get displayed variable in VV variable list

default_ui_state

The sane defaults for a UI such as a computer or a machine.

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:

diff_appearances

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

dump_in_space

Dump a movable in a random valid spacetile

emissive_appearance

Produces a mutable appearance glued to the [EMISSIVE_PLANE] dyed to be the EMISSIVE_COLOR.

end_cooldown

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

Arguments:

This sends a signal reporting the cooldown end.

english_list_assoc

English_list but associative supporting. Higher overhead. @depricated

find_record

Returns datum/data/record

finish_unequip_mob

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

firing_squad

firing_squad is a proc for the :B:erforate smite to shoot each individual bullet at them, so that we can add actual delays without sleep() nonsense

Hilariously, if you drag someone away mid smite, the bullets will still chase after them from the original spot, possibly hitting other people. Too funny to fix imo

Arguments:

force_apc_arcing

Set all APCs to start (or stop) arcing

format_frequency

Format frequency by moving the decimal.

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_changeling_meteor

Recieves a mob candidate, transforms them into a changeling, and hurls them at the station inside of a changeling meteor

Takes a given candidate and turns them into a changeling, generates a changeling meteor, and throws it at the station. Returns the changeling generated by the event, NOT the meteor. This is so that it plays nicely with the dynamic ruleset while still being usable in the ghost_role event as well.

Arguments:

generate_icon_alpha_mask

Helper proc to generate a cutout alpha mask out of an icon.

Why is it a helper if it's so simple?

Because BYOND's documentation is hot garbage and I don't trust anyone to actually figure this out on their own without sinking countless hours into it. Yes, it's that simple, now enjoy.

But why not use filters?

Filters do not allow for masks that are not the exact same on every dir. An example of a need for that can be found in [/proc/generate_left_leg_mask()].

Arguments:

Returns an /icon that is the alpha mask of the provided icon and icon_state.

generate_selectable_species

Generates species available to choose in character setup at roundstart

This proc generates which species are available to pick from in character setup. If there are no available roundstart species, defaults to human.

get_allowed_instrument_ids

Get all non admin_only instruments.

get_atom_on_turf

Returns the top-most atom sitting on the turf. For example, using this on a disk, which is in a bag, on a mob, will return the mob because it's on the turf.

Arguments

get_base_area

Returns the base area the target is located in if there is one. Alternatively, returns the area as is.

get_bbox_of_atoms

Get a bounding box of a list of atoms.

Arguments:

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

get_cached_actionspeed_modifier

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

get_cached_movespeed_modifier

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

get_chat_toggles

Get the given client's chat toggle prefs.

Getter function for prefs.chat_toggles which guards against null client and null prefs. The client object is fickle and can go null at times, so use this instead of directly accessing the var if you want to ensure no runtimes.

returns client.prefs.chat_toggles or FALSE if something went wrong.

Arguments:

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_path_to

This file contains the stuff you need for using JPS (Jump Point Search) pathing, an alternative to A* that skips over large numbers of uninteresting tiles resulting in much quicker pathfinding solutions. Mind that diagonals cost the same as cardinal moves currently, so paths may look a bit strange, but should still be optimal.

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.

Arguments:

get_rand_frequency_low_range

get_rand_frequency but lower range.

get_ranged_target_turf_direct

Get ranged target turf, but with direct targets as opposed to directions

Starts at atom A and gets the exact angle between A and target Moves from A with that angle, Range amount of times, until it stops, bound to map size Arguments:

get_sub_areas

Returns either null, or a list containing every sub area associated with our base area. If include_base is TRUE, the base area will also be added to the return list.

get_sub_areas_contents

Simple proc that returns a sum of all contents from every sub area, Think of the above but for all contents, not just turfs, and without target z.

get_sub_areas_turfs

Proc used for purposes similar to get_areas_turfs(), but aimed to include associated areas. Only accepts area instances and paths for the first arg, no text strings. Returns a list of all turfs found in the sub areas (including the base's if include_base is TRUE) and located in a z level matching target_z, or anywhere if target_z is 0

get_teleport_loc

Returns location. Returns null if no location was found.

get_thirst

Don't blame me if they have negative thirst, admeme.

get_valid_screen_location

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

Returns a screen loc representing the valid location

get_vog_special

get special role multiplier for voice of god. No double dipping.

getleftblocks

DNA HELPER-PROCS

give_admin_popup

Tries to give the target an admin popup. If it fails, will send the error to the passed admin.

give_escape_menu_details

Provides a singleton for the escape menu details screen.

give_escape_menu_title

Provides a singleton for the escape menu details screen.

haunt_outburst

Takes a given area and chance, applying the haunted_item component to objects in the area.

Takes an epicenter, and within the range around it, runs a haunt_chance percent chance of applying the haunted_item component to nearby objects.

hull_shielding_get_tiles_around_area

HELPER FILE FOR SHIELDING Gets hull exterior adjacent tiles of a certain area Area method. EXPENSIVE. If the area itself is already considered exterior, it'll find all tiles inside it that's next to an interior area.

hull_shielding_get_tiles_in_z

Gets hull adjacent exterior tiles of an entire zlevel EXPENSIVE. Gets the tiles in the exterior area touching to a non-exterior area

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)

immerse_player

"Immerse", or how I made the entire playerbase quit the game.

init_keybindings

Creates and sorts all the keybinding datums

init_language_holder_prototypes

Inits the global list of language holder prototypes.

is_admin

Returns if the given client is an admin, REGARDLESS of if they're deadminned or not.

is_energy_reflectable_projectile

//// MISC HELPERS //////// Is this atom reflectable with ""standardized"" reflection methods like you know eshields and deswords and similar

is_guest_key

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

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.

isemptylist

@depricated

jaro_similarity

Calculate Jaro similarity between two strings.

Arguments:

Returns a number between 0 and 1, where

Reference: https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance

jaro_winkler_similarity

Calculate Jaro-Winkler similarity between two strings.

Arguments:

Returns a number between 0 and 1, where

Reference: https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance

json_deserialize_datum

Convert a list of json to datum

json_serialize_datum

Convert a datum into a json blob

lightningbolt

this is the actual bolt effect and damage, made into its own proc because it is used elsewhere

listgetindex

@depricated

load_map

Shortcut function to parse a map and apply it to the world.

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_combat

Log a combat message in the attack log

Arguments:

log_suspicious_login

Writes to a special log file if the log_suspicious_login config flag is set, which is intended to contain all logins that failed under suspicious circumstances.

Mirrors this log entry to log_access when access_log_mirror is TRUE, so this proc doesn't need to be used alongside log_access and can replace it where appropriate.

log_tgui

Appends a tgui-related log entry. All arguments are optional.

log_wound

log_wound() is for when someone is attacked and suffers a wound. Note that this only captures wounds from damage, so smites/forced wounds aren't logged, as well as demotions like cuts scabbing over

Note that this has no info on the attack that dealt the wound: information about where damage came from isn't passed to the bodypart's damaged proc. When in doubt, check the attack log for attacks at that same time TODO later: Add logging for healed wounds, though that will require some rewriting of healing code to prevent admin heals from spamming the logs. Not high priority

Arguments:

machine_slur

Slur proc for robotic humans

make_datum_references_lists

Initial Building

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_centcom

Used by communications consoles to message CentCom

message_inteq

Used by communications consoles to message the Syndicate

message_syndicate

Used by communications consoles to message the Syndicate

message_to_html

Message-related procs

Message format (/list):

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

movespeed_data_null_check

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

nuke_request

Used by communications consoles to request the nuclear launch codes

offset_to_screen_loc

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 around, so it can't go out of scope

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

parse_caught_click_modifiers

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

pick_n_take

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

play_fov_effect

Plays a visual effect representing a sound cue for people with vision obstructed by FOV or blindness

podspawn

One proc for easy spawning of pods in the code to drop off items before whizzling (please don't proc call this in game, it will destroy you)

Arguments:

process_teleport_locs

Generate a list of turfs you can teleport to from the areas list

Includes areas if they're not a shuttle or not not teleport or have no contents

The chosen turf is the first item in the areas contents that is a station level

The returned list of turfs is sorted by name

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.

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_organ_check

release_gas_to

Releases gas from src to output air. This means that it can not transfer air to gas mixture with higher pressure. a global proc due to rustmos

remove_image_from_client

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

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:

reset_cooldown

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

Arguments:

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

return_unused_frequency

returns a random unused frequency between MIN_FREE_FREQ & MAX_FREE_FREQ if free = TRUE, and MIN_FREQ & MAX_FREQ if FALSE

rgb_construct_color_matrix

Assembles a color matrix, defaulting to identity

rgba_construct_color_matrix

Assembles a color matrix, defaulting to identity

rustg_get_version

Gets the version of rust_g

rustg_redis_disconnect_rq

Disconnects from a previously connected redis server

rustg_unix_timestamp

Returns the timestamp as a string

safepick

@depricated

sanitize_css_class_name

Removes all non-alphanumerics from the text, keep in mind this can lead to id conflicts

sanitize_frequency

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

sanitize_hexcolor

Sanitizes a hexadecimal color. Always outputs lowercase.

@params

sanitize_ooccolor

Makes sure the input color is text with a # at the start followed by 6 hexadecimal characters. Examples: "#ff1234", "#A38321", COLOR_GREEN_GRAY

scramble_message_replace_chars

Slightly expensive proc to scramble a message using equal probabilities of character replacement from a list. DOES NOT SUPPORT HTML!

screen_loc_to_offset

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) We require context to get info out of screen locs that contain relative info, so NORTH, SOUTH, etc

seedify

Finds and extracts seeds from an object

Checks if the object is such that creates a seed when extracted. Used by seed extractors or posably anything that would create seeds in some way. The seeds are dropped either at the extractor, if it exists, or where the original object was and it qdel's the object

Arguments:

select_hallucination_type

Helper to give the passed mob the ability to select a hallucination from the list of all hallucination subtypes.

send2adminchat

Sends a message to TGS admin chat channels.

category - The category of the mssage. message - The message to send.

send2chat

Sends a message to TGS chat channels.

message - The message to send. channel_tag - Required. If "", the message with be sent to all connected (Game-type for TGS3) channels. Otherwise, it will be sent to TGS4 channels with that tag (Delimited by ','s). admin_only - Determines if this communication can only be sent to admin only channels.

send2otherserver

Sends a message to a set of cross-communications-enabled servers using world topic calls

Arguments:

send_fax_to_area

Sends a fax to a fax machine in an area! fax_area is a type, where all subtypes are also queried. If multiple machines, one is randomly picked If force is TRUE, we send a droppod with a fax machine and fax the message to that fax machine

send_supply_pod_to_area

Easily send a supplypod to an area

setup_mod_themes

Global proc that sets up all MOD themes as singletons in a list and returns it.

single_path_typecache_immutable

Makes a typecache of a single typecache

Obviously in BYOND we don't have the efficiency around here to have proper enforcement so If you use this you better know what you're doing. The list you get back is globally cached and if it's modified, you might break multiple things.

slur

Makes you speak like you're drunk

stars

Convert random parts of a passed in message to stars

This proc is dangerously laggy, avoid it or die

start_unequip_mob

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

stoplag

returns the number of ticks slept

stripped_multiline_input_or_reflect

stripped_multiline_input but reflects to the user instead if it's too big and returns null.

stutter

Adds stuttering to the message passed in

tgalert

DEPRECATED: USE tgui_alert(...) INSTEAD

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

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:

tgui_alert_async

Creates an asynchronous TGUI alert window with an associated callback.

This proc should be used to create alerts that invoke a callback with the user's chosen option. Arguments:

tgui_input_checkboxes

tgui_input_checkbox

Opens a window with a list of checkboxes and returns a list of selected choices.

user - The mob to display the window to message - The message inside the window title - The title of the window list/items - The list of items to display min_checked - The minimum number of checkboxes that must be checked (defaults to 1) max_checked - The maximum number of checkboxes that can be checked (optional) timeout - The timeout for the input (optional)

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:

tgui_input_list_async

Creates an asynchronous TGUI input list window with an associated callback.

This proc should be used to create inputs that invoke a callback with the user's chosen option. Arguments:

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:

tgui_input_number_async

Creates an asynchronous TGUI input num window with an associated callback.

This proc should be used to create inputs that invoke a callback with the user's chosen option. Arguments:

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:

tgui_input_text_async

Creates an asynchronous TGUI input text window with an associated callback.

This proc should be used to create inputs that invoke a callback with the user's chosen option. Arguments:

timeleft

Get the remaining deciseconds on a timer

Arguments:

to_chat

Sends the message to the recipient (target).

Recommended way to write to_chat calls:

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

to_chat_immediate

Circumvents the message queue and sends the message to the recipient (target) as soon as possible.

tool_behaviour_name

returns an ic name of the tool needed Arguments:

transform_matrix_construct

constructs a transform matrix, defaulting to identity

typecacheof

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

ui_status_only_living

Returns a UI status such that the dead will be able to watch, but not interact.

ui_status_silicon_has_access

Returns a UI status such that silicons will be able to interact with whatever they would have access to if this was a machine. For example, AIs can interact if there's cameras with wireless control is enabled.

ui_status_user_has_free_hands

Returns a UI status such that those without blocked hands will be able to interact, but everyone else can only watch.

ui_status_user_is_abled

Returns a UI status such that users with debilitating conditions, such as being dead or not having power for silicons, will not be able to interact. Being dead will disable UI, being incapacitated will continue updating it, and anything else will make it interactive.

ui_status_user_is_adjacent

Returns a UI status such that users adjacent to source will be able to interact, far away users will be able to see, and anyone farther won't see anything. Dead users will receive updates no matter what, though you likely want to add a [ui_status_only_living] check for finer observer interactions.

ui_status_user_is_advanced_tool_user

Returns a UI status such that advanced tool users will be able to interact, but everyone else can only watch.

ui_status_user_is_conscious_and_lying_down

Returns UI_INTERACTIVE if the user is conscious and lying down. Returns UI_UPDATE otherwise.

ui_status_user_strictly_adjacent

Return UI_INTERACTIVE if the user is strictly adjacent to the target atom, whether they can see it or not. Return UI_CLOSE otherwise.

unformat_frequency

Opposite of format, returns as a number

url2htmlloader

Return html to load a url. for use inside of browse() calls to html assets that might be loaded on a cdn.

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:

valid_window_location

Checks whether the target turf is in a valid state to accept a directional window or other directional pseudo-dense object such as railings.

Returns FALSE if the target turf cannot accept a directional window or railing. Returns TRUE otherwise.

Arguments:

velvetspeech

FermiChem

view_to_pixels

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

voice_of_god

VOICE OF GOD

wave_explosion

Creates a wave explosion at a certain place

web_sound

Takes an input from either proc/play_web_sound or the request manager and runs it through youtube-dl and prompts the user before playing it to the server.

weight_class_to_text

Returns a string based on the weight class define used as argument

woundscan

Displays wounds with extended information on their status vs medscanners

zone2body_parts_covered

For finding out what body parts a body zone covers, the inverse of the below basically