Integrates NTTC + Other Stuff

This commit is contained in:
AffectedArc07
2020-05-15 19:48:53 +01:00
parent 64dc83846e
commit d97a20aa3c
40 changed files with 776 additions and 11869 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ z7 = empty
#define MAP_TRANSITION_CONFIG list(\
DECLARE_LEVEL(MAIN_STATION, CROSSLINKED, list(STATION_LEVEL, STATION_CONTACT, REACHABLE, AI_OK)),\
DECLARE_LEVEL(CENTCOMM, SELFLOOPING, list(ADMIN_LEVEL, BLOCK_TELEPORT, IMPEDES_MAGIC)),\
DECLARE_LEVEL(TELECOMMS, CROSSLINKED, list(REACHABLE, BOOSTS_SIGNAL, AI_OK)),\
DECLARE_LEVEL(TELECOMMS, CROSSLINKED, list(REACHABLE)),\
DECLARE_LEVEL(CONSTRUCTION, CROSSLINKED, list(REACHABLE)),\
DECLARE_LEVEL(MINING, SELFLOOPING, list(REACHABLE, STATION_CONTACT, HAS_WEATHER, ORE_LEVEL, AI_OK)),\
DECLARE_LEVEL(DERELICT, CROSSLINKED, list(REACHABLE)),\
-5
View File
@@ -89,11 +89,6 @@ datum/theft_objective/ai/check_special_completion(var/obj/item/aicard/C)
return 1
return 0
/datum/theft_objective/voidsuit
name = "a nasa voidsuit"
typepath = /obj/item/clothing/suit/space/nasavoid
protected_jobs = list("Research Director")
/datum/theft_objective/capmedal
name = "the medal of captaincy"
typepath = /obj/item/clothing/accessory/medal/gold/captain
@@ -297,12 +297,6 @@
build_path = /obj/machinery/computer/operating
origin_tech = "programming=2;biotech=3"
/obj/item/circuitboard/comm_traffic
name = "Circuitboard (Telecommunications Traffic Control)"
build_path = /obj/machinery/computer/telecomms/traffic
origin_tech = "programming=3;magnets=3;bluespace=2"
/obj/item/circuitboard/shuttle
name = "circuit board (Shuttle)"
build_path = /obj/machinery/computer/shuttle
+15 -1
View File
@@ -899,7 +899,21 @@ to destroy them and players will be able to make replacements.
/obj/item/stock_parts/manipulator = 1)
// Telecomms circuit boards:
#warn AA put new boards here you dingus
/obj/item/circuitboard/tcomms/relay
name = "Circuit Board (Telecommunications Relay)"
build_path = /obj/machinery/tcomms/relay
board_type = "machine"
origin_tech = "programming=2;engineering=2;bluespace=2"
frame_desc = "Requires 2 Manipulators and 2 Cable Coil."
req_components = list(/obj/item/stock_parts/manipulator = 2, /obj/item/stack/cable_coil = 2)
/obj/item/circuitboard/tcomms/core
name = "Circuit Board (Telecommunications Core)"
build_path = /obj/machinery/tcomms/core
board_type = "machine"
origin_tech = "programming=2;engineering=2"
frame_desc = "Requires 2 Manipulators and 2 Cable Coil."
req_components = list(/obj/item/stock_parts/manipulator = 2, /obj/item/stack/cable_coil = 2)
// End telecomms circuit boards
/obj/item/circuitboard/ore_redemption
name = "circuit board (Ore Redemption)"
+130 -25
View File
@@ -16,10 +16,17 @@
*/
// Global list for all telecomms machines in the world
/// Global list for all telecomms machines in the world
GLOBAL_LIST_EMPTY(tcomms_machines)
// Base type for tcomms machines
/**
* # Telecommunications Device
*
* This is the base machine for both tcomms devices (core + relay)
*
* This holds a few base procs (Icon updates, enable/disable, etc)
* It also has the initial overrides for Initialize() and Destroy()
*/
/obj/machinery/tcomms
name = "Telecommunications Device"
desc = "Someone forgot to say what this thingy does. Please yell at a coder"
@@ -27,60 +34,142 @@ GLOBAL_LIST_EMPTY(tcomms_machines)
icon_state = "error"
density = TRUE
anchored = TRUE
// Network ID used for names + auto linkage
use_power = IDLE_POWER_USE
idle_power_usage = 500
/// Network ID used for names + auto linkage
var/network_id = "None"
// Is the machine active
/// Is the machine active
var/active = TRUE
/**
* Base Initializer
*
* Ensures that the machine is put into the global list of tcomms devices, and then its made sure that the icon is correct if the machine starts offline
*/
/obj/machinery/tcomms/Initialize(mapload)
. = ..()
GLOB.tcomms_machines += src
update_icon()
/**
* Base Destructor
*
* Ensures that the machine is taken out of the global list when destroyed
*/
/obj/machinery/tcomms/Destroy()
. = ..()
GLOB.tcomms_machines -= src
/**
* Icon Updater
*
* Ensures that the icon updates properly based on if the machine is active or not. This removes the need for this check in many other places.
*/
/obj/machinery/tcomms/update_icon()
. = ..()
if(active)
icon_state = initial(icon_state)
else
if(!active || (stat & NOPOWER))
icon_state = "[initial(icon_state)]_off"
else
icon_state = initial(icon_state)
// Datum for a new message being sent over tcomms
// Attack overrides. These are needed so the UIs can be opened up //
/obj/machinery/tcomms/attack_ai(mob/user as mob)
add_hiddenprint(user)
ui_interact(user)
/obj/machinery/tcomms/attack_ghost(mob/user as mob)
ui_interact(user)
/obj/machinery/tcomms/attack_hand(mob/user as mob)
if(..(user))
return
ui_interact(user)
/**
* Machine Enabler
*
* Quick and dirty proc to allow for the machine to be programatically enabled easily. Used for the anomaly event
*/
/obj/machinery/tcomms/proc/enable_machine()
active = TRUE
update_icon()
/**
* Machine Disabler
*
* Quick and dirty proc to allow for the machine to be programatically disabled easily. Used for the anomaly event
*/
/obj/machinery/tcomms/proc/disable_machine()
active = FALSE
update_icon()
/**
* Logging helper
*
* Proc which allows easy logging of changs made to tcomms machines
* Arguments:
* * user - The user who did the action
* * msg - The log message
* * adminmsg - Should an admin log be sent when this happens
*/
/obj/machinery/tcomms/proc/log_action(user, msg, adminmsg = FALSE)
log_game("NTTC: [key_name(user)] [msg]")
log_investigate("[key_name(user)] [msg]", "nttc")
if(adminmsg)
message_admins("NTTC: [key_name_admin(user)] [msg]")
/**
* Power Change Handler
*
* Proc which ensures icons are updated when machines lose power
*/
/obj/machinery/tcomms/power_change()
..()
update_icon()
/**
* # Telecommunications Message
*
* Datum which holds all the data for a message being sent
*
* This used to be a single associative list with just keys and values
* It had no typepath or presence checking, and was absolutely awful to work with
* This fixes that
*
*/
/datum/tcomms_message
// Who sent the message
/// Who sent the message
var/sender_name = "Error"
// What job are they
/// What job are they
var/sender_job = "Error"
// Pieces of the message
/// Pieces of the message
var/list/message_pieces = list()
// Source Z-level
/// Source Z-level
var/source_level = 0
// What frequency the message is sent on
/// What frequency the message is sent on
var/freq = 0
// Was it sent with a voice changer
/// Was it sent with a voice changer
var/vmask = FALSE
// Did the signal come from a device that requires tcomms to function
/// Did the signal come from a device that requires tcomms to function
var/needs_tcomms = TRUE
// Origin of the signal
/// Origin of the signal
var/datum/radio_frequency/connection
// Who sent it
/// Who sent it
var/mob/sender
// The radio it was sent from
/// The radio it was sent from
var/obj/item/radio/radio
// The signal data (See defines/radio.dm)
/// The signal data (See defines/radio.dm)
var/data
// Verbage used
/// Verbage used
var/verbage = "says"
// Follow target for AI use
/// Follow target for AI use
var/atom/follow_target = null
// Is this signal meant to be rejected
/// Is this signal meant to be rejected
var/reject = FALSE
// Voice name if the person doesnt have a name (diona, alien, etc)
/// Voice name if the person doesnt have a name (diona, alien, etc)
var/vname
// List of all channels this can be sent or recieved on
/// List of all channels this can be sent or recieved on
var/list/zlevels = list()
@@ -88,7 +177,15 @@ GLOBAL_LIST_EMPTY(tcomms_machines)
#define CENTCOMM_RADIO_TYPE 1
#define SYNDICATE_RADIO_TYPE 2
//Makes sure players cant read radios of a higher level than they are
/**
* Connection checker
*
* Checks the connection frequency against the intended frequency for the message
* NOTE: I barely know what on earth this does, but it works and it scares me
* Arguments:
* * old_freq - Frequency of the connection
* * new_freq - Frequency of the message
*/
/proc/is_bad_connection(old_freq, new_freq)
var/old_type = CREW_RADIO_TYPE
var/new_type = CREW_RADIO_TYPE
@@ -111,6 +208,14 @@ GLOBAL_LIST_EMPTY(tcomms_machines)
#undef SYNDICATE_RADIO_TYPE
/**
* Message Broadcast Proc
*
* This big fat disaster is responsible for sending the message out to all headsets and radios on the station
* It is absolutely disgusting, but used to take about 20 arguments before I slimmed it down to just one
* Arguments:
* * tcm - The tcomms message datum
*/
/proc/broadcast_message(datum/tcomms_message/tcm)
+176 -15
View File
@@ -1,41 +1,84 @@
/*
The core of the entire telecomms operation
*/
#define UI_TAB_CONFIG "CONFIG"
#define UI_TAB_LINKS "LINKS"
/**
* # Telecommunications Core
*
* The core of the entire telecomms operation
*
* This thing basically handles the main broadcasting of the data, as well as NTTC configs
* The relays dont do any actual processing, they are just objects which can bring tcomms to another zlevel
*/
/obj/machinery/tcomms/core
name = "Telecommunications Core"
desc = "A large rack full of communications equipment. Looks important."
icon_state = "core"
// The NTTC config for this device
/// The NTTC config for this device
var/datum/nttc_configuration/nttc = new()
// List of all reachable devices
/// List of all reachable devices
var/list/reachable_zlevels = list()
// List of all linked relays
/// List of all linked relays
var/list/linked_relays = list()
// Password for linking stuff together
/// Password for linking stuff together
var/link_password
/// What tab of the UI were currently on
var/ui_tab = UI_TAB_CONFIG
/**
* Initializer for the core.
*
* Calls parent to ensure its added to the GLOB of tcomms machines, before generating a link password and adding itself to the list of reachable Zs.
*/
/obj/machinery/tcomms/core/Initialize(mapload)
. = ..()
link_password = GenerateKey()
reachable_zlevels |= loc.z
// Helper to see if a Z-level is reachable
/**
* Descruter for the core.
*
* Ensures that the machine is taken out of the global list when destroyed, and also unlinks all connected relays
*/
/obj/machinery/tcomms/core/Destroy()
. = ..()
for(var/obj/machinery/tcomms/relay/R in linked_relays)
R.Reset()
/**
* Helper to see if a zlevel is reachable
*
* This is a simple check to see if the input z-level is in the list of reachable ones
* Returns TRUE if it can, FALSE if it cant
*
* Arguments:
* * zlevel - The input z level to test
*/
/obj/machinery/tcomms/core/proc/zlevel_reachable(zlevel)
if(zlevel in reachable_zlevels)
return TRUE
else
return FALSE
// This handles taking in the message then broadcasting it out
/**
* Proc which takes in the message datum
*
* Some checks are ran on the signal, and NTTC is applied
* After that, it is broadcasted out to the required Z-levels
*
* Arguments:
* * tcm - The tcomms message datum
*/
/obj/machinery/tcomms/core/proc/handle_message(datum/tcomms_message/tcm)
// Don't do anything with rejected signals, or if were offline
if(tcm.reject || !active)
// Don't do anything with rejected signals, or if were offline, or if we have no power
if(tcm.reject || !active || (stat & NOPOWER))
return FALSE
// Kill the signal if its on a z-level that isnt reachable
if(!(tcm.source_level in reachable_zlevels))
if(!zlevel_reachable(tcm.source_level))
return FALSE
// Now we can run NTTC
tcm = nttc.modify_message(tcm)
// Now we generate the list of where that signal should go to
tcm.zlevels = reachable_zlevels
tcm.zlevels |= tcm.source_level
@@ -47,10 +90,128 @@
return FALSE
// This remakes the list of reachable zlevels. Call this if you add or remove a relay
/**
* Proc to remake the list of available zlevels
*
* Loops through the list of connected relays and adds their zlevels in.
* This is called if a relay is added or removed
*
*/
/obj/machinery/tcomms/core/proc/refresh_zlevels()
// Refresh the list
reachable_zlevels = list()
for(var/obj/machinery/tcomms/relay/R in GLOB.tcomms_machines)
reachable_zlevels |= R.loc.z
// Add itself as a reachable Z-level
reachable_zlevels |= loc.z
// Add all the linked relays in
for(var/obj/machinery/tcomms/relay/R in linked_relays)
// Only if the relay is active
if(R.active)
reachable_zlevels |= R.loc.z
//////////////
// UI STUFF //
//////////////
/obj/machinery/tcomms/core/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
// this is silly but it has to be done because NTTC inits before languages do
if(nttc.valid_languages.len == 1)
nttc.update_languages()
// Now the actual UI stuff
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "tcomms_core.tmpl", "Telecommunications Core", 800, 600)
ui.open()
ui.set_auto_update(1)
/obj/machinery/tcomms/core/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state)
var/data[0]
// What tab are we on
data["tab"] = ui_tab
// Only send NTTC settings if were on the right tab. This saves on sending overhead.
if(ui_tab == UI_TAB_CONFIG)
// Z-level list
var/zlevel_string = jointext(reachable_zlevels, ", ")
data["sectors_available"] = "Count: [length(reachable_zlevels)] | List: [copytext(zlevel_string, 1, length(zlevel_string)-1)]"
// Toggles
data["active"] = active
data["nttc_toggle_jobs"] = nttc.toggle_jobs
data["nttc_toggle_job_color"] = nttc.toggle_job_color
data["nttc_toggle_name_color"] = nttc.toggle_name_color
data["nttc_toggle_command_bold"] = nttc.toggle_command_bold
// Strings
data["nttc_setting_language"] = nttc.setting_language
data["nttc_job_indicator_type"] = nttc.job_indicator_type
return data
/obj/machinery/tcomms/core/Topic(href, href_list)
// Check against href exploits
if(..())
return
if(href_list["tab"])
// Make sure its a valid tab
if(href_list["tab"] in list(UI_TAB_CONFIG, UI_TAB_LINKS))
ui_tab = href_list["tab"]
// Check if they did a href, but only for that current tab
if(ui_tab == UI_TAB_CONFIG)
// All the toggle on/offs go here
if(href_list["toggle_active"])
active = !active
update_icon()
// NTTC Toggles
if(href_list["nttc_toggle_jobs"])
nttc.toggle_jobs = !nttc.toggle_jobs
log_action(usr, "toggled job tags (Now [nttc.toggle_jobs])")
if(href_list["nttc_toggle_job_color"])
nttc.toggle_job_color = !nttc.toggle_job_color
log_action(usr, "toggled job colors (Now [nttc.toggle_job_color])")
if(href_list["nttc_toggle_name_color"])
nttc.toggle_name_color = !nttc.toggle_name_color
log_action(usr, "toggled name colors (Now [nttc.toggle_name_color])")
if(href_list["nttc_toggle_command_bold"])
nttc.toggle_command_bold = !nttc.toggle_command_bold
log_action(usr, "toggled command bold (Now [nttc.toggle_command_bold])")
// We need to be a little more fancy for the others
// Job Format
if(href_list["nttc_job_indicator_type"])
var/card_style = input(usr, "Pick a job card format.", "Job Card Format") as null|anything in nttc.job_card_styles
if(!card_style)
return
nttc.job_indicator_type = card_style
to_chat(usr, "<span class='notice'>Jobs will now have the style of [card_style].</span>")
log_action(usr, "has set NTTC job card format to [card_style]")
// Language Settings
if(href_list["nttc_setting_language"])
var/new_language = input(usr, "Pick a language to convert messages to.", "Language Conversion") as null|anything in nttc.valid_languages
if(!new_language)
return
if(new_language == "--DISABLE--")
nttc.setting_language = null
to_chat(usr, "<span class='notice'>Language conversion disabled.</span>")
else
nttc.setting_language = new_language
to_chat(usr, "<span class='notice'>Messages will now be converted to [new_language].</span>")
log_action(usr, new_language == "--DISABLE--" ? "disabled NTTC language conversion" : "set NTTC language conversion to [new_language]", TRUE)
// Imports and exports
if(href_list["import"])
var/json = input(usr, "Provide configuration JSON below.", "Load Config", nttc.nttc_serialize()) as message
if(nttc.nttc_deserialize(json, usr.ckey))
log_action(usr, "has uploaded a NTTC JSON configuration: [ADMIN_SHOWDETAILS("Show", json)]", TRUE)
if(href_list["export"])
usr << browse(nttc.nttc_serialize(), "window=save_nttc")
// Try to speed-update the UI
SSnanoui.update_uis(src)
#undef UI_TAB_CONFIG
#undef UI_TAB_LINKS
+288
View File
@@ -0,0 +1,288 @@
/*
NTTC system
This is basically the replacement for NTSL and allows tickbox features such as job titles and colours, without needing a script
This also means that there is no user input here, which means the system isnt prone to exploits since its only selecting options, no user input
Basically, just imagine pfSense for tcomsm
All this code was written by Tigercat2000. I take no credit -aa07
*/
#define JOB_STYLE_1 "Name (Job)"
#define JOB_STYLE_2 "Name - Job"
#define JOB_STYLE_3 "\[Job\] Name"
#define JOB_STYLE_4 "(Job) Name"
/datum/nttc_configuration
var/regex/word_blacklist = new("(<iframe|<embed|<script|<svg|<canvas|<video|<audio|onload)", "i") // Blacklist of naughties
// ALL OF THE JOB CRAP
// Dict of all jobs and their department color classes
var/all_jobs = list(
// AI
"AI" = "airadio",
"Android" = "airadio",
"Cyborg" = "airadio",
"Personal AI" = "airadio",
"Robot" = "airadio",
// Civilian + Varients
"Assistant" = "radio",
"Businessman" = "radio",
"Civilian" = "radio",
"Tourist" = "radio",
"Trader" = "radio",
// Command (Solo command, not department heads)
"Blueshield" = "comradio",
"Captain" = "comradio",
"Head of Personnel" = "comradio",
"Nanotrasen Representative" = "comradio",
// Engineeering
"Atmospheric Technician" = "engradio",
"Chief Engineer" = "engradio",
"Electrician" = "engradio",
"Engine Technician" = "engradio",
"Life Support Specialist" = "engradio",
"Maintenance Technician" = "engradio",
"Mechanic" = "engradio",
"Station Engineer" = "engradio",
// ERT
"Emergency Response Team Engineer" = "dsquadradio", // I know this says deathsquad but the class for responseteam is neon green. No.
"Emergency Response Team Leader" = "dsquadradio",
"Emergency Response Team Medic" = "dsquadradio",
"Emergency Response Team Member" = "dsquadradio",
"Emergency Response Team Officer" = "dsquadradio",
// Medical
"Chemist" = "medradio",
"Chief Medical Officer" = "medradio",
"Coroner" = "medradio",
"Medical Doctor" = "medradio",
"Microbiologist" = "medradio",
"Nurse" = "medradio",
"Paramedic" = "medradio",
"Pharmacologist" = "medradio",
"Pharmacist" = "medradio",
"Psychiatrist" = "medradio",
"Psychologist" = "medradio",
"Surgeon" = "medradio",
"Therapist" = "medradio",
"Virologist" = "medradio",
// Science
"Anomalist" = "sciradio",
"Biomechanical Engineer" = "sciradio",
"Chemical Researcher" = "sciradio",
"Geneticist" = "sciradio",
"Mechatronic Engineer" = "sciradio",
"Plasma Researcher" = "sciradio",
"Research Director" = "sciradio",
"Roboticist" = "sciradio",
"Scientist" = "sciradio",
"Xenoarcheologist" = "sciradio",
"Xenobiologist" = "sciradio",
// Security
"Brig Physician" = "secradio",
"Detective" = "secradio",
"Forensic Technician" = "secradio",
"Head of Security" = "secradio",
"Human Resources Agent" = "secradio",
"Internal Affairs Agent" = "secradio",
"Magistrate" = "secradio",
"Security Officer" = "secradio",
"Security Pod Pilot" = "secradio",
"Warden" = "secradio",
// Supply
"Quartermaster" = "supradio",
"Cargo Technician" = "supradio",
"Shaft Miner" = "supradio",
"Spelunker" = "supradio",
// Service
"Barber" = "srvradio",
"Bartender" = "srvradio",
"Beautician" = "srvradio",
"Botanical Researcher" = "srvradio",
"Botanist" = "srvradio",
"Butcher" = "srvradio",
"Chaplain" = "srvradio",
"Chef" = "srvradio",
"Clown" = "srvradio",
"Cook" = "srvradio",
"Culinary Artist" = "srvradio",
"Custodial Technician" = "srvradio",
"Hair Stylist" = "srvradio",
"Hydroponicist" = "srvradio",
"Janitor" = "srvradio",
"Journalist" = "srvradio",
"Librarian" = "srvradio",
"Mime" = "srvradio",
)
// Just command members
var/heads = list("Captain", "Head of Personnel", "Nanotrasen Representative", "Blueshield", "Chief Engineer", "Chief Medical Officer", "Research Director", "Head of Security", "Magistrate", "AI")
// 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_class = "radio"
// NOW FOR ACTUAL TOGGLES
/* Simple Toggles */
var/toggle_jobs = FALSE
var/toggle_job_color = FALSE
var/toggle_name_color = FALSE
var/toggle_command_bold = FALSE
/* Strings */
var/setting_language = null
var/job_indicator_type = null
// This tells the datum what is safe to serialize and what's not. It also applies to deserialization.
var/list/to_serialize = list(
"toggle_jobs",
"toggle_job_color",
"toggle_name_color",
"job_indicator_type",
"toggle_command_bold",
"setting_language"
)
// This is used for sanitization.
var/list/serialize_sanitize = list(
"toggle_jobs" = "bool",
"toggle_job_color" = "bool",
"toggle_name_color" = "bool",
"job_indicator_type" = "string",
"toggle_command_bold" = "bool",
"setting_language" = "string"
)
// 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--")
/datum/nttc_configuration/proc/reset()
toggle_jobs = initial(toggle_jobs)
toggle_job_color = initial(toggle_job_color)
toggle_name_color = initial(toggle_name_color)
toggle_command_bold = initial(toggle_command_bold)
/* Strings */
setting_language = initial(setting_language)
job_indicator_type = initial(job_indicator_type)
/datum/nttc_configuration/proc/update_languages()
for(var/language in GLOB.all_languages)
var/datum/language/L = GLOB.all_languages[language]
if(L.flags & HIVEMIND)
continue
valid_languages[language] = TRUE
// I'd use serialize() but it's used by another system. This converts the configuration into a JSON string.
/datum/nttc_configuration/proc/nttc_serialize()
. = list()
for(var/variable in to_serialize)
.[variable] = vars[variable]
. = json_encode(.)
// This loads a configuration from a JSON string.
// Fucking broken as shit, someone help me fix this.
/datum/nttc_configuration/proc/nttc_deserialize(text, var/ckey)
if(word_blacklist.Find(text)) //uh oh, they tried to be naughty
message_admins("<span class='danger'>EXPLOIT WARNING: </span> [ckey] attempted to upload an NTTC configuration containing JS abusable tags!")
log_admin("EXPLOIT WARNING: [ckey] attempted to upload an NTTC configuration containing JS abusable tags")
return FALSE
var/list/var_list = json_decode(text)
for(var/variable in var_list)
if(variable in to_serialize) // Don't just accept any random vars jesus christ!
var/sanitize_method = serialize_sanitize[variable]
var/variable_value = var_list[variable]
variable_value = nttc_sanitize(variable_value, sanitize_method)
if(variable_value != null)
vars[variable] = variable_value
return TRUE
// Sanitizing user input. Don't blindly trust the JSON.
/datum/nttc_configuration/proc/nttc_sanitize(variable, sanitize_method)
if(!sanitize_method)
return null
switch(sanitize_method)
if("bool")
return variable ? TRUE : FALSE
// if("table", "array")
if("array")
if(!islist(variable))
return list()
// Insert html filtering for the regexes here if you're boring
var/newlist = json_decode(html_decode(json_encode(variable)))
if(!islist(newlist))
return null
return newlist
if("string")
return "[variable]"
return variable
// Primary signal modification. This is where all of the variables behavior are actually implemented.
/datum/nttc_configuration/proc/modify_message(datum/tcomms_message/tcm)
// All job and coloring shit
if(toggle_job_color || toggle_name_color)
var/job = tcm.sender_job
job_class = all_jobs[job]
if(toggle_name_color)
var/new_name = "<span class=\"[job_class]\">" + tcm.sender_name + "</span>"
tcm.sender_name = new_name
tcm.vname = 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 = ""
var/job = tcm.sender_job
if(job in ert_jobs)
job = "ERT"
if(toggle_job_color)
switch(job_indicator_type)
// These must have trailing spaces. No exceptions.
if(JOB_STYLE_1)
new_name = "[tcm.sender_name] <span class=\"[job_class]\">([job])</span> "
if(JOB_STYLE_2)
new_name = "[tcm.sender_name] - <span class=\"[job_class]\">[job]</span> "
if(JOB_STYLE_3)
new_name = "<span class=\"[job_class]\"><small>\[[job]\]</small></span> [tcm.sender_name] "
if(JOB_STYLE_4)
new_name = "<span class=[job_class]>([job])</span> [tcm.sender_name] "
else
switch(job_indicator_type)
if(JOB_STYLE_1)
new_name = "[tcm.sender_name] ([job]) "
if(JOB_STYLE_2)
new_name = "[tcm.sender_name] - [job] "
if(JOB_STYLE_3)
new_name = "<small>\[[job]\]</small> [tcm.sender_name] "
if(JOB_STYLE_4)
new_name = "([job]) [tcm.sender_name] "
// Only change the name if they have a job tag set, otherwise everyone becomes unknown, and thats bad
if(new_name != "")
tcm.sender_name = new_name
tcm.vname = new_name // this is required because the broadcaster uses this directly if the speaker doesn't have a voice changer on
// This is hacky stuff for multilingual messages...
var/list/message_pieces = tcm.message_pieces
// Makes heads of staff bold
if(toggle_command_bold)
var/job = tcm.sender_job
if((job in ert_jobs) || (job in heads))
for(var/datum/multilingual_say_piece/S in message_pieces)
S.message = "<b>[capitalize(S.message)]</b>" // This only capitalizes the first word
// Language Conversion
if(setting_language && valid_languages[setting_language])
if(setting_language == "--DISABLE--")
setting_language = null
else
for(var/datum/multilingual_say_piece/S in message_pieces)
if(S.speaking != GLOB.all_languages["Noise"]) // check if they are emoting, these do not need to be translated
S.speaking = GLOB.all_languages[setting_language]
return tcm
#undef JOB_STYLE_1
#undef JOB_STYLE_2
#undef JOB_STYLE_3
#undef JOB_STYLE_4
+1 -1
View File
@@ -25,7 +25,7 @@
hidden_link = TRUE
// CC RELAY //
/obj/machinery/tcomms/cc/ruskie
/obj/machinery/tcomms/relay/cc
network_id = "CENTCOMM-RELAY"
autolink_id = "STATION-CORE"
hidden_link = TRUE
+60 -9
View File
@@ -1,29 +1,47 @@
/*
Relays just expand transmitting and recieving to other Z-levels.
*/
/**
* # Telecommunications Relay
*
* Extends the reach of telecomms to the z-level it is built on
*
* Relays themselves dont do any processing, they just tell the core that this z-level is available in the tcomms network.
*/
/obj/machinery/tcomms/relay
name = "Telecommunications Relay"
desc = "A large device with several radio antennas on it."
icon_state = "relay"
// The host core for this relay
/// The host core for this relay
var/obj/machinery/tcomms/core/linked_core
// ID of the hub to auto link to
/// ID of the hub to auto link to
var/autolink_id
// Is this linked to anything at all
/// Is this linked to anything at all
var/linked = FALSE
// Is this link invisible on the hub?
/// Is this link invisible on the hub?
var/hidden_link = FALSE
/**
* Initializer for the relay.
*
* Calls parent to ensure its added to the GLOB of tcomms machines, before checking if there is an autolink that needs to be added.
*/
/obj/machinery/tcomms/relay/Initialize(mapload)
. = ..()
if(mapload && autolink_id)
return INITIALIZE_HINT_LATELOAD
/**
* Descrutor for the relay.
*
* Ensures that the machine is taken out of the global list when destroyed, and also removes the link to the core.
*/
/obj/machinery/tcomms/relay/Destroy()
Reset()
. = ..()
Reset()
/**
* Late Initialize for the relay.
*
* Calls parent, then adds links to the cores. This is a LateInitialize because the core MUST be initialized first
*/
/obj/machinery/tcomms/relay/LateInitialize()
. = ..()
for(var/obj/machinery/tcomms/core/C in GLOB.tcomms_machines)
@@ -32,14 +50,47 @@
// Only ONE of these with one ID should exist per world
break
/**
* Proc to link the relay to the core.
*
* Sets the linked core to the target (argument below), before adding it to the list of linked relays, then re-freshing the zlevel list
* The relay is then marked as linked
* Arguments:
* * target - The telecomms core that this relay should be linked to
*/
/obj/machinery/tcomms/relay/proc/AddLink(obj/machinery/tcomms/core/target)
linked_core = target
target.linked_relays |= src
target.refresh_zlevels()
linked = TRUE
/**
* Proc to rest the relay.
*
* Resets the relay, removing its linkage status, and refreshing the core's list of z-levels
*/
/obj/machinery/tcomms/relay/proc/Reset()
linked_core.linked_relays -= src
linked_core.refresh_zlevels()
linked_core = null
linked = FALSE
/**
* Relay Enabler
*
* Modification to the standard one so that the links get updated
*/
/obj/machinery/tcomms/relay/enable_machine()
..()
if(linked_core)
linked_core.refresh_zlevels()
/**
* Relay Disabler
*
* Modification to the standard one so that the links get updated
*/
/obj/machinery/tcomms/relay/disable_machine()
..()
if(linked_core)
linked_core.refresh_zlevels()
+6 -16
View File
@@ -14,20 +14,10 @@
if(prob(30)) //most of the time, we don't want an announcement, so as to allow AIs to fake blackouts.
GLOB.event_announcement.Announce(alert)
#warn AA, make ion anomalies disable the hubs only
/*
/datum/event/communications_blackout/start()
for(var/obj/machinery/tcomms/T in GLOB.telecomms_list)
T.emp_act(1)
/proc/communications_blackout(var/silent = 1)
if(!silent)
GLOB.event_announcement.Announce("Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you-BZZT", new_sound = 'sound/misc/interference.ogg')
else // AIs will always know if there's a comm blackout, rogue AIs could then lie about comm blackouts in the future while they shutdown comms
for(var/mob/living/silicon/ai/A in GLOB.player_list)
to_chat(A, "<br>")
to_chat(A, "<span class='warning'><b>Ionospheric anomalies detected. Temporary telecommunication failure imminent. Please contact you-BZZT<b></span>")
to_chat(A, "<br>")
for(var/obj/machinery/telecomms/T in GLOB.telecomms_list)
T.emp_act(1)
*/
// This only affects the cores, relays should be unaffected imo
for(var/obj/machinery/tcomms/core/T in GLOB.tcomms_machines)
T.disable_machine()
// Bring it back sometime between 3-5 minutes. This uses deciseconds, so 1800 and 3000 respecticely.
// Note that because this is a strict enable not a toggle, the crew or AI can re-enable the machine themselves
addtimer(CALLBACK(T, /obj/machinery/tcomms.proc/enable_machine), rand(1800, 3000))
@@ -302,16 +302,6 @@
build_path = /obj/item/circuitboard/supplycomp
category = list("Computer Boards")
/datum/design/comm_traffic
name = "Console Board (Telecommunications Traffic Control Console)"
desc = "Allows for the construction of circuit boards used to build a telecommunications traffic control console."
id = "comm_traffic"
req_tech = list("programming" = 3, "magnets" = 3, "bluespace" = 2)
build_type = IMPRINTER
materials = list(MAT_GLASS = 1000)
build_path = /obj/item/circuitboard/comm_traffic
category = list("Computer Boards")
/datum/design/teleconsole
name = "Console Board (Teleporter Console)"
desc = "Allows for the construction of circuit boards used to build a teleporter control console."
@@ -1,3 +1,23 @@
////////////////////////////////////////
//////////Telecomms Equipment///////////
////////////////////////////////////////
// Only 2 of these exist, so they should really be in a different place. But oh well.
/datum/design/telecomms_core
name = "Machine Board (Telecommunications Core)"
desc = "Allows for the construction of Telecommunications Cores."
id = "s-hub"
req_tech = list("programming" = 2, "engineering" = 2)
build_type = IMPRINTER
materials = list(MAT_GLASS = 1000)
build_path = /obj/item/circuitboard/tcomms/core
category = list("Subspace Telecomms")
/datum/design/telecomms_relay
name = "Machine Board (Telecommunications Core)"
desc = "Allows for the construction of Telecommunications Relays."
id = "s-relay"
req_tech = list("programming" = 2, "engineering" = 2, "bluespace" = 2)
build_type = IMPRINTER
materials = list(MAT_GLASS = 1000)
build_path = /obj/item/circuitboard/tcomms/relay
category = list("Subspace Telecomms")
-1
View File
@@ -1 +0,0 @@
node_modules/
-154
View File
@@ -1,154 +0,0 @@
/* Global */
html, body {
background-color: #272727;
font-family: Verdana, Geneva, sans-serif;
font-size: 12px;
color: #fff;
margin: 0;
padding: 0;
}
/* Navbar */
#navbar {
background: #383838;
border-bottom: 2px solid #161616;
list-style-type: none;
height: 28px;
margin: 0;
padding: 0;
}
#navbar > div {
background: #40628a;
border-radius: 5px 5px 0 0;
color: #ffffff;
display: block;
height: 80%;
float: left;
text-decoration: none;
padding: 0 7px 0 5px;
margin: 6px 0 0 5px;
}
#navbar > div:hover {
background: #ffffff;
color: #40628a;
cursor: pointer;
}
#navbar > img {
float: left;
margin: 2px 10px 2px 0;
height: 24px;
}
#navbar > .title {
color: #a7a7a7;
float: right;
background: none;
font-size: 1.5em;
font-family: Helvetica;
text-decoration: bold;
padding: 0;
padding-right: 10px;
margin: 0;
}
#navbar > .title:hover {
background: none;
color: #a7a7a7;
cursor: default;
}
.btnActive {
background: #2f943c !important;
color: #fff !important;
}
/* Content */
#content {
min-height: 75%;
line-height: 1.5;
margin: 10px;
}
/* Links */
.link, .linkOn, .linkOff {
background: #40628a;
border: 1px solid #161616;
color: #ffffff;
cursor: pointer;
display: inline;
margin: 0 2px 0px 0;
min-width: 15px;
padding: 0px 4px 0px 4px;
text-align: center;
text-decoration: none;
user-select: none;
white-space: nowrap;
}
.linkOn, .linkOn:link, .linkOn:visited, .linkOn:active, .linkOn:hover
{
color: #ffffff;
background: #2f943c;
border-color: #24722e;
}
.linkOff, .linkOff:link, .linkOff:visited, .linkOff:active, .linkOff:hover
{
color: #ffffff;
background: #999999;
border-color: #666666;
}
.linkActive:hover {
background: #507aac;
}
.linkActive:active {
background: #2f943c;
}
/* Config Tables */
.tblConfig td {
padding-right: 40px;
}
.tables {
border: 1px solid black;
text-align: center;
}
.tables th {
border-bottom: 2px solid black;
}
.tables th, .tables td {
border-right: 2px dotted black;
min-width: 70px;
}
/* Footer */
.footer {
height: 15px;
position: absolute;
right: 10px;
bottom: 10px;
}
/* Hacking stuff. */
.hack {
color: #fff;
text-shadow: 1px 1px #300;
font-size: 1.12em;
}
.hackBtn {
background-color: #a00 !important;
}
.hackBtn:hover {
background-color: #fff !important;
}
.hackBtn:hover .hack {
color: #000 !important;
}
-10907
View File
File diff suppressed because one or more lines are too long
-31
View File
@@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>NTTC</title>
<script type="text/javascript" src="bundle.js"></script>
<link rel="stylesheet" type="text/css" href="bundle.css">
</head>
<body>
<div id="navbar">
<img src="uiTitleFluff.png">
<div class="navBtn" data-tab="home">Home</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>
<div class="title">NTTC</div>
</div>
<div id="content">
<!-- Javascript loads this -->
</div>
<div class="footer">
<activeLink data-href="save_config=1">Save Config</activeLink>
<activeLink data-href="load_config=1">Load Config</activeLink>
</div>
</body>
</html>
-33
View File
@@ -1,33 +0,0 @@
<div>
<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>
</tr>
<tr>
<td>Language Conversion?</td>
<td><activeLink data-aconfig="setting_language" data-href="setting_language=1"></activeLink></td>
</tr>
</table>
</div>
-4
View File
@@ -1,4 +0,0 @@
<div>
<h2>FIREWALL</h2>
<arrayBoat data-config="firewall" data-header="Blocked User|Delete Entry"></arrayBoat>
</div>
-22
View File
@@ -1,22 +0,0 @@
<div>
<h2>1337 HAaCCkEr MeNU!</h2>
<table class="tblConfig">
<tr>
<td>H*lp Tr%%ait0r i* $c/e#ce</td>
<td><activeLink data-sconfig="toggle_gibberish" data-href="toggle=toggle_gibberish"></activeLink></td>
</tr>
<tr>
<td>HoNKKk!!11!</td>
<td><activeLink data-sconfig="toggle_honk" data-href="toggle=toggle_honk"></activeLink></td>
</tr>
</table>
</div>
<style type="text/css">
html, body {
background: #a00;
}
#navbar {
background: #400;
}
</style>
-9
View File
@@ -1,9 +0,0 @@
<div>
<h2>Home</h2>
<table class="tblConfig">
<tr>
<td>Telecomms Activated?</td>
<td><activeLink data-sconfig="toggle_activated" data-href="toggle=toggle_activated;"></activeLink></td>
</tr>
</table>
</div>
-4
View File
@@ -1,4 +0,0 @@
<div>
<h2>Regex</h2>
<listBoat data-config="regex" data-header="From|To|Del"></listBoat>
</div>
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 670 B

