Daedalus Dock - Modules - TypesVar Details - Proc Details

preference

Represents an individual preference.

Vars

can_randomizeIf set, will be available to randomize, but only if the preference is for PREFERENCE_CHARACTER.
categoryThe category of preference, for use by the PreferencesMenu. This isn't used for anything other than as a key for UI data. It is up to the PreferencesMenu UI itself to interpret it.
exclude_species_traitsAny species that has any of the listed species traits will not have the option to pick this pref
explanationThe display default name when inserted into the chargen
is_sub_preferenceIs this type a sub preference?
priorityThe priority of when to apply this preference. Used for when you need to rely on another preference.
relevant_external_organIf the selected species has this in its /datum/species/var/cosmetic_organs, will show the feature as selectable.
relevant_mutant_bodypartIf the selected species has this in its /datum/species/mutant_bodyparts, will show the feature as selectable.
relevant_species_traitIf the selected species has this in its /datum/species/species_traits, will show the feature as selectable.
requires_accessibleIf this preference is not accessible, do not attempt to apply it to mobs.
savefile_identifierWhat savefile should this preference be read from? Valid values are PREFERENCE_CHARACTER and PREFERENCE_PLAYER. See the documentation in code/__DEFINES/preferences.dm.
savefile_keyThe key inside the savefile to use. This is also sent to the UI. Once you pick this, don't change it.
sub_preferenceA typepath for a sub preference. Ex: Hair Style's sub_preference is /datum/preference/color/hair_color

Procs

apply_to_clientApply this preference onto the given client. Called when the savefile_identifier == PREFERENCE_PLAYER.
apply_to_client_updatedFired when the preference is updated. Calls apply_to_client by default, but can be overridden.
apply_to_humanApply this preference onto the given human. Must be overriden by subtypes. Called when the savefile_identifier == PREFERENCE_CHARACTER.
compile_constant_dataReturns data compiled into the preferences JSON asset
compile_ui_dataReturns data to be sent to users in the menu
create_default_valueProduce a default, potentially random value for when no value for this preference is found in the savefile. Either this or create_informed_default_value must be overriden by subtypes.
create_informed_default_valueProduce a default, potentially random value for when no value for this preference is found in the savefile. Unlike create_default_value(), will provide the preferences object if you need to use it. If not overriden, will call create_default_value() instead.
create_random_valueProduce a random value for the purposes of character randomization. Will just create a default value by default.
deserializeCalled on the saved input when retrieving. Also called by the value sent from the user through UI. Do not trust it. Input is the value inside the savefile, output is to tell other code what the value is. This is useful either for more optimal data saving or for migrating older data. Must be overridden by subtypes. Can return null if no value was found.
get_spritesheet_keyReturns the key that will be used in the spritesheet for a given value.
is_accessibleReturns whether or not this preference is accessible. If FALSE, will not show in the UI and will not be editable (by update_preference).
is_randomizableReturns whether or not a preference can be randomized.
is_validChecks that a given value is valid. Must be overriden by subtypes. Any type can be passed through.
readGiven a savefile, return either the saved data or an acceptable default. This will write to the savefile if a value was not found with the new value.
serializeCalled on the input while saving. Input is the current value, output is what to save in the savefile.
value_changedCalled when a user updates the value of this preference.
writeGiven a savefile, writes the inputted value. Returns TRUE for a successful application. Return FALSE if it is invalid.

Var Details

can_randomize

If set, will be available to randomize, but only if the preference is for PREFERENCE_CHARACTER.

category

The category of preference, for use by the PreferencesMenu. This isn't used for anything other than as a key for UI data. It is up to the PreferencesMenu UI itself to interpret it.

exclude_species_traits

Any species that has any of the listed species traits will not have the option to pick this pref

explanation

The display default name when inserted into the chargen

is_sub_preference

Is this type a sub preference?

priority

The priority of when to apply this preference. Used for when you need to rely on another preference.

relevant_external_organ

If the selected species has this in its /datum/species/var/cosmetic_organs, will show the feature as selectable.

relevant_mutant_bodypart

If the selected species has this in its /datum/species/mutant_bodyparts, will show the feature as selectable.

relevant_species_trait

If the selected species has this in its /datum/species/species_traits, will show the feature as selectable.

requires_accessible

If this preference is not accessible, do not attempt to apply it to mobs.

savefile_identifier

What savefile should this preference be read from? Valid values are PREFERENCE_CHARACTER and PREFERENCE_PLAYER. See the documentation in code/__DEFINES/preferences.dm.

savefile_key

The key inside the savefile to use. This is also sent to the UI. Once you pick this, don't change it.

sub_preference

A typepath for a sub preference. Ex: Hair Style's sub_preference is /datum/preference/color/hair_color

Proc Details

apply_to_client

Apply this preference onto the given client. Called when the savefile_identifier == PREFERENCE_PLAYER.

apply_to_client_updated

Fired when the preference is updated. Calls apply_to_client by default, but can be overridden.

apply_to_human

Apply this preference onto the given human. Must be overriden by subtypes. Called when the savefile_identifier == PREFERENCE_CHARACTER.

compile_constant_data

Returns data compiled into the preferences JSON asset

compile_ui_data

Returns data to be sent to users in the menu

create_default_value

Produce a default, potentially random value for when no value for this preference is found in the savefile. Either this or create_informed_default_value must be overriden by subtypes.

create_informed_default_value

Produce a default, potentially random value for when no value for this preference is found in the savefile. Unlike create_default_value(), will provide the preferences object if you need to use it. If not overriden, will call create_default_value() instead.

create_random_value

Produce a random value for the purposes of character randomization. Will just create a default value by default.

deserialize

Called on the saved input when retrieving. Also called by the value sent from the user through UI. Do not trust it. Input is the value inside the savefile, output is to tell other code what the value is. This is useful either for more optimal data saving or for migrating older data. Must be overridden by subtypes. Can return null if no value was found.

get_spritesheet_key

Returns the key that will be used in the spritesheet for a given value.

is_accessible

Returns whether or not this preference is accessible. If FALSE, will not show in the UI and will not be editable (by update_preference).

is_randomizable

Returns whether or not a preference can be randomized.

is_valid

Checks that a given value is valid. Must be overriden by subtypes. Any type can be passed through.

read

Given a savefile, return either the saved data or an acceptable default. This will write to the savefile if a value was not found with the new value.

serialize

Called on the input while saving. Input is the current value, output is what to save in the savefile.

value_changed

Called when a user updates the value of this preference.

write

Given a savefile, writes the inputted value. Returns TRUE for a successful application. Return FALSE if it is invalid.