(global)
Vars | |
Failsafe | Failsafe |
---|---|
Master | StonedMC |
SSautomatedfire | |
SSescape_menu | Subsystem for controlling anything related to the escape menu |
SSinfluxdriver | Sends collected statistics to an influxdb v2 backend periodically |
SSinfluxstats | Sends generic round running statistics to the InfluxDB backend |
SSminimaps | |
SSpager_status | Updates BYOND pager status periodically |
SStgui | tgui subsystem |
SStimer | |
Procs | |
CreateBans | DEBUG |
GUID | returns a GUID like identifier (using a mostly made up record format) guids are not on their own suitable for access or security tokens, as most of their bits are predictable. (But may make a nice salt to one) |
Get_Angle | Calculate the angle between two atoms. Uses north-clockwise convention: NORTH = 0, EAST = 90, etc. |
HandleUserlessProcCall | Handles a userless proccall, used by circuits. |
HandleUserlessSDQL | Handles a userless sdql, used by TGS. |
TurfBlockedNonWindow | the actual dir between the start and target turf The direction that mover's path is being blocked by |
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. |
______qdel_list_wrapper | the underscores are to encourage people not to use this directly. |
_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. |
_animate_filter | Auxtools REALLY doesn't know how to handle filters as values; when passed as arguments to auxtools-called procs, they aren't simply treated as nulls - they don't even count towards the length of args. For example, calling some_proc([a filter], foo, bar) from auxtools is equivalent to calling some_proc(foo, bar). Thus, we can't use _animate directly on filters. Use this to perform animation steps on a filter. Consecutive steps on the same filter can be achieved by calling _animate with no target. |
_pick_list | Allow me to explain for some reason, if pick() is passed arglist(args) directly and args contains only one list it considers it to be a list of lists this means something like _pick(list) would fail need to do this instead |
add_keybinding | Adds an instanced keybinding to the global tracker |
add_verb | handles adding verbs and updating the stat panel browser |
admin_ticket_log | Use this proc when an admin takes action that may be related to an open ticket on what what can be a client, ckey, or mob player_message: If the message should be shown in the player ticket panel, fill this out log_in_blackbox: Whether or not this message with the blackbox system. If disabled, this message should be logged with a different proc call |
anyprob | chances are 1:value. anyprob(1) will always return true |
at_least | Takes a value, and a threshold it has to at least match returns the correctly signed value max'd to the threshold |
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 |
big_number_to_text | Formats a larger number to correct textual representation without losing data |
bit_count | counts the number of bits in Byond's 16-bit width field, in constant time and memory! |
bitfield_to_list | Converts a bitfield to a list of numbers (or words if a wordlist is provided) |
capitalize_first_letters | Finds the first letter of each word in the provided string and capitalize them |
center_image | Center's an image. Requires: The Image The x dimension of the icon file used in the image The y dimension of the icon file used in the image eg: center_image(image_to_center, 32,32) eg2: center_image(image_to_center, 96,96) |
check_asay_links | Checks a given message to see if any of the words are something we want to treat specially, as detailed below. |
cmp_mob_deathtime_asc | Compares mobs based on their timeofdeath value in ascending order |
cmp_obs_larvaqueuetime_asc | Compares observers based on their larva_queue_time value in ascending order Assumes the client on the observer is not null |
color_matrix_from_string | Converts a hex color string to a color matrix. |
color_matrix_recolor_red | Creates a matrix to re-paint a sprite, replacing shades of red with corresponding shades of a new color. In the base sprite, Hue must always be pure red. Saturation and Lightness can be anything. Arg is a hex string for a color. Proc is by Lummox JR, www.byond.com/forum/post/2209545 color_matrix_recolor_rgb is more complex, but gives more precise control over the palette, at least if using 3 or fewer colours. |
color_matrix_recolor_rgb | Creates a matrix to re-paint a sprite, replacing pure red, green, and blue with 3 different shades. Doesn't work with mixed tones of RGB or whites or greys -- must be pure. R/G/B 255 becomes the new color, darker shades become correspondingly darker. The arg is a list of hex colours, for ex "list("#d4c218", "#b929f7", "#339933"". if you want variations of the same color, color_matrix_recolor_red() is simpler. |
create_strippable_list | Creates an assoc list of keys to /datum/strippable_item |
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. Uses north-clockwise convention: NORTH = 0, EAST = 90, etc. |
deltimer | Delete a timer |
display_power | Format a power value in W, kW, MW, or GW. |
doview | Version of oview() which ignores darkness |
dview | Version of view() which ignores darkness, because BYOND doesn't have it (I actually suggested it but it was tagged redundant, BUT HEARERS IS A T- /rant). |
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. |
end_cooldown | Callback called by a timer to end an associative-list-indexed cooldown. |
extend_line_to_radius | gets a line from a x and y, to the offset x and y of length radius |
flick_overlay_to_clients | Add an image to a list of clients and calls a proc to remove it after a duration |
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_lazy_template_map | Iterates through all lazy template datums that exist and returns a list of them as an associative list of type -> instance. |
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_alien_candidates | Get a list of observers that can be alien candidates. |
get_all_notes | Returns all notes associated with a CKEY, structured as a list of strings. |
get_bbox_of_atoms | Get a bounding box of a list of atoms. |
get_cardinal_dir | Returns the nearest cardinal dir between two atoms. Favors NORTH/SOUTH on perfect diagonals. Consistent and reversible. |
get_ceiling_protection_level | Convert a turf protection level to a ceiling protection level |
get_icon_dmi_path | given an icon object, dmi file path, or atom/image/mutable_appearance, attempts to find and return an associated dmi file path. a weird quirk about dm is that /icon objects represent both compile-time or dynamic icons in the rsc, but stringifying rsc references returns a dmi file path ONLY if that icon represents a completely unchanged dmi file from when the game was compiled. so if the given object is associated with an icon that was in the rsc when the game was compiled, this returns a path. otherwise it returns "" |
get_line | Get a list of turfs in a line from start_atom to end_atom . |
get_minimap_flag_for_faction | Gets the MINIMAP_FLAG for the provided faction or hivenumber if one exists |
get_pixel_position_x | Gives X position on pixel grid of an object, accounting for offsets |
get_pixel_position_y | Gives Y position on pixel grid of an object, accounting for offsets |
get_player_is_alt | Returns either a list containing the primary CKEYs this alt is connected to, or FALSE. |
get_radios_in_view | only gets FUNCTIONING radios |
get_related_directions | Given a direction, return the direction and the +-45 degree directions next to it |
get_specialist_set | Get a specialist set datum typepath given a mob, returns null if they aren't a spec or haven't chosen a kit. |
get_tacmap_data_png | Fetches the datum containing an announced flattend map png reference. |
get_tacmap_data_svg | Fetches the last set of svg coordinates for the tacmap drawing. |
get_total_living_playtime | Returns the total time in minutes a specific player ID has played for |
get_turf_on_clickcatcher | Helper proc that processes a clicked target, if the target is not black tiles, it will not change it. If they are it will return the turf of the black tiles. It will return null if the object is a screen object other than black tiles. |
get_unannounced_tacmap_data_png | Fetches the datum containing the latest unannounced flattend map png reference. |
get_whitelisted_roles | returns a list of strings containing the whitelists held by a specific ckey |
getpois | Returns a list of all items of interest with their name |
give_action | Gives an action to a mob and returns it |
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. |
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: |
icon_exists | Checks if the given iconstate exists in the given file, caching the result. Setting scream to TRUE will print a stack trace ONCE. |
init_keybindings | Creates and sorts all the keybinding datums |
initiate_surgery_moment | Does the surgery initiation. Returns TRUE if the triggering attack should be halted. |
is_path_in_list | Checks if the needle path derives from any in the path_list |
is_type_in_list | Checks if the needle atom is any type in the type_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 |
lisp_replace | Replaces S and similar sounds with 'th' and such. Stolen from tg. |
list_clear_nulls | Removes any null entries from the list Returns TRUE if the list had nulls, FALSE otherwise |
load_map | Helper and recommened way to load a map file |
log_mapping | Logging for mapping errors |
log_perf | Logging for game performance |
log_tgui | Appends a tgui-related log entry. All arguments are optional. |
make_tuple | Returns the name of the mathematical tuple of same length as the number arg (rounded down). |
map_pill_icons | Pills. |
md5asfile | Save file as an external file then md5 it. Used because md5ing files stored in the rsc sometimes gives incorrect md5 results. |
mergeListsSum | Sums values in two associative lists, from mergee into result, in place |
message_alien_candidates | Messages observers that are currently candidates an update on the queue. |
message_to_html | Message-related procs |
mutable_appearance | Helper similar to image() |
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. 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. |
playsound_area | Plays sound to all mobs that are map-level contents of an area |
playsound_z | Play sound for all on-map clients on a given Z-level. Good for ambient sounds. |
qdel | Should be treated as a replacement for the 'del' keyword. |
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_holder_check | Will attempt to find what's holding this item if it's being contained by something, ie if it's in a satchel held by a human, this'll return the human |
remove_image_from_client | Removes an image from a client's .images . Useful as a callback. |
remove_images_from_clients | Like remove_image_from_client, but will remove the image from a list of clients |
remove_verb | handles removing verb and sending it to browser to update, use this for removing verbs |
replace_non_alphanumeric_plus | Helper for only alphanumeric characters plus common punctuation, spaces, underscore and hyphen _ -. |
resend_current_map_png | Re-sends relevant flattened tacmaps to a single client. |
reset_cooldown | Proc used by stoppable timers to end a cooldown before the time has ran out. |
return_generator_args | returns the arguments given to a generator and manually extracts them from the internal byond object returns: |
reverse_range | replaces reverseList ~Carnie |
send2adminchat | Sends a message to TGS admin chat channels. |
send2chat | Asynchronously sends a message to TGS chat channels. |
setup_hazard_joe_emotes | Setup for Hazard joe emotes and category list, returns data for hj_emotes |
setup_offset | Sets the offset 2 lines above. |
setup_upp_joe_emotes | Setup for Hazard joe emotes and category list, returns data for uppj_emotes |
setup_working_joe_emotes | Setup for Working joe emotes and category list, returns data for wj_emotes |
shakeship | Shakes the ship around |
should_block_game_interaction | Returns TRUE if the target is somewhere that the game should not interact with if possible In this case, admin Zs and tutorial areas |
show_blurb | *Shows a ticker reading out the given text on a client's screen. targets = mob or list of mobs to show it to. |
show_blurb_uscm | Shows operation start blurb to living marines. Slightly different for squad marines, pilots, and deploying ship crew/passengers. exempt_ztraits = trait or list of traits of zlevels where any marines don't see the message, ex. marine faction survivors colonyside shouldn't see the ship marines' drop message. Ex. ZTRAIT_GROUND by default. unit = the unit the marines are from. FF, Dust Raiders etc. Military crew see this. base = the base the marines are staging from. The ship, Whiskey Outpost etc. Noncombat crew see this. |
show_location_blurb | Reads out a description of game time, game date, main ship and current area. Originally for displaying roundstart messages on a conventional SS13 server. |
shuffle_inplace | same as shuffle, but returns nothing and acts on list in place |
sort_list | sort any value in a list |
sort_list_dist | Returns a list of atoms sorted by each entry's distance to target . |
stars_decode_html | Summary: proc that parses an html input string and scrambles the non-html string contents. |
string_list | Caches lists with non-numeric stringify-able values (text or typepath). |
string_starts_with | Check if the string haystack begins with the string needle . |
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_color_picker | Creates a TGUI color picker window and returns the user's response. |
tgui_color_picker_async | Creates an asynchronous TGUI color picker window with an associated callback. |
tgui_input_checkboxes | |
tgui_input_checkboxes_async | |
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. |
tgui_input_number | Creates a TGUI window with a number input. Returns the user's response as num | null. |
tgui_input_number_async | Creates an asynchronous TGUI number input window with an associated callback. |
tgui_input_real_number | A clone of tgui_input_number that defaults to accepting negative inputs too. |
tgui_input_text | Creates a TGUI window with a text input. Returns the user's response. |
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. |
ui_status_only_living | Returns a UI status such that the dead will be able to watch, but not interact. |
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_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. |
unique_list | Return a list with no duplicate entries |
unique_list_in_place | same as unique_list, but returns nothing and acts on list in place (also handles associated values properly) |
updatetimedelay | Update the delay on an existing LOOPING timer Will come into effect on the next process |
url2htmlloader | Return html to load a url. for use inside of browse() calls to html assets that might be loaded on a cdn. |
worldtime2text | Returns the world time in english. Do not use to get date information - starts at 0 + a random time offset from 10 minutes to 24 hours. |
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
SSautomatedfire
Maintains a timer-like system to handle autofiring. Much of this code is modeled after or adapted from TGMC's runechat subsytem.
Note that this has the same structure for storing and queueing shooter component as the timer subsystem does for handling timers: the bucket_list is a list of autofire component, each of which are the head of a linked list. Any given index in bucket_list could be null, representing an empty bucket.
Doesn't support any event scheduled for more than 100 ticks in the future, as it has no secondary queue by design
SSescape_menu
Subsystem for controlling anything related to the escape menu
SSinfluxdriver
Sends collected statistics to an influxdb v2 backend periodically
SSinfluxstats
Sends generic round running statistics to the InfluxDB backend
SSminimaps
Handles updating and handling of the by-zlevel minimaps
Minimaps are a low priority subsystem that fires relatively often the Initialize proc for this subsystem draws the maps as one of the last initializing subsystems
Fire() for this subsystem doesn't actually update anything, and purely just reapplies the overlays that it already tracks actual updating of marker locations is handled by [/datum/controller/subsystem/minimaps/proc/on_move] and zlevel changes are handled in /datum/controller/subsystem/minimaps/proc/on_z_change tracking of the actual atoms you want to be drawn on is done by means of datums holding info pertaining to them with /datum/hud_displays
SSpager_status
Updates BYOND pager status periodically
SStgui
tgui subsystem
Contains all tgui state and subsystem code.
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.
Proc Details
CreateBans
DEBUG
GUID
returns a GUID like identifier (using a mostly made up record format) guids are not on their own suitable for access or security tokens, as most of their bits are predictable. (But may make a nice salt to one)
Get_Angle
Calculate the angle between two atoms. Uses north-clockwise convention: NORTH = 0, EAST = 90, etc.
HandleUserlessProcCall
Handles a userless proccall, used by circuits.
Arguments:
- user - a string used to identify the user
- target - the target to proccall on
- proc - the proc to call
- arguments - any arguments
HandleUserlessSDQL
Handles a userless sdql, used by TGS.
Arguments:
- user - a string used to identify the user
- query_text - the query text
TurfBlockedNonWindow
the actual dir between the start and target turf The direction that mover's path is being blocked by
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.
______qdel_list_wrapper
the underscores are to encourage people not to use this directly.
_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
_animate_filter
Auxtools REALLY doesn't know how to handle filters as values; when passed as arguments to auxtools-called procs, they aren't simply treated as nulls - they don't even count towards the length of args. For example, calling some_proc([a filter], foo, bar) from auxtools is equivalent to calling some_proc(foo, bar). Thus, we can't use _animate directly on filters. Use this to perform animation steps on a filter. Consecutive steps on the same filter can be achieved by calling _animate with no target.
_pick_list
Allow me to explain for some reason, if pick() is passed arglist(args) directly and args contains only one list it considers it to be a list of lists this means something like _pick(list) would fail need to do this instead
I hate this timeline
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
admin_ticket_log
Use this proc when an admin takes action that may be related to an open ticket on what what can be a client, ckey, or mob player_message: If the message should be shown in the player ticket panel, fill this out log_in_blackbox: Whether or not this message with the blackbox system. If disabled, this message should be logged with a different proc call
anyprob
chances are 1:value. anyprob(1) will always return true
at_least
Takes a value, and a threshold it has to at least match returns the correctly signed value max'd to the threshold
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
big_number_to_text
Formats a larger number to correct textual representation without losing data
bit_count
counts the number of bits in Byond's 16-bit width field, in constant time and memory!
bitfield_to_list
Converts a bitfield to a list of numbers (or words if a wordlist is provided)
capitalize_first_letters
Finds the first letter of each word in the provided string and capitalize them
center_image
Center's an image. Requires: The Image The x dimension of the icon file used in the image The y dimension of the icon file used in the image eg: center_image(image_to_center, 32,32) eg2: center_image(image_to_center, 96,96)
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
cmp_mob_deathtime_asc
Compares mobs based on their timeofdeath value in ascending order
cmp_obs_larvaqueuetime_asc
Compares observers based on their larva_queue_time value in ascending order Assumes the client on the observer is not null
color_matrix_from_string
Converts a hex color string to a color matrix.
color_matrix_recolor_red
Creates a matrix to re-paint a sprite, replacing shades of red with corresponding shades of a new color. In the base sprite, Hue must always be pure red. Saturation and Lightness can be anything. Arg is a hex string for a color. Proc is by Lummox JR, www.byond.com/forum/post/2209545 color_matrix_recolor_rgb is more complex, but gives more precise control over the palette, at least if using 3 or fewer colours.
color_matrix_recolor_rgb
Creates a matrix to re-paint a sprite, replacing pure red, green, and blue with 3 different shades. Doesn't work with mixed tones of RGB or whites or greys -- must be pure. R/G/B 255 becomes the new color, darker shades become correspondingly darker. The arg is a list of hex colours, for ex "list("#d4c218", "#b929f7", "#339933"". if you want variations of the same color, color_matrix_recolor_red() is simpler.
create_strippable_list
Creates an assoc list of keys to /datum/strippable_item
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. Uses north-clockwise convention: NORTH = 0, EAST = 90, etc.
deltimer
Delete a timer
Arguments:
- id a timerid or a /datum/timedevent
display_power
Format a power value in W, kW, MW, or GW.
doview
Version of oview() which ignores darkness
dview
Version of view() which ignores darkness, because BYOND doesn't have it (I actually suggested it but it was tagged redundant, BUT HEARERS IS A T- /rant).
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.
end_cooldown
Callback called by a timer to end an associative-list-indexed cooldown.
Arguments:
- source - datum storing the cooldown
- index - string index storing the cooldown on the cooldowns associative list
This sends a signal reporting the cooldown end.
extend_line_to_radius
gets a line from a x and y, to the offset x and y of length radius
flick_overlay_to_clients
Add an image to a list of clients and calls a proc to remove it after a duration
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_lazy_template_map
Iterates through all lazy template datums that exist and returns a list of them as an associative list of type -> instance.
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. appearance_flags indicates whether appearance_flags should be respected (at the cost of about 10-20% perf)
get_active_player_count
Get active players who are playing in the round
get_alien_candidates
Get a list of observers that can be alien candidates.
Arguments:
- hive - The hive we're filling a slot for to check if the player is banished
- sorted - Whether to sort by larva_queue_time (default TRUE) or leave unsorted
- abomination - Whether the potential larva is for an abomination
get_all_notes
Returns all notes associated with a CKEY, structured as a list of strings.
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_cardinal_dir
Returns the nearest cardinal dir between two atoms. Favors NORTH/SOUTH on perfect diagonals. Consistent and reversible.
get_ceiling_protection_level
Convert a turf protection level to a ceiling protection level
get_icon_dmi_path
given an icon object, dmi file path, or atom/image/mutable_appearance, attempts to find and return an associated dmi file path. a weird quirk about dm is that /icon objects represent both compile-time or dynamic icons in the rsc, but stringifying rsc references returns a dmi file path ONLY if that icon represents a completely unchanged dmi file from when the game was compiled. so if the given object is associated with an icon that was in the rsc when the game was compiled, this returns a path. otherwise it returns ""
get_line
Get a list of turfs in a line from start_atom
to end_atom
.
Based on a linear interpolation method from Red Blob Games.
Arguments:
- start_atom - starting point of the line
- end_atom - ending point of the line
- include_start_atom - when truthy includes start_atom in the list, default TRUE
Returns: list - turfs from start_atom (in/exclusive) to end_atom (inclusive)
get_minimap_flag_for_faction
Gets the MINIMAP_FLAG for the provided faction or hivenumber if one exists
get_pixel_position_x
Gives X position on pixel grid of an object, accounting for offsets
get_pixel_position_y
Gives Y position on pixel grid of an object, accounting for offsets
get_player_is_alt
Returns either a list containing the primary CKEYs this alt is connected to, or FALSE.
get_radios_in_view
only gets FUNCTIONING radios
get_related_directions
Given a direction, return the direction and the +-45 degree directions next to it
get_specialist_set
Get a specialist set datum typepath given a mob, returns null if they aren't a spec or haven't chosen a kit.
get_tacmap_data_png
Fetches the datum containing an announced flattend map png reference.
Arguments:
- faction: FACTION_MARINE or XENO_HIVE_NORMAL
get_tacmap_data_svg
Fetches the last set of svg coordinates for the tacmap drawing.
Arguments:
- faction: which faction get the map for: FACTION_MARINE or XENO_HIVE_NORMAL
get_total_living_playtime
Returns the total time in minutes a specific player ID has played for
get_turf_on_clickcatcher
Helper proc that processes a clicked target, if the target is not black tiles, it will not change it. If they are it will return the turf of the black tiles. It will return null if the object is a screen object other than black tiles.
get_unannounced_tacmap_data_png
Fetches the datum containing the latest unannounced flattend map png reference.
Arguments:
- faction: FACTION_MARINE or XENO_HIVE_NORMAL
get_whitelisted_roles
returns a list of strings containing the whitelists held by a specific ckey
getpois
Returns a list of all items of interest with their name
give_action
Gives an action to a mob and returns it
If mob already has the action, unhide it if it's hidden
Can pass additional initialization args
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.
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
- keyonly - if TRUE, only returns the asset key to use get_asset_url manually. Overrides sourceonly.
icon_exists
Checks if the given iconstate exists in the given file, caching the result. Setting scream to TRUE will print a stack trace ONCE.
init_keybindings
Creates and sorts all the keybinding datums
initiate_surgery_moment
Does the surgery initiation. Returns TRUE if the triggering attack should be halted.
is_path_in_list
Checks if the needle path derives from any in the path_list
is_type_in_list
Checks if the needle atom is any type in the type_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
lisp_replace
Replaces S and similar sounds with 'th' and such. Stolen from tg.
list_clear_nulls
Removes any null entries from the list Returns TRUE if the list had nulls, FALSE otherwise
load_map
Helper and recommened way to load a map file
- dmm_file: The path to the map file
- x_offset: The x offset to load the map at
- y_offset: The y offset to load the map at
- z_offset: The z offset to load the map at
- crop_map: If true, the map will be cropped to the world bounds
- measure_only: If true, the map will not be loaded, but the bounds will be calculated
- no_changeturf: If true, the map will not call /turf/AfterChange
- x_lower: The minimum x coordinate to load
- x_upper: The maximum x coordinate to load
- y_lower: The minimum y coordinate to load
- y_upper: The maximum y coordinate to load
- z_lower: The minimum z coordinate to load
- z_upper: The maximum z coordinate to load
- place_on_top: Whether to use /turf/proc/PlaceOnTop rather than /turf/proc/ChangeTurf
- new_z: If true, a new z level will be created for the map
- delete: CM/TGMC addition, if we need to manually clear turf contents before spawning stuff
log_mapping
Logging for mapping errors
log_perf
Logging for game performance
log_tgui
Appends a tgui-related log entry. All arguments are optional.
make_tuple
Returns the name of the mathematical tuple of same length as the number arg (rounded down).
map_pill_icons
Pills.
Returns a list mapping pill icon classes to icon states
md5asfile
Save file as an external file then md5 it. Used because md5ing files stored in the rsc sometimes gives incorrect md5 results.
mergeListsSum
Sums values in two associative lists, from mergee into result, in place
message_alien_candidates
Messages observers that are currently candidates an update on the queue.
Arguments:
- candidates - The list of observers from get_alien_candidates()
- dequeued - How many candidates to skip messaging because they were dequeued
- cache_only - Whether to not actually send a to_chat message and instead only update larva_queue_cached_message
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
mutable_appearance
Helper similar to image()
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. 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.
playsound_area
Plays sound to all mobs that are map-level contents of an area
playsound_z
Play sound for all on-map clients on a given Z-level. Good for ambient sounds.
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.
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_holder_check
Will attempt to find what's holding this item if it's being contained by something, ie if it's in a satchel held by a human, this'll return the human
remove_image_from_client
Removes an image from a client's .images
. Useful as a callback.
remove_images_from_clients
Like remove_image_from_client, but will remove the image from a list of clients
remove_verb
handles removing verb and sending it to browser to update, use this for removing verbs
pass the verb type path to this instead of removing it from verbs so the statpanel can update Arguments:
- target - Who the verb is being removed from, client or mob typepath
- verb - typepath to a verb, or a list of verbs, supports lists of lists
replace_non_alphanumeric_plus
Helper for only alphanumeric characters plus common punctuation, spaces, underscore and hyphen _ -.
resend_current_map_png
Re-sends relevant flattened tacmaps to a single client.
Arguments:
- user: The mob that is either an observer, marine, or xeno
reset_cooldown
Proc used by stoppable timers to end a cooldown before the time has ran out.
Arguments:
- source - datum storing the cooldown
- index - string index storing the cooldown on the cooldowns associative list
This sends a signal reporting the cooldown end, passing the time left as an argument.
return_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
reverse_range
replaces reverseList ~Carnie
send2adminchat
Sends a message to TGS admin chat channels.
category - The category of the mssage. message - The message to send.
send2chat
Asynchronously sends a message to TGS chat channels.
message - The /datum/tgs_message_content 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.
setup_hazard_joe_emotes
Setup for Hazard joe emotes and category list, returns data for hj_emotes
setup_offset
Sets the offset 2 lines above.
setup_upp_joe_emotes
Setup for Hazard joe emotes and category list, returns data for uppj_emotes
setup_working_joe_emotes
Setup for Working joe emotes and category list, returns data for wj_emotes
shakeship
Shakes the ship around
Shakes the ship around and has the ship make sounds because of it, including warning klaxons it it's a big hit despite being in /almayer, this thing should work in any shipmap. Arguments:
- sstrength - How hard the camera shakes, and how hard the rocking on the ship is
- stime - For how long the camera shakes
- drop - If the shaking can make people fall, or be thrown away if sstrength is above 7
- osound - not included in the admin verb! Can be set to FALSE if you don't want it's original sounds to play in case you want something different
should_block_game_interaction
Returns TRUE if the target is somewhere that the game should not interact with if possible In this case, admin Zs and tutorial areas
show_blurb
*Shows a ticker reading out the given text on a client's screen. targets = mob or list of mobs to show it to.
duration = how long it lingers after it finishes ticking.
message = the message to display. Due to using maptext it isn't very flexible format-wise. 11px font, up to 480 pixels per line. Use \n for line breaks. Single-character HTML tags (, , etc.) are handled correctly but others display strangely. Note that maptext can display text macros in strange ways, ex. \improper showing as "ÿ". Lines containing only spaces, including ones only containing "\improper ", don't display.
scroll_down = by default each line pushes the previous line upwards - this tells it to start high and scroll down. Ticks on \n - does not autodetect line breaks in long strings.
screen_position = screen loc for the bottom-left corner of the blurb.
text_alignment = "right", "left", or "center"
text_color = color of the text.
blurb_key = a key used for specific blurb types so they are not shown repeatedly. Ex. someone who joins as CLF repeatedly only seeing the mission blurb the first time.
ignore_key = used to skip key checks. Ex. a USCM ERT member shouldn't see the normal USCM drop message, but should see their own spawn message even if the player already dropped as USCM.*
show_blurb_uscm
Shows operation start blurb to living marines. Slightly different for squad marines, pilots, and deploying ship crew/passengers. exempt_ztraits = trait or list of traits of zlevels where any marines don't see the message, ex. marine faction survivors colonyside shouldn't see the ship marines' drop message. Ex. ZTRAIT_GROUND by default. unit = the unit the marines are from. FF, Dust Raiders etc. Military crew see this. base = the base the marines are staging from. The ship, Whiskey Outpost etc. Noncombat crew see this.
show_location_blurb
Reads out a description of game time, game date, main ship and current area. Originally for displaying roundstart messages on a conventional SS13 server.
shuffle_inplace
same as shuffle, but returns nothing and acts on list in place
sort_list
sort any value in a list
sort_list_dist
Returns a list of atoms sorted by each entry's distance to target
.
stars_decode_html
Summary: proc that parses an html input string and scrambles the non-html string contents.
Arguments:
- message - an html string value to be parsed and modified.
Return: returns the parsed and modified html output with the text content being partially scrambled with asteriks
string_list
Caches lists with non-numeric stringify-able values (text or typepath).
string_starts_with
Check if the string haystack
begins with the string needle
.
tgui_Topic
Middleware for /client/Topic.
return bool If TRUE, prevents propagation of the topic call.
tgui_alert
Creates a TGUI alert window and returns the user's response.
This proc should be used to create alerts that the caller will wait for a response from. Arguments:
- user - The user to show the alert to.
- message - The content of the alert, shown in the body of the TGUI window.
- title - The of the alert modal, shown on the top of the TGUI window.
- buttons - The options that can be chosen by the user, each string is assigned a button on the UI.
- timeout - The timeout of the alert, after which the modal will close and qdel itself. Set to zero for no timeout.
- autofocus - The bool that controls if this alert should grab window focus.
- ui_state - The TGUI UI state that will be returned in ui_state(). Default: always_state
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.
- autofocus - The bool that controls if this alert should grab window focus.
- ui_state - The TGUI UI state that will be returned in ui_state(). Default: always_state
tgui_color_picker
Creates a TGUI color picker window and returns the user's response.
This proc should be used to create a color picker that the caller will wait for a response from. Arguments:
- user - The user to show the picker to.
- title - The of the picker modal, shown on the top of the TGUI window.
- timeout - The timeout of the picker, after which the modal will close and qdel itself. Set to zero for no timeout.
- autofocus - The bool that controls if this picker should grab window focus.
tgui_color_picker_async
Creates an asynchronous TGUI color picker window with an associated callback.
This proc should be used to create a color picker that invokes a callback with the user's chosen option. Arguments:
- user - The user to show the picker to.
- title - The of the picker modal, shown on the top of the TGUI window.
- callback - The callback to be invoked when a choice is made.
- timeout - The timeout of the picker, after which the modal will close and qdel itself. Set to zero for no timeout.
- autofocus - The bool that controls if this picker should grab window focus.
tgui_input_checkboxes
Opens a window with a list of checkboxes and returns a list of selected choices.
- Arguments:
- 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)
- theme - The ui theme to use for the TGUI window (optional).
- ui_state - The TGUI UI state that will be returned in ui_state(). Default: always_state
tgui_input_checkboxes_async
Opens a window with a list of checkboxes and returns a list of selected choices.
- Arguments:
- 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)
- callback - The callback to be invoked when a choice is made.
- timeout - The timeout for the input (optional)
- theme - The ui theme to use for the TGUI window (optional).
- ui_state - The TGUI UI state that will be returned in ui_state(). Default: always_state
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 list input, 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 list input will close and qdel itself. Set to zero for no timeout.
- theme - The ui theme to use for the TGUI window.
- default - If an option is already preselected on the UI. Current values, etc.
- ui_state - The TGUI UI state that will be returned in ui_state(). Default: always_state
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 list input, 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 list_input will close and qdel itself. Set to zero for no timeout.
- theme - The ui theme to use for the TGUI window.
- default - If an option is already preselected on the UI. Current values, etc.
- ui_state - The TGUI UI state that will be returned in ui_state(). Default: always_state
tgui_input_number
Creates a TGUI window with a number input. Returns the user's response as num | null.
This proc should be used to create windows for number entry that the caller will wait for a response from. If tgui fancy chat is turned off: Will return a normal input. If a max or min value is specified, will validate the input inside the UI and ui_act.
Arguments:
- user - The user to show the number input to.
- message - The content of the number input, shown in the body of the TGUI window.
- title - The title of the number input modal, shown on the top of the TGUI window.
- default - The default (or current) value, shown as a placeholder. Users can press refresh with this.
- max_value - Specifies a maximum value. If none is set, any number can be entered. Pressing "max" defaults to 1000.
- min_value - Specifies a minimum value. Often 0.
- timeout - The timeout of the number input, after which the modal will close and qdel itself. Set to zero for no timeout.
- integer_only - whether the inputted number is rounded down into an integer.
- ui_state - The TGUI UI state that will be returned in ui_state(). Default: always_state
tgui_input_number_async
Creates an asynchronous TGUI number input window with an associated callback.
This proc should be used to create number inputs that invoke a callback with the user's entry.
Arguments:
- user - The user to show the number input to.
- message - The content of the number input, shown in the body of the TGUI window.
- title - The title of the number input modal, shown on the top of the TGUI window.
- default - The default (or current) value, shown as a placeholder. Users can press refresh with this.
- max_value - Specifies a maximum value. If none is set, any number can be entered. Pressing "max" defaults to 1000.
- min_value - Specifies a minimum value. Often 0.
- callback - The callback to be invoked when a choice is made.
- timeout - The timeout of the number input, after which the modal will close and qdel itself. Set to zero for no timeout.
- integer_only - whether the inputted number is rounded down into an integer.
- ui_state - The TGUI UI state that will be returned in ui_state(). Default: always_state
tgui_input_real_number
A clone of tgui_input_number that defaults to accepting negative inputs too.
tgui_input_text
Creates a TGUI window with a text input. Returns the user's response.
This proc should be used to create windows for text entry that the caller will wait for a response from. If tgui fancy chat is turned off: Will return a normal input. If max_length is specified, will return stripped_multiline_input.
Arguments:
- user - The user to show the text input to.
- message - The content of the text input, shown in the body of the TGUI window.
- title - The title of the text input modal, shown on the top of the TGUI window.
- default - The default (or current) value, shown as a placeholder.
- max_length - Specifies a max length for input. MAX_MESSAGE_LEN is default (1024)
- multiline - Bool that determines if the input box is much larger. Good for large messages, laws, etc.
- encode - Toggling this determines if input is filtered via html_encode. Setting this to FALSE gives raw input.
- timeout - The timeout of the textbox, after which the modal will close and qdel itself. Set to zero for no timeout.
- trim - Whether or not to trim leading and trailing whitespace from your input. Defaults to TRUE
- ui_state - The TGUI UI state that will be returned in ui_state(). Default: always_state
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.
ui_status_only_living
Returns a UI status such that the dead will be able to watch, but not interact.
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_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.
unique_list
Return a list with no duplicate entries
unique_list_in_place
same as unique_list, but returns nothing and acts on list in place (also handles associated values properly)
updatetimedelay
Update the delay on an existing LOOPING timer Will come into effect on the next process
Arguments:
- id a timerid or a /datum/timedevent
- new_wait the new wait to give this looping timer
url2htmlloader
Return html to load a url. for use inside of browse() calls to html assets that might be loaded on a cdn.
worldtime2text
Returns the world time in english. Do not use to get date information - starts at 0 + a random time offset from 10 minutes to 24 hours.