/datum
Vars | |
comp_lookup | Any datum registered to receive signals from this datum is in this list |
---|---|
datum_components | Components attached to this datum |
open_uis | Open uis owned by this datum Lazy, since this case is semi rare |
signal_procs | Lazy associated list in the structure of signals:proctype that are run when the datum receives that signal |
tgui_shared_states | global |
Procs | |
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 |
RegisterSignal | |
RegisterSignals | Registers multiple signals to the same proc. |
RemoveComponentsOfType | Calls RemoveComponent on all components of a given type that are attached to this datum |
TakeComponent | Transfer this component to another parent |
TransferComponents | Transfer all components to target |
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 |
_LoadComponent | Get existing component of type, or create it and return a reference to it |
_SendSignal | Internal proc to handle most all of the signaling procedure |
onProcCalled | called when a proc is admin-called |
onVarChanged | called when a variable is admin-edited |
safe_delete | Used when you need to record a proc call to delete something (see spawn_rules.dm) |
ui_act | public |
ui_assets | public |
ui_close | public |
ui_data | public |
ui_host | private |
ui_interact | public |
ui_state | private |
ui_static_data | public |
ui_status | public |
update_static_data | public |
update_static_data_for_all_viewers | public |
Var Details
comp_lookup
Any datum registered to receive signals from this datum is in this list
Lazy associated list in the structure of signal:registree/list of registrees
datum_components
Components attached to this datum
Lazy associated list in the structure of type:component/list of components
open_uis
Open uis owned by this datum Lazy, since this case is semi rare
signal_procs
Lazy associated list in the structure of signals:proctype
that are run when the datum receives that signal
tgui_shared_states
global
Associative list of JSON-encoded shared states that were set by tgui clients.
Proc Details
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
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
-
- signal_type A signal name
-
Complex signals (of the form list(component_type, string) can also be used.)
-
- proctype The proc to call back when the signal is emitted
-
- override If a previous registration exists you must explicitly set this
-
- other arguments get passed to complexsignal/register in the case of a complex signal
RegisterSignals
Registers multiple signals to the same proc.
RemoveComponentsOfType
Calls RemoveComponent on all components of a given type that are attached to this datum
Arguments:
- c_type The component type path
TakeComponent
Transfer this component to another parent
Component is taken from source datum
Arguments:
- datum/component/target Target datum to transfer to
TransferComponents
Transfer all components to target
All components from source datum are taken
Arguments:
- /datum/target the target to move the components to
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 an 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
_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
_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
onProcCalled
called when a proc is admin-called
onVarChanged
called when a variable is admin-edited
safe_delete
Used when you need to record a proc call to delete something (see spawn_rules.dm)
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
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_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
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
update_static_data_for_all_viewers
public
Will force an update on static data for all viewers. Should be done manually whenever something happens to change static data.