Files
Bubberstation/code/modules/client/preferences/ui_style.dm
SkyratBot 57abd05851 [MIRROR] Separate init_possible_values() from icon generation [MDB IGNORE] (#23221)
* Separate init_possible_values() from icon generation

* Update clothing.dm

* Update lizard.dm

* Modular

* Runtime fix

* Modular adjustments

* Fixes icon offset for undershirt

* Update mutant_parts.dm

* Update mutant_parts.dm

* Fix a merge skew

* Update mutant_parts.dm

* More of a catch-all solution

* Update _preference.dm

---------

Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com>
Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com>
2023-08-24 21:44:13 -04:00

25 lines
820 B
Plaintext

/// UI style preference
/datum/preference/choiced/ui_style
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_identifier = PREFERENCE_PLAYER
savefile_key = "UI_style"
should_generate_icons = TRUE
/datum/preference/choiced/ui_style/init_possible_values()
return assoc_to_keys(GLOB.available_ui_styles)
/datum/preference/choiced/ui_style/icon_for(value)
var/icon/icons = GLOB.available_ui_styles[value]
var/icon/icon = icon(icons, "hand_r")
icon.Crop(1, 1, world.icon_size * 2, world.icon_size)
icon.Blend(icon(icons, "hand_l"), ICON_OVERLAY, world.icon_size)
return icon
/datum/preference/choiced/ui_style/create_default_value()
return GLOB.available_ui_styles[1]
/datum/preference/choiced/ui_style/apply_to_client(client/client, value)
client.mob?.hud_used?.update_ui_style(ui_style2icon(value))