mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
Merge pull request #10258 from AffectedArc07/nttc-additions
NTTC Fixes And Features
This commit is contained in:
@@ -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\]", "<B>")
|
||||
text = replacetext(text, "\[/b\]", "</B>")
|
||||
text = replacetext(text, "\[i\]", "<I>")
|
||||
@@ -509,10 +509,12 @@ proc/checkhtml(var/t)
|
||||
text = replacetext(text, "\[cell\]", "<td>")
|
||||
text = replacetext(text, "\[logo\]", "<img src = ntlogo.png>")
|
||||
text = replacetext(text, "\[time\]", "[station_time_timestamp()]") // TO DO
|
||||
if(P)
|
||||
text = "<font face=\"[deffont]\" color=[P ? P.colour : "black"]>[text]</font>"
|
||||
else
|
||||
text = "<font face=\"[deffont]\">[text]</font>"
|
||||
if(!no_font)
|
||||
if(P)
|
||||
text = "<font face=\"[deffont]\" color=[P ? P.colour : "black"]>[text]</font>"
|
||||
else
|
||||
text = "<font face=\"[deffont]\">[text]</font>"
|
||||
|
||||
text = copytext(text, 1, MAX_PAPER_MESSAGE_LEN)
|
||||
return text
|
||||
|
||||
|
||||
@@ -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 = "<font color=\"[job_color]\">" + signal.data["name"] + "</font>"
|
||||
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"] + " <font color=\"[job_color]\">([job])</font> "
|
||||
if(JOB_STYLE_2)
|
||||
new_name = signal.data["name"] + " - <font color=\"[job_color]\">[job]</font> "
|
||||
if(JOB_STYLE_3)
|
||||
new_name = "<font color=\"[job_color]\"><small>\[[job]\]</small></font> " + signal.data["name"] + " "
|
||||
if(JOB_STYLE_4)
|
||||
new_name = "<font color=[job_color]>([job])</font> " + 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 = "<small>\[[job]\]</small> " + 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"] = "<b>" + signal.data["message"] + "</b>"
|
||||
|
||||
// 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, "<span class='notice'>Jobs will now have the style of [card_style].</span>")
|
||||
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, "<span class='notice'>Added row [new_value].</span>")
|
||||
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 += "</script>"
|
||||
return dat
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -3,7 +3,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<head>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
<title>NTSL</title>
|
||||
<title>NTTC</title>
|
||||
<script type="text/javascript" src="bundle.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="bundle.css">
|
||||
</head>
|
||||
@@ -12,7 +12,7 @@
|
||||
<div id="navbar">
|
||||
<img src="uiTitleFluff.png">
|
||||
<div class="navBtn" data-tab="home">Home</div>
|
||||
<div class="navBtn" data-tab="filtering">Filtering</div>
|
||||
<div class="navBtn" data-tab="filtering">Configuration</div>
|
||||
<div class="navBtn" data-tab="regex">Regex</div>
|
||||
<div class="navBtn" style="display:none" data-locked="1" data-tab="firewall">Firewall</div>
|
||||
<div class="navBtn hackBtn" style="display:none" data-locked="1" data-tab="hack"><span class='hack'>1337</span></div>
|
||||
|
||||
Vendored
+17
-1
@@ -1,10 +1,26 @@
|
||||
<div>
|
||||
<h2>Filtering Settings</h2>
|
||||
<h2>Configuration</h2>
|
||||
<table class="tblConfig">
|
||||
<tr>
|
||||
<td>Announce Jobs?</td>
|
||||
<td><activeLink data-sconfig="toggle_jobs" data-href="toggle=toggle_jobs"></activeLink></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Job Announcement Format:</td>
|
||||
<td><activeLink data-aconfig="job_indicator_type" data-href="setting_job_card_style=1"></activeLink></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Theme Jobs?</td>
|
||||
<td><activeLink data-sconfig="toggle_job_color" data-href="toggle=toggle_job_color"></activeLink></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Theme Names?</td>
|
||||
<td><activeLink data-sconfig="toggle_name_color" data-href="toggle=toggle_name_color"></activeLink></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Louder Command Members</td>
|
||||
<td><activeLink data-sconfig="toggle_command_bold" data-href="toggle=toggle_command_bold"></activeLink></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Announce Timecodes?</td>
|
||||
<td><activeLink data-sconfig="toggle_timecode" data-href="toggle=toggle_timecode"></activeLink></td>
|
||||
|
||||
@@ -1,10 +1,26 @@
|
||||
<div>
|
||||
<h2>Filtering Settings</h2>
|
||||
<h2>Configuration</h2>
|
||||
<table class="tblConfig">
|
||||
<tr>
|
||||
<td>Announce Jobs?</td>
|
||||
<td><activeLink data-sconfig="toggle_jobs" data-href="toggle=toggle_jobs"></activeLink></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Job Announcement Format:</td>
|
||||
<td><activeLink data-aconfig="job_indicator_type" data-href="setting_job_card_style=1"></activeLink></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Theme Jobs?</td>
|
||||
<td><activeLink data-sconfig="toggle_job_color" data-href="toggle=toggle_job_color"></activeLink></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Theme Names?</td>
|
||||
<td><activeLink data-sconfig="toggle_name_color" data-href="toggle=toggle_name_color"></activeLink></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Louder Command Members</td>
|
||||
<td><activeLink data-sconfig="toggle_command_bold" data-href="toggle=toggle_command_bold"></activeLink></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Announce Timecodes?</td>
|
||||
<td><activeLink data-sconfig="toggle_timecode" data-href="toggle=toggle_timecode"></activeLink></td>
|
||||
|
||||
Reference in New Issue
Block a user