diff --git a/code/__HELPERS/text.dm b/code/__HELPERS/text.dm index f8c11dd6a69..c7380d9f402 100644 --- a/code/__HELPERS/text.dm +++ b/code/__HELPERS/text.dm @@ -455,7 +455,7 @@ proc/checkhtml(var/t) // Pencode -/proc/pencode_to_html(text, mob/user, obj/item/pen/P = null, format = 1, sign = 1, fields = 1, deffont = PEN_FONT, signfont = SIGNFONT, crayonfont = CRAYON_FONT) +/proc/pencode_to_html(text, mob/user, obj/item/pen/P = null, format = 1, sign = 1, fields = 1, deffont = PEN_FONT, signfont = SIGNFONT, crayonfont = CRAYON_FONT, no_font = FALSE) text = replacetext(text, "\[b\]", "") text = replacetext(text, "\[/b\]", "") text = replacetext(text, "\[i\]", "") @@ -509,10 +509,12 @@ proc/checkhtml(var/t) text = replacetext(text, "\[cell\]", "") text = replacetext(text, "\[logo\]", "") text = replacetext(text, "\[time\]", "[station_time_timestamp()]") // TO DO - if(P) - text = "[text]" - else - text = "[text]" + if(!no_font) + if(P) + text = "[text]" + else + text = "[text]" + text = copytext(text, 1, MAX_PAPER_MESSAGE_LEN) return text diff --git a/code/game/machinery/telecomms/ntsl2.dm b/code/game/machinery/telecomms/ntsl2.dm index ee9fabd272a..fa76f98ec39 100644 --- a/code/game/machinery/telecomms/ntsl2.dm +++ b/code/game/machinery/telecomms/ntsl2.dm @@ -1,3 +1,7 @@ +#define JOB_STYLE_1 "Name (Job)" +#define JOB_STYLE_2 "Name - Job" +#define JOB_STYLE_3 "\[Job\] Name" +#define JOB_STYLE_4 "(Job) Name" GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) // Custom Implementations for NTTC /* NTTC Configuration Datum @@ -5,16 +9,125 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) * as well as allowing users to save and load configurations. */ /datum/nttc_configuration + // ALL OF THE JOB CRAP + // Dict of all jobs and their colors + var/all_jobs = list( + // AI + "AI" = "#FF00FF", + "Android" = "#FF00FF", + "Cyborg" = "#FF00FF", + "Personal AI" = "#FF00FF", + "Robot" = "#FF00FF", + // Civilian + Varients + "Assistant" = "#408010", + "Businessman" = "#408010", + "Civilian" = "#408010", + "Tourist" = "#408010", + "Trader" = "#408010", + // Command (Solo command, not department heads) + "Blueshield" = "#204090", + "Captain" = "#204090", + "Head of Personnel" = "#204090", + "Nanotrasen Representative" = "#204090", + // Engineeering + "Atmospheric Technician" = "#A66300", + "Chief Engineer" = "#A66300", + "Electrician" = "#A66300", + "Engine Technician" = "#A66300", + "Life Support Specialist" = "#A66300", + "Maintenance Technician" = "#A66300", + "Mechanic" = "#A66300", + "Station Engineer" = "#A66300", + // ERT + "Emergency Response Team Engineer" = "#5C5C7C", + "Emergency Response Team Leader" = "#5C5C7C", + "Emergency Response Team Medic" = "#5C5C7C", + "Emergency Response Team Member" = "#5C5C7C", + "Emergency Response Team Officer" = "#5C5C7C", + // Medical + "Chemist" = "#009190", + "Chief Medical Officer" = "#009190", + "Coroner" = "#009190", + "Medical Doctor" = "#009190", + "Microbiologist" = "#009190", + "Nurse" = "#009190", + "Paramedic" = "#009190", + "Pharmacologist" = "#009190", + "Pharmacist" = "#009190", + "Psychiatrist" = "#009190", + "Psychologist" = "#009190", + "Surgeon" = "#009190", + "Therapist" = "#009190", + "Virologist" = "#009190", + // Science + "Anomalist" = "#993399", + "Biomechanical Engineer" = "#993399", + "Chemical Researcher" = "#993399", + "Geneticist" = "#993399", + "Mechatronic Engineer" = "#993399", + "Plasma Researcher" = "#993399", + "Research Director" = "#993399", + "Roboticist" = "#993399", + "Scientist" = "#993399", + "Xenoarcheologist" = "#993399", + "Xenobiologist" = "#993399", + // Security + "Brig Physician" = "#A30000", + "Detective" = "#A30000", + "Forensic Technician" = "#A30000", + "Head of Security" = "#A30000", + "Human Resources Agent" = "#A30000", + "Internal Affairs Agent" = "#A30000", + "Magistrate" = "#A30000", + "Security Officer" = "#A30000", + "Security Pod Pilot" = "#A30000", + "Warden" = "#A30000", + // Supply + "Quartermaster" = "#7F6539", + "Cargo Technician" = "#7F6539", + "Shaft Miner" = "#7F6539", + "Spelunker" = "#7F6539", + // Service + "Barber" = "#80A000", + "Bartender" = "#80A000", + "Beautician" = "#80A000", + "Botanical Researcher" = "#80A000", + "Botanist" = "#80A000", + "Butcher" = "#80A000", + "Chaplain" = "#80A000", + "Chef" = "#80A000", + "Clown" = "#80A000", + "Cook" = "#80A000", + "Culinary Artist" = "#80A000", + "Custodial Technician" = "#80A000", + "Hair Stylist" = "#80A000", + "Hydroponicist" = "#80A000", + "Janitor" = "#80A000", + "Journalist" = "#80A000", + "Librarian" = "#80A000", + "Mime" = "#80A000", + ) + // Just command members + var/heads = list("Captain", "Head of Personnel", "Nanotrasen Representative", "Blueshield", "Chief Engineer", "Chief Medical Officer", "Research Director", "Head of Security") + // Just ERT + var/ert_jobs = list("Emergency Response Team Officer", "Emergency Response Team Engineer", "Emergency Response Team Medic", "Emergency Response Team Leader", "Emergency Response Team Member") + // Defined so code compiles and incase someone has a non-standard job + var/job_color = "#000000" + // NOW FOR ACTUAL TOGGLES /* Simple Toggles */ var/toggle_activated = TRUE var/toggle_jobs = FALSE + var/toggle_job_color = FALSE + var/toggle_name_color = FALSE var/toggle_timecode = FALSE + var/toggle_command_bold = FALSE // Hack section var/toggle_gibberish = FALSE var/toggle_honk = FALSE /* Strings */ var/setting_language = null + var/job_indicator_type = null /* Tables */ var/list/regex = list() @@ -38,7 +151,11 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) var/list/to_serialize = list( "toggle_activated", "toggle_jobs", + "toggle_job_color", + "toggle_name_color", + "job_indicator_type", "toggle_timecode", + "toggle_command_bold", "toggle_gibberish", "toggle_honk", "setting_language", @@ -50,7 +167,11 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) var/list/serialize_sanitize = list( "toggle_activated" = "bool", "toggle_jobs" = "bool", + "toggle_job_color" = "bool", + "toggle_name_color" = "bool", + "job_indicator_type" = "string", "toggle_timecode" = "bool", + "toggle_command_bold" = "bool", "toggle_gibberish" = "bool", "toggle_honk" = "bool", "setting_language" = "string", @@ -58,6 +179,10 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) "firewall" = "array" ) + // These are the job card styles + var/list/job_card_styles = list( + JOB_STYLE_1, JOB_STYLE_2, JOB_STYLE_3, JOB_STYLE_4 + ) // Used to determine what languages are allowable for conversion. Generated during runtime. var/list/valid_languages = list("--DISABLE--") @@ -65,13 +190,17 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) /* Simple Toggles */ toggle_activated = initial(toggle_activated) toggle_jobs = initial(toggle_jobs) + toggle_job_color = initial(toggle_job_color) + toggle_name_color = initial(toggle_name_color) toggle_timecode = initial(toggle_timecode) + toggle_command_bold = initial(toggle_command_bold) // Hack section toggle_gibberish = initial(toggle_gibberish) toggle_honk = initial(toggle_honk) /* Strings */ setting_language = initial(setting_language) + job_indicator_type = initial(job_indicator_type) /* Tables */ regex = list() @@ -142,10 +271,42 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) if(firewall.Find(signal.data["name"])) signal.data["reject"] = 1 - // These two stack properly. - // Simple job indicator switch. + // All job and coloring shit + if(toggle_job_color || toggle_name_color) + var/job = signal.data["job"] + job_color = all_jobs[job] + + if(toggle_name_color) + var/new_name = "" + signal.data["name"] + "" + signal.data["name"] = new_name + signal.data["realname"] = new_name // this is required because the broadcaster uses this directly if the speaker doesn't have a voice changer on + if(toggle_jobs) - var/new_name = signal.data["name"] + " ([signal.data["job"]]) " + var/new_name = "" + var/job = signal.data["job"] + if(job in ert_jobs) + job = "ERT" + if(toggle_job_color) + switch(job_indicator_type) + if(JOB_STYLE_1) + new_name = signal.data["name"] + " ([job]) " + if(JOB_STYLE_2) + new_name = signal.data["name"] + " - [job] " + if(JOB_STYLE_3) + new_name = "\[[job]\] " + signal.data["name"] + " " + if(JOB_STYLE_4) + new_name = "([job]) " + signal.data["name"] + " " + else + switch(job_indicator_type) + if(JOB_STYLE_1) + new_name = signal.data["name"] + " ([job]) " + if(JOB_STYLE_2) + new_name = signal.data["name"] + " - [job] " + if(JOB_STYLE_3) + new_name = "\[[job]\] " + signal.data["name"] + " " + if(JOB_STYLE_4) + new_name = "([job]) " + signal.data["name"] + " " + signal.data["name"] = new_name signal.data["realname"] = new_name // this is required because the broadcaster uses this directly if the speaker doesn't have a voice changer on @@ -155,6 +316,12 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) signal.data["name"] = new_name signal.data["realname"] = new_name // this is required because the broadcaster uses this directly if the speaker doesn't have a voice changer on + // Makes heads of staff bold + if(toggle_command_bold) + var/job = signal.data["job"] + if((job in ert_jobs) || (job in heads)) + signal.data["message"] = "" + signal.data["message"] + "" + // Hacks! // Censor dat shit like nobody's business if(toggle_gibberish) @@ -169,7 +336,6 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) new_message += pick("HoNK!", "HONK", "HOOOoONK", "HONKHONK!", "HoNnnkKK!!!", "HOOOOOOOOOOONK!!!!11!", "henk!") + " " signal.data["message"] = new_message - // Language Conversion if(setting_language && valid_languages[setting_language]) if(setting_language == "--DISABLE--") @@ -183,7 +349,7 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) var/new_message = original for(var/reg in regex) var/replacePattern = pencode_to_html(regex[reg]) - var/regex/start = regex(reg, "gi") + var/regex/start = regex("[reg]", "gi") new_message = start.Replace(new_message, replacePattern) signal.data["message"] = new_message @@ -202,6 +368,15 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) vars[var_to_toggle] = !vars[var_to_toggle] log_action(user, "toggled NTTC variable [var_to_toggle] [vars[var_to_toggle] ? "on" : "off"]") + // Job Format + if(href_list["setting_job_card_style"]) + var/card_style = input(user, "Pick a job card format.", "Job Card Format") as null|anything in job_card_styles + if(!card_style) + return + job_indicator_type = card_style + to_chat(user, "Jobs will now have the style of [card_style].") + log_action(user, "has set NTTC job card format to [card_style]", TRUE) + // Strings if(href_list["setting_language"]) var/new_language = input(user, "Pick a language to convert messages to.", "Language Conversion") as null|anything in valid_languages @@ -252,7 +427,7 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) var/list/array = vars[href_list["array"]] array.Add(new_value) to_chat(user, "Added row [new_value].") - log_action(user, "updated [href_list["array"]] - new value [new_value]") + log_action(user, "updated [href_list["array"]] - new value [new_value]", TRUE) if(href_list["delete_item"]) if(href_list["array"] && href_list["array"] in arrays) @@ -316,3 +491,4 @@ GLOBAL_DATUM_INIT(nttc_config, /datum/nttc_configuration, new()) dat += "window.updateConfig = function(config) { window.config = JSON.parse(config); window.reload_tab() };" dat += "" return dat + diff --git a/html/nttc/dist/index.html b/html/nttc/dist/index.html index 80e7a40ac81..a8a7a17f1e3 100644 --- a/html/nttc/dist/index.html +++ b/html/nttc/dist/index.html @@ -3,7 +3,7 @@ - NTSL + NTTC @@ -12,7 +12,7 @@