diff --git a/code/modules/client/preference_setup/global/setting_datums.dm b/code/modules/client/preference_setup/global/setting_datums.dm index 99892d4d15..8fefa8c929 100644 --- a/code/modules/client/preference_setup/global/setting_datums.dm +++ b/code/modules/client/preference_setup/global/setting_datums.dm @@ -248,6 +248,12 @@ var/list/_client_preferences_by_type description ="Hear In-game Instruments" key = "SOUND_INSTRUMENT" +/datum/client_preference/vchat_enable + description = "Enable/Disable VChat" + key = "VCHAT_ENABLE" + enabled_description = "Enabled" + disabled_description = "Disabled" + /******************** * Staff Preferences * ********************/ diff --git a/code/modules/client/preferences_toggle_procs.dm b/code/modules/client/preferences_toggle_procs.dm index 4e21568c13..b8e0ea3d5c 100644 --- a/code/modules/client/preferences_toggle_procs.dm +++ b/code/modules/client/preferences_toggle_procs.dm @@ -308,6 +308,19 @@ feedback_add_details("admin_verb","THInstm") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! +/client/verb/toggle_vchat() + set name = "Toggle VChat" + set category = "Preferences" + set desc = "Enable/Disable VChat. Reloading VChat and/or reconnecting required to affect changes." + + var/pref_path = /datum/client_preference/vchat_enable + toggle_preference(pref_path) + SScharacter_setup.queue_preferences_save(prefs) + + to_chat(src, "You have toggled VChat [is_preference_enabled(pref_path) ? "on" : "off"]. \ + You will have to reload VChat and/or reconnect to the server for these changes to take place. \ + VChat message persistence is not guaranteed if you change this again before the start of the next round.") + // Not attached to a pref datum because those are strict binary toggles /client/verb/toggle_examine_mode() diff --git a/code/modules/vchat/vchat_client.dm b/code/modules/vchat/vchat_client.dm index 0e8f005136..6e0ac509b0 100644 --- a/code/modules/vchat/vchat_client.dm +++ b/code/modules/vchat/vchat_client.dm @@ -77,6 +77,10 @@ GLOBAL_DATUM_INIT(iconCache, /savefile, new("data/iconCache.sav")) //Cache of ic become_broken() return FALSE + if(!owner.is_preference_enabled(/datum/client_preference/vchat_enable)) + become_broken() + return FALSE + //Could be loaded from a previous round, are you still there? if(winget(owner,"outputwindow.htmloutput","is-visible") == "true") //Winget returns strings send_event(event = list("evttype" = "availability")) @@ -101,7 +105,7 @@ GLOBAL_DATUM_INIT(iconCache, /savefile, new("data/iconCache.sav")) //Cache of ic return owner << browse(file2text("code/modules/vchat/html/vchat.html"), "window=htmloutput") - + //Check back later spawn(15 SECONDS) if(!src) @@ -118,12 +122,12 @@ GLOBAL_DATUM_INIT(iconCache, /savefile, new("data/iconCache.sav")) //Cache of ic loaded = TRUE broken = FALSE owner.chatOutputLoadedAt = world.time - + //update_vis() //It does it's own winsets ping_cycle() send_playerinfo() load_database() - + //Perform DB shenanigans /datum/chatOutput/proc/load_database() set waitfor = FALSE @@ -144,12 +148,12 @@ GLOBAL_DATUM_INIT(iconCache, /savefile, new("data/iconCache.sav")) //Cache of ic if(!owner) qdel(src) return - + update_vis() - + spawn() alert(owner,"VChat didn't load after some time. Switching to use oldchat as a fallback. Try using 'Reload VChat' verb in OOC verbs, or reconnecting to try again.") - + //Provide the JS with who we are /datum/chatOutput/proc/send_playerinfo() if(!owner) @@ -342,7 +346,7 @@ var/to_chat_src if(C.chatOutput.broken) DIRECT_OUTPUT(C, original_message) return - + // // Client still loading, put their messages in a queue - Actually don't, logged already in database. // if(!C.chatOutput.loaded && C.chatOutput.message_queue && islist(C.chatOutput.message_queue)) // C.chatOutput.message_queue[++C.chatOutput.message_queue.len] = list("time" = time, "message" = message) diff --git a/html/changelogs/ateromnera_vchat_pref.yml b/html/changelogs/ateromnera_vchat_pref.yml new file mode 100644 index 0000000000..903399b418 --- /dev/null +++ b/html/changelogs/ateromnera_vchat_pref.yml @@ -0,0 +1,4 @@ +author: Atermonera +delete-after: True +changes: + - rscadd:"Adds a preference to forcibly disable (or enable) VChat. Useful mostly for people on linux, to skip the 60s waiting period where it tries to work and keeps you from seeing chat. Reloading VChat or reconnecting to the server are required for any changes to the preference to take effect. Support for issues that arise as a result of this preference is not guaranteed."