[MIRROR] Time: Stamped (#7001)

Co-authored-by: Casey <a.roaming.shadow@gmail.com>
Co-authored-by: Raeschen <rycoop29@gmail.com>
This commit is contained in:
CHOMPStation2
2023-09-18 09:11:58 -07:00
committed by GitHub
parent 86fed82d17
commit fee6e944d3
5 changed files with 44 additions and 8 deletions

View File

@@ -16,6 +16,7 @@
S["tgui_input_mode"] >> pref.tgui_input_mode
S["tgui_large_buttons"] >> pref.tgui_large_buttons
S["tgui_swapped_buttons"] >> pref.tgui_swapped_buttons
S["chat_timestamp"] >> pref.chat_timestamp
/datum/category_item/player_setup_item/player_global/ui/save_preferences(var/savefile/S)
S["UI_style"] << pref.UI_style
@@ -31,6 +32,7 @@
S["tgui_input_mode"] << pref.tgui_input_mode
S["tgui_large_buttons"] << pref.tgui_large_buttons
S["tgui_swapped_buttons"] << pref.tgui_swapped_buttons
S["chat_timestamp"] << pref.chat_timestamp
/datum/category_item/player_setup_item/player_global/ui/sanitize_preferences()
pref.UI_style = sanitize_inlist(pref.UI_style, all_ui_styles, initial(pref.UI_style))
@@ -46,6 +48,7 @@
pref.tgui_input_mode = sanitize_integer(pref.tgui_input_mode, 0, 1, initial(pref.tgui_input_mode))
pref.tgui_large_buttons = sanitize_integer(pref.tgui_large_buttons, 0, 1, initial(pref.tgui_large_buttons))
pref.tgui_swapped_buttons = sanitize_integer(pref.tgui_swapped_buttons, 0, 1, initial(pref.tgui_swapped_buttons))
pref.chat_timestamp = sanitize_integer(pref.chat_timestamp, 0, 1, initial(pref.chat_timestamp))
/datum/category_item/player_setup_item/player_global/ui/content(var/mob/user)
. = "<b>UI Style:</b> <a href='?src=\ref[src];select_style=1'><b>[pref.UI_style]</b></a><br>"
@@ -61,6 +64,7 @@
. += "<b>TGUI Input Framework:</b> <a href='?src=\ref[src];tgui_input_mode=1'><b>[(pref.tgui_input_mode) ? "Enabled" : "Disabled (default)"]</b></a><br>"
. += "<b>TGUI Large Buttons:</b> <a href='?src=\ref[src];tgui_large_buttons=1'><b>[(pref.tgui_large_buttons) ? "Enabled (default)" : "Disabled"]</b></a><br>"
. += "<b>TGUI Swapped Buttons:</b> <a href='?src=\ref[src];tgui_swapped_buttons=1'><b>[(pref.tgui_swapped_buttons) ? "Enabled" : "Disabled (default)"]</b></a><br>"
. += "<b>Chat Timestamps:</b> <a href='?src=\ref[src];chat_timestamps=1'><b>[(pref.chat_timestamp) ? "Enabled" : "Disabled (default)"]</b></a><br>"
if(can_select_ooc_color(user))
. += "<b>OOC Color:</b>"
if(pref.ooccolor == initial(pref.ooccolor))
@@ -142,6 +146,10 @@
pref.tgui_swapped_buttons = !pref.tgui_swapped_buttons
return TOPIC_REFRESH
else if(href_list["chat_timestamps"])
pref.chat_timestamp = !pref.chat_timestamp
return TOPIC_REFRESH
else if(href_list["reset"])
switch(href_list["reset"])
if("ui")

View File

@@ -31,6 +31,7 @@ var/list/preferences_datums = list()
var/tgui_input_mode = FALSE // All the Input Boxes (Text,Number,List,Alert)
var/tgui_large_buttons = TRUE
var/tgui_swapped_buttons = FALSE
var/chat_timestamp = FALSE
//character preferences
var/real_name //our character's name

View File

@@ -379,6 +379,16 @@
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.")
/client/verb/toggle_chat_timestamps()
set name = "Toggle Chat Timestamps"
set category = "Preferences"
set desc = "Toggles whether or not messages in chat will display timestamps. Enabling this will not add timestamps to messages that have already been sent."
prefs.chat_timestamp = !prefs.chat_timestamp //There is no preference datum for tgui input lock, nor for any TGUI prefs.
SScharacter_setup.queue_preferences_save(prefs)
to_chat(src, span_notice("You have toggled chat timestamps: [prefs.chat_timestamp ? "ON" : "OFF"]."))
/client/verb/toggle_status_indicators()
set name = "Toggle Status Indicators"
set category = "Preferences"

View File

@@ -138,15 +138,28 @@
ai_holder.on_hear_say(speaker, multilingual_to_message(message_pieces))
/mob/proc/on_hear_say(var/message)
var/time = say_timestamp()
if(client)
if(client.prefs.chat_timestamp)
to_chat(src, "<span class='game say'>[time] [message]</span>")
else
to_chat(src, "<span class='game say'>[message]</span>")
if(teleop)
else if(teleop)
to_chat(teleop, "<span class='game say'>[create_text_tag("body", "BODY:", teleop.client)][message]</span>")
else
to_chat(src, "<span class='game say'>[message]</span>")
/mob/living/silicon/on_hear_say(var/message)
var/time = say_timestamp()
if(client)
if(client.prefs.chat_timestamp)
to_chat(src, "<span class='game say'>[time] [message]</span>")
if(teleop)
to_chat(teleop, "<span class='game say'>[create_text_tag("body", "BODY:", teleop.client)][time] [message]</span>")
else
to_chat(src, "<span class='game say'>[message]</span>")
else if(teleop)
to_chat(teleop, "<span class='game say'>[create_text_tag("body", "BODY:", teleop.client)][message]</span>")
else
to_chat(src, "<span class='game say'>[message]</span>")
// Checks if the mob's own name is included inside message. Handles both first and last names.
/mob/proc/check_mentioned(var/message)
@@ -199,7 +212,7 @@
on_hear_radio(part_a, part_b, speaker_name, track, part_c, message, part_d, part_e)
/proc/say_timestamp()
return "<span class='say_quote'>\[[stationtime2text()]\]</span>"
return "<span class='say_quote'>\[[time2text(world.timeofday, "hh:mm")]\]</span>"
/mob/proc/on_hear_radio(part_a, part_b, speaker_name, track, part_c, formatted, part_d, part_e)
var/final_message = "[part_b][speaker_name][part_c][formatted][part_d]"

View File

@@ -46,6 +46,7 @@
return ..()
/mob/proc/show_message(msg, type, alt, alt_type)//Message, type of message (1 or 2), alternative message, alt message type (1 or 2)
var/time = say_timestamp()
if(!client && !teleop) return
@@ -68,9 +69,12 @@
if(stat == UNCONSCIOUS || sleeping > 0)
to_chat(src, "<span class='filter_notice'><I>... You can almost hear someone talking ...</I></span>")
else
to_chat(src,msg)
if(teleop)
if(client.prefs.chat_timestamp)
to_chat(src,"[time] [msg]")
else if(teleop)
to_chat(teleop, create_text_tag("body", "BODY:", teleop.client) + "[msg]")
else
to_chat(src,msg)
return
// Show a message to all mobs and objects in sight of this one