-106
View File
@@ -1,106 +0,0 @@
/* Dependencies */
// Regular node dependencies
var child_process = require("child_process");
var fs = require("fs");
var path = require("path");
// Main compilers
var browserify = require("browserify");
var gulp = require("gulp");
// Extras
var del = require("del");
var concat = require("gulp-concat");
var flatten = require("gulp-flatten");
var rename = require("gulp-rename");
var buffer = require("vinyl-buffer");
var source = require("vinyl-source-stream");
/* Configuration */
const watch_targets = [
"./src/index.js",
"./src/css/*",
"./src/js/*",
"./src/html/**/*"
]
const output = {
"css": "bundle.css",
"dest": "./dist/",
"js": "bundle.js"
};
/* Clean out the dist directory to get rid of any old build artifacts. */
gulp.task("clean", function () {
del(output.dest + "*");
});
/* This uses browserify to compress every single require() into a single javascript file. */
gulp.task("browserify", ["clean"], function () {
var bundleStream = browserify("./src/index.js").bundle();
bundleStream
.pipe(source("index.js"))
.pipe(rename("bundle.js"))
.pipe(buffer())
.pipe(gulp.dest(output.dest))
});
/* CSS concatenation and output. */
gulp.task("css", ["clean"], function () {
gulp.src("./src/css/*.css")
.pipe(concat(output.css))
.pipe(buffer())
.pipe(gulp.dest(output.dest))
});
/* Basically just copy-paste the html files into the dest, but flatten the directory structure. */
gulp.task("etc", ["clean"], function () {
gulp.src("./src/html/**/*.html")
.pipe(flatten())
.pipe(buffer())
.pipe(gulp.dest(output.dest));
gulp.src("./src/img/*")
.pipe(buffer())
.pipe(gulp.dest(output.dest));
});
// This runs all of the other defined tasks on "gulp"
gulp.task("default", ["css", "etc", "browserify"])
// Autoreload
gulp.task("reload", ["default"], function() {
child_process.exec("reload.bat", function (err, stdout) {
if (err)
throw err;
var byond_cache = path.join(stdout.trim(), "BYOND", "cache");
var files = fs.readdirSync(byond_cache);
for (let file of files) {
let filepath = path.join(byond_cache, file);
let stats = fs.statSync(filepath)
if (file.startsWith("tmp") && stats.isDirectory()) {
var tmpFiles = fs.readdirSync(filepath);
if (tmpFiles.includes("bundle.js")) {
setTimeout(function () {transfer_files(filepath)}, 500);
}
}
}
});
});
function transfer_files(target) {
console.log("transfer_files")
let filesToTransfer = fs.readdirSync(path.join(".", "dist"));
for (let file of filesToTransfer) {
console.log(file, path.join(target, file))
let filepath = path.join(".", "dist", file);
fs.createReadStream(filepath).pipe(fs.createWriteStream(path.join(target, file)))
}
}
gulp.task("watch", function () {
gulp.watch(watch_targets, ["reload"]);
});
-25
View File
@@ -1,25 +0,0 @@
{
"name": "nttc",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Tigercat2000",
"license": "AGPL-3.0-only",
"dependencies": {
"del": "^3.0.0",
"gulp-flatten": "^0.4.0",
"he": "^1.2.0",
"jquery": "^3.3.1"
},
"devDependencies": {
"browserify": "^16.2.3",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.1",
"gulp-rename": "^1.4.0",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0"
}
}
-9
View File
@@ -1,9 +0,0 @@
@echo off
for /f "tokens=3* delims= " %%a in (
'reg query "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders" /v "Personal"'
) do (
set documents=%%a
)
echo %documents%
-154
View File
@@ -1,154 +0,0 @@
/* Global */
html, body {
background-color: #272727;
font-family: Verdana, Geneva, sans-serif;
font-size: 12px;
color: #fff;
margin: 0;
padding: 0;
}
/* Navbar */
#navbar {
background: #383838;
border-bottom: 2px solid #161616;
list-style-type: none;
height: 28px;
margin: 0;
padding: 0;
}
#navbar > div {
background: #40628a;
border-radius: 5px 5px 0 0;
color: #ffffff;
display: block;
height: 80%;
float: left;
text-decoration: none;
padding: 0 7px 0 5px;
margin: 6px 0 0 5px;
}
#navbar > div:hover {
background: #ffffff;
color: #40628a;
cursor: pointer;
}
#navbar > img {
float: left;
margin: 2px 10px 2px 0;
height: 24px;
}
#navbar > .title {
color: #a7a7a7;
float: right;
background: none;
font-size: 1.5em;
font-family: Helvetica;
text-decoration: bold;
padding: 0;
padding-right: 10px;
margin: 0;
}
#navbar > .title:hover {
background: none;
color: #a7a7a7;
cursor: default;
}
.btnActive {
background: #2f943c !important;
color: #fff !important;
}
/* Content */
#content {
min-height: 75%;
line-height: 1.5;
margin: 10px;
}
/* Links */
.link, .linkOn, .linkOff {
background: #40628a;
border: 1px solid #161616;
color: #ffffff;
cursor: pointer;
display: inline;
margin: 0 2px 0px 0;
min-width: 15px;
padding: 0px 4px 0px 4px;
text-align: center;
text-decoration: none;
user-select: none;
white-space: nowrap;
}
.linkOn, .linkOn:link, .linkOn:visited, .linkOn:active, .linkOn:hover
{
color: #ffffff;
background: #2f943c;
border-color: #24722e;
}
.linkOff, .linkOff:link, .linkOff:visited, .linkOff:active, .linkOff:hover
{
color: #ffffff;
background: #999999;
border-color: #666666;
}
.linkActive:hover {
background: #507aac;
}
.linkActive:active {
background: #2f943c;
}
/* Config Tables */
.tblConfig td {
padding-right: 40px;
}
.tables {
border: 1px solid black;
text-align: center;
}
.tables th {
border-bottom: 2px solid black;
}
.tables th, .tables td {
border-right: 2px dotted black;
min-width: 70px;
}
/* Footer */
.footer {
height: 15px;
position: absolute;
right: 10px;
bottom: 10px;
}
/* Hacking stuff. */
.hack {
color: #fff;
text-shadow: 1px 1px #300;
font-size: 1.12em;
}
.hackBtn {
background-color: #a00 !important;
}
.hackBtn:hover {
background-color: #fff !important;
}
.hackBtn:hover .hack {
color: #000 !important;
}
-31
View File
@@ -1,31 +0,0 @@
<!DOCTYPE html>
<html>
<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>
<script type="text/javascript" src="bundle.js"></script>
<link rel="stylesheet" type="text/css" href="bundle.css">
</head>
<body>
<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="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>
<div class="title">NTTC</div>
</div>
<div id="content">
<!-- Javascript loads this -->
</div>
<div class="footer">
<activeLink data-href="save_config=1">Save Config</activeLink>
<activeLink data-href="load_config=1">Load Config</activeLink>
</div>
</body>
</html>
@@ -1,33 +0,0 @@
<div>
<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>
</tr>
<tr>
<td>Language Conversion?</td>
<td><activeLink data-aconfig="setting_language" data-href="setting_language=1"></activeLink></td>
</tr>
</table>
</div>
@@ -1,4 +0,0 @@
<div>
<h2>FIREWALL</h2>
<arrayBoat data-config="firewall" data-header="Blocked User|Delete Entry"></arrayBoat>
</div>
-22
View File
@@ -1,22 +0,0 @@
<div>
<h2>1337 HAaCCkEr MeNU!</h2>
<table class="tblConfig">
<tr>
<td>H*lp Tr%%ait0r i* $c/e#ce</td>
<td><activeLink data-sconfig="toggle_gibberish" data-href="toggle=toggle_gibberish"></activeLink></td>
</tr>
<tr>
<td>HoNKKk!!11!</td>
<td><activeLink data-sconfig="toggle_honk" data-href="toggle=toggle_honk"></activeLink></td>
</tr>
</table>
</div>
<style type="text/css">
html, body {
background: #a00;
}
#navbar {
background: #400;
}
</style>
-9
View File
@@ -1,9 +0,0 @@
<div>
<h2>Home</h2>
<table class="tblConfig">
<tr>
<td>Telecomms Activated?</td>
<td><activeLink data-sconfig="toggle_activated" data-href="toggle=toggle_activated;"></activeLink></td>
</tr>
</table>
</div>
-4
View File
@@ -1,4 +0,0 @@
<div>
<h2>Regex</h2>
<listBoat data-config="regex" data-header="From|To|Del"></listBoat>
</div>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 670 B

