Adds pref to toggle vchat without 60s wait for linux users (#6980)

This commit is contained in:
Atermonera
2020-04-11 21:50:51 -07:00
committed by VirgoBot
parent 967a417ea1
commit 83c1a512e2
4 changed files with 34 additions and 7 deletions

View File

@@ -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)