/tg/ Station 13 - Modules - Types — Var Details - Proc Details

preference_middleware

Preference middleware is code that helps to decentralize complicated preference features.

Vars

action_delegationsMap of ui_act actions -> proc paths to call. Signature is `(list/params, mob/user) -> TRUE/FALSE. Return output is the same as ui_act--TRUE if it should update, FALSE if it should not
keyThe key that will be used for get_constant_data(). If null, will use the typepath minus /datum/preference_middleware.
preferencesThe preferences datum

Procs

add_preview_answerAdds what this middleware reads from the preview mob to an answer, which goes to the page right after the mob is rebuilt for the changes the answer covers (start_answer()). The window's own data, sent as each change is made, may read the mob before it is rebuilt. Add only what changed since the page last got it.
apply_to_humanCalled when applying preferences to the mob.
get_character_preferencesMerge this into the result of compile_character_preferences.
get_constant_dataAppend all of these into /datum/asset/json/preferences.
get_ui_assetsAppend all of these into ui_assets
get_ui_dataAppend all of these into ui_data
get_ui_static_dataAppend all of these into ui_static_data
on_new_characterCalled when a character is changed.
post_set_preferenceCalled after every update_preference
pre_set_preferenceCalled before every update_preference, returns TRUE if this handled it.

Var Details

action_delegations

Map of ui_act actions -> proc paths to call. Signature is `(list/params, mob/user) -> TRUE/FALSE. Return output is the same as ui_act--TRUE if it should update, FALSE if it should not

key

The key that will be used for get_constant_data(). If null, will use the typepath minus /datum/preference_middleware.

preferences

The preferences datum

Proc Details

add_preview_answer

Adds what this middleware reads from the preview mob to an answer, which goes to the page right after the mob is rebuilt for the changes the answer covers (start_answer()). The window's own data, sent as each change is made, may read the mob before it is rebuilt. Add only what changed since the page last got it.

Arguments:

apply_to_human

Called when applying preferences to the mob.

get_character_preferences

Merge this into the result of compile_character_preferences.

get_constant_data

Append all of these into /datum/asset/json/preferences.

get_ui_assets

Append all of these into ui_assets

get_ui_data

Append all of these into ui_data

get_ui_static_data

Append all of these into ui_static_data

on_new_character

Called when a character is changed.

post_set_preference

Called after every update_preference

pre_set_preference

Called before every update_preference, returns TRUE if this handled it.