(global)
Vars | |
Debugger | StonedMC |
---|---|
Failsafe | Failsafe |
SSambience | The subsystem used to play ambience to users every now and then, makes them real excited. |
SSdiscord | |
SSlag_switch | The subsystem for controlling drastic performance enhancements aimed at reducing server load for a smoother albeit slightly duller gaming experience |
SSmaterials | Because we add an implicit 1 for the coordinate calcuations. |
SSmouse_entered | Defers MouseEntered inputs to only apply to the most recently hovered over atom in the tick |
SSmovablephysics | Real fast ticking subsystem for moving movables via modifying pixel_x/y/z |
SSpoints_of_interest | Subsystem for managing all POIs. |
SSrunechat | |
SSspeech_controller | verb_manager subsystem just for handling say's |
SStgui | tgui subsystem |
SStime_track | The reference to the end of round sound that we have chosen. |
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. |
Procs | |
Gibberish | Turn text into complete gibberish! |
REF | \ref behaviour got changed in 512 so this is necesary to replicate old behaviour. If it ever becomes necesary to get a more performant REF(), this lies here in wait #define REF(thing) (thing && isdatum(thing) && (thing:datum_flags & DF_USE_TAG) && thing:tag ? "[thing:tag]" : text_ref(thing)) |
WEAKREF | Creates a weakref to the given input. See /datum/weakref's documentation for more information. |
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. |
_alert_drones | Broadcast a message to all drones in a faction |
_auxtools_register_gas | For registering gases, do not touch this. |
_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. |
above_neck | Would this zone be above the neck |
active_free_borgs | Silicon Mob Procs |
add_keybinding | Adds an instanced keybinding to the global tracker |
add_verb | handles adding verbs and updating the stat panel browser |
allocate_nameid | Make new sequential number for this id_tag or reuse one of the free ones |
anonymous_ai_name | anonymous_ai_name: generates a corporate random name (but for sillycones). used in admin event tool anonymous names |
anonymous_name | anonymous_name: generates a corporate random name. used in admin event tool anonymous names |
auxtools_atmos_init | Registers gases, and get reaction infos for auxmos, only call when ssair is initing. |
baseturfs_string_list | A wrapper for baseturf string lists, to offer support of non list values, and a stack_trace if we have major issues |
bitfield_to_list | Converts a bitfield to a list of numbers (or words if a wordlist is provided) |
callback_select | Runs a list of callbacks asyncronously, returning only when all have finished |
check_asay_links | Checks a given message to see if any of the words are something we want to treat specially, as detailed below. |
check_zone | Convert a PRECISE ZONE into the BODY_ZONE |
circle_range_turfs | Returns a list of turfs around a center based on RANGE_TURFS() |
circle_view_turfs | Returns a list of turfs around a center based on view() |
collect_fish_properties | Awful workaround around initial(x.list_variable) not being a thing while trying to keep some semblance of being structured |
color_to_full_rgba_matrix | Converts RGB shorthands into RGBA matrices complete of constants rows (ergo a 20 keys list in byond). |
colorize_string | Gets a color for a name, will return the same color for a given string consistently within a round.atom |
completed_bounty_count | Subtype Gens |
considered_exiled | Exiled check |
cultslur | Makes you talk like you got cult stunned, which is slurring but with some dark messages |
deallocate_nameid | Free the previously used sequential number for vent/scrubber so it can be used again |
debug_variable | Get displayed variable in VV variable list |
delete_all_SS_and_recreate_master | Delete all existing SS to basically start over |
deltimer | Delete a timer |
derpspeech | Convert a message to derpy speak |
emissive_appearance | Produces a mutable appearance glued to the [EMISSIVE_PLANE] dyed to be the EMISSIVE_COLOR. |
emissive_blocker | Produces a mutable appearance glued to the [EMISSIVE_PLANE] dyed to be the EM_BLOCK_COLOR. |
equalize_all_gases_in_list | Args: (list). Takes every gas in the list and makes them all identical, scaled to their respective volumes. The total heat and amount of substance in all of the combined gases is conserved. |
expand_weights | Takes a weighted list (see above) and expands it into raw entries This eats more memory, but saves time when actually picking from it |
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.) |
finalize_gas_refs | For updating reagent gas fire products, do not use for now. |
find_record | Returns datum/data/record |
findname | Find if the message has the real name of any user mob in the mob_list |
flop_animation | This animation should be applied to actual parent atom instead of vc_object. |
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_autowiki_output | When the AUTOWIKI define is enabled, will generate an output file for tools/autowiki/autowiki.js to consume.
Autowiki code intentionally still exists even without the define, to ensure developers notice
when they break it immediately, rather than until CI or worse, call time.
Returns a string of the autowiki output file |
generate_bitfields | Turns /datum/bitfield subtypes into a list for use in debugging |
generate_icon_alpha_mask | Helper proc to generate a cutout alpha mask out of an icon. |
generate_selectable_species | Generates species available to choose in character setup at roundstart |
getFlatIcon | Create a single /icon from a given /atom or /image. |
get_active_player_count | Get active players who are playing in the round |
get_adjacent_open_turfs | Returns a list with all the adjacent open turfs. |
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_area_turfs | Returns a list of all turfs in the provided area instance. |
get_areatype_turfs | Returns a list of all turfs in ALL areas of that type in the world. |
get_bbox_of_atoms | Get a bounding box of a list of atoms. |
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_hearers_in_view | Returns a list of hearers in view(view_radius) from source (ignoring luminosity). recursively checks contents for hearers |
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_nested_locs | Returns a list of all locations (except the area) the movable is within. |
get_number_decal | Returns a subtype of /obj/effect/turf_decal/number according to the arguments num and shift_mode. |
get_path_by_slot | Returns a generic path of the object based on the slot |
get_powernet_info_from_source | Extracts the powernet and cell of the provided power source |
get_ranged_target_turf_direct | Get ranged target turf, but with direct targets as opposed to directions |
get_temp_change_amount | Used to get the amount of change between two body temperatures |
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. |
goonchem_vortex | Simulates a vortex that moves nearby movable atoms towards or away from the turf T. Range also determines the strength of the effect. High values cause nearby objects to be thrown. |
greatest_common_factor | Takes a list of numbers as input, returns the highest value that is cleanly divides them all Note: this implementation is expensive as heck for large numbers, I only use it because most of my usecase Is < 10 ints |
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 | the dmi file path we attempt to return if the given object argument is associated with a stringifiable icon if successful, this looks like "icons/path/to/dmi_file.dmi" but they pass both isicon() and isfile() checks. theyre the easiest case since stringifying them gives us the path we want 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: |
init_fishing_configurations | These are shared between their spots |
init_keybindings | Creates and sorts all the keybinding datums |
isAdminGhostAI | Is the passed in mob an admin ghost WITH AI INTERACT enabled |
isAdminObserver | Is the passed in mob a ghost with admin powers, doesn't check for AI interact like isAdminGhost() used to |
is_ctf_target | hey uhhh don't hit anyone behind them |
is_special_character | Is this mob special to the gamemode? |
is_type_in_list | Checks for specific types in a 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 |
iso_timestamp | Returns the time in an ISO-8601 friendly format. Used when dumping data into external services such as ElasticSearch |
item_heal_robotic | Heal a robotic body part on a mob |
json_deserialize_datum | Convert a list of json to datum |
json_serialize_datum | Convert a datum into a json blob |
lizard_name | NAMEOF that actually works in static definitions because src::type requires src to be defined |
load_map | Shortcut function to parse a map and apply it to the world. |
load_poll_data | Loads all current and future server polls and their options to store both as datums. |
log_combat | Log a combat message in the attack log |
log_directed_talk | Helper for logging of messages with only one sender and receiver |
log_tgui | Appends a tgui-related log entry. All arguments are optional. |
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_syndicate | Used by communications consoles to message the Syndicate |
message_to_html | Message-related procs |
movespeed_data_null_check | Checks if a move speed modifier is valid and not missing any data |
notice | not an error or a warning, but worth to mention on the world log, just in case. |
notify_ghosts | Fancy notifications for ghosts |
nuke_request | Used by communications consoles to request the nuclear launch codes |
offer_control | Offer control of the passed in mob to dead player |
pick_n_take | Pick a random element from the list and remove it from the list. |
pick_weight | Picks a random element from a list based on a weighting system: |
pick_weight_allow_zero | Picks a random element from a list based on a weighting system. 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. You should only pass integers in. |
pick_weight_recursive | Like pick_weight, but allowing for nested lists. |
populate_editable_sign_types | This proc populates GLOBAL_LIST_EMPTY(editable_sign_types) |
populate_gear_list | Create a list of gear datums to sort |
portalAnnounce | Should point to a central mapzone.weather_controller, one doesn't exist in shiptest |
process_atmos_callbacks | Args: (ms). Runs callbacks until time limit is reached. If time limit is omitted, runs all callbacks. |
process_teleport_locs | Generate a list of turfs you can teleport to from the areas list |
propagate_network | remove the old powernet and replace it with a new one throughout the network. |
qdel | Should be treated as a replacement for the 'del' keyword. |
ran_zone | Return the zone or randomly, another valid zone |
random_fish_type | Returns random fish, using random_case_rarity probabilities. |
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 | |
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 |
return_generator_args | returns the arguments given to a generator and manually extracts them from the internal byond object returns: |
rustg_get_version | Gets the version of rust_g |
rustg_unix_timestamp | Returns the timestamp as a string |
sanitize_css_class_name | Removes all non-alphanumerics from the text, keep in mind this can lead to id conflicts |
sanitize_name | returns nothing with an alert instead of the message if it contains something in the ic filter, and sanitizes normally if the name is fine. It returns nothing so it backs out of the input the same way as if you had entered nothing. |
scramble_message_replace_chars | Slightly expensive proc to scramble a message using equal probabilities of character replacement from a list. DOES NOT SUPPORT HTML! |
seedify | Finds and extracts seeds from an object |
send2adminchat | Sends a message to TGS admin chat channels. |
send2chat | Sends a message to TGS chat channels. |
send2otherserver | Sends a message to a set of cross-communications-enabled servers using world topic calls |
setup_mod_themes | Global proc that sets up all MOD themes as singletons in a list and returns it. |
shake_camera | Shake the camera of the person viewing the mob SO REAL! |
should_have_space_before_emote | Returns a boolean based on whether or not the string contains a comma or an apostrophe, to be used for emotes to decide whether or not to have a space between the name of the user and the emote. |
slur | Makes you speak like you're drunk |
stars | Convert random parts of a passed in message to stars |
string_list | Caches lists with non-numeric stringify-able values (text or typepath). |
stutter | Adds stuttering to the message passed in |
techweb_item_boost_check | Returns an associative list of techweb node datums with values of the boost it gives. var/list/returned = list() |
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_alert_async | Creates an asynchronous TGUI alert window with an associated callback. |
tgui_input_list | Creates a TGUI input list window and returns the user's response. |
tgui_input_list_async | Creates an asynchronous TGUI input list window with an associated callback. |
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. |
truncate | Truncate a string to the given length |
turf_peel | Behaves like the orange() proc, but only looks in the outer range of the function (The "peel" of the orange). Credit to ArcaneMusic for this one |
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_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. |
url2htmlloader | Return html to load a url. for use inside of browse() calls to html assets that might be loaded on a cdn. |
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. |
voice_of_god | VOICE OF GOD |
warning | Print a warning message to world.log |
Var Details
Debugger
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
Failsafe
Failsafe
Pretty much pokes the MC to make sure it's still alive.
SSambience
The subsystem used to play ambience to users every now and then, makes them real excited.
SSdiscord
This subsystem handles some integrations with discord
NOTES:
- There is a DB table to track ckeys and associated discord IDs. (discord_link)
- This system REQUIRES TGS for notifying users at end of the round
- The SS uses fire() instead of just pure shutdown, so people can be notified if it comes back after a crash, where the SS wasn't properly shutdown
- It only writes to the disk every 5 minutes, and it won't write to disk if the file is the same as it was the last time it was written. This is to save on disk writes
- The system is kept per-server (EG: Terry will not notify people who pressed notify on Sybil), but the accounts are between servers so you dont have to relink on each server.
- The file is loaded and the discord IDs are extracted
- A ping is sent to the discord with the IDs of people who wished to be notified
- The file is emptied
- Someone usees the notify verb, it adds their discord ID to the list.
- On fire, it will write that to the disk, as long as conditions above are correct
- The file is force-saved, incase it hasn't fired at end round
This is an absolute clusterfuck, but its my clusterfuck -aa07
SSlag_switch
The subsystem for controlling drastic performance enhancements aimed at reducing server load for a smoother albeit slightly duller gaming experience
SSmaterials
Because we add an implicit 1 for the coordinate calcuations.
SSmouse_entered
Defers MouseEntered inputs to only apply to the most recently hovered over atom in the tick
SSmovablephysics
Real fast ticking subsystem for moving movables via modifying pixel_x/y/z
SSpoints_of_interest
Subsystem for managing all POIs.
SSrunechat
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.
SSspeech_controller
verb_manager subsystem just for handling say's
SStgui
tgui subsystem
Contains all tgui state and subsystem code.
SStime_track
The reference to the end of round sound that we have chosen.
SStimer
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 doubly-linked lists. The object at a given index in bucket_list is a /datum/timedevent, the head of a list, which has prev and next references for the respective elements in that bucket's 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.
Proc Details
Gibberish
Turn text into complete gibberish!
text is the inputted message, replace_characters will cause original letters to be replaced and chance are the odds that a character gets modified.
REF
\ref behaviour got changed in 512 so this is necesary to replicate old behaviour. If it ever becomes necesary to get a more performant REF(), this lies here in wait #define REF(thing) (thing && isdatum(thing) && (thing:datum_flags & DF_USE_TAG) && thing:tag ? "[thing:tag]" : text_ref(thing))
WEAKREF
Creates a weakref to the given input. See /datum/weakref's documentation for more information.
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:
- 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
_alert_drones
Broadcast a message to all drones in a faction
Arguments:
- msg - The message to send
- dead_can_hear - Boolean that determines if ghosts can hear the message (
FALSE
by default) - source - /atom source that created the message
- faction_checked_mob - /mob/living to determine faction matches from
- exact_faction_match - Passed to /mob/proc/faction_check_mob
_auxtools_register_gas
For registering gases, do not touch this.
_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.
above_neck
Would this zone be above the neck
active_free_borgs
Silicon Mob Procs
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
allocate_nameid
Make new sequential number for this id_tag or reuse one of the free ones
anonymous_ai_name
anonymous_ai_name: generates a corporate random name (but for sillycones). used in admin event tool anonymous names
first letter is always a letter Example name = "Employee Assistant Assuming Delta" Arguments:
- is_ai - boolean to decide whether the name has "Core" (AI) or "Assistant" (Cyborg)
anonymous_name
anonymous_name: generates a corporate random name. used in admin event tool anonymous names
first letter is always a letter Example name = "Employee Q5460Z" Arguments:
- M - mob for preferences and gender
auxtools_atmos_init
Registers gases, and get reaction infos for auxmos, only call when ssair is initing.
baseturfs_string_list
A wrapper for baseturf string lists, to offer support of non list values, and a stack_trace if we have major issues
bitfield_to_list
Converts a bitfield to a list of numbers (or words if a wordlist is provided)
callback_select
Runs a list of callbacks asyncronously, returning only when all have finished
Callbacks can be repeated, to call it multiple times
Arguments:
- list/callbacks the list of callbacks to be called
- list/callback_args the list of lists of arguments to pass into each callback
- savereturns Optionally save and return the list of returned values from each of the callbacks
- resolution The number of byond ticks between each time you check if all callbacks are complete
check_asay_links
Checks a given message to see if any of the words are something we want to treat specially, as detailed below.
There are 3 cases where a word is something we want to act on
- Admin pings, like @adminckey. Pings the admin in question, text is not clickable
- Datum refs, like @0x2001169 or @mob_23. Clicking on the link opens up the VV for that datum
- Ticket refs, like #3. Displays the status and ahelper in the link, clicking on it brings up the ticket panel for it. Returns a list being used as a tuple. Index ASAY_LINK_NEW_MESSAGE_INDEX contains the new message text (with clickable links and such) while index ASAY_LINK_PINGED_ADMINS_INDEX contains a list of pinged admin clients, if there are any.
Arguments:
- msg - the message being scanned
check_zone
Convert a PRECISE ZONE into the BODY_ZONE
circle_range_turfs
Returns a list of turfs around a center based on RANGE_TURFS()
circle_view_turfs
Returns a list of turfs around a center based on view()
collect_fish_properties
Awful workaround around initial(x.list_variable) not being a thing while trying to keep some semblance of being structured
color_to_full_rgba_matrix
Converts RGB shorthands into RGBA matrices complete of constants rows (ergo a 20 keys list in byond).
colorize_string
Gets a color for a name, will return the same color for a given string consistently within a round.atom
Note that this proc aims to produce pastel-ish colors using the HSL colorspace. These seem to be favorable for displaying on the map.
Arguments:
- name - The name to generate a color for
- sat_shift - A value between 0 and 1 that will be multiplied against the saturation
- lum_shift - A value between 0 and 1 that will be multiplied against the luminescence
completed_bounty_count
Subtype Gens
Strict Type Gens
Dynamic Gens
Cutoff for Non-Low Priority Bounties
Low Priority Gens
considered_exiled
Exiled check
Checks if the current body of the mind has an exile implant and is currently in an away mission. Returns FALSE if any of those conditions aren't met.
cultslur
Makes you talk like you got cult stunned, which is slurring but with some dark messages
deallocate_nameid
Free the previously used sequential number for vent/scrubber so it can be used again
debug_variable
Get displayed variable in VV variable list
delete_all_SS_and_recreate_master
Delete all existing SS to basically start over
deltimer
Delete a timer
Arguments:
- id a timerid or a /datum/timedevent
derpspeech
Convert a message to derpy speak
emissive_appearance
Produces a mutable appearance glued to the [EMISSIVE_PLANE] dyed to be the EMISSIVE_COLOR.
emissive_blocker
Produces a mutable appearance glued to the [EMISSIVE_PLANE] dyed to be the EM_BLOCK_COLOR.
equalize_all_gases_in_list
Args: (list). Takes every gas in the list and makes them all identical, scaled to their respective volumes. The total heat and amount of substance in all of the combined gases is conserved.
expand_weights
Takes a weighted list (see above) and expands it into raw entries This eats more memory, but saves time when actually picking from it
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.)
finalize_gas_refs
For updating reagent gas fire products, do not use for now.
find_record
Returns datum/data/record
findname
Find if the message has the real name of any user mob in the mob_list
flop_animation
This animation should be applied to actual parent atom instead of vc_object.
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_autowiki_output
When the AUTOWIKI
define is enabled, will generate an output file for tools/autowiki/autowiki.js to consume.
Autowiki code intentionally still exists even without the define, to ensure developers notice
when they break it immediately, rather than until CI or worse, call time.
Returns a string of the autowiki output file
generate_bitfields
Turns /datum/bitfield subtypes into a list for use in debugging
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:
- icon_to_mask - The icon file you want to generate an alpha mask out of.
- icon_state_to_mask - The specific icon_state you want to generate an alpha mask out of.
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.
getFlatIcon
Create a single /icon from a given /atom or /image.
Very low-performance. Should usually only be used for HTML, where BYOND's appearance system (overlays/underlays, etc.) is not available.
Only the first argument is required.
get_active_player_count
Get active players who are playing in the round
get_adjacent_open_turfs
Returns a list with all the adjacent open turfs.
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_area_turfs
Returns a list of all turfs in the provided area instance.
Arguments:
- A - The area to get all the turfs from
get_areatype_turfs
Returns a list of all turfs in ALL areas of that type in the world.
Arguments:
- areatype - The type of area to search for as a text string or typepath or instance
- target_z - The z level to search for areas on
- subtypes - Whether or not areas of a subtype type are included in the results
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_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_hearers_in_view
Returns a list of hearers in view(view_radius) from source (ignoring luminosity). recursively checks contents for hearers
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_nested_locs
Returns a list of all locations (except the area) the movable is within.
get_number_decal
Returns a subtype of /obj/effect/turf_decal/number according to the arguments num and shift_mode.
num - must be an integer in [0, 9] and determines the number displayed by the returned decal type. shift_mode - must be NONE, EAST, or WEST:
- If NONE is passed, the returned decal will be centered.
- If EAST is passed, the returned decal will be shifted to the right.
- If WEST is passed, the returned decal will be shifted to the left.
get_path_by_slot
Returns a generic path of the object based on the slot
get_powernet_info_from_source
Extracts the powernet and cell of the provided power source
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:
- A - Initial Firer / Position
- target - Target to aim towards
- range - Distance of returned target turf from A
- offset - Angle offset, 180 input would make the returned target turf be in the opposite direction
get_temp_change_amount
Used to get the amount of change between two body temperatures
When passed the difference between two temperatures returns the amount of change to temperature to apply. The change rate should be kept at a low value tween 0.16 and 0.02 for optimal results. vars:
- temp_diff (required) The differance between two temperatures
- change_rate (optional)(Default: 0.06) The rate of range multiplyer
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.
goonchem_vortex
Simulates a vortex that moves nearby movable atoms towards or away from the turf T. Range also determines the strength of the effect. High values cause nearby objects to be thrown.
greatest_common_factor
Takes a list of numbers as input, returns the highest value that is cleanly divides them all Note: this implementation is expensive as heck for large numbers, I only use it because most of my usecase Is < 10 ints
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
the dmi file path we attempt to return if the given object argument is associated with a stringifiable icon if successful, this looks like "icons/path/to/dmi_file.dmi" but they pass both isicon() and isfile() checks. theyre the easiest case since stringifying them gives us the path we want 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
init_fishing_configurations
These are shared between their spots
init_keybindings
Creates and sorts all the keybinding datums
isAdminGhostAI
Is the passed in mob an admin ghost WITH AI INTERACT enabled
isAdminObserver
Is the passed in mob a ghost with admin powers, doesn't check for AI interact like isAdminGhost() used to
is_ctf_target
hey uhhh don't hit anyone behind them
is_special_character
Is this mob special to the gamemode?
returns 1 for special characters and 2 for heroes of gamemode
is_type_in_list
Checks for specific types in a list.
If using zebra mode the list should be an assoc list with truthy/falsey values. The check short circuits so earlier entries in the input list will take priority. Ergo, subtypes should come before parent types. Notice that this is the opposite priority of [/proc/typecacheof].
Arguments:
- type_to_check: An instance to check.
- list_to_check: A list of typepaths to check the type_to_check against.
- zebra: Whether to use the value of the matching type in the list instead of just returning true when a match is found.
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
iso_timestamp
Returns the time in an ISO-8601 friendly format. Used when dumping data into external services such as ElasticSearch
item_heal_robotic
Heal a robotic body part on a mob
json_deserialize_datum
Convert a list of json to datum
json_serialize_datum
Convert a datum into a json blob
lizard_name
NAMEOF that actually works in static definitions because src::type requires src to be defined
load_map
Shortcut function to parse a map and apply it to the world.
dmm_file
: A .dmm file to load (Required).x_offset
,y_offset
,z_offset
: Positions representign where to load the map (Optional).cropMap
: When true, the map will be cropped to fit the existing world dimensions (Optional).measureOnly
: When true, no changes will be made to the world (Optional).no_changeturf
: When true, turf/AfterChange won't be called on loaded turfsx_lower
,x_upper
,y_lower
,y_upper
: Coordinates (relative to the map) to crop to (Optional).placeOnTop
: Whether to use turf/PlaceOnTop rather than turf/ChangeTurf (Optional).
load_poll_data
Loads all current and future server polls and their options to store both as datums.
log_combat
Log a combat message in the attack log
Arguments:
- atom/user - argument is the actor performing the action
- atom/target - argument is the target of the action
- what_done - is a verb describing the action (e.g. punched, throwed, kicked, etc.)
- atom/object - is a tool with which the action was made (usually an item)
- addition - is any additional text, which will be appended to the rest of the log line
log_directed_talk
Helper for logging of messages with only one sender and receiver
log_tgui
Appends a tgui-related log entry. All arguments are optional.
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_syndicate
Used by communications consoles to message the Syndicate
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
movespeed_data_null_check
Checks if a move speed modifier is valid and not missing any data
notice
not an error or a warning, but worth to mention on the world log, just in case.
notify_ghosts
Fancy notifications for ghosts
The kitchen sink of notification procs
Arguments:
- message
- ghost_sound sound to play
- enter_link Href link to enter the ghost role being notified for
- source The source of the notification
- alert_overlay The alert overlay to show in the alert message
- action What action to take upon the ghost interacting with the notification, defaults to NOTIFY_JUMP
- flashwindow Flash the byond client window
- ignore_key Ignore keys if they're in the GLOB.poll_ignore list
- header The header of the notifiaction
- notify_volume How loud the sound should be to spook the user
nuke_request
Used by communications consoles to request the nuclear launch codes
offer_control
Offer control of the passed in mob to dead player
Automatic logging and uses pollCandidatesForMob, how convenient
pick_n_take
Pick a random element from the list and remove it from the list.
pick_weight
Picks a random element from a list based on a weighting system:
- Adds up the total of weights for each element
- Gets a number between 1 and that total
- For each element in the list, subtracts its weighting from that number
- If that makes the number 0 or less, return that element. Will output null sometimes if you use decimals (e.g. 0.1 instead of 10) as rand() uses integers, not floats
pick_weight_allow_zero
Picks a random element from a list based on a weighting system. 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. You should only pass integers in.
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)
populate_editable_sign_types
This proc populates GLOBAL_LIST_EMPTY(editable_sign_types)
The first time a pen is used on any sign, this populates GLOBAL_LIST_EMPTY(editable_sign_types), creating a global list of all the signs that you can set a sign backing to with a pen.
populate_gear_list
Create a list of gear datums to sort
portalAnnounce
Should point to a central mapzone.weather_controller, one doesn't exist in shiptest
process_atmos_callbacks
Args: (ms). Runs callbacks until time limit is reached. If time limit is omitted, runs all callbacks.
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
propagate_network
remove the old powernet and replace it with a new one throughout the network.
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.
ran_zone
Return the zone or randomly, another valid zone
probability controls the chance it chooses the passed in zone, or another random zone defaults to 80
random_fish_type
Returns random fish, using random_case_rarity probabilities.
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
- recursive_organ_check
- inputs: O (object to start with)
- outputs:
- description: A pseudo-recursive loop based off of the recursive mob check, this check looks for any organs held
-
within 'O', toggling their frozen flag. This check excludes items held within other safe organ
-
storage units, so that only the lowest level of container dictates whether we do or don't decompose
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:
- 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
return_generator_args
returns the arguments given to a generator and manually extracts them from the internal byond object returns:
- flat list of strings for args given to the generator.
- Note: this means things like "list(1,2,3)" will need to be processed
rustg_get_version
Gets the version of rust_g
rustg_unix_timestamp
Returns the timestamp as a string
sanitize_css_class_name
Removes all non-alphanumerics from the text, keep in mind this can lead to id conflicts
sanitize_name
returns nothing with an alert instead of the message if it contains something in the ic filter, and sanitizes normally if the name is fine. It returns nothing so it backs out of the input the same way as if you had entered nothing.
scramble_message_replace_chars
Slightly expensive proc to scramble a message using equal probabilities of character replacement from a list. DOES NOT SUPPORT HTML!
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:
- O - Object containing the seed, can be the loc of the dumping of seeds
- t_max - Amount of seed copies to dump, -1 is ranomized
- l_user - If true, sets the location to drop under the user rather than the extractor
- d_item - If true, deletes the item after the proc is done
- extractor - Seed Extractor, used as the dumping loc for the seeds and seed multiplier
- user - Checks if we can remove the object from the inventory
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).
send2otherserver
Sends a message to a set of cross-communications-enabled servers using world topic calls
Arguments:
- source - Who sent this message
- msg - The message body
- type - The type of message, becomes the topic command under the hood
- target_servers - A collection of servers to send the message to, defined in config
- additional_data - An (optional) associated list of extra parameters and data to send with this world topic call
setup_mod_themes
Global proc that sets up all MOD themes as singletons in a list and returns it.
shake_camera
Shake the camera of the person viewing the mob SO REAL!
should_have_space_before_emote
Returns a boolean based on whether or not the string contains a comma or an apostrophe, to be used for emotes to decide whether or not to have a space between the name of the user and the emote.
Requires the message to be HTML decoded beforehand. Not doing it here for performance reasons.
Returns TRUE if there should be a space, FALSE if there shouldn't.
slur
Makes you speak like you're drunk
stars
Convert random parts of a passed in message to stars
- phrase - the string to convert
- probability - probability any character gets changed
This proc is dangerously laggy, avoid it or die
string_list
Caches lists with non-numeric stringify-able values (text or typepath).
stutter
Adds stuttering to the message passed in
techweb_item_boost_check
Returns an associative list of techweb node datums with values of the boost it gives. var/list/returned = list()
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.
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:
- 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.
- callback - The callback to be invoked when a choice is made.
- timeout - The timeout of the alert, after which the modal will close and qdel itself. Set to zero for no timeout.
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.
- buttons - The options that can be chosen by the user, each string is assigned a button on the UI.
- timeout - The timeout of the input box, after which the input box will close and qdel itself. Set to zero for no timeout.
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:
- 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.
- buttons - The options that can be chosen by the user, each string is assigned a button on the UI.
- callback - The callback to be invoked when a choice is made.
- timeout - The timeout of the input box, after which the menu will close and qdel itself. Set to zero for no timeout.
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,
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.
truncate
Truncate a string to the given length
Will only truncate if the string is larger than the length and ignores unicode concerns
This exists soley because trim does other stuff too.
Arguments:
- text - String
- max_length - integer length to truncate at
turf_peel
Behaves like the orange() proc, but only looks in the outer range of the function (The "peel" of the orange). Credit to ArcaneMusic for this one
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_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.
url2htmlloader
Return html to load a url. for use inside of browse() calls to html assets that might be loaded on a cdn.
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:
- dest_turf - The destination turf to check for existing windows and railings
- test_dir - The prospective dir of some atom you'd like to put on this turf.
- is_fulltile - Whether the thing you're attempting to move to this turf takes up the entire tile or whether it supports multiple movable atoms on its tile.
voice_of_god
VOICE OF GOD
warning
Print a warning message to world.log