-1
View File
@@ -1 +0,0 @@
var main = require("./js/main.js")
-14
View File
@@ -1,14 +0,0 @@
var $ = require("jquery");
module.exports.reload = function () {
$(".linkActive")
.off("click")
.on("click", function (event) {
event.preventDefault();
var href = $(this).data("href");
if (href) {
href = window.byondSrc + href;
window.location.href = href;
}
})
};
-42
View File
@@ -1,42 +0,0 @@
var $ = require("jquery");
var he = require("he");
var templater = require("./templater.js")
$(document).ready(function () {
if(window.originalConfig) {
window.config = JSON.parse(he.decode(window.originalConfig))
}
var current_tab = "home";
function tab(tabname) {
console.log(tabname)
loadtab(tabname);
}
function loadtab(tabname) {
current_tab = tabname;
$.when($.ajax({
url: "tab_" + tabname + ".html",
cache: false,
dataType: 'html'}))
.done(function (tabdata) {
$("#content").html(tabdata);
templater.parseCurrentPage();
});
}
window.reload_tab = function() {
loadtab(current_tab)
}
loadtab("home");
$(".navBtn[data-tab='home']").addClass("btnActive");
$(".navBtn").click(function () {
$(".navBtn").removeClass("btnActive")
var toSwitch = $(this).data("tab");
$(this).addClass("btnActive");
tab(toSwitch);
});
});
-145
View File
@@ -1,145 +0,0 @@
var $ = require("jquery");
function createLink(href, text) {
let $link = $("<div>");
$link.addClass("link linkActive");
$link.data("href", href);
$link.attr("unselectable", "on")
$link.text(text);
return $link;
}
function link_onClick(event) {
event.preventDefault();
let href = $(this).data("href")
if (href) {
href = window.byondSrc + href;
window.location.href = href;
}
}
module.exports.parseCurrentPage = function () {
$("listBoat").each(function () {
var config_attr = $(this).data("config");
if (!config_attr)
return;
let th = $(this).data("header");
let dataList = config[config_attr];
$(this).replaceWith("<table class=\"tables\" id=\"WORK\">");
if (th) {
let assembledString = "<tr>";
let split = th.split("|");
for (let header in split) {
assembledString += "<th>";
assembledString += split[header];
assembledString += "</th>";
}
assembledString += "</tr>";
$("#WORK").append(assembledString);
}
for (let key in dataList) {
let value = dataList[key];
let $tr = $("<tr>");
$tr.append($("<td>").text(key));
$tr.append($("<td>").text(value));
let $td = $("<td>");
$td.append(createLink('table='+config_attr+';delete_row='+key, "X"))
$tr.append($td);
$("#WORK").append($tr);
}
$(createLink('table='+config_attr+';create_row=1', "New")).insertAfter("#WORK").click(link_onClick);
$("#WORK .link").click(link_onClick);
$("#WORK").attr("id", null);
});
$("arrayBoat").each(function () {
var config_attr = $(this).data("config");
if (!config_attr)
return;
let th = $(this).data("header");
let dataList = config[config_attr];
$(this).replaceWith("<table class=\"tables\" id=\"WORK\">");
if (th) {
let assembledString = "<tr>";
let split = th.split("|");
for (let header in split) {
assembledString += "<th>";
assembledString += split[header];
assembledString += "</th>";
}
assembledString += "</tr>";
$("#WORK").append(assembledString);
}
for (var i = 0; i < dataList.length; i++) {
let value = dataList[i];
let $tr = $("<tr>");
$tr.append($("<td>").text(value));
let $td = $("<td>");
$td.append(createLink('array='+config_attr+';delete_item='+value, "X"))
$tr.append($td);
$("#WORK").append($tr);
}
$(createLink('array='+config_attr+';create_item=1', "New")).insertAfter("#WORK").click(link_onClick);
$("#WORK .link").click(link_onClick);
$("#WORK").attr("id", null);
});
$("activeLink").each(function () {
let href = $(this).data("href");
let simple_config = $(this).data("sconfig");
let advanced_config = $(this).data("aconfig");
let internalText = $(this).text();
$(this).replaceWith("<div id=\"WORK\">")
$("#WORK")
.addClass("link linkActive")
.data("href", href)
.text(internalText)
.on("click", link_onClick)
.attr("unselectable", "on")
if (simple_config) {
if (window.config[simple_config]) {
$("#WORK")
.addClass("linkOn")
.text("Enabled")
} else {
$("#WORK")
.text("Disabled")
}
}
if (advanced_config) {
if (window.config[advanced_config])
$("#WORK").text(window.config[advanced_config])
else
$("#WORK").text("Unset")
}
$("#WORK").attr("id", null);
});
if (!window.secretsunlocked) {
$("div[data-locked='1']").hide()
} else {
$("div[data-locked='1']").show()
}
$("configRead").each(function () {
let seeked = $(this).data("config");
$(this).replaceWith("<span id=\"WORK\">")
$("#WORK")
.text(window.config[seeked])
.attr("id", null);
});
}
-15
View File
@@ -1,15 +0,0 @@
{
"name": "nttc-src",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Tigercat2000",
"license": "AGPL-3.0-only",
"dependencies": {
"he": "^1.1.1",
"jquery": "^3.3.1"
}
}
+77
View File
@@ -0,0 +1,77 @@
{{:helper.link('Device Configuration', 'wrench', {'tab' : "CONFIG"}, data.tab == "CONFIG" ? 'selected' : '')}}
{{:helper.link('Device Links', 'link', {'tab' : "LINKS"}, data.tab == "LINKS" ? 'selected' : '')}}
{{if data.tab == "CONFIG"}}
<h1>Device Config</h1>
<h3>Status</h3>
<div class="item">
<div class="itemLabel">
Machine Active:
</div>
<div class="itemContent">
{{:helper.link(data.active ? 'Enabled' : 'Disabled', 'power-off', {'toggle_active' : 1}, null, data.active ? 'selected' : '')}}
</div>
</div>
<div class="itemLabel">
Sectors with Telecommunications Signal:
</div>
<div class="itemContent">
{{:data.sectors_available}}
</div>
</div>
<h3>Settings</h3>
<div class="item">
<div class="itemLabel">
Job Announcements:
</div>
<div class="itemContent">
{{:helper.link(data.nttc_toggle_jobs ? 'Enabled' : 'Disabled', 'clipboard', {'nttc_toggle_jobs' : 1}, null, data.nttc_toggle_jobs ? 'selected' : null)}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Job Departmentalisation:
</div>
<div class="itemContent">
{{:helper.link(data.nttc_toggle_job_color ? 'Enabled' : 'Disabled', 'clipboard', {'nttc_toggle_job_color' : 1}, null, data.nttc_toggle_job_color ? 'selected' : null)}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Name Departmentalisation:
</div>
<div class="itemContent">
{{:helper.link(data.nttc_toggle_name_color ? 'Enabled' : 'Disabled', 'users', {'nttc_toggle_name_color' : 1}, null, data.nttc_toggle_name_color ? 'selected' : null)}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Command Amplification:
</div>
<div class="itemContent">
{{:helper.link(data.nttc_toggle_command_bold ? 'Enabled' : 'Disabled', 'volume-up', {'nttc_toggle_command_bold' : 1}, null, data.nttc_toggle_command_bold ? 'selected' : null)}}
</div>
</div>
<h3>Advanced</h3>
<div class="item">
<div class="itemLabel">
Job Announcement Format:
</div>
<div class="itemContent">
{{:helper.link(data.nttc_job_indicator_type ? data.nttc_job_indicator_type : 'Unset', 'pencil', {'nttc_job_indicator_type' : 1}, null, data.nttc_job_indicator_type ? 'selected' : null)}}
</div>
</div>
<div class="item">
<div class="itemLabel">
Language Conversion:
</div>
<div class="itemContent">
{{:helper.link(data.nttc_setting_language ? data.nttc_setting_language : 'Unset', 'globe', {'nttc_setting_language' : 1}, null, data.nttc_setting_language ? 'selected' : null)}}
</div>
</div>
<h3>Maintenance</h3>
{{:helper.link('Import Configuration', 'sign-in', {'import' : 1})}}
{{:helper.link('Export Configuration', 'sign-out', {'export' : 1})}}
{{else data.tab == "LINKS"}}
<h1>Connected Devices</h1>
{{/if}}
+2 -1
View File
@@ -748,8 +748,9 @@
#include "code\game\machinery\pipe\pipe_dispenser.dm"
#include "code\game\machinery\tcomms\_base.dm"
#include "code\game\machinery\tcomms\core.dm"
#include "code\game\machinery\tcomms\nttc.dm"
#include "code\game\machinery\tcomms\presets.dm"
#include "code\game\machinery\tcomms\relay.dm"
#include "code\game\machinery\telecomms\ntsl2.dm"
#include "code\game\magic\Uristrunes.dm"
#include "code\game\mecha\mech_bay.dm"
#include "code\game\mecha\mech_fabricator.dm"