datum
Vars | |
cached_ref | A cached version of our \ref The brunt of \ref costs are in creating entries in the string tree (a tree of immutable strings) This avoids doing that more then once per datum by ensuring ref strings always have a reference to them after they're first pulled |
---|---|
isprocessing | Used by SSprocessing |
md5_unique_datum_id | MD5'd version of the UID. Used for instances where we dont want to make clients aware of UIDs. |
status_traits | Status traits attached to this datum |
tgui_shared_states | global |
Procs | |
CanProcCall | Proc to check if a datum allows proc calls on it |
DeleteComponent | Removes the component from the datum |
DeleteComponentsType | Removes all components of a given type from the datum |
GetComponent | Return any component assigned to this datum of the given type |
GetComponents | Get all components of a given type that are attached to this datum |
GetExactComponent | Return any component assigned to this datum of the exact given type |
LoadComponent | Get existing component of type, or create it and return a reference to it |
MD5_UID | Safety wrapper for getting MD5 UIDs |
RegisterSignal | Register to listen for a signal from the passed in target |
RegisterSignals | Registers multiple signals to the same proc. |
TakeComponent | Transfer this component to another parent |
TransferComponent | Transfer a single component from the source datum, to the target. |
TransferComponents | Transfer all components to target |
UID | Gets or creates the UID of a datum |
UnregisterSignal | Stop listening to a given signal from target |
_AddComponent | Creates an instance of new_type in the datum and attaches to it as parent |
_AddElement | Finds the singleton for the element type given and attaches it to src |
_RemoveElement | Finds the singleton for the element type given and detaches it from src You only need additional arguments beyond the type if you're using ELEMENT_BESPOKE |
_SendSignal | Internal proc to handle most all of the signaling procedure |
p_a | Functionally the \a macro, for the cases where you put a bicon between "some [bicon] pop corn" |
p_are | Applies "is" for singular genders, or "are" for plural ones (e.g. "he is here" Vs. "they are here"). |
p_do | Applies "does" for singular genders, or "do" for plural ones (e.g. "she does stuff" Vs. "they do stuff"). |
p_es | Adds an "es" to the end of a word as appropriate for a particular gender (e.g. "he screeches" and "they screech"). For verb conjugation. |
p_have | Applies "has" for singular genders, or "have" for plural ones (e.g. "she has eaten" Vs. "they have eaten"). |
p_s | Used to add an "s" to the end of a word as appropriate for a particular gender (e.g. "she looks" and "they look"). For verb conjugation. |
p_their | Applies one of "their", "its", "his", or "her" as appropriate. Set to TRUE to capitalise. |
p_them | Applies one of "them", "it", "him", or "her" as appropriate. Set to TRUE to capitalise. |
p_themselves | Applies one of "themselves", "itself", "himself", or "herself" as appropriate. Set to TRUE to capitalise. |
p_they | Applies one of "they", "it", "he", or "she" as appropriate. Set to TRUE to capitalise. |
p_theyre | Applies one of "they're", "it's", "he's", or "she's" as appropriate. Set to TRUE to capitalise. |
p_theyve | Applies one of "they've", "it's", "he's", or "she's" as appropriate. Set to TRUE to capitalise. |
p_were | Applies "was" for singular genders, or "were" for plural ones (e.g. "it was huge" Vs. "they were huge"). |
signal_cancel_activate_self | Used for signal registrars who wish to completely ignore all behavior in the attack chain from parent types. Should be used sparingly, as subtypes are meant to build on behavior from the parent type. |
signal_cancel_attack_by | Used for signal registrars who wish to completely ignore all behavior
in the attack chain from parent types calling attack_by . Should be
used sparingly, as subtypes are meant to build on behavior from the parent
type. |
signal_qdel | |
string_assoc_list | Caches associative lists with non-numeric stringify-able index keys and stringify-able values (text/typepath -> text/path/number). |
ui_act | public |
ui_assets | public |
ui_close | public |
ui_data | public |
ui_host | private |
ui_interact | External tgui definitions, such as src_object APIs. |
ui_modal_act | Call this from a proc that is called in ui_act() to process modal actions |
ui_modal_answer | Calls the source's currently assigned modal's (if there is one) on_answer() proc. Private. |
ui_modal_bento | Opens a bento input UI modal |
ui_modal_boolean | Opens a yes/no UI modal |
ui_modal_choice | Opens a dropdown input UI modal |
ui_modal_clear | Clears the current modal for a given datum |
ui_modal_data | Call this from ui_data() to return modal information if needed |
ui_modal_input | Opens a text input UI modal |
ui_modal_message | Opens a message UI modal |
ui_modal_new | Registers a given modal to a source. Private. |
ui_modal_preprocess_answer | Passes an answer from JS through the modal's proc. |
ui_state | private |
ui_static_data | public |
ui_status | Base state and helpers for states. Just does some sanity checks, implement a proper state for in-depth checks. |
update_static_data | public |
Var Details
cached_ref
A cached version of our \ref The brunt of \ref costs are in creating entries in the string tree (a tree of immutable strings) This avoids doing that more then once per datum by ensuring ref strings always have a reference to them after they're first pulled
isprocessing
Used by SSprocessing
md5_unique_datum_id
MD5'd version of the UID. Used for instances where we dont want to make clients aware of UIDs.
status_traits
Status traits attached to this datum
tgui_shared_states
global
Associative list of JSON-encoded shared states that were set by tgui clients.
Proc Details
CanProcCall
Proc to check if a datum allows proc calls on it
Returns TRUE if you can call a proc on the datum, FALSE if you cant
DeleteComponent
Removes the component from the datum
DeleteComponentsType
Removes all components of a given type from the datum
GetComponent
Return any component assigned to this datum of the given type
This will throw an error if it's possible to have more than one component of that type on the parent
Arguments:
- datum/component/c_type The typepath of the component you want to get a reference to
GetComponents
Get all components of a given type that are attached to this datum
Arguments:
- c_type The component type path
GetExactComponent
Return any component assigned to this datum of the exact given type
This will throw an error if it's possible to have more than one component of that type on the parent
Arguments:
- datum/component/c_type The typepath of the component you want to get a reference to
LoadComponent
Get existing component of type, or create it and return a reference to it
Use this if the item needs to exist at the time of this call, but may not have been created before now
Arguments:
- component_type The typepath of the component to create or return
- ... additional arguments to be passed when creating the component if it does not exist
MD5_UID
Safety wrapper for getting MD5 UIDs
This ensures it exists before reading it
RegisterSignal
Register to listen for a signal from the passed in target
This sets up a listening relationship such that when the target object emits a signal the source datum this proc is called upon, will receive a callback to the given proctype Return values from procs registered must be a bitfield
Arguments:
- datum/target The target to listen for signals from
- sig_type_or_types Either a string signal name, or a list of signal names (strings)
- proctype The proc to call back when the signal is emitted
- override If a previous registration exists you must explicitly set this
RegisterSignals
Registers multiple signals to the same proc.
TakeComponent
Transfer this component to another parent
Component is taken from source datum
Arguments:
- datum/component/target Target datum to transfer to
TransferComponent
Transfer a single component from the source datum, to the target.
Arguments:
- datum/target - the target to move the component to
- component_instance_or_typepath - either an already created component, or a component typepath
TransferComponents
Transfer all components to target
All components from source datum are taken
Arguments:
- /datum/target the target to move the components to
UID
Gets or creates the UID of a datum
BYOND refs are recycled, so this system prevents that. If a datum does not have a UID when this proc is ran, one will be created Returns the UID of the datum
UnregisterSignal
Stop listening to a given signal from target
Breaks the relationship between target and source datum, removing the callback when the signal fires
Doesn't care if a registration exists or not
Arguments:
- datum/target Datum to stop listening to signals from
- sig_typeor_types Signal string key or list of signal keys to stop listening to specifically
_AddComponent
Creates an instance of new_type
in the datum and attaches to it as parent
Sends the COMSIG_COMPONENT_ADDED signal to the datum
Returns the component that was created. Or the old component in a dupe situation where COMPONENT_DUPE_UNIQUE was set
If this tries to add a component to an incompatible type, the component will be deleted and the result will be null
. This is very unperformant, try not to do it
Properly handles duplicate situations based on the dupe_mode
var
_AddElement
Finds the singleton for the element type given and attaches it to src
_RemoveElement
Finds the singleton for the element type given and detaches it from src You only need additional arguments beyond the type if you're using ELEMENT_BESPOKE
_SendSignal
Internal proc to handle most all of the signaling procedure
Will runtime if used on datums with an empty component list
Use the SEND_SIGNAL define instead
p_a
Functionally the \a macro, for the cases where you put a bicon between "some [bicon] pop corn"
p_are
Applies "is" for singular genders, or "are" for plural ones (e.g. "he is here" Vs. "they are here").
p_do
Applies "does" for singular genders, or "do" for plural ones (e.g. "she does stuff" Vs. "they do stuff").
p_es
Adds an "es" to the end of a word as appropriate for a particular gender (e.g. "he screeches" and "they screech"). For verb conjugation.
p_have
Applies "has" for singular genders, or "have" for plural ones (e.g. "she has eaten" Vs. "they have eaten").
p_s
Used to add an "s" to the end of a word as appropriate for a particular gender (e.g. "she looks" and "they look"). For verb conjugation.
p_their
Applies one of "their", "its", "his", or "her" as appropriate. Set to TRUE to capitalise.
p_them
Applies one of "them", "it", "him", or "her" as appropriate. Set to TRUE to capitalise.
p_themselves
Applies one of "themselves", "itself", "himself", or "herself" as appropriate. Set to TRUE to capitalise.
p_they
Applies one of "they", "it", "he", or "she" as appropriate. Set to TRUE to capitalise.
p_theyre
Applies one of "they're", "it's", "he's", or "she's" as appropriate. Set to TRUE to capitalise.
p_theyve
Applies one of "they've", "it's", "he's", or "she's" as appropriate. Set to TRUE to capitalise.
p_were
Applies "was" for singular genders, or "were" for plural ones (e.g. "it was huge" Vs. "they were huge").
signal_cancel_activate_self
Used for signal registrars who wish to completely ignore all behavior in the attack chain from parent types. Should be used sparingly, as subtypes are meant to build on behavior from the parent type.
signal_cancel_attack_by
Used for signal registrars who wish to completely ignore all behavior
in the attack chain from parent types calling attack_by
. Should be
used sparingly, as subtypes are meant to build on behavior from the parent
type.
signal_qdel
Signal qdel
Proc intended to be used when someone wants the src datum to be qdeled when a certain signal is sent to them.
Example usage: RegisterSignal(item, COMSIG_PARENT_QDELETING, TYPE_PROC_REF(/datum, signal_qdel))
string_assoc_list
Caches associative lists with non-numeric stringify-able index keys and stringify-able values (text/typepath -> text/path/number).
ui_act
public
Called on a UI when the UI receieves a href. Think of this as Topic().
required action string The action/button that has been invoked by the user. required params list A list of parameters attached to the button.
return bool If the UI should be updated or not.
ui_assets
public
Called on an object when a tgui object is being created, allowing you to push various assets to tgui, for examples spritesheets.
return list List of asset datums or file paths.
ui_close
public
Called on a UI's object when the UI is closed, not to be confused with client/verb/uiclose(), which closes the ui window
ui_data
public
Data to be sent to the UI. This must be implemented for a UI to work.
required user mob The mob interacting with the UI.
return list Data to be sent to the UI.
ui_host
private
The UI's host object (usually src_object). This allows modules/datums to have the UI attached to them, and be a part of another object.
ui_interact
External tgui definitions, such as src_object APIs.
Copyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT
public
Used to open and update UIs. If this proc is not implemented properly, the UI will not update correctly.
required user mob The mob who opened/is using the UI. optional ui datum/tgui The UI to be updated, if it exists.
ui_modal_act
Call this from a proc that is called in ui_act() to process modal actions
Example: /obj/machinery/chem_master/proc/ui_act_modal You can then switch based on the return value and show different modals depending on the answer. Arguments:
- source - The source datum
- action - The called action
- params - The params to the action
ui_modal_answer
Calls the source's currently assigned modal's (if there is one) on_answer() proc. Private.
Arguments:
- source - The source datum
- id - The ID of the modal
- answer - The provided answer
ui_modal_bento
Opens a bento input UI modal
Internally checks if the answer is in the list of choices. Arguments:
- source - The source datum
- id - The ID of the modal
- text - The text to display above the answers
- delegate - The proc to call when submitted
- arguments - List of arguments passed to and from JS (mostly useful for chaining modals)
- value - The default value of the bento
- choices - The list of available choices in the bento
ui_modal_boolean
Opens a yes/no UI modal
Arguments:
- source - The source datum
- id - The ID of the modal
- text - The text to display above the answers
- delegate - The proc to call when "Yes" is pressed
- delegate_no - The proc to call when "No" is pressed
- arguments - List of arguments passed to and from JS (mostly useful for chaining modals)
- yes_text - The text to show in the "Yes" button
- no_text - The text to show in the "No" button
ui_modal_choice
Opens a dropdown input UI modal
Internally checks if the answer is in the list of choices. Arguments:
- source - The source datum
- id - The ID of the modal
- text - The text to display above the answers
- delegate - The proc to call when submitted
- arguments - List of arguments passed to and from JS (mostly useful for chaining modals)
- value - The default value of the dropdown
- choices - The list of available choices in the dropdown
ui_modal_clear
Clears the current modal for a given datum
Arguments:
- source - The source datum
ui_modal_data
Call this from ui_data() to return modal information if needed
Arguments:
- source - The source datum
ui_modal_input
Opens a text input UI modal
Arguments:
- source - The source datum
- id - The ID of the modal
- text - The text to display above the answers
- delegate - The proc to call when submitted
- arguments - List of arguments passed to and from JS (mostly useful for chaining modals)
- value - The default value of the input
- max_length - The maximum char length of the input
ui_modal_message
Opens a message UI modal
Arguments:
- source - The source datum
- id - The ID of the modal
- text - The text to display above the answers
- delegate - The proc to call when closed
- arguments - List of arguments passed to and from JS (mostly useful for chaining modals)
ui_modal_new
Registers a given modal to a source. Private.
Arguments:
- source - The source datum
- modal - The datum/ui_modal to register
- replace_previous - Whether any modal currently assigned to source should be replaced
- instant_update - Whether the changes should reflect immediately
ui_modal_preprocess_answer
Passes an answer from JS through the modal's proc.
Used namely for cutting the text short if it's longer than an input modal's max_length. Arguments:
- source - The source datum
- answer - The provided answer
ui_state
private
The UI's state controller to be used for created uis This is a proc over a var for memory reasons
ui_static_data
public
Static Data to be sent to the UI.
Static data differs from normal data in that it's large data that should be sent infrequently. This is implemented optionally for heavy uis that would be sending a lot of redundant data frequently. Gets squished into one object on the frontend side, but the static part is cached.
required user mob The mob interacting with the UI.
return list Statuic Data to be sent to the UI.
ui_status
Base state and helpers for states. Just does some sanity checks, implement a proper state for in-depth checks.
Copyright (c) 2020 Aleksej Komarov SPDX-License-Identifier: MIT
public
Checks the UI state for a mob.
required user mob The mob who opened/is using the UI. required state datum/ui_state The state to check.
return UI_state The state of the UI.
update_static_data
public
Forces an update on static data. Should be done manually whenever something happens to change static data.
required user the mob currently interacting with the ui optional ui ui to be updated