From b9bd7bb37351a734fff77704a56275a67fe62067 Mon Sep 17 00:00:00 2001 From: Matt Atlas Date: Sat, 24 Jul 2021 20:49:22 +0200 Subject: [PATCH] Adds a preference to toggle Goonchat off. (#12177) As per title. Goon chat will be on by default. Note that icons beyond accents are not supported in the old chat. This won't impact your playing experience by that much, considering they're often unnecessary and none are vital. If you are using the dark mode, accent icons will most likely not load for you. You will have to restart your game. --- SQL/migrate/V069__goonchat_pref.sql | 5 +++ code/__defines/misc.dm | 1 + .../preference_setup/global/02_settings.dm | 18 +++++++- .../browserassets/js/browserOutput.js | 4 ++ code/modules/mob/abstract/unauthed/login.dm | 2 - code/modules/mob/login.dm | 5 ++- code/modules/mob/mob_helpers.dm | 7 +++- code/stylesheet.dm | 1 + html/changelogs/mattatlas-goonchatpref.yml | 41 +++++++++++++++++++ 9 files changed, 77 insertions(+), 7 deletions(-) create mode 100644 SQL/migrate/V069__goonchat_pref.sql create mode 100644 html/changelogs/mattatlas-goonchatpref.yml diff --git a/SQL/migrate/V069__goonchat_pref.sql b/SQL/migrate/V069__goonchat_pref.sql new file mode 100644 index 00000000000..2241dbc8f68 --- /dev/null +++ b/SQL/migrate/V069__goonchat_pref.sql @@ -0,0 +1,5 @@ +-- +-- Set default 'On' for 'GOONCHAT_ON in toggles_secondary' +-- + +UPDATE `ss13_player_preferences` SET `toggles_secondary` = `toggles_secondary` | 64; \ No newline at end of file diff --git a/code/__defines/misc.dm b/code/__defines/misc.dm index 5727a024149..c500e83c6ff 100644 --- a/code/__defines/misc.dm +++ b/code/__defines/misc.dm @@ -65,6 +65,7 @@ #define PARALLAX_IS_STATIC 0x8 #define FLOATING_MESSAGES 0x10 #define HOTKEY_DEFAULT 0x20 +#define GOONCHAT_ON 0x40 #define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS|CHAT_LOOC|CHAT_GHOSTLOOC) diff --git a/code/modules/client/preference_setup/global/02_settings.dm b/code/modules/client/preference_setup/global/02_settings.dm index 1c654a2a72c..53b66f76899 100644 --- a/code/modules/client/preference_setup/global/02_settings.dm +++ b/code/modules/client/preference_setup/global/02_settings.dm @@ -97,7 +97,8 @@ "Progress Bars: [(pref.toggles_secondary & PROGRESS_BARS) ? "Yes" : "No"]
", "Floating Messages: [(pref.toggles_secondary & FLOATING_MESSAGES) ? "Yes" : "No"]
", "Static Space: [(pref.toggles_secondary & PARALLAX_IS_STATIC) ? "Yes" : "No"]
", - "Hotkey Mode Default: [(pref.toggles_secondary & HOTKEY_DEFAULT) ? "On" : "Off"]
" + "Hotkey Mode Default: [(pref.toggles_secondary & HOTKEY_DEFAULT) ? "On" : "Off"]
", + "Goonchat: [(pref.toggles_secondary & GOONCHAT_ON) ? "On" : "Off"]
" ) . = dat.Join() @@ -116,10 +117,25 @@ if(href_list["paratoggle"]) var/flag = text2num(href_list["paratoggle"]) pref.toggles_secondary ^= flag + toggle_flag(flag) return TOPIC_REFRESH return ..() +/datum/category_item/player_setup_item/player_global/settings/proc/toggle_flag(var/flag) + var/mob/M = preference_mob() + var/client/C = M.client + switch(flag) + if(GOONCHAT_ON) + if(pref.toggles_secondary & GOONCHAT_ON) + C.chatOutput.loaded = FALSE + C.chatOutput.start() + else + C.chatOutput.ehjax_send(data = "setWhiteTheme") + winset(C, "output", "is-visible=true;is-disabled=false") + winset(C, "browseroutput", "is-visible=false") + to_chat(C, "If you had dark mode on with Goonchat prior to switching chats, your accent icons will probably not work. Restart your game.") + /datum/category_item/player_setup_item/player_global/settings/proc/validate_current_character() if (!establish_db_connection(dbcon)) return pref.current_character diff --git a/code/modules/goonchat/browserassets/js/browserOutput.js b/code/modules/goonchat/browserassets/js/browserOutput.js index 1146c8b98d8..54125be38d3 100644 --- a/code/modules/goonchat/browserassets/js/browserOutput.js +++ b/code/modules/goonchat/browserassets/js/browserOutput.js @@ -517,6 +517,10 @@ function ehjaxCallback(data) { opts.pingTime = Date.now(); runByond('?_src_=chat&proc=ping'); + } else if (data == 'setWhiteTheme'){ + setTheme('white'); + savedConfig.stheme = 'white'; + } else if (data == 'pong') { if (opts.pingDisabled) {return;} opts.pongTime = Date.now(); diff --git a/code/modules/mob/abstract/unauthed/login.dm b/code/modules/mob/abstract/unauthed/login.dm index b319c2f36c1..d0d8a229826 100644 --- a/code/modules/mob/abstract/unauthed/login.dm +++ b/code/modules/mob/abstract/unauthed/login.dm @@ -11,8 +11,6 @@ /mob/abstract/unauthed/LateLogin() SHOULD_CALL_PARENT(FALSE) - client.chatOutput.start() //We have to unfortunately put this here too since the LateLogin chains are disconnected. - update_Login_details() to_chat(src, "You need to authenticate before you can continue.") token = md5("[client.ckey][client.computer_id][world.time][rand()]") diff --git a/code/modules/mob/login.dm b/code/modules/mob/login.dm index 9a551a772da..95b9e597e43 100644 --- a/code/modules/mob/login.dm +++ b/code/modules/mob/login.dm @@ -71,8 +71,6 @@ player_age = client.player_age - client.chatOutput.start() - if(loc && !isturf(loc)) client.eye = loc client.perspective = EYE_PERSPECTIVE @@ -95,3 +93,6 @@ // Check code/modules/admin/verbs/antag-ooc.dm for definition client.add_aooc_if_necessary() + + if(client.prefs.toggles_secondary & GOONCHAT_ON) + client.chatOutput.start() diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index 6d02cd6e20f..c00cc573962 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -1170,8 +1170,11 @@ proc/is_blind(A) var/datum/accent/a = SSrecords.accents[used_accent] if(istype(a)) var/final_icon = a.tag_icon - var/datum/asset/spritesheet/S = get_asset_datum(/datum/asset/spritesheet/goonchat) - return S.icon_tag(final_icon) + if(client.prefs.toggles_secondary & GOONCHAT_ON) + var/datum/asset/spritesheet/S = get_asset_datum(/datum/asset/spritesheet/goonchat) + return S.icon_tag(final_icon) + else + return "" /mob/proc/flash_eyes(intensity = FLASH_PROTECTION_MODERATE, override_blindness_check = FALSE, affect_silicon = FALSE, visual = FALSE, type = /obj/screen/fullscreen/flash) for(var/mob/M in contents) diff --git a/code/stylesheet.dm b/code/stylesheet.dm index 82ed522058e..1f4dc480b4c 100644 --- a/code/stylesheet.dm +++ b/code/stylesheet.dm @@ -66,6 +66,7 @@ em {font-style: normal;font-weight: bold;} .say {} .alert {color: #ff0000;} h1.alert, h2.alert {color: #000000;} +.vote {color: #6c18c0} .emote {font-style: italic;} diff --git a/html/changelogs/mattatlas-goonchatpref.yml b/html/changelogs/mattatlas-goonchatpref.yml new file mode 100644 index 00000000000..efae89c5cdb --- /dev/null +++ b/html/changelogs/mattatlas-goonchatpref.yml @@ -0,0 +1,41 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - rscadd: "Added a Goonchat preference to the Global tab. If this preference is off, Goonchat will not load. If you were using darkmode Goonchat, note that your accent icons will most likely not work until you restart the game."