mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-08-25 13:09:11 +01:00
TGUI Say (#16160)
* TGUI Say * Add icon_ref_map.json to make tgui-dev-server stop screaming * Update tgui.bundle.js * bundle recompile --------- Co-authored-by: Heroman3003 <31296024+Heroman3003@users.noreply.github.com> Co-authored-by: Heroman <alesha3000@list.ru>
This commit is contained in:
co-authored by
Heroman3003
Heroman
parent
bd1d79aebf
commit
7a7920f29e
@@ -127,6 +127,9 @@
|
||||
asset_cache_preload_data(href_list["asset_cache_preload_data"])
|
||||
return
|
||||
|
||||
if(href_list["commandbar_typing"])
|
||||
handle_commandbar_typing(href_list)
|
||||
|
||||
switch(href_list["_src_"])
|
||||
if("holder") hsrc = holder
|
||||
if("mentorholder") hsrc = (check_rights(R_ADMIN, 0) ? holder : mentorholder)
|
||||
@@ -179,6 +182,8 @@
|
||||
GLOB.directory[ckey] = src
|
||||
|
||||
// Instantiate tgui panel
|
||||
tgui_say = new(src, "tgui_say")
|
||||
initialize_commandbar_spy()
|
||||
tgui_panel = new(src, "browseroutput")
|
||||
|
||||
GLOB.ahelp_tickets.ClientLogin(src)
|
||||
@@ -211,6 +216,7 @@
|
||||
prefs.selecting_slots = FALSE
|
||||
|
||||
// Initialize tgui panel
|
||||
tgui_say.initialize()
|
||||
tgui_panel.initialize()
|
||||
|
||||
connection_time = world.time
|
||||
|
||||
@@ -226,7 +226,13 @@ var/list/_client_preferences_by_type
|
||||
|
||||
/datum/client_preference/show_typing_indicator/toggled(var/mob/preference_mob, var/enabled)
|
||||
if(!enabled)
|
||||
preference_mob.set_typing_indicator(FALSE)
|
||||
preference_mob.client?.stop_thinking()
|
||||
|
||||
/datum/client_preference/show_typing_indicator_subtle
|
||||
description ="Typing indicator (subtle)"
|
||||
key = "SHOW_TYPING_SUBTLE"
|
||||
enabled_description = "Show"
|
||||
disabled_description = "Hide"
|
||||
|
||||
/datum/client_preference/show_ooc
|
||||
description ="OOC chat"
|
||||
@@ -401,6 +407,19 @@ var/list/_client_preferences_by_type
|
||||
enabled_description = "Automatic"
|
||||
disabled_description = "Manual Only"
|
||||
|
||||
/datum/client_preference/tgui_say
|
||||
description = "TGUI Say: Use TGUI For Say Input"
|
||||
key = "TGUI_SAY"
|
||||
enabled_by_default = TRUE
|
||||
enabled_description = "Yes"
|
||||
disabled_description = "No"
|
||||
|
||||
/datum/client_preference/tgui_say_light
|
||||
description = "TGUI Say: Use Light Mode"
|
||||
key = "TGUI_SAY_LIGHT_MODE"
|
||||
enabled_by_default = FALSE
|
||||
enabled_description = "Yes"
|
||||
disabled_description = "No"
|
||||
|
||||
/********************
|
||||
* Staff Preferences *
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#define IC_VERBS list("say", "me", "whisper", "subtle")
|
||||
|
||||
/client/var/commandbar_thinking = FALSE
|
||||
/client/var/commandbar_typing = FALSE
|
||||
|
||||
/client/proc/initialize_commandbar_spy()
|
||||
src << output('html/typing_indicator.html', "commandbar_spy")
|
||||
|
||||
/client/proc/handle_commandbar_typing(href_list)
|
||||
if(!is_preference_enabled(/datum/client_preference/show_typing_indicator))
|
||||
return
|
||||
|
||||
if(length(href_list["verb"]) < 1 || !(lowertext(href_list["verb"]) in IC_VERBS) || text2num(href_list["argument_length"]) < 1)
|
||||
if(commandbar_typing)
|
||||
commandbar_typing = FALSE
|
||||
stop_typing()
|
||||
|
||||
if(commandbar_thinking)
|
||||
commandbar_thinking = FALSE
|
||||
stop_thinking()
|
||||
return
|
||||
|
||||
if(!commandbar_thinking)
|
||||
commandbar_thinking = TRUE
|
||||
start_thinking(href_list["verb"])
|
||||
|
||||
if(!commandbar_typing)
|
||||
commandbar_typing = TRUE
|
||||
start_typing(href_list["verb"])
|
||||
|
||||
|
||||
/** Sets the mob as "thinking" - with indicator and the TRAIT_THINKING_IN_CHARACTER trait */
|
||||
/client/proc/start_thinking(channel)
|
||||
if(!is_preference_enabled(/datum/client_preference/show_typing_indicator))
|
||||
return FALSE
|
||||
if(channel == "Whis" || channel == "Subtle" || channel == "whisper" || channel == "subtle")
|
||||
if(!is_preference_enabled(/datum/client_preference/show_typing_indicator_subtle))
|
||||
return FALSE
|
||||
ADD_TRAIT(mob, TRAIT_THINKING_IN_CHARACTER, CURRENTLY_TYPING_TRAIT)
|
||||
mob.create_thinking_indicator()
|
||||
|
||||
/** Removes typing/thinking indicators and flags the mob as not thinking */
|
||||
/client/proc/stop_thinking(channel)
|
||||
mob?.remove_all_indicators()
|
||||
|
||||
/**
|
||||
* Handles the user typing. After a brief period of inactivity,
|
||||
* signals the client mob to revert to the "thinking" icon.
|
||||
*/
|
||||
/client/proc/start_typing(channel)
|
||||
var/mob/client_mob = mob
|
||||
client_mob.remove_thinking_indicator()
|
||||
if(!is_preference_enabled(/datum/client_preference/show_typing_indicator) || !HAS_TRAIT(client_mob, TRAIT_THINKING_IN_CHARACTER))
|
||||
return FALSE
|
||||
if(channel == "Whis" || channel == "Subtle" || channel == "whisper" || channel == "subtle")
|
||||
if(!is_preference_enabled(/datum/client_preference/show_typing_indicator_subtle))
|
||||
return FALSE
|
||||
client_mob.create_typing_indicator()
|
||||
addtimer(CALLBACK(src, PROC_REF(stop_typing), channel), 5 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE | TIMER_STOPPABLE)
|
||||
|
||||
/**
|
||||
* Callback to remove the typing indicator after a brief period of inactivity.
|
||||
* If the user was typing IC, the thinking indicator is shown.
|
||||
*/
|
||||
/client/proc/stop_typing(channel)
|
||||
if(isnull(mob))
|
||||
return FALSE
|
||||
var/mob/client_mob = mob
|
||||
client_mob.remove_typing_indicator()
|
||||
if(!is_preference_enabled(/datum/client_preference/show_typing_indicator) || !HAS_TRAIT(client_mob, TRAIT_THINKING_IN_CHARACTER))
|
||||
return FALSE
|
||||
if(channel == "Whis" || channel == "Subtle" || channel == "whisper" || channel == "subtle")
|
||||
if(!is_preference_enabled(/datum/client_preference/show_typing_indicator_subtle))
|
||||
return FALSE
|
||||
client_mob.create_thinking_indicator()
|
||||
|
||||
#undef IC_VERBS
|
||||
Reference in New Issue
Block a user