diff --git a/code/__DEFINES/{yogs_defines}/preferences.dm b/code/__DEFINES/{yogs_defines}/preferences.dm index a3ddf6772244..4d2b74a12002 100644 --- a/code/__DEFINES/{yogs_defines}/preferences.dm +++ b/code/__DEFINES/{yogs_defines}/preferences.dm @@ -1,12 +1,13 @@ #define DONOR_CHARACTER_SLOTS 6 -#define CHAT_LOOC (1<<10) - +#define CHAT_LOOC (1<<11) +#define GHOST_CKEY (1<<12) +#define CHAT_TYPING_INDICATOR (1<<13) #undef TOGGLES_DEFAULT_CHAT -#define TOGGLES_DEFAULT_CHAT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_PULLR|CHAT_GHOSTWHISPER|CHAT_GHOSTPDA|CHAT_GHOSTRADIO|CHAT_LOOC) +#define TOGGLES_DEFAULT_CHAT (CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_PULLR|CHAT_GHOSTWHISPER|CHAT_GHOSTPDA|CHAT_GHOSTRADIO|CHAT_BANKCARD|CHAT_LOOC|GHOST_CKEY|CHAT_TYPING_INDICATOR) + -#define GHOST_CKEY (1<<11) //YOGS pref.yogstoggles enum's diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm index bd7c84bad362..2dad63f25675 100644 --- a/code/modules/client/preferences_savefile.dm +++ b/code/modules/client/preferences_savefile.dm @@ -5,7 +5,7 @@ // You do not need to raise this if you are adding new values that have sane defaults. // Only raise this value when changing the meaning/format/name/layout of an existing value // where you would want the updater procs below to run -#define SAVEFILE_VERSION_MAX 35 +#define SAVEFILE_VERSION_MAX 37 /* SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Carn @@ -49,6 +49,8 @@ SAVEFILE UPDATING/VERSIONING - 'Simplified', or rather, more coder-friendly ~Car be_special += "Ragin Mages" if (current_version < 35) toggles |= SOUND_ALT + if (current_version < 37) + chat_toggles |= CHAT_TYPING_INDICATOR return /datum/preferences/proc/update_character(current_version, savefile/S) diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm index 3192416d9e14..4fb85927f9ab 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -18,6 +18,10 @@ if (QDELETED(src)) return + // yogs start -- typing indicators, look in yogstation specific folder for proc + handle_typing_indicator() + //yogs end + if(.) //not dead handle_blood() diff --git a/icons/mob/talk.dmi b/icons/mob/talk.dmi index 7d4845f16a45..772d4bc6f930 100644 Binary files a/icons/mob/talk.dmi and b/icons/mob/talk.dmi differ diff --git a/yogstation/code/_globalvars/configuration.dm b/yogstation/code/_globalvars/configuration.dm index 82c8522c5265..925e933b52ea 100644 --- a/yogstation/code/_globalvars/configuration.dm +++ b/yogstation/code/_globalvars/configuration.dm @@ -1,2 +1,3 @@ GLOBAL_VAR_INIT(looc_allowed, TRUE) -GLOBAL_VAR_INIT(dlooc_allowed, FALSE) \ No newline at end of file +GLOBAL_VAR_INIT(dlooc_allowed, FALSE) +GLOBAL_VAR_INIT(typing_indicators,TRUE) diff --git a/yogstation/code/modules/client/preferences_toggles.dm b/yogstation/code/modules/client/preferences_toggles.dm index b1024b6e6635..0d877e4fd6d3 100644 --- a/yogstation/code/modules/client/preferences_toggles.dm +++ b/yogstation/code/modules/client/preferences_toggles.dm @@ -16,3 +16,11 @@ TOGGLE_CHECKBOX(/datum/verbs/menu/Settings, ghost_ckey)() usr.client.prefs.chat_toggles ^= GHOST_CKEY usr.client.prefs.save_preferences() to_chat(usr, "Your ckey is [(usr.client.prefs.chat_toggles & GHOST_CKEY) ? "no longer" : "now"] visible in deadchat.") + +TOGGLE_CHECKBOX(/datum/verbs/menu/Settings, typing_indicators)() + set name = "Show/Hide typing indicators" + set category = "Preferences" + set desc = "Toggle typing indicators" + usr.client.prefs.chat_toggles ^= CHAT_TYPING_INDICATOR + usr.client.prefs.save_preferences() + to_chat(usr, "You will [(usr.client.prefs.chat_toggles & CHAT_TYPING_INDICATOR) ? "now" : "no longer"] see typing indicators.") diff --git a/yogstation/code/modules/mob/say.dm b/yogstation/code/modules/mob/say.dm index b29357823e73..04b0b0b674ac 100644 --- a/yogstation/code/modules/mob/say.dm +++ b/yogstation/code/modules/mob/say.dm @@ -1,3 +1,86 @@ +#define TYPING_INDICATOR_RANGE 7 + /mob/proc/get_say() + create_typing_indicator() + window_typing = TRUE var/msg = input(src, null, "say \"text\"") as text|null - say_verb(msg) \ No newline at end of file + window_typing = FALSE + remove_typing_indicator() + say_verb(msg) + +/mob + var/image/typing_overlay + var/list/speech_bubble_recipients + var/last_typed + var/last_typed_time + var/window_typing = FALSE + var/bar_typing = FALSE + +/mob/proc/handle_typing_indicator() + INVOKE_ASYNC(src,.proc/typing_indicator_process) + +/mob/proc/typing_indicator_process() + if(!GLOB.typing_indicators) + return + if(client) + var/temp = winget(client, "input", "text") + if(temp != last_typed) + last_typed = temp + last_typed_time = world.time + if(world.time > last_typed_time + 10 SECONDS) + bar_typing = FALSE + remove_typing_indicator() + return + if(length(temp) > 5 && findtext(temp, "Say \"", 1, 7)) + create_typing_indicator() + bar_typing = TRUE + else if(length(temp) > 3 && findtext(temp, "Me ", 1, 5)) + //set_typing_indicator(1) + else + bar_typing = FALSE + remove_typing_indicator() + + +/mob/proc/create_typing_indicator() + if(typing_overlay) + return + if(stat) + return + var/list/listening = get_hearers_in_view(TYPING_INDICATOR_RANGE, src) + speech_bubble_recipients = list() + for(var/mob/M in listening) + if(M.client && M.client.prefs.chat_toggles & CHAT_TYPING_INDICATOR) + speech_bubble_recipients.Add(M.client) + var/bubble = "default" + if(isliving(src)) + var/mob/living/L = src + bubble = L.bubble_icon + typing_overlay = image('yogstation/icons/mob/talk.dmi', src, "[bubble]_talking", FLY_LAYER) + typing_overlay.appearance_flags = APPEARANCE_UI + typing_overlay.invisibility = invisibility + typing_overlay.alpha = alpha + for(var/client/C in speech_bubble_recipients) + C.images += typing_overlay + + +/mob/proc/remove_typing_indicator() + if(!typing_overlay) + return + if(window_typing || bar_typing) + return + for(var/client/C in speech_bubble_recipients) + C.images -= typing_overlay + typing_overlay = null + speech_bubble_recipients = list() + +/mob/camera/handle_typing_indicator() //RIP in piece camera mobs + return + +/mob/camera/create_typing_indicator() + return + +/mob/camera/remove_typing_indicator() + return + + +#undef TYPING_INDICATOR_RANGE diff --git a/yogstation/icons/mob/talk.dmi b/yogstation/icons/mob/talk.dmi new file mode 100644 index 000000000000..9411d2a99826 Binary files /dev/null and b/yogstation/icons/mob/talk.dmi differ