Files
Bubberstation/code/modules/client/preferences/ai_hologram_display.dm
T
MothblocksandGitHub 380ce9c300 Separate init_possible_values() from icon generation (#77660)
## About The Pull Request
`init_possible_values()` now only ever returns a list of values instead
of both values and icons. The responsibility of icon generation has
moved from this proc to a new `icon_for(value)` proc, which returns the
icon/typepath of an atom. A runtime is thrown if any value does not have
an icon.

This boosts production initialization times by 3+ seconds, but is
primarily done to allow for further optimizations of this process. As an
example, it is a mapping of value -> icon so that in the code that
executes this we can have more fine grained control over tick overrun.

As a bonus, fixes #67092.
2023-08-20 14:49:26 -07:00

25 lines
920 B
Plaintext

/// What to show on the AI hologram
/datum/preference/choiced/ai_hologram_display
category = PREFERENCE_CATEGORY_NON_CONTEXTUAL
savefile_identifier = PREFERENCE_CHARACTER
savefile_key = "preferred_ai_hologram_display"
should_generate_icons = TRUE
/datum/preference/choiced/ai_hologram_display/init_possible_values()
return assoc_to_keys(GLOB.ai_hologram_icons) + "Random"
/datum/preference/choiced/ai_hologram_display/icon_for(value)
if (value == "Random")
return icon('icons/mob/silicon/ai.dmi', "questionmark")
else
return icon(GLOB.ai_hologram_icons[value], GLOB.ai_hologram_icon_state[value])
/datum/preference/choiced/ai_hologram_display/is_accessible(datum/preferences/preferences)
if (!..(preferences))
return FALSE
return istype(preferences.get_highest_priority_job(), /datum/job/ai)
/datum/preference/choiced/ai_hologram_display/apply_to_human(mob/living/carbon/human/target, value)
return