mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-20 03:26:37 +01:00
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>
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
/datum/preference_middleware/bay_adapter
|
||||
key = "legacy"
|
||||
|
||||
/datum/preference_middleware/bay_adapter/get_ui_data(mob/user)
|
||||
var/list/data = ..()
|
||||
|
||||
if(preferences.current_window != PREFERENCE_TAB_CHARACTER_PREFERENCES)
|
||||
return data
|
||||
|
||||
var/list/legacy = list()
|
||||
if(preferences.player_setup.selected_category)
|
||||
for(var/datum/category_item/player_setup_item/item as anything in preferences.player_setup.selected_category.items)
|
||||
legacy += item.tgui_data(user)
|
||||
data["selected_category"] = list(
|
||||
"name" = preferences.player_setup.selected_category.name,
|
||||
"items" = legacy,
|
||||
)
|
||||
|
||||
data["preview_loadout"] = preferences.equip_preview_mob & EQUIP_PREVIEW_LOADOUT
|
||||
data["preview_job_gear"] = preferences.equip_preview_mob & EQUIP_PREVIEW_JOB
|
||||
data["preview_animations"] = preferences.animations_toggle
|
||||
|
||||
return data
|
||||
|
||||
/datum/preference_middleware/bay_adapter/get_ui_static_data(mob/user)
|
||||
var/list/data = ..()
|
||||
|
||||
if(preferences.current_window != PREFERENCE_TAB_CHARACTER_PREFERENCES)
|
||||
return data
|
||||
|
||||
var/list/categories_data = list()
|
||||
for(var/datum/category_group/player_setup_category/category as anything in preferences.player_setup.categories)
|
||||
UNTYPED_LIST_ADD(categories_data, category.name)
|
||||
data["categories"] = categories_data
|
||||
|
||||
var/list/legacy = list()
|
||||
if(preferences.player_setup.selected_category)
|
||||
var/list/items = preferences.player_setup.selected_category.items
|
||||
for(var/datum/category_item/player_setup_item/item as anything in items)
|
||||
legacy += item.tgui_static_data(user)
|
||||
data["selected_category_static"] = legacy
|
||||
|
||||
return data
|
||||
|
||||
/datum/preference_middleware/bay_adapter/get_constant_data()
|
||||
var/list/data = list()
|
||||
|
||||
var/datum/category_collection/player_setup_collection/collection = new()
|
||||
|
||||
var/list/categories = collection.categories
|
||||
for(var/datum/category_group/player_setup_category/category as anything in categories)
|
||||
for(var/datum/category_item/player_setup_item/item as anything in category.items)
|
||||
data += item.tgui_constant_data()
|
||||
|
||||
return data
|
||||
|
||||
/datum/category_item/player_setup_item/proc/tgui_constant_data()
|
||||
return list()
|
||||
|
||||
|
||||
/datum/preference_middleware/bay_adapter/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
|
||||
switch(action)
|
||||
if("cycle_background")
|
||||
preferences.bgstate = next_in_list(preferences.bgstate, preferences.bgstate_options)
|
||||
preferences.update_preview_icon()
|
||||
return TRUE
|
||||
if("toggle_preview_loadout")
|
||||
preferences.equip_preview_mob ^= EQUIP_PREVIEW_LOADOUT
|
||||
preferences.update_preview_icon()
|
||||
return TRUE
|
||||
if("toggle_preview_job_gear")
|
||||
preferences.equip_preview_mob ^= EQUIP_PREVIEW_JOB
|
||||
preferences.update_preview_icon()
|
||||
return TRUE
|
||||
if("toggle_preview_animations")
|
||||
preferences.animations_toggle = !preferences.animations_toggle
|
||||
preferences.update_preview_icon()
|
||||
return TRUE
|
||||
|
||||
for(var/datum/category_group/player_setup_category/category as anything in preferences.player_setup.categories)
|
||||
for(var/datum/category_item/player_setup_item/item as anything in category.items)
|
||||
. = item.tgui_act(action, params, ui, state)
|
||||
if(.)
|
||||
if(. & TOPIC_UPDATE_PREVIEW)
|
||||
preferences.update_preview_icon()
|
||||
return
|
||||
@@ -0,0 +1,4 @@
|
||||
/// Remaps jukebox volume from 0-1 to 0-100.
|
||||
/datum/preferences/proc/migration_18_jukebox(datum/json_savefile/S)
|
||||
S.set_entry("media_volume", S.get_entry("media_volume") * 100)
|
||||
S.save()
|
||||
@@ -183,3 +183,21 @@
|
||||
/datum/preference/text/living/private_notes/apply_to_living(mob/living/target, value)
|
||||
target.private_notes = value
|
||||
return
|
||||
|
||||
/datum/preference/choiced/living/emote_sound_mode
|
||||
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED
|
||||
savefile_identifier = PREFERENCE_CHARACTER
|
||||
savefile_key = "emote_sound_mode"
|
||||
|
||||
/datum/preference/choiced/living/emote_sound_mode/init_possible_values()
|
||||
return list(
|
||||
EMOTE_SOUND_NO_FREQ,
|
||||
EMOTE_SOUND_VOICE_FREQ,
|
||||
EMOTE_SOUND_VOICE_LIST,
|
||||
)
|
||||
|
||||
/datum/preference/choiced/living/emote_sound_mode/apply_to_living(mob/living/target, value)
|
||||
target.emote_sound_mode = value
|
||||
|
||||
/datum/preference/choiced/living/emote_sound_mode/create_informed_default_value(datum/preferences/preferences)
|
||||
return EMOTE_SOUND_VOICE_FREQ
|
||||
|
||||
@@ -148,3 +148,102 @@
|
||||
|
||||
/datum/preference/numeric/ambience_chance/create_default_value()
|
||||
return 35
|
||||
|
||||
// Volume channels
|
||||
/datum/preference/volume_channels
|
||||
category = PREFERENCE_CATEGORY_MANUALLY_RENDERED
|
||||
savefile_key = "volume_channels"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
|
||||
/datum/preference/volume_channels/pref_deserialize(input, datum/preferences/preferences)
|
||||
if(!islist(input))
|
||||
return list()
|
||||
|
||||
for(var/channel in input)
|
||||
if(!(channel in GLOB.all_volume_channels))
|
||||
// Channel no longer exists, yeet
|
||||
input -= channel
|
||||
|
||||
for(var/channel in GLOB.all_volume_channels)
|
||||
if(!(channel in input))
|
||||
input["[channel]"] = 1
|
||||
else
|
||||
input["[channel]"] = clamp(input["[channel]"], 0, 2)
|
||||
|
||||
return input
|
||||
|
||||
/datum/preference/volume_channels/is_valid(value)
|
||||
return islist(value)
|
||||
|
||||
|
||||
/mob/proc/get_preference_volume_channel(volume_channel)
|
||||
if(!client)
|
||||
return 0
|
||||
return client.get_preference_volume_channel(volume_channel)
|
||||
|
||||
/client/proc/get_preference_volume_channel(volume_channel)
|
||||
if(!volume_channel || !prefs)
|
||||
return 1
|
||||
|
||||
var/list/volume_channels = prefs.read_preference(/datum/preference/volume_channels)
|
||||
return volume_channels["[volume_channel]"]
|
||||
|
||||
// Neat little volume adjuster thing in case you don't wanna touch preferences by hand you lazy fuck
|
||||
/datum/volume_panel
|
||||
/datum/volume_panel/tgui_state(mob/user)
|
||||
return GLOB.tgui_always_state
|
||||
|
||||
/datum/volume_panel/tgui_interact(mob/user, datum/tgui/ui, datum/tgui/parent_ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "VolumePanel", "Volume Panel")
|
||||
ui.open()
|
||||
|
||||
/datum/volume_panel/tgui_data(mob/user)
|
||||
if(!user.client || !user.client.prefs)
|
||||
return list("error" = TRUE)
|
||||
|
||||
var/list/data = ..()
|
||||
data["volume_channels"] = user.client.prefs.read_preference(/datum/preference/volume_channels)
|
||||
return data
|
||||
|
||||
/datum/volume_panel/tgui_act(action, params, datum/tgui/ui)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
if(!ui.user?.client?.prefs)
|
||||
return TRUE
|
||||
|
||||
var/datum/preferences/P = ui.user.client.prefs
|
||||
var/list/volume_channels = P.read_preference(/datum/preference/volume_channels)
|
||||
|
||||
switch(action)
|
||||
if("adjust_volume")
|
||||
var/channel = params["channel"]
|
||||
if(channel in volume_channels)
|
||||
volume_channels["[channel]"] = clamp(params["vol"], 0, 2)
|
||||
P.write_preference_by_type(/datum/preference/volume_channels, volume_channels)
|
||||
return TRUE
|
||||
|
||||
/client/verb/volume_panel()
|
||||
set name = "Volume Panel"
|
||||
set category = "Preferences.Sounds"
|
||||
set desc = "Allows you to adjust volume levels on the fly."
|
||||
|
||||
if(!volume_panel)
|
||||
volume_panel = new(src)
|
||||
|
||||
volume_panel.tgui_interact(mob)
|
||||
|
||||
// Jukebox volume
|
||||
/datum/preference/numeric/living/jukebox_volume
|
||||
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
|
||||
savefile_key = "media_volume"
|
||||
savefile_identifier = PREFERENCE_PLAYER
|
||||
|
||||
minimum = 0
|
||||
maximum = 100
|
||||
step = 1
|
||||
|
||||
/datum/preference/numeric/living/jukebox_volume/apply_to_client_updated(client/client, value)
|
||||
client?.media?.update_volume(value)
|
||||
|
||||
Reference in New Issue
Block a user