diff --git a/code/__defines/subsystems.dm b/code/__defines/subsystems.dm index ac480237b5..728ea67cd9 100644 --- a/code/__defines/subsystems.dm +++ b/code/__defines/subsystems.dm @@ -77,6 +77,7 @@ var/global/list/runlevel_flags = list(RUNLEVEL_LOBBY, RUNLEVEL_SETUP, RUNLEVEL_G #define FIRE_PRIORITY_VOTE 9 #define FIRE_PRIORITY_AI 10 #define FIRE_PRIORITY_GARBAGE 15 +#define FIRE_PRIORITY_CHARSETUP 25 #define FIRE_PRIORITY_AIRFLOW 30 #define FIRE_PRIORITY_AIR 35 #define FIRE_PRIORITY_OBJ 40 diff --git a/code/controllers/subsystems/character_setup.dm b/code/controllers/subsystems/character_setup.dm new file mode 100644 index 0000000000..f10623bad0 --- /dev/null +++ b/code/controllers/subsystems/character_setup.dm @@ -0,0 +1,38 @@ +SUBSYSTEM_DEF(character_setup) + name = "Character Setup" + init_order = INIT_ORDER_DEFAULT + priority = FIRE_PRIORITY_CHARSETUP + flags = SS_BACKGROUND + wait = 1 SECOND + runlevels = RUNLEVEL_LOBBY | RUNLEVELS_DEFAULT + + var/list/prefs_awaiting_setup = list() + var/list/preferences_datums = list() + var/list/newplayers_requiring_init = list() + + var/list/save_queue = list() +/* +/datum/controller/subsystem/character_setup/Initialize() + while(prefs_awaiting_setup.len) + var/datum/preferences/prefs = prefs_awaiting_setup[prefs_awaiting_setup.len] + prefs_awaiting_setup.len-- + prefs.setup() + while(newplayers_requiring_init.len) + var/mob/new_player/new_player = newplayers_requiring_init[newplayers_requiring_init.len] + newplayers_requiring_init.len-- + new_player.deferred_login() + . = ..() +*/ //Might be useful if we ever switch to Bay prefs. +/datum/controller/subsystem/character_setup/fire(resumed = FALSE) + while(save_queue.len) + var/datum/preferences/prefs = save_queue[save_queue.len] + save_queue.len-- + + if(!QDELETED(prefs)) + SScharacter_setup.queue_preferences_save(prefs) + + if(MC_TICK_CHECK) + return + +/datum/controller/subsystem/character_setup/proc/queue_preferences_save(var/datum/preferences/prefs) + save_queue |= prefs \ No newline at end of file diff --git a/code/game/verbs/ignore.dm b/code/game/verbs/ignore.dm index ea1ad6a0b7..686a9ed5af 100644 --- a/code/game/verbs/ignore.dm +++ b/code/game/verbs/ignore.dm @@ -15,7 +15,7 @@ return prefs.ignored_players |= key_to_ignore - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) usr << "Now ignoring [key_to_ignore]." /client/verb/unignore(key_to_unignore as text) @@ -31,7 +31,7 @@ usr << "[key_to_unignore] isn't being ignored." return prefs.ignored_players -= key_to_unignore - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) usr << "Reverted ignore on [key_to_unignore]." /mob/proc/is_key_ignored(var/key_to_check) diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index e50441454d..448f6895d0 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -580,7 +580,7 @@ var/list/admin_verbs_event_manager = list( prefs.ooccolor = input(src, "Please select your OOC colour.", "OOC colour") as color else if(response == "Reset to default") prefs.ooccolor = initial(prefs.ooccolor) - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","OC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! return diff --git a/code/modules/client/preferences_toggle_procs.dm b/code/modules/client/preferences_toggle_procs.dm index c45970ec02..c9e240317a 100644 --- a/code/modules/client/preferences_toggle_procs.dm +++ b/code/modules/client/preferences_toggle_procs.dm @@ -10,7 +10,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear all mob speech as a ghost.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TGEars") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -25,7 +25,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] see all emotes as a ghost.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TGVision") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -40,7 +40,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear all radios as a ghost.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TGRadio") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -55,7 +55,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear dead chat as a ghost.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TDeadChat") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -70,7 +70,7 @@ to_chat(src,"You will [ (is_preference_enabled(/datum/client_preference/show_ooc)) ? "now" : "no longer"] hear global out of character chat.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -85,7 +85,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear local out of character chat.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TLOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -100,7 +100,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] have the speech indicator.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TTIND") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -115,7 +115,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] receive noise from admin messages.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TAHelp") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -130,7 +130,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear music in the lobby.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TLobMusic") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -145,7 +145,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear MIDIs from admins.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TAMidis") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -160,7 +160,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear ambient noise.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TAmbience") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -175,7 +175,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear weather sounds.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TWeatherSounds") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -190,7 +190,7 @@ to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear a hum from the supermatter.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TSupermatterHum") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -203,7 +203,7 @@ if(!role_flag) return prefs.be_special ^= role_flag - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) to_chat(src,"You will [(prefs.be_special & role_flag) ? "now" : "no longer"] be considered for [role] events (where possible).") @@ -216,7 +216,7 @@ var/pref_path = /datum/client_preference/safefiring toggle_preference(pref_path) - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) to_chat(src,"You will now use [(is_preference_enabled(/datum/client_preference/safefiring)) ? "safe" : "dangerous"] firearms firing.") @@ -229,7 +229,7 @@ var/pref_path = /datum/client_preference/mob_tooltips toggle_preference(pref_path) - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) to_chat(src,"You will now [(is_preference_enabled(/datum/client_preference/mob_tooltips)) ? "see" : "not see"] mob tooltips.") @@ -242,7 +242,7 @@ var/pref_path = /datum/client_preference/instrument_toggle toggle_preference(pref_path) - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) to_chat(src, "You will now [(is_preference_enabled(/datum/client_preference/instrument_toggle)) ? "hear" : "not hear"] instruments being played.") @@ -261,7 +261,7 @@ if(check_rights(R_ADMIN|R_DEBUG)) toggle_preference(pref_path) to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] receive debug logs.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! @@ -276,6 +276,6 @@ if(check_rights(R_ADMIN|R_MOD)) toggle_preference(pref_path) to_chat(src,"You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] receive attack logs.") - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! diff --git a/code/modules/client/ui_style.dm b/code/modules/client/ui_style.dm index 4a736aec5e..e7393e22c5 100644 --- a/code/modules/client/ui_style.dm +++ b/code/modules/client/ui_style.dm @@ -77,5 +77,5 @@ var/global/list/all_tooltip_styles = list( prefs.UI_style = UI_style_new prefs.UI_style_alpha = UI_style_alpha_new prefs.UI_style_color = UI_style_color_new - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) usr << "UI was saved" diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index e9218f8704..b75b224b30 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -423,7 +423,7 @@ src << browse('html/changelog.html', "window=changes;size=675x650") if(prefs.lastchangelog != changelog_hash) prefs.lastchangelog = changelog_hash - prefs.save_preferences() + SScharacter_setup.queue_preferences_save(prefs) winset(src, "rpane.changelog", "background-color=none;font-style=;") /mob/verb/observe() diff --git a/code/modules/mob/new_player/new_player.dm b/code/modules/mob/new_player/new_player.dm index 73e9174570..8c0bee97b6 100644 --- a/code/modules/mob/new_player/new_player.dm +++ b/code/modules/mob/new_player/new_player.dm @@ -303,7 +303,7 @@ var/savefile/F = get_server_news() if(F) client.prefs.lastnews = md5(F["body"]) - client.prefs.save_preferences() + SScharacter_setup.queue_preferences_save(client.prefs) var/dat = "
" dat += "

[F["title"]]

" diff --git a/polaris.dme b/polaris.dme index d0d96c33e1..b3b5f1ff7f 100644 --- a/polaris.dme +++ b/polaris.dme @@ -193,6 +193,7 @@ #include "code\controllers\subsystems\air.dm" #include "code\controllers\subsystems\airflow.dm" #include "code\controllers\subsystems\atoms.dm" +#include "code\controllers\subsystems\character_setup.dm" #include "code\controllers\subsystems\circuits.dm" #include "code\controllers\subsystems\events.dm" #include "code\controllers\subsystems\garbage.dm"