mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-15 12:11:45 +00:00
## About The Pull Request All usages of world.icon_size in code have been replaced with new `ICONSIZE_X`, `ICONSIZE_Y` and `ICONSIZE_ALL` defines depending on context Replaces some "32" magic numbers with the defines A few bits of code have been modified to split up x/y math as well ## Why It's Good For The Game Magic number bad, code more readable, code more flexible and I'm told there's an access cost to doing world.icon_size so minor performance gains ## Changelog 🆑 tonty code: made some code relating to the world's icon size more readable /🆑 --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
25 lines
808 B
Plaintext
25 lines
808 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, ICON_SIZE_X * 2, ICON_SIZE_Y)
|
|
icon.Blend(icon(icons, "hand_l"), ICON_OVERLAY, ICON_SIZE_X)
|
|
|
|
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))
|