Files
VOREStation/code/modules/asset_cache/assets/preferences.dm
T
ShadowLarkens 31e8e009db Character Setup Rework (#17576)
* Character Setup Rework

Little tweaks

Species selection done~

Merk randomize body button

Body color and eye color

Merk more replaced code

Convert robolimbs to tgui

Add a warning if flavor text/ooc notes are too short

Custom preview icons for species selector!

A sidequest that only took 8
hours. Also add digitigrade and blood type.

Remove unused body_descriptor system completely

Finish the general tab~

Reorganization to prepare for loadout page creation

* Start of work on the loadout screen

* Only send the data that's actually selected

* Get rid of these ugly ../../../..

* Retype this to avoid conflicts

* Holy shit why did this work this way

* Finish loadout screen

* Add copy loadout function

* Finish occupation page

* Move Special Roles into general tab

* Fix path conflict

* Move size prefs to general tab

* Convert jukebox and volume settings to datum/preference

* Fix a little mergery fuckery in loadout

* Migrate jukebox to new range

* Fix TabbedMenu tabs

* Fix wordwrap for loadout screen

* Kill the vore tab, just traits left to convert

* Convert custom messages

* Convert custom species name

* Convert blood color and reagents

* Move icobase to tgui

* Finished

* This can fuck off too

* Fix a few bugs

* Update index.tsx

* initial for emote sound mode switch

* Make show_roles actually work, hide fluff items

* Fix not being able to select species

* Add emote_sound_mode to body tab

* Fix runtime when no active gear list is present

* Add a save notification to character setup

* Switch to floating

* Add more search bars

* Whoops forgot to add this

---------

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
2025-05-25 03:20:51 +02:00

70 lines
2.3 KiB
Plaintext

/datum/asset/simple/preferences
assets = list(
"preview_protean_animation.gif" = 'icons/mob/human_races/preview_protean_animation.gif',
"preview_custom_animation.gif" = 'icons/mob/human_races/preview_custom_animation.gif',
)
/// Assets generated from `/datum/preference` icons
/datum/asset/spritesheet/preferences
name = "preferences"
early = TRUE
/datum/asset/spritesheet/preferences/create_spritesheets()
var/list/to_insert = list()
for(var/preference_key in GLOB.preference_entries_by_key)
var/datum/preference/choiced/preference = GLOB.preference_entries_by_key[preference_key]
if(!istype(preference))
continue
if(!preference.should_generate_icons)
continue
for(var/preference_value in preference.get_choices())
var/create_icon_of = preference.icon_for(preference_value)
var/icon/icon
var/icon_state
if(ispath(create_icon_of, /atom))
var/atom/atom_icon_source = create_icon_of
icon = initial(atom_icon_source.icon)
icon_state = initial(atom_icon_source.icon_state)
else if(isicon(create_icon_of))
icon = create_icon_of
else
CRASH("[create_icon_of] is an invalid preference value (from [preference_key]:[preference_value]).")
to_insert[preference.get_spritesheet_key(preference.pref_serialize(preference_value))] = list(icon, icon_state)
for(var/spritesheet_key in to_insert)
var/list/inserting = to_insert[spritesheet_key]
Insert(spritesheet_key, inserting[1], inserting[2])
/// Returns the key that will be used in the spritesheet for a given value.
/datum/preference/proc/get_spritesheet_key(value)
return "[savefile_key]___[sanitize_css_class_name(value)]"
/// Sends information needed for shared details on individual preferences
/datum/asset/json/preferences
name = "preferences"
/datum/asset/json/preferences/generate()
var/list/preference_data = list()
for(var/middleware_type in subtypesof(/datum/preference_middleware))
var/datum/preference_middleware/middleware = new middleware_type
var/data = middleware.get_constant_data()
if(!isnull(data))
preference_data[middleware.key] = data
qdel(middleware)
for(var/preference_type in GLOB.preference_entries)
var/datum/preference/preference_entry = GLOB.preference_entries[preference_type]
var/data = preference_entry.compile_constant_data()
if(!isnull(data))
preference_data[preference_entry.savefile_key] = data
return preference_data