mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 10:43:20 +00:00
[MIRROR] Convert preferences to /tg/ preferences (#9797)
Co-authored-by: ShadowLarkens <shadowlarkens@gmail.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
689b354903
commit
039ee85382
@@ -13,7 +13,7 @@
|
||||
|
||||
/datum/preferences/ui_assets(mob/user)
|
||||
var/list/assets = list(
|
||||
// get_asset_datum(/datum/asset/spritesheet/preferences),
|
||||
get_asset_datum(/datum/asset/spritesheet/preferences),
|
||||
get_asset_datum(/datum/asset/json/preferences),
|
||||
)
|
||||
|
||||
@@ -79,6 +79,34 @@
|
||||
|
||||
return TRUE
|
||||
|
||||
if("set_color_preference")
|
||||
var/requested_preference_key = params["preference"]
|
||||
|
||||
var/datum/preference/requested_preference = GLOB.preference_entries_by_key[requested_preference_key]
|
||||
if(isnull(requested_preference))
|
||||
return FALSE
|
||||
|
||||
if(!istype(requested_preference, /datum/preference/color))
|
||||
return FALSE
|
||||
|
||||
var/default_value = read_preference(requested_preference.type)
|
||||
|
||||
// Yielding
|
||||
var/new_color = input(
|
||||
usr,
|
||||
"Select new color",
|
||||
null,
|
||||
default_value || COLOR_WHITE,
|
||||
) as color | null
|
||||
|
||||
if(!new_color)
|
||||
return FALSE
|
||||
|
||||
if(!update_preference(requested_preference, new_color))
|
||||
return FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
for(var/datum/preference_middleware/preference_middleware as anything in middleware)
|
||||
var/delegation = preference_middleware.action_delegations[action]
|
||||
if(!isnull(delegation))
|
||||
|
||||
Reference in New Issue
Block a user