/(global)
Vars | |
ATOM_ICON_CACHE_ALL | SSoverlays. Target both normal and protected overlay caches. |
---|---|
ATOM_ICON_CACHE_NORMAL | SSoverlays. Target the normal overlay cache. |
ATOM_ICON_CACHE_PROTECTED | SSoverlays. Target the protected overlay cache. |
CHAMELEON_FLEXIBLE_OPTIONS_EXTENSION | Grants the full set of chameleon selection options available to the extension. |
CHAMELEON_FLEXIBLE_OPTIONS_PARENT_TYPE | Grants a (potential) subset of chameleon options available to the extension, based on the instance's parent_type . Falls back to type if not a valid type for the extension. |
CHAMELEON_FLEXIBLE_OPTIONS_TYPE | Grants a (potential) subset of chameleon options available to the extension, based on the instance's type . |
CLICK_HANDLER_REMOVE_IF_NOT_TOP | Removes and prevents creation of the click handler if it is not the active handler for the mob. |
CLICK_HANDLER_REMOVE_ON_MOB_LOGOUT | Removes this click handler on /mob/Logout() . |
DEG_TO_RAD | Multiplier for converting degrees to radians, rounded to 10 places |
Failsafe | Failsafe |
GC_CURRENTLY_BEING_QDELETED | datum.gc_destroyed signal value |
GLOB | Managed Globals datum. Any defined global vars can be accessed via GLOB.varname . |
GLOBAL_PROC | ** Callbacks Callbacks wrap a target, callable, and arguments to pass. See the dm reference for call(). When the target is GLOBAL_PROC, the callable is global - otherwise it is a datum (or dead) reference. Callbacks are created with the new keyword via a global alias like: |
HALF_PI | Half the mathematical constant pi, rounded to 10 places |
HAZARD_FLAG_SHARD | For mob/living/ignore_hazard_flags. When set, shards do not damage the mob. |
Master | StonedMC |
PI | The mathematical constant pi, rounded to 10 places |
QDEL_HINT_HARDDEL | Destroy() return value. Queue this instance for hard deletion regardless of its refcount GC state. |
QDEL_HINT_HARDDEL_NOW | Destroy() return value. Immediately hard delete the instance. |
QDEL_HINT_IWILLGC | Destroy() return value. Same as QDEL_HINT_LETMELIVE but the instance expects to refcount GC without help. |
QDEL_HINT_LETMELIVE | Destroy() return value. Do not queue the instance for hard deletion. Does not expect to be refcount GCd. |
QDEL_HINT_QUEUE | Destroy() return value. Queue the instance for eventual hard deletion. |
RAD_TO_DEG | Multiplier for converting radians to degrees, rounded to 10 places |
SSpresence | Builds a list of z-level populations to allow for easier pauses on processing when nobody is around to care |
TIMER_LOOP | Looping timers automatically re-queue themselves after firing, assuming they are still valid |
TIMER_NO_HASH_WAIT | Skips adding the wait to the timer hash, allowing for uniques with variable wait times |
TIMER_OVERRIDE | Attempting to add a unique timer will re-queue the event instead of being ignored |
TIMER_STOPPABLE | Stoppable timers produce a hash that can be given to deltimer() to unqueue them |
TIMER_UNIQUE | Two of the same timer signature cannot be queued at once when they are unique |
TWO_PI | Twice the mathematical constant pi, rounded to 10 places |
access_cent_general | Central Command |
access_hangar | SEV Torch |
access_petrov | NRV Petrov |
access_security | Station access |
access_syndicate | Antag access |
access_synth | Misc |
photo_count | photo |
state_machines | List and procs for caching state machine instances. |
z_levels | < What the map edge should be formed with. (null = world.turf) |
Procs | |
Atan2 | The 2-argument arctangent of x and y |
BoundedCircularRandomCoordinate | A circular random coordinate with radius on center_x, center_y, reflected into low_x,low_y -> high_x,high_y, clamped in low,high, and rounded if round is set |
Broadcast_Message | Here is the big, bad function that broadcasts a message given the appropriate parameters. |
CircularRandomCoordinate | A circular random coordinate pair from 0, unit by default, scaled by radius, then rounded if round. |
CircularRandomTurf | Pick a random turf using BoundedCircularRandomCoordinate about x,y on level z |
CircularRandomTurfAround | Pick a random turf using BoundedCircularRandomCoordinate around the turf of target |
CreateBans | DEBUG |
Drand | Returns a random real from an arbitrary XdY dice roll |
GetAnomalySusceptibility | returns 0..1, with 1 being no protection and 0 being fully protected |
Interpolate | Returns a linear interpolation from a to b according to weight. weight 0 is a, weight 1 is b, weight 0.5 is half-way between the two. |
Mean | Returns the mean of either a list or variadic arguments: Mean(list(1, 2, 3)) = 2 , Mean(1, 2, 3) = 2 |
VecMag | Returns the euclidian magnitude of a vector of either a list or variadic arguments: VecMag(list(3, 4)) = 5 , VecMag(3, 4) = 5 |
VecSquareMag | Returns the euclidian square magnitude of a vector of either a list or variadic arguments: VecSquareMag(list(1, 2, 3)) = 14 , VecSquareMag(1, 2, 3) = 14 |
_fetch_bans | Checks for bans matching ckey, ip, or cid. |
_fetch_connections | Checks for prior connections matching ckey, ip, or cid. |
_find_bans_in_connections | Checks a list of connections for bans matching any of the list entries. |
_show_associated_connections | Generates and displays an HTML window, displaying data from a _fetch_connections() call with the provided
parameters. |
_unique_cids_from_connections | Returns a sorted list containing only each unique CID present in a list of connections provided by _fetch_connections() . |
_unique_ckeys_from_bans | Returns a sorted list containing only each unique ckey present in a list of connections provided by _fetch_connections() . |
_unique_ckeys_from_connections | Returns a sorted list containing only each unique ckey present in a list of connections provided by _fetch_connections() . |
_unique_ips_from_connections | Returns a sorted list containing only each unique IP present in a list of connections provided by _fetch_connections() . |
all_hearers | Hear Helpers |
all_viewers | View Helpers |
callHook | @file hooks.dm Implements hooks, a simple way to run code on pre-defined events. |
ckey2client | Get the client associated with ckey text if it is currently connected |
clients_in_range | Range Helpers |
cmp_clientcolor_order | The comparison function for sorting client_colors by order. |
copy_health | Copies the state of health from one atom to another. |
do_unstable_teleport_safe | Teleport an object randomly within a set of connected zlevels |
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. |
empulse | Generates an EMP pulse on the turf of the provided origin point, for the given range as a radius value. Calls
emp_act() on every atom within range. |
findNullRod | Construct Spells |
generate_padding | Builds a string of padding repeated until its character count meets or exceeds size |
getOPressureDifferential | Gets the highest and lowest pressures from the tiles in cardinal directions around us, then checks the difference. |
get_base_turf_by_area | Fetches the area's base_turf , if defined, or the z level's base_turf as a default. |
get_circle_coordinates | Get the coordinates that make up a circle of radius on center, packed as (x | y left shift 12). These coordinates are able to be outside the world: check (v < 1 || v > world.maxV) for safety. Implements the Bresenham Circle Drawing Algorithm for the actual point picking. |
get_circle_turfs | Uses get_circle_coordinates to return a list of turfs on the in-bounds edge of the circle. |
get_compass_direction_string | Returns direction-string, rounded to multiples of 22.5, from the first parameter to the second N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW |
get_default_outfit_backpack | Helpers |
get_fax_machines_by_department | Retrieves a list of all fax machines matching the given department tag. |
get_mannequin | Initial Building |
get_random_poster_type | Picks and returns a random (sub)type of the provided random_poster_base_type which: |
get_random_uplink_items | Support procs |
get_wound_type | WOUND DEFINITIONS |
get_zone_with_miss_chance | Emulates targetting a specific body part, and miss chances May return null if missed. Miss_chance_mod may be negative. In order to make this proc compatible with melee and projectile attacks, only return projectile compatible zones if not point blank. |
grand | Generate a random number from min to max on a sigma^2 = 1 gaussian distribution. |
html_list | Converts a list to an HTML formatted list, i.e.: |
html_list_dl | Converts an associative list to an HTML formatted definition list, i.e.: |
html_page | Page matter from #30904, to be replaced by that behavior later |
is_abstract | Passed a path or instance, returns whether it is abstract. Otherwise null. |
is_special_character | ADMIN HELPER PROCS |
is_suid | Check if thing is an SUID. If other is supplied, check if other matches thing. |
isfinite | True if number is a number that is not nan or an infinity. |
join_url | Connects either a list or variadic arguments with "/" and cleans up multiple joins.
eg:
join_url("a", "b", "c") => "a/b/c"
join_url(list("a", "b", "c")) => "a/b/c"
join_url("https://some.tld/", "/cats", " |
key2client | Get the client associated with key text if it is currently connected |
legion_add_voice | Adds a player's last words to the legion's pool. origin can be a living mob, a mind datum, or a brain. |
legion_warp_effect | Creates a warp effect on the given target turf. |
list_to_map | Convert list to a map by calling handler per entry. Map may be supplied as a reference. Handlers should implement a no-params clear. |
ltm_by_atom_name | Entry handler for list_to_map. Produces a "name"=ref map, overwriting duplicate names in encounter order. |
ltm_by_atom_name_numbered | Entry handler for list_to_map. Produces a "name"=ref map, suffixing a count to name for duplicate names. |
new_simple_coin | Create a new random simple coin at loc and return it. |
pad_left | Pads the matter of padding onto the start of text until the result length is size |
pad_right | Pads the matter of padding onto the start of text until the result length is size |
pick_legion_message | Randomly chooses a legion message to broadcast. |
poly_interp2 | Sample t(0..1) into a quadratic binomial polynomial. Generally this is useful for shaping rand() distribution. see tools/polyvis.html for a parameter picker. |
poly_interp3 | Sample t(0..1) into a cubic binomial polynomial. Generally this is useful for shaping rand() distribution. see tools/polyvis.html for a parameter picker. More expensive than poly_interp2. |
poly_interp4 | Sample t(0..1) into a quartic binomial polynomial. Generally this is useful for shaping rand() distribution. see tools/polyvis.html for a parameter picker. More expensive than poly_interp3. |
pop | Remove and return the last element of the list, or null. |
popleft | Returns the first element from the list and removes it from the list |
profiler_init | Starts the profiler. |
qdel | Queue datum D for garbage collection / deletion. Calls the datum's Destroy() and sets its gc_destroyed value. |
randhex | Returns random hex of char length nibbles |
resolve_client | Null, or a client if thing is a client, a mob with a client, a connected ckey, or null |
resolve_species | Helpers related to /datum/species Null, or a species if thing is a species, a species path, or a species name |
select_client | Null or a client from the list of connected clients, chosen by actor if actor is valid |
send_fax_loop | Handles the loop of sending a fax to all machines matching the department tag. Returns TRUE if at least one fax machine successfully received the fax. Does not include sending faxes to admins. |
set_scent_by_reagents | Reagents have the following vars, which coorelate to the vars on the standard scent extension: scent, scent_intensity, scent_descriptor, scent_range To add a scent extension to an atom using a reagent's info, where R. is the reagent, use set_scent_by_reagents(). |
show_legion_broadcast | Displays a legion message through all radios in the given z-levels. |
shuffle | Returns a Fisher-Yates shuffled copy of list, or list itself if in_place. |
stoplag | Non-blocking sleep that allows server state to advance while the caller waits for something to be complete, or to pause its own behavior to be neighbourly |
subtypesof | typesof() without the type of thing (or thing if it is a type) included. |
subtypesof_real | subtypesof() without abstract types included. |
time_to_readable | Converts some number of deciseconds to a user-readable string split into time measurements from seconds to years. |
typecache_filter_list | Returns a new list with only atoms that are in typecache L |
typecacheof | Like typesof() or subtypesof(), but returns a typecache instead of a list |
typesof_real | typesof() without abstract types included. |
uptime | Real time in deciseconds the server process has been active |
valid_ckey | Duck check to see if text looks like a ckey |
valid_key | Duck check to see if text looks like a key |
weakref | Creates a weakref to the given input. See /weakref 's documentation for more information. |
xdy | Roll a Y sided die X times, producing either a sum result or list of rolls. |
Var Details
ATOM_ICON_CACHE_ALL
SSoverlays. Target both normal and protected overlay caches.
ATOM_ICON_CACHE_NORMAL
SSoverlays. Target the normal overlay cache.
ATOM_ICON_CACHE_PROTECTED
SSoverlays. Target the protected overlay cache.
CHAMELEON_FLEXIBLE_OPTIONS_EXTENSION
Grants the full set of chameleon selection options available to the extension.
CHAMELEON_FLEXIBLE_OPTIONS_PARENT_TYPE
Grants a (potential) subset of chameleon options available to the extension, based on the instance's parent_type
. Falls back to type
if not a valid type for the extension.
CHAMELEON_FLEXIBLE_OPTIONS_TYPE
Grants a (potential) subset of chameleon options available to the extension, based on the instance's type
.
CLICK_HANDLER_REMOVE_IF_NOT_TOP
Removes and prevents creation of the click handler if it is not the active handler for the mob.
CLICK_HANDLER_REMOVE_ON_MOB_LOGOUT
Removes this click handler on /mob/Logout()
.
DEG_TO_RAD
Multiplier for converting degrees to radians, rounded to 10 places
Failsafe
Failsafe
Pretty much pokes the MC to make sure it's still alive.
GC_CURRENTLY_BEING_QDELETED
datum.gc_destroyed signal value
GLOB
Managed Globals datum. Any defined global vars can be accessed via GLOB.varname
.
New globals can be defined on the global scope (Outside of any class definitions) via the various GLOBAL_*()
defines listed at the end of code\__datastructures\globals.dm
.
GLOBAL_PROC
** Callbacks Callbacks wrap a target, callable, and arguments to pass. See the dm reference for call(). When the target is GLOBAL_PROC, the callable is global - otherwise it is a datum (or dead) reference. Callbacks are created with the new keyword via a global alias like:
- var/datum/callback/instance = new Callback(GLOBAL_PROC, /proc/get_area, someObject) Callbacks are thin - they should be used with invoke or invoke_async.
** Invocation
invoke and invoke_async call a callable against a target with optional params. They accept either:
invoke(target, callable, params...)
or invoke(
** Callables Callables are proc names or proc references, with references preferred for safety (in most cases). These vary between 515 and older major versions: Before 515:
- .proc/name refers to the last override of name on target, OR the global proc name. After 515:
- src::name() must be used for the last override, or ::name() for the global.
- nameof() is available at compile time to resolve safe proc names like nameof(/datum::fooBehavior()). This can be preferable to direct refs in complex cases. A specific version of a proc may be called by fully specifying its type depth, like invoke(myLivingMob, /mob/living/proc/handle_vision)
** Timers Timers accept callbacks as their first argument. For full timer documentation, see the timedevent datum. For example: addTimer(new Callback(myMob, myMob::drop_l_hand()), 10 SECONDS)
HALF_PI
Half the mathematical constant pi, rounded to 10 places
HAZARD_FLAG_SHARD
For mob/living/ignore_hazard_flags. When set, shards do not damage the mob.
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
PI
The mathematical constant pi, rounded to 10 places
QDEL_HINT_HARDDEL
Destroy() return value. Queue this instance for hard deletion regardless of its refcount GC state.
QDEL_HINT_HARDDEL_NOW
Destroy() return value. Immediately hard delete the instance.
QDEL_HINT_IWILLGC
Destroy() return value. Same as QDEL_HINT_LETMELIVE but the instance expects to refcount GC without help.
QDEL_HINT_LETMELIVE
Destroy() return value. Do not queue the instance for hard deletion. Does not expect to be refcount GCd.
QDEL_HINT_QUEUE
Destroy() return value. Queue the instance for eventual hard deletion.
RAD_TO_DEG
Multiplier for converting radians to degrees, rounded to 10 places
SSpresence
Builds a list of z-level populations to allow for easier pauses on processing when nobody is around to care
TIMER_LOOP
Looping timers automatically re-queue themselves after firing, assuming they are still valid
TIMER_NO_HASH_WAIT
Skips adding the wait to the timer hash, allowing for uniques with variable wait times
TIMER_OVERRIDE
Attempting to add a unique timer will re-queue the event instead of being ignored
TIMER_STOPPABLE
Stoppable timers produce a hash that can be given to deltimer() to unqueue them
TIMER_UNIQUE
Two of the same timer signature cannot be queued at once when they are unique
TWO_PI
Twice the mathematical constant pi, rounded to 10 places
access_cent_general
Central Command
access_hangar
SEV Torch
access_petrov
NRV Petrov
access_security
Station access
access_syndicate
Antag access
access_synth
Misc
photo_count
photo
state_machines
List and procs for caching state machine instances.
z_levels
< What the map edge should be formed with. (null = world.turf)
Proc Details
Atan2
The 2-argument arctangent of x and y
BoundedCircularRandomCoordinate
A circular random coordinate with radius on center_x, center_y, reflected into low_x,low_y -> high_x,high_y, clamped in low,high, and rounded if round is set
Generally this proc is useful for placement around a point (eg a player) that must stay within map boundaries, or some similar circle in box constraint
A "donut" pattern can be achieved by varying the number supplied as radius outside the scope of the proc, eg as BoundedCircularRandomCoordinate(Frand(1, 3), ...)
Broadcast_Message
Here is the big, bad function that broadcasts a message given the appropriate parameters.
@param connection: The datum generated in radio.dm, stored in signal.data["connection"].
@param M: Reference to the mob/speaker, stored in signal.data["mob"]
@param vmask: Boolean value if the mob is "hiding" its identity via voice mask, stored in signal.data["vmask"]
@param vmessage: If specified, will display this as the message; such as "chimpering" for monkies if the mob is not understood. Stored in signal.data["vmessage"].
@param radio: Reference to the radio broadcasting the message, stored in signal.data["radio"]
@param message: The actual string message to display to mobs who understood mob M. Stored in signal.data["message"]
@param name: The name to display when a mob receives the message. signal.data["name"]
@param job: The name job to display for the AI when it receives the message. signal.data["job"]
@param realname: The "real" name associated with the mob. signal.data["realname"]
@param vname: If specified, will use this name when mob M is not understood. signal.data["vname"]
@param data: If specified: 1 -- Will only broadcast to intercoms 2 -- Will only broadcast to intercoms and station-bounced radios 3 -- Broadcast to syndicate frequency 4 -- AI can't track down this person. Useful for imitation broadcasts where you can't find the actual mob
@param compression: If 0, the signal is audible If nonzero, the signal may be partially inaudible or just complete gibberish.
@param level: The list of Z levels that the sending radio is broadcasting to. Having 0 in the list broadcasts on all levels
@param freq The frequency of the signal
@param channel_tag The "name" of the frequency. Displayed in brackets before the message
@param channel_color Color of the radio message
CircularRandomCoordinate
A circular random coordinate pair from 0, unit by default, scaled by radius, then rounded if round.
CircularRandomTurf
Pick a random turf using BoundedCircularRandomCoordinate about x,y on level z
CircularRandomTurfAround
Pick a random turf using BoundedCircularRandomCoordinate around the turf of target
CreateBans
DEBUG
Drand
Returns a random real from an arbitrary XdY dice roll
GetAnomalySusceptibility
returns 0..1, with 1 being no protection and 0 being fully protected
Interpolate
Returns a linear interpolation from a to b according to weight. weight 0 is a, weight 1 is b, weight 0.5 is half-way between the two.
Mean
Returns the mean of either a list or variadic arguments: Mean(list(1, 2, 3)) = 2 , Mean(1, 2, 3) = 2
VecMag
Returns the euclidian magnitude of a vector of either a list or variadic arguments: VecMag(list(3, 4)) = 5 , VecMag(3, 4) = 5
VecSquareMag
Returns the euclidian square magnitude of a vector of either a list or variadic arguments: VecSquareMag(list(1, 2, 3)) = 14 , VecSquareMag(1, 2, 3) = 14
_fetch_bans
Checks for bans matching ckey, ip, or cid.
Returns list of lists.
_fetch_connections
Checks for prior connections matching ckey, ip, or cid.
Returns list of lists.
_find_bans_in_connections
Checks a list of connections for bans matching any of the list entries.
Parameters:
connections
(list) - List of connections. Should be the output of_fetch_connections()
.include_inactive
(boolean, defaultFALSE
) - If set, includes inactive/expired bans in the list.
Returns list of lists.
_show_associated_connections
Generates and displays an HTML window, displaying data from a _fetch_connections()
call with the provided
parameters.
WARNING: This proc makes no validation or access checks. Ensure user
is a valid candidate to receive this
information before calling.
Used by the Check Connections
button in the player panel.
Parameters:
user
- The mob requesing that the window is displayed to.connections
- List generated from a_fetch_connections()
call.target_ckey
- If provided, highlights ckeys in the window that match this value.target_ip
- If provided, highlights IP addresses in the window that match this value.target_cid
- If provided, highlights CIDs in the window that match this value.
Has no return value.
_unique_cids_from_connections
Returns a sorted list containing only each unique CID present in a list of connections provided by _fetch_connections()
.
_unique_ckeys_from_bans
Returns a sorted list containing only each unique ckey present in a list of connections provided by _fetch_connections()
.
_unique_ckeys_from_connections
Returns a sorted list containing only each unique ckey present in a list of connections provided by _fetch_connections()
.
_unique_ips_from_connections
Returns a sorted list containing only each unique IP present in a list of connections provided by _fetch_connections()
.
all_hearers
Hear Helpers
all_viewers
View Helpers
callHook
@file hooks.dm Implements hooks, a simple way to run code on pre-defined events.
-
@page hooks Code hooks
-
@section hooks Hooks
-
A hook is defined under /hook in the type tree.
-
To add some code to be called by the hook, define a proc under the type, as so:
-
@code hook/foo/proc/bar() if(1) return 1 //Sucessful else return 0 //Error, or runtime.
-
@endcode
-
All hooks must return nonzero on success, as runtimes will force return null.
Calls a hook, executing every piece of code that's attached to it. @param hook Identifier of the hook to call. @returns 1 if all hooked code runs successfully, 0 otherwise.
ckey2client
Get the client associated with ckey text if it is currently connected
clients_in_range
Range Helpers
cmp_clientcolor_order
The comparison function for sorting client_colors by order.
copy_health
Copies the state of health from one atom to another.
Does not support mobs that don't use standardized health.
do_unstable_teleport_safe
Teleport an object randomly within a set of connected zlevels
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.
empulse
Generates an EMP pulse on the turf of the provided origin point, for the given range as a radius value. Calls
emp_act()
on every atom within range.
Parameters:
origin
- The atom to originate the EMP from. Will be converted toget_turf()
if not already a turf.heavy_range
- The radius in tiles to useEMP_ACT_HEAVY
in theemp_act()
call.light_range
- The radius in tiles to useEMP_ACT_LIGHT
in theemp_act()
call. NOTE: This is the total range of the EMP, not added toheavy_range
. This should be equal to or greater thanheavy_range
to avoid weirdness.log
- IfTRUE
, generates an admin log detailing the EMP's size and origin area.
Returns FALSE
if the emp failed to generate, TRUE
otherwise.
findNullRod
Construct Spells
generate_padding
Builds a string of padding repeated until its character count meets or exceeds size
getOPressureDifferential
Gets the highest and lowest pressures from the tiles in cardinal directions around us, then checks the difference.
get_base_turf_by_area
Fetches the area's base_turf
, if defined, or the z level's base_turf
as a default.
get_circle_coordinates
Get the coordinates that make up a circle of radius on center, packed as (x | y left shift 12). These coordinates are able to be outside the world: check (v < 1 || v > world.maxV) for safety. Implements the Bresenham Circle Drawing Algorithm for the actual point picking.
get_circle_turfs
Uses get_circle_coordinates to return a list of turfs on the in-bounds edge of the circle.
get_compass_direction_string
Returns direction-string, rounded to multiples of 22.5, from the first parameter to the second N, NNE, NE, ENE, E, ESE, SE, SSE, S, SSW, SW, WSW, W, WNW, NW, NNW
get_default_outfit_backpack
Helpers
get_fax_machines_by_department
Retrieves a list of all fax machines matching the given department tag.
get_mannequin
Initial Building
get_random_poster_type
Picks and returns a random (sub)type of the provided random_poster_base_type which:
- Is not abstract, and
- Has a poster_flags value with the POSTER_FLAG_RANDOM_PICK flag, and
- Has a poster_flags value which does not match one or more of the excluded_flags (if provided)
get_random_uplink_items
Support procs
get_wound_type
WOUND DEFINITIONS
get_zone_with_miss_chance
Emulates targetting a specific body part, and miss chances May return null if missed. Miss_chance_mod may be negative. In order to make this proc compatible with melee and projectile attacks, only return projectile compatible zones if not point blank.
grand
Generate a random number from min to max on a sigma^2 = 1 gaussian distribution.
html_list
Converts a list to an HTML formatted list, i.e.:
list(
"Value1",
"Value2"
)
Becomes:
<ul>
<li>Value1</li>
<li>Value2</li>
</ul>
Parameters:
input
- The list to convert to an HTML formatted list. Values must be convertable to string. List keys from associative lists are not used.numbered_list
(Boolean, defaultFALSE
) - If set, the list will use<ol>
instead of<ul>
tags, generating a numbered list instead of bullets.
Returns string, or null if input
is empty.
html_list_dl
Converts an associative list to an HTML formatted definition list, i.e.:
list(
"Key1" = "Value1",
"Key2" = "Value2"
)
Becomes:
<dl>
<dt>Key1</dt>
<dd>Value1</dd>
<dt>Key2</dt>
<dd>Value2</dd>
...
</dl>
Parameters:
input
- The list to convert to an HTML formatted list. Both the key and value must be convertable to string.
Returns string, or null if input
is empty.
html_page
Page matter from #30904, to be replaced by that behavior later
is_abstract
Passed a path or instance, returns whether it is abstract. Otherwise null.
is_special_character
ADMIN HELPER PROCS
is_suid
Check if thing is an SUID. If other is supplied, check if other matches thing.
isfinite
True if number is a number that is not nan or an infinity.
join_url
Connects either a list or variadic arguments with "/" and cleans up multiple joins.
eg:
join_url("a", "b", "c") => "a/b/c"
join_url(list("a", "b", "c")) => "a/b/c"
join_url("https://some.tld/", "/cats", "", "//dogs") => "https://some.tld/cats//dogs"
key2client
Get the client associated with key text if it is currently connected
legion_add_voice
Adds a player's last words to the legion's pool. origin
can be a living mob, a mind datum, or a brain.
legion_warp_effect
Creates a warp effect on the given target turf.
list_to_map
Convert list to a map by calling handler per entry. Map may be supplied as a reference. Handlers should implement a no-params clear.
ltm_by_atom_name
Entry handler for list_to_map. Produces a "name"=ref map, overwriting duplicate names in encounter order.
ltm_by_atom_name_numbered
Entry handler for list_to_map. Produces a "name"=ref map, suffixing a count to name for duplicate names.
new_simple_coin
Create a new random simple coin at loc and return it.
pad_left
Pads the matter of padding onto the start of text until the result length is size
pad_right
Pads the matter of padding onto the start of text until the result length is size
pick_legion_message
Randomly chooses a legion message to broadcast.
Returns string.
poly_interp2
Sample t(0..1) into a quadratic binomial polynomial. Generally this is useful for shaping rand() distribution. see tools/polyvis.html for a parameter picker.
poly_interp3
Sample t(0..1) into a cubic binomial polynomial. Generally this is useful for shaping rand() distribution. see tools/polyvis.html for a parameter picker. More expensive than poly_interp2.
poly_interp4
Sample t(0..1) into a quartic binomial polynomial. Generally this is useful for shaping rand() distribution. see tools/polyvis.html for a parameter picker. More expensive than poly_interp3.
pop
Remove and return the last element of the list, or null.
popleft
Returns the first element from the list and removes it from the list
profiler_init
Starts the profiler.
qdel
Queue datum D for garbage collection / deletion. Calls the datum's Destroy() and sets its gc_destroyed value.
randhex
Returns random hex of char length nibbles
resolve_client
Null, or a client if thing is a client, a mob with a client, a connected ckey, or null
resolve_species
Helpers related to /datum/species Null, or a species if thing is a species, a species path, or a species name
select_client
Null or a client from the list of connected clients, chosen by actor if actor is valid
send_fax_loop
Handles the loop of sending a fax to all machines matching the department tag. Returns TRUE
if at least one fax machine successfully received the fax. Does not include sending faxes to admins.
set_scent_by_reagents
Reagents have the following vars, which coorelate to the vars on the standard scent extension: scent, scent_intensity, scent_descriptor, scent_range To add a scent extension to an atom using a reagent's info, where R. is the reagent, use set_scent_by_reagents().
show_legion_broadcast
Displays a legion message through all radios in the given z-levels.
shuffle
Returns a Fisher-Yates shuffled copy of list, or list itself if in_place.
stoplag
Non-blocking sleep that allows server state to advance while the caller waits for something to be complete, or to pause its own behavior to be neighbourly
subtypesof
typesof()
without the type of thing (or thing if it is a type) included.
subtypesof_real
subtypesof()
without abstract types included.
time_to_readable
Converts some number of deciseconds to a user-readable string split into time measurements from seconds to years.
typecache_filter_list
Returns a new list with only atoms that are in typecache L
typecacheof
Like typesof() or subtypesof(), but returns a typecache instead of a list
typesof_real
typesof()
without abstract types included.
uptime
Real time in deciseconds the server process has been active
valid_ckey
Duck check to see if text looks like a ckey
valid_key
Duck check to see if text looks like a key
weakref
Creates a weakref to the given input. See /weakref
's documentation for more information.
xdy
Roll a Y sided die X times, producing either a sum result or list of rolls.