mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-19 05:26:28 +00:00
## 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.
24 lines
792 B
Plaintext
24 lines
792 B
Plaintext
/datum/preference/choiced/glasses
|
|
category = PREFERENCE_CATEGORY_SECONDARY_FEATURES
|
|
savefile_key = "glasses"
|
|
savefile_identifier = PREFERENCE_CHARACTER
|
|
should_generate_icons = TRUE
|
|
|
|
/datum/preference/choiced/glasses/init_possible_values()
|
|
return assoc_to_keys(GLOB.nearsighted_glasses) + "Random"
|
|
|
|
/datum/preference/choiced/glasses/icon_for(value)
|
|
if (value == "Random")
|
|
return icon('icons/effects/random_spawners.dmi', "questionmark")
|
|
else
|
|
return icon('icons/obj/clothing/glasses.dmi', "glasses_[lowertext(value)]")
|
|
|
|
/datum/preference/choiced/glasses/is_accessible(datum/preferences/preferences)
|
|
if (!..(preferences))
|
|
return FALSE
|
|
|
|
return "Nearsighted" in preferences.all_quirks
|
|
|
|
/datum/preference/choiced/glasses/apply_to_human(mob/living/carbon/human/target, value)
|
|
return
|