diff --git a/byond-extools.dll b/byond-extools.dll
index 821dad2a080d..50538a5a1cc4 100644
Binary files a/byond-extools.dll and b/byond-extools.dll differ
diff --git a/byond-extools.pdb b/byond-extools.pdb
index 0bed2a153180..b0492a32bc11 100644
Binary files a/byond-extools.pdb and b/byond-extools.pdb differ
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index 812ff5d9503d..890ab0ddc4a9 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -466,7 +466,7 @@ GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
#define CALCULATE_ADJACENT_TURFS(T) SSadjacent_air.queue[T] = 1
#endif
-GLOBAL_VAR(atmos_extools_initialized) // this must be an uninitialized (null) one or init_monstermos will be called twice because reasons
+GLOBAL_VAR(atmos_extools_initialized) // this must be an uninitialized (null) one or will be called twice because reasons
#define ATMOS_EXTOOLS_CHECK if(!GLOB.atmos_extools_initialized){\
GLOB.atmos_extools_initialized=TRUE;\
if(fexists(EXTOOLS)){\
diff --git a/code/game/machinery/telecomms/machines/server.dm b/code/game/machinery/telecomms/machines/server.dm
index 33004ee04952..d0fe0a019df5 100644
--- a/code/game/machinery/telecomms/machines/server.dm
+++ b/code/game/machinery/telecomms/machines/server.dm
@@ -54,8 +54,14 @@
log.name = "data packet ([md5(identifier)])"
log_entries.Add(log)
- if(Compiler && autoruncode)//Yogs -- NTSL
- Compiler.Run(signal)// Yogs -- ditto
+ //Yogs start -- Joao
+ if(autoruncode && codestr && codestr != "")
+ var/datum/script_packet/packet = new(signal)
+ var/ret = run_script(codestr,packet)
+ if(!ret)
+ signal.data["reject"] = 1
+ signal = packet.signal // I'm not exactly sure if this is the case implicitly or not :(
+ //Yogs end
if(!relay_information(signal, /obj/machinery/telecomms/hub)) //yogs
relay_information(signal, /obj/machinery/telecomms/broadcaster)
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 5a361d2ffc20..654123d2d8b1 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -1121,4 +1121,4 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!check_rights(R_DEBUG))
return
if(alert(usr, "Are you absolutely sure you want to reload the configuration from the default path on the disk, wiping any in-round modificatoins?", "Really reset?", "No", "Yes") == "Yes")
- config.admin_reload()
+ config.admin_reload()
\ No newline at end of file
diff --git a/code/modules/admin/verbs/mapping.dm b/code/modules/admin/verbs/mapping.dm
index 6197bf56a169..e23095350ff4 100644
--- a/code/modules/admin/verbs/mapping.dm
+++ b/code/modules/admin/verbs/mapping.dm
@@ -77,6 +77,7 @@ GLOBAL_LIST_INIT(admin_verbs_debug_all, list(
/client/proc/reload_configuration,
/datum/admins/proc/create_or_modify_area,
/client/proc/debug_typeof, // Yogs -- Adds a debug verb for getting the subtypes of something
+ /client/proc/execute_joao, // Yogs
/client/proc/toggle_cdn
))
GLOBAL_PROTECT(admin_verbs_debug_all)
diff --git a/tgui/packages/tgui/interfaces/TrafficControl.js b/tgui/packages/tgui/interfaces/TrafficControl.js
new file mode 100644
index 000000000000..5fa95dca2101
--- /dev/null
+++ b/tgui/packages/tgui/interfaces/TrafficControl.js
@@ -0,0 +1,247 @@
+import { useBackend } from '../backend';
+import { useDispatch } from '../../common/redux';
+import { Button, LabeledList, Section, Icon, Divider, ByondUi, Box, Tabs, NoticeBox } from '../components';
+import { Window } from '../layouts';
+import { classes } from 'common/react';
+import { Component, createRef, createTextVNode } from 'inferno';
+
+export class JoaoBox extends Component {
+ constructor(props, context) {
+ super(props, context);
+ this.textareaRef = createRef();
+ this.codeRef = createRef();
+ this.buttonRef = createRef();
+ this.state = {
+ text: "",
+ cursorloc: 0,
+ };
+ this.act = props.act;
+ this.handleOnInput = e => {
+ if(e.target.value !== "")
+ {
+ this.state.text = e.target.value;
+ }
+ this.state.cursorloc = e.target.selectionStart;
+ this.forceUpdate();
+ this.fixcursor(e.target);
+ };
+ this.fixcursor = (node) => {
+ //Hope to Allah you don't have IE8
+ node.selectionStart = this.state.cursorloc;
+ node.selectionEnd = this.state.cursorloc;
+ };
+ this.lexify = (txt) =>
+ {
+ let normal = 'rgb(0,128,255)';
+ let classy = 'rgb(255,0,128)';
+ let operator = 'rgb(255,128,0)';
+ var keywords = [
+ ["main", normal],
+ ["return",normal],
+ ["Value",classy],
+ ["Object",classy],
+ ["\/",operator],
+ ["\{",operator],
+ ["\}",operator],
+ ]
+ function recurse(my_txt,lvl)
+ {
+ if(!my_txt)
+ {
+ return;
+ }
+ if(lvl >= keywords.length)
+ {
+ return my_txt;
+ }
+ // I wanted to use regexes here like a sensible person but a certain flag I want doesn't work on my machine so, bollocks to that
+ let keyword = keywords[lvl][0];
+ let colour = keywords[lvl][1];
+ if(!keyword)
+ {
+ return (
Couldn't understand what the keyword was!
);
+ }
+ //Try to find our keyword
+ let index = my_txt.search(keyword);
+ if(index === -1) // if keyword not found
+ return recurse(my_txt,lvl+1);
+
+ let header = my_txt.substring(0,index);
+ let footer = my_txt.substring(index+keyword.length);
+ return (
+
+ {recurse(header,lvl+1)}
+ {keyword}
+ {recurse(footer,lvl+1)}
+
+ );
+ }
+
+ return (
+ {recurse(txt,0)}
+ );
+ }
+ }
+
+ getValue() {
+ return this.state.text;
+ }
+
+ render() {
+ const { text } = this.state;
+ return (
+
+
+
+ {this.lexify(text)}
+
+
+
+ );
+ }
+}
+
+export const TrafficControl = (props, context) => {
+ const { act, data } = useBackend(context);
+ // Extract `health` and `color` variables from the `data` object.
+ const {
+ auth,
+ screen_state,
+ is_authorized,
+ servers,
+ serverSelected_id,
+ serverSelected_enabledcode,
+ logs
+ } = data;
+ const cooler_auth = auth ? auth : "NO ACCESS";
+ const dispatch = useDispatch(context);
+ if(!is_authorized)
+ {
+ return (
+
+
+
+ Identification:
+
+
+
+ No Authorization Found!
+ Please insert identification card to continue.
+
+
+
+ );
+ }
+
+ if(screen_state == 0) // MAIN MENU
+ {
+ const server_list = (servers && servers.map((server) => {
+ let should_be_disabled = serverSelected_id != -1 && server == serverSelected_id;
+ return act('select', {'server_id': server})} disabled={should_be_disabled}>
+ {should_be_disabled ? "Server Selected" : "Select Server"}
+
+ )}>
+
+ })) || "";
+
+ const server_display = (serverSelected_id != -1 && (
+
+ Name: {serverSelected_id}
+ Code execution status:
+
+
+ )) || (No Server Selected!);
+ return (
+
+
+ Identification:
+
+
+
+ Server List
+
+ {act('goto',{"screen_state":2})}}>
+ Computer Logs
+
+
+
+
+ {server_list}
+
+
+ {server_display}
+
+
+ );
+ }
+ if(screen_state == 2) // COMPUTER LOGS
+ {
+ const log_list = (logs && logs.map((log) => {
+ return
+ {log}
+
+ })) || "";
+ return (
+
+ Identification:
+
+
+ {act('goto',{"screen_state":0})}}>
+ Server List
+
+
+ Computer Logs
+
+
+ {log_list}
+
+ );
+ }
+ if(screen_state == 3) // SCREEN_CODING
+ {
+ return (
+
+
+ Input code here...
+
+
+ );
+ }
+
+ return (
+
+
+
+ Identification:
+
+
+
+
+
+
+
+
+
+
+
+ You found a bug!
+ Please report this to Altoids on the Yogstation Discord.
+
+
+ );
+};
diff --git a/tgui/packages/tgui/styles/interfaces/TrafficControl.scss b/tgui/packages/tgui/styles/interfaces/TrafficControl.scss
new file mode 100644
index 000000000000..b5254752d0d8
--- /dev/null
+++ b/tgui/packages/tgui/styles/interfaces/TrafficControl.scss
@@ -0,0 +1,32 @@
+@use '../base.scss';
+
+#joao_textarea, #joao_code {
+ /* Both elements need the same text and space styling so they are directly on top of each other */
+ border: 0;
+ margin: 0em 0px;
+ width: 90%;
+ height: 1000px;
+ top:50px;
+ left:0px;
+ font-size: 15pt;
+ font-family: monospace;
+ line-height: 20pt;
+ position: absolute;
+ tab-size: 2;
+}
+#joao_textarea
+{
+ z-index: 1;
+ top:70px;
+ color: transparent;
+ background: transparent;
+ background-color: transparent;
+ caret-color: white;
+
+}
+#joao_code
+{
+ text-overflow: none;
+ z-index: 0;
+ color: rgb(192, 192, 192);
+}
\ No newline at end of file
diff --git a/tgui/packages/tgui/styles/main.scss b/tgui/packages/tgui/styles/main.scss
index 2b9d31766dbb..7ef59c5aad1b 100644
--- a/tgui/packages/tgui/styles/main.scss
+++ b/tgui/packages/tgui/styles/main.scss
@@ -42,6 +42,7 @@
@include meta.load-css('./interfaces/CameraConsole.scss');
@include meta.load-css('./interfaces/NuclearBomb.scss');
@include meta.load-css('./interfaces/Roulette.scss');
+@include meta.load-css('./interfaces/TrafficControl.scss');
// Layouts
@include meta.load-css('./layouts/Layout.scss');
diff --git a/yogstation.dme b/yogstation.dme
index b002e518256d..836fe6b18a5d 100644
--- a/yogstation.dme
+++ b/yogstation.dme
@@ -3596,7 +3596,6 @@
#include "yogstation\code\modules\research\techweb\all_nodes.dm"
#include "yogstation\code\modules\ruins\lavaland_ruin_code.dm"
#include "yogstation\code\modules\scripting\Errors.dm"
-#include "yogstation\code\modules\scripting\IDE.dm"
#include "yogstation\code\modules\scripting\Options.dm"
#include "yogstation\code\modules\scripting\stack.dm"
#include "yogstation\code\modules\scripting\AST\AST Nodes.dm"
@@ -3611,6 +3610,7 @@
#include "yogstation\code\modules\scripting\Interpreter\Interpreter.dm"
#include "yogstation\code\modules\scripting\Interpreter\Objects.dm"
#include "yogstation\code\modules\scripting\Interpreter\Scope.dm"
+#include "yogstation\code\modules\scripting\Joao\joao.dm"
#include "yogstation\code\modules\scripting\Parser\Expressions.dm"
#include "yogstation\code\modules\scripting\Parser\Keywords.dm"
#include "yogstation\code\modules\scripting\Parser\Parser.dm"
diff --git a/yogstation/code/controllers/subsystem/yogs.dm b/yogstation/code/controllers/subsystem/yogs.dm
index c17e12ec8081..916e7365c55e 100644
--- a/yogstation/code/controllers/subsystem/yogs.dm
+++ b/yogstation/code/controllers/subsystem/yogs.dm
@@ -15,6 +15,14 @@ SUBSYSTEM_DEF(Yogs)
/datum/controller/subsystem/Yogs/Initialize()
mentortickets = list()
+ //JOAO
+ if(fexists(EXTOOLS)){
+ var/result = call(EXTOOLS,"init_joao")();
+ if(result != "ok") {CRASH(result);}
+ } else {
+ CRASH("byond-extools.dll does not exist!");
+ }
+
//PRIZEPOOL MODIFIER THING
GLOB.arcade_prize_pool[/obj/item/grenade/plastic/glitterbomb/pink] = 1
GLOB.arcade_prize_pool[/obj/item/toy/plush/goatplushie/angry] = 2
diff --git a/yogstation/code/game/machinery/telecomms/computers/traffic_control.dm b/yogstation/code/game/machinery/telecomms/computers/traffic_control.dm
index fb7527ad6abb..ba09ead101f3 100644
--- a/yogstation/code/game/machinery/telecomms/computers/traffic_control.dm
+++ b/yogstation/code/game/machinery/telecomms/computers/traffic_control.dm
@@ -1,27 +1,33 @@
+#define SCREEN_MAINMENU 0
+#define SCREEN_SERVER 1
+#define SCREEN_LOGS 2
+#define SCREEN_CODING 3
+#define TELECOMMS_SEARCH_RANGE 25 // The radius from which a traffic computer can perceive servers.
/obj/machinery/computer/telecomms/traffic
- name = "telecommunications traffic control console"
+ name = "traffic control computer"
+ desc = "A computer used to interface with the programming of communication servers."
- var/screen = 0 // the screen number:
var/emagged = FALSE
- var/list/servers = list() // the servers located by the computer
- var/mob/editingcode
- var/mob/lasteditor
- var/list/viewingcode = list()
- var/obj/machinery/telecomms/server/SelectedServer
+ var/list/cached_server_list = list() // The servers located by the computer
+ var/mob/editUser
+ var/mob/lastUser
+ var/obj/machinery/telecomms/server/serverSelected
- var/network = "NULL" // the network to probe
- var/temp = "" // temporary feedback messages
+ var/network = null // The network we're currently looking at
+ var/codestr = "" // Cached code, completely undigested string (!!!)
+
+ var/screen_state = SCREEN_MAINMENU
- var/storedcode = "" // code stored
var/obj/item/card/id/auth = null
var/list/access_log = list()
- var/process = 0
circuit = /obj/item/circuitboard/computer/telecomms/comm_traffic
req_access = list(ACCESS_TCOM_ADMIN)
+ tgui_id = "TrafficControl"
+
/obj/machinery/computer/telecomms/traffic/Initialize(mapload)
. = ..()
GLOB.traffic_comps += src
@@ -30,120 +36,8 @@
GLOB.traffic_comps -= src
return ..()
-/obj/machinery/computer/telecomms/traffic/proc/stop_editing()
- if(editingcode)
- if(editingcode.client)
- winshow(editingcode, "Telecomms IDE", 0) // hide the window!
- editingcode.unset_machine()
- editingcode = null
-
-/obj/machinery/computer/telecomms/traffic/process()
-
- if(stat & (NOPOWER|BROKEN))
- stop_editing()
- return
-
- if(editingcode && editingcode.machine != src)
- stop_editing()
- return
-
- if(!editingcode)
- if(length(viewingcode) > 0)
- editingcode = pick(viewingcode)
- viewingcode.Remove(editingcode)
- return
-
- process = !process
- if(!process)
- return
-
- // loop if there's someone manning the keyboard
- if(!editingcode.client)
- stop_editing()
- return
-
- // For the typer, the input is enabled. Buffer the typed text
- storedcode = "[winget(editingcode, "tcscode", "text")]"
- winset(editingcode, "tcscode", "is-disabled=false")
-
- // If the player's not manning the keyboard anymore, adjust everything
- if(!in_range(editingcode, src) && !issilicon(editingcode) || editingcode.machine != src)
- winshow(editingcode, "Telecomms IDE", 0) // hide the window!
- editingcode = null
- return
-
- // For other people viewing the typer type code, the input is disabled and they can only view the code
- // (this is put in place so that there's not any magical shenanigans with 50 people inputting different code all at once)
-
- if(length(viewingcode))
- // This piece of code is very important - it escapes quotation marks so string aren't cut off by the input element
- var/showcode = replacetext(storedcode, "\\\"", "\\\\\"")
- showcode = replacetext(storedcode, "\"", "\\\"")
-
- for(var/mob/M in viewingcode)
-
- if( (M.machine == src && in_range(M, src) ) || issilicon(M))
- winset(M, "tcscode", "is-disabled=true")
- winset(M, "tcscode", "text=\"[showcode]\"")
- else
- viewingcode.Remove(M)
- winshow(M, "Telecomms IDE", 0) // hide the windows
-
-
-/obj/machinery/computer/telecomms/traffic/ui_interact(mob/user)
- if(..())
- return
- user.set_machine(src)
- var/dat = "Telecommunication Traffic ControlTelecommunications Traffic Control"
- dat += "
[(auth ? "AUTHED" : "NOT AUTHED")]: [(!auth ? "Insert ID" : auth)]
"
- dat += "View System Log
"
-
- if(issilicon(user) || auth)
-
- switch(screen)
-
-
- // --- Main Menu ---
-
- if(0)
- dat += "
[temp]
"
- dat += "
Current Network: [network]
"
- if(servers.len)
- dat += "
Detected Telecommunication Servers:"
- for(var/obj/machinery/telecomms/T in servers)
- dat += "- \ref[T] [T.name] ([T.id])
"
- dat += "
"
- dat += "
\[Flush Buffer\]"
-
- else
- dat += "
No servers detected. Scan for servers: \[Scan\]"
-
-
- // --- Viewing Server ---
-
- if(1)
- if(SelectedServer)
- dat += "
[temp]
"
- dat += "\[Main Menu\] \[Refresh\]"
- dat += "
Current Network: [network]"
- dat += "
Selected Server: [SelectedServer.id]"
- dat += "
"
- dat += "
\[Edit Code\]"
- dat += "
Signal Execution: "
- if(SelectedServer.autoruncode)
- dat += "ALWAYS"
- else
- dat += "NEVER"
- else
- screen = 0
- return
-
- dat += ""
- user << browse(dat, "window=traffic_control;size=575x400")
- onclose(user, "server_control")
-
- temp = ""
- return
+/obj/machinery/computer/telecomms/traffic/proc/isAuthorized(mob/user) // Confirm that the current user can use the restricted functions of this computer.
+ return issilicon(user) || ( (emagged || auth) && in_range(user, src))
/obj/machinery/computer/telecomms/traffic/proc/create_log(entry, mob/user)
var/id = null
@@ -151,6 +45,8 @@
id = "System Administrator"
else if(ispAI(user))
id = "[user.name] (pAI)"
+ else if(isdrone(user))
+ id = "[user.name]"
else
if(auth)
id = "[auth.registered_name] ([auth.assignment])"
@@ -158,149 +54,13 @@
return
access_log += "\[[get_timestamp()]\] [id] [entry]"
-/obj/machinery/computer/telecomms/traffic/proc/print_logs()
- . = "Traffic Control Telecomms System Log
"
- for(var/entry in access_log)
- . += entry + "
"
- . += ""
- return .
-
-/obj/machinery/computer/telecomms/traffic/Topic(href, href_list)
- if(..())
- return
-
-
- add_fingerprint(usr)
- usr.set_machine(src)
-
- if(href_list["auth"])
- if(iscarbon(usr))
- var/mob/living/carbon/C = usr
- if(!auth)
- var/obj/item/card/id/I = C.get_active_held_item()
- if(istype(I))
- if(check_access(I))
- if(!C.transferItemToLoc(I, src))
- return
- auth = I
- create_log("has logged in.", usr)
- else
- create_log("has logged out.", usr)
- auth.loc = src.loc
- C.put_in_hands(auth)
- auth = null
- updateUsrDialog()
- return
-
- if(href_list["print"])
- usr << browse(print_logs(), "window=traffic_logs")
- return
-
- if(!auth && !issilicon(usr) && !emagged)
- to_chat(usr, span_danger("ACCESS DENIED."))
- return
-
- if(href_list["viewserver"])
- screen = 1
- for(var/obj/machinery/telecomms/T in servers)
- if(T.id == href_list["viewserver"])
- SelectedServer = T
- create_log("selected server [T.name]", usr)
- break
- if(href_list["operation"])
- create_log("has performed action: [href_list["operation"]].", usr)
- switch(href_list["operation"])
-
- if("release")
- servers = list()
- screen = 0
-
- if("mainmenu")
- screen = 0
-
- if("scan")
- if(servers.len > 0)
- temp = "- FAILED: CANNOT PROBE WHEN BUFFER FULL -"
-
- else
- for(var/obj/machinery/telecomms/server/T in range(25, src))
- if(T.network == network)
- servers.Add(T)
-
- if(!servers.len)
- temp = "- FAILED: UNABLE TO LOCATE SERVERS IN \[[network]\] -"
- else
- temp = "- [servers.len] SERVERS PROBED & BUFFERED -"
-
- screen = 0
-
- if("editcode")
- if(is_banned_from(usr.ckey, "Signal Technician"))
- to_chat(usr, span_warning("You are banned from using NTSL."))
- return
- if(editingcode == usr)
- return
- if(usr in viewingcode)
- return
- if(!editingcode)
- lasteditor = usr
- editingcode = usr
- winshow(editingcode, "Telecomms IDE", 1) // show the IDE
- winset(editingcode, "tcscode", "is-disabled=false")
- winset(editingcode, "tcscode", "text=\"\"")
- var/showcode = replacetext(storedcode, "\\\"", "\\\\\"")
- showcode = replacetext(storedcode, "\"", "\\\"")
- winset(editingcode, "tcscode", "text=\"[showcode]\"")
-
- else
- viewingcode.Add(usr)
- winshow(usr, "Telecomms IDE", 1) // show the IDE
- winset(usr, "tcscode", "is-disabled=true")
- winset(editingcode, "tcscode", "text=\"\"")
- var/showcode = replacetext(storedcode, "\"", "\\\"")
- winset(usr, "tcscode", "text=\"[showcode]\"")
-
- if("togglerun")
- SelectedServer.autoruncode = !(SelectedServer.autoruncode)
-
- if(href_list["network"])
-
- var/newnet = stripped_input(usr, "Which network do you want to view?", "Comm Monitor", network)
-
- if(newnet && canAccess(usr))
- if(length(newnet) > 15)
- temp = "- FAILED: NETWORK TAG STRING TOO LONG -"
-
- else
-
- network = newnet
- screen = 0
- servers = list()
- temp = "- NEW NETWORK TAG SET IN ADDRESS \[[network]\] -"
- create_log("has set the network to [network].", usr)
-
- updateUsrDialog()
- return
-
/obj/machinery/computer/telecomms/traffic/attackby(obj/O, mob/user, params)
- src.updateUsrDialog()
if(istype(O, /obj/item/card/id) && check_access(O) && user.transferItemToLoc(O, src))
auth = O
create_log("has logged in.", usr)
else
..()
-/obj/machinery/computer/telecomms/traffic/emag_act(mob/user)
- if(!emagged)
- playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
- emagged = TRUE
- to_chat(user, span_notice("You you disable the security protocols."))
-
-/obj/machinery/computer/telecomms/traffic/proc/canAccess(mob/user)
- if(issilicon(user) || in_range(user, src))
- return 1
- return 0
-
/obj/machinery/computer/telecomms/traffic/AltClick(mob/user)
if(!user.canUseTopic(src, BE_CLOSE))
return
@@ -319,5 +79,146 @@
auth.forceMove(drop_location())
C.put_in_hands(auth)
auth = null
- updateUsrDialog()
- return
\ No newline at end of file
+ return
+
+/obj/machinery/computer/telecomms/traffic/emag_act(mob/user)
+ if(!emagged)
+ playsound(src.loc, 'sound/effects/sparks4.ogg', 75, 1)
+ emagged = TRUE
+ to_chat(user, span_notice("You disable the security protocols of the [src]."))
+
+/obj/machinery/computer/telecomms/traffic/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "TrafficControl")
+ ui.open()
+
+/obj/machinery/computer/telecomms/traffic/ui_act(action, list/params)
+ if(..())
+ return
+ switch(action)
+ if("refreshme")
+ return TRUE
+ if("back")
+ if(!isAuthorized(usr))
+ return
+ screen_state = SCREEN_MAINMENU // Just to be sure
+ playsound(src, "terminal_type", 15, FALSE)
+ return TRUE
+
+ if("goto")
+ if(!isAuthorized(usr))
+ return
+ switch(params["screen_state"])
+ if(SCREEN_SERVER)
+ screen_state = SCREEN_SERVER
+ playsound(src, "terminal_type", 15, FALSE)
+ return TRUE
+ if(SCREEN_CODING)
+ if(is_banned_from(usr.ckey, "Signal Technician"))
+ to_chat(usr, span_warning("You are banned from using scripting."))
+ return
+ screen_state = SCREEN_CODING
+ playsound(src, "terminal_type", 15, FALSE)
+ return TRUE
+ if(SCREEN_MAINMENU)
+ screen_state = SCREEN_MAINMENU
+ playsound(src, "terminal_type", 15, FALSE)
+ return TRUE
+
+ if(SCREEN_LOGS)
+ screen_state = SCREEN_LOGS
+ playsound(src, "terminal_type", 15, FALSE)
+ return TRUE
+ return
+ if("savecode")
+ if(!isAuthorized(usr))
+ return
+ if(is_banned_from(usr.ckey, "Signal Technician"))
+ to_chat(usr, span_warning("You are banned from using scripting."))
+ return
+ codestr = params["code"]
+ if(!serverSelected) // Weird for this to be the case
+ return
+ serverSelected.setcode(codestr)
+ playsound(src, "terminal_type", 15, FALSE)
+ return TRUE
+ if("auth")
+ if(iscarbon(usr))
+ var/mob/living/carbon/C = usr
+ if(!auth)
+ var/obj/item/card/id/I = C.get_active_held_item()
+ if(istype(I))
+ if(check_access(I))
+ if(!C.transferItemToLoc(I, src))
+ return
+ auth = I
+ create_log("has logged in.", usr)
+ playsound(src, 'sound/machines/terminal_on.ogg', 25, FALSE)
+ else
+ create_log("has logged out.", usr)
+ auth.loc = src.loc
+ C.put_in_hands(auth)
+ auth = null
+ playsound(src, 'sound/machines/terminal_off.ogg', 25, FALSE)
+ return TRUE
+ return
+ if("scan")
+ if(!isAuthorized(usr))
+ return
+ if(cached_server_list.len > 0)
+ cached_server_list = list()
+ for(var/obj/machinery/telecomms/server/T in range(TELECOMMS_SEARCH_RANGE, src))
+ if(T.network == network)
+ cached_server_list.Add(T)
+ screen_state = SCREEN_MAINMENU
+ playsound(src, "terminal_type", 15, FALSE)
+ return TRUE
+ if("select")
+ for(var/s in cached_server_list)
+ var/obj/machinery/telecomms/server/server = s
+ if(server.id == params["server_id"])
+ serverSelected = server
+ playsound(src, "terminal_type", 15, FALSE)
+ return TRUE
+ if("toggle_code")
+ if(is_banned_from(usr.ckey, "Signal Technician"))
+ to_chat(usr, span_warning("You are banned from using scripting."))
+ return
+ serverSelected.autoruncode = !(serverSelected.autoruncode)
+ playsound(src, "terminal_type", 15, FALSE)
+ return TRUE
+
+/obj/machinery/computer/telecomms/traffic/ui_data(mob/user)
+ var/data = list()
+
+ //Basic state variables
+ data["screen_state"] = screen_state
+ data["auth"] = auth ? auth.registered_name : FALSE
+ data["is_authorized"] = issilicon(user) || emagged || (auth ? TRUE : FALSE)
+ if(serverSelected)
+ data["serverSelected_id"] = serverSelected.id
+ data["serverSelected_enabledcode"] = serverSelected.autoruncode
+ else
+ data["serverSelected_id"] = -1
+
+ //Server data
+ if(screen_state == SCREEN_MAINMENU)
+ {
+ var/list/servers = list()
+ for(var/obj/machinery/telecomms/server/s in cached_server_list)
+ servers.Add(s.id)
+ data["servers"] = servers
+
+ }
+ else if(screen_state == SCREEN_LOGS)
+ {
+ data["logs"] = access_log // Inshallah this will work
+ }
+ return data
+
+#undef SCREEN_MAINMENU
+#undef SCREEN_SERVER
+#undef SCREEN_LOGS
+#undef SCREEN_CODING
+#undef TELECOMMS_SEARCH_RANGE
\ No newline at end of file
diff --git a/yogstation/code/game/machinery/telecomms/machines/server.dm b/yogstation/code/game/machinery/telecomms/machines/server.dm
index d70267fa8989..47e9b16a01c0 100644
--- a/yogstation/code/game/machinery/telecomms/machines/server.dm
+++ b/yogstation/code/game/machinery/telecomms/machines/server.dm
@@ -4,34 +4,23 @@
return FALSE // The server's radio isn't for receiving, it's for outputting. For now.
/obj/machinery/telecomms/server
- //NTSL-related stuffs
- var/datum/TCS_Compiler/Compiler // the compiler that compiles and runs the code
+ //Joao-related stuffs
var/autoruncode = FALSE // 1 if the code is set to run every time a signal is picked up
var/list/memory = list() // stored memory, for mem() in NTSL
- var/rawcode = "" // the code to compile (raw-ass text)
- var/compiledcode = "" //the last compiled code (also raw-ass text)
+ var/codestr = "" // the code to compile (raw-ass text)
var/obj/item/radio/server/server_radio // Allows the server to talk on the radio, via broadcast() in NTSL
var/last_signal = 0 // Marks the last time an NTSL script called signal() from this server, to stop spam.
var/list/compile_warnings = list()
- //End-NTSL
+ //End-Joao
-//NTSL-related procs
+//Joao-related procs
/obj/machinery/telecomms/server/Initialize()
- Compiler = new()
- Compiler.Holder = src
server_radio = new()
. = ..()
/obj/machinery/telecomms/server/proc/update_logs()
if(log_entries.len >= 400) // If so, start deleting at least, hopefully, one log entry
log_entries.Cut(1, 2)
- /*
- for(var/i = 1, i <= log_entries.len, i++) // locate the first garbage collectable log entry and remove it
- var/datum/comm_log_entry/L = log_entries[i]
- if(L.garbage_collector)
- log_entries.Remove(L)
- break
- */
/obj/machinery/telecomms/server/proc/add_entry(content, input)
var/datum/comm_log_entry/log = new
@@ -44,42 +33,6 @@
/obj/machinery/telecomms/server/proc/setcode(t)
- if(t)
- if(istext(t))
- rawcode = t
-
-/obj/machinery/telecomms/server/proc/compile(mob/user = usr)
- if(is_banned_from(user.ckey, "Signal Technician"))
- to_chat(user, span_warning("You are banned from using NTSL."))
- return
- if(Compiler)
- var/list/compileerrors = Compiler.Compile(rawcode)
- if(!compileerrors.len && (compiledcode != rawcode))
- user.log_message(rawcode, LOG_NTSL)
- compiledcode = rawcode
- if(user.mind.assigned_role == "Signal Technician") //achivement description says only Signal Technician gets the achivement
- var/freq
- if(freq_listening.len > 0)
- freq = freq_listening[1]
- else
- freq = 1459
- var/atom/movable/M = new()
- var/atom/movable/virtualspeaker/speaker = new(null, M, server_radio)
- speaker.name = "Poly"
- speaker.job = ""
- var/datum/signal/subspace/vocal/signal = new(src, freq, speaker, /datum/language/common, "test", list(), )
- signal.data["server"] = src
- Compiler.Run(signal)
- if(signal.data["reject"] == 1)
- signal.data["name"] = ""
- signal.data["reject"] = 0
- Compiler.Run(signal)
- if(signal.data["reject"] == 0)
- SSachievements.unlock_achievement(/datum/achievement/engineering/Poly_silent, user.client)
- else
- for(var/sample in signal.data["spans"])
- if(sample == SPAN_COMMAND)
- SSachievements.unlock_achievement(/datum/achievement/engineering/Poly_loud, user.client)
- break // Not having this break leaves us open to a potential DoS attack.
- return compileerrors
-//end-NTSL
+ if(t && istext(t))
+ codestr = t
+//end-Joao
diff --git a/yogstation/code/modules/admin/verbs/telecomms.dm b/yogstation/code/modules/admin/verbs/telecomms.dm
index 625c8da8486a..a5d2b8a22f7e 100644
--- a/yogstation/code/modules/admin/verbs/telecomms.dm
+++ b/yogstation/code/modules/admin/verbs/telecomms.dm
@@ -7,15 +7,13 @@
return
if(check_rights(R_ADMIN,1))
- var/confirm = alert(src, "You sure you want to blank all NTSL scripts?", "Confirm", "Yes", "No")
+ var/confirm = alert(src, "You sure you want to blank all telecomms scripts?", "Confirm", "Yes", "No")
if(confirm !="Yes") return
for(var/obj/machinery/telecomms/server/S in GLOB.telecomms_list)
- var/datum/TCS_Compiler/C = S.Compiler
- S.rawcode = ""
+ S.codestr = ""
S.autoruncode = FALSE
- C.Compile("")
for(var/obj/machinery/computer/telecomms/traffic/T in GLOB.traffic_comps)
- T.storedcode = ""
+ T.codestr = ""
log_game("[key_name_admin(usr)] blanked all telecomms scripts.")
message_admins("[key_name_admin(usr)] blanked all telecomms scripts.")
diff --git a/yogstation/code/modules/scripting/IDE.dm b/yogstation/code/modules/scripting/IDE.dm
deleted file mode 100644
index 3f4e5ecc13dd..000000000000
--- a/yogstation/code/modules/scripting/IDE.dm
+++ /dev/null
@@ -1,232 +0,0 @@
-/client/verb/tcssave()
- set hidden = 1
- if(is_banned_from(usr.ckey, "Signal Technician"))
- to_chat(usr, span_warning("You are banned from using NTSL."))
- return
- if(mob.machine || issilicon(mob))
- if(telecomms_check(mob))
- var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
- if(Machine.editingcode != mob)
- return
-
- if(Machine.SelectedServer)
- var/obj/machinery/telecomms/server/Server = Machine.SelectedServer
- var/tcscode=winget(src, "tcscode", "text")
- Server.setcode( tcscode ) // this actually saves the code from input to the server
- src << output(null, "tcserror") // clear the errors
- else
- src << output(null, "tcserror")
- src << output("Failed to save: Unable to locate server machine. (Back up your code before exiting the window!)", "tcserror")
- else
- src << output(null, "tcserror")
- src << output("Failed to save: Unable to locate machine. (Back up your code before exiting the window!)", "tcserror")
- else
- src << output(null, "tcserror")
- src << output("Failed to save: Unable to locate machine. (Back up your code before exiting the window!)", "tcserror")
-
-
-/client/verb/tcscompile()
- set hidden = 1
- if(is_banned_from(usr.ckey, "Signal Technician"))
- to_chat(usr, span_warning("You are banned from using NTSL."))
- return
- if(mob.machine || issilicon(mob))
- if(telecomms_check(mob))
- var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
- if(Machine.editingcode != mob)
- return
-
- if(Machine.SelectedServer)
- var/obj/machinery/telecomms/server/Server = Machine.SelectedServer
- Server.setcode( winget(src, "tcscode", "text") ) // save code first
-
- spawn(0)
- // Output all the compile-time errors
- src << output(null, "tcserror")
- src << output("Compiling on [Server.name]...", "tcserror")
-
- var/list/compileerrors = Server.compile(mob) // then compile the code!
- if(!telecomms_check(mob))
- return
-
- if(compileerrors.len)
- src << output("Compile Errors", "tcserror")
- var/i = 1
- for(var/scriptError/e in compileerrors)
- if(i) //. Bold the first one, since it's probably important
- src << output("\t>[e.message]", "tcserror")
- i = 0
- else
- src << output("\t>[e.message]", "tcserror")
- src << output("([compileerrors.len] errors)", "tcserror")
-
- // Output compile errors to all other people viewing the code too
- for(var/mob/M in Machine.viewingcode)
- if(M.client)
- M << output(null, "tcserror")
- M << output("Compile Errors", "tcserror")
- i = 1 //. Still using var/i from above
- for(var/scriptError/e in compileerrors)
- if(i)
- M << output("\t>[e.message]", "tcserror")
- i = 0
- else
- M << output("\t>[e.message]", "tcserror")
- M << output("([compileerrors.len] errors)", "tcserror")
-
-
- else // If no errors
- src << output("TCS compilation successful!", "tcserror")
- src << output("Time of compile: [gameTimestamp("hh:mm:ss")]","tcserror")
- //. ^ To make it obvious that it's done a new compile
- src << output("(0 errors)", "tcserror")
-
- for(var/mob/M in Machine.viewingcode)
- if(M.client)
- M << output("TCS compilation successful!", "tcserror")
- M << output("Time of compile: [gameTimestamp("hh:mm:ss")]","tcserror")
- M << output("(0 errors)", "tcserror")
- if(Server.compile_warnings.len)
- src << output("Compile Warnings", "tcserror")
- for(var/scriptError/e in Server.compile_warnings)
- src << output("\t>[e.message]", "tcserror")
- src << output("([Server.compile_warnings.len] warnings)", "tcserror")
- for(var/fuck_you_for_making_me_do_this_altoids in Machine.viewingcode)
- var/mob/M = fuck_you_for_making_me_do_this_altoids
- if(M.client)
- M << output("Compile Warnings", "tcserror")
- for(var/scriptError/e in Server.compile_warnings)
- M << output("\t>[e.message]", "tcserror")
- M << output("([Server.compile_warnings.len] warnings)", "tcserror")
-
- else
- src << output(null, "tcserror")
- src << output("Failed to compile: Unable to locate server machine. (Back up your code before exiting the window!)", "tcserror")
- else
- src << output(null, "tcserror")
- src << output("Failed to compile: Unable to locate machine. (Back up your code before exiting the window!)", "tcserror")
- else
- src << output(null, "tcserror")
- src << output("Failed to compile: Unable to locate machine. (Back up your code before exiting the window!)", "tcserror")
-
-/client/verb/tcsrun()
- set hidden = 1
- if(is_banned_from(usr.ckey, "Signal Technician"))
- to_chat(usr, span_warning("You are banned from using NTSL."))
- return
- if(mob.machine || issilicon(mob))
- if(telecomms_check(mob))
- var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
- if(Machine.editingcode != mob)
- return
-
- if(Machine.SelectedServer)
- var/obj/machinery/telecomms/server/Server = Machine.SelectedServer
-
- var/datum/signal/signal = new()
- signal.data["message"] = ""
- if(Server.freq_listening.len > 0)
- signal.frequency = Server.freq_listening[1]
- else
- signal.frequency = 1459
- signal.data["name"] = ""
- signal.data["job"] = ""
- signal.data["reject"] = 0
- signal.data["server"] = Server
-
- Server.Compiler.Run(signal)
-
-
- else
- src << output(null, "tcserror")
- src << output("Failed to run: Unable to locate server machine. (Back up your code before exiting the window!)", "tcserror")
- else
- src << output(null, "tcserror")
- src << output("Failed to run: Unable to locate machine. (Back up your code before exiting the window!)", "tcserror")
- else
- src << output(null, "tcserror")
- src << output("Failed to run: Unable to locate machine. (Back up your code before exiting the window!)", "tcserror")
-
-
-/client/verb/exittcs()
- set hidden = 1
- if(is_banned_from(usr.ckey, "Signal Technician"))
- to_chat(usr, span_warning("You are banned from using NTSL."))
- return
- if(mob.machine || issilicon(mob))
- if(telecomms_check(mob))
- var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
- if(Machine.editingcode == mob)
- Machine.storedcode = "[winget(mob, "tcscode", "text")]"
- Machine.editingcode = null
- else
- if(mob in Machine.viewingcode)
- Machine.viewingcode.Remove(mob)
-
-/client/verb/tcsrevert()
- set hidden = 1
- if(is_banned_from(usr.ckey, "Signal Technician"))
- to_chat(usr, span_warning("You are banned from using NTSL."))
- return
- if(mob.machine || issilicon(mob))
- if(telecomms_check(mob))
- var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
- if(Machine.editingcode != mob)
- return
-
- if(Machine.SelectedServer)
- var/obj/machinery/telecomms/server/Server = Machine.SelectedServer
-
- // Replace quotation marks with quotation macros for proper winset() compatibility
- var/showcode = replacetext(Server.rawcode, "\\\"", "\\\\\"")
- showcode = replacetext(showcode, "\"", "\\\"")
-
- winset(mob, "tcscode", "text=\"[showcode]\"")
-
- src << output(null, "tcserror") // clear the errors
- else
- src << output(null, "tcserror")
- src << output("Failed to revert: Unable to locate server machine.", "tcserror")
- else
- src << output(null, "tcserror")
- src << output("Failed to revert: Unable to locate machine.", "tcserror")
- else
- src << output(null, "tcserror")
- src << output("Failed to revert: Unable to locate machine.", "tcserror")
-
-
-/client/verb/tcsclearmem()
- set hidden = 1
- if(is_banned_from(usr.ckey, "Signal Technician"))
- to_chat(usr, span_warning("You are banned from using NTSL."))
- return
- if(mob.machine || issilicon(mob))
- if(telecomms_check(mob))
- var/obj/machinery/computer/telecomms/traffic/Machine = mob.machine
- if(Machine.editingcode != mob)
- return
-
- if(Machine.SelectedServer)
- var/obj/machinery/telecomms/server/Server = Machine.SelectedServer
- Server.memory = list() // clear the memory
- // Show results
- //// Write shitty code comments
- src << output(null, "tcserror")
- src << output("Server memory cleared!", "tcserror")
- for(var/mob/M in Machine.viewingcode)
- if(M.client)
- M << output("Server memory cleared!", "tcserror")
- else
- src << output(null, "tcserror")
- src << output("Failed to clear memory: Unable to locate server machine.", "tcserror")
- else
- src << output(null, "tcserror")
- src << output("Failed to clear memory: Unable to locate machine.", "tcserror")
- else
- src << output(null, "tcserror")
- src << output("Failed to clear memory: Unable to locate machine.", "tcserror")
-
-/proc/telecomms_check(var/mob/mob)
- if(mob && istype(mob.machine, /obj/machinery/computer/telecomms/traffic) && in_range(mob.machine, mob) || issilicon(mob) && istype(mob.machine, /obj/machinery/computer/telecomms/traffic))
- return 1
- return 0
diff --git a/yogstation/code/modules/scripting/Joao/joao.dm b/yogstation/code/modules/scripting/Joao/joao.dm
new file mode 100644
index 000000000000..4f573d3d6aed
--- /dev/null
+++ b/yogstation/code/modules/scripting/Joao/joao.dm
@@ -0,0 +1,44 @@
+//The datum that's actually passed to the external scripting language, typically modified in-place.
+/datum/script_packet
+ var/datum/signal/subspace/vocal/signal // The message
+ var/datum/script_error/err // A possible error. Left with errcode at 0 if there was no error.
+/datum/script_packet/New(var/datum/signal/subspace/vocal/p)
+ signal = p
+ err = new
+
+/datum/script_error
+ var/what = "Nothing. :)" // Describes the error. Must be a string.
+ var/code = 0; // 0 indicates success. Everything else indicates failure. Must be an integer.
+
+/client/proc/execute_joao()
+ set category = "Misc.Server Debug"
+ set name = "Execute Joao Script"
+
+ if(!check_rights(R_DEBUG))
+ return
+
+ var/script_text = input("Input Joao program:","Execute Joao Script", null) as message|null
+ if(!script_text)
+ return
+
+ var/datum/signal/subspace/vocal/newsign = new // This runtimes, actually.
+ newsign.data = list() // I guess, lol
+ newsign.data["name"] = "source"
+ newsign.data["message"] = "message"
+ newsign.frequency = 1459;
+ var/datum/script_packet/packet = new(newsign)
+ var/ret = run_script(script_text,packet)
+ if(packet.err.code < 0)
+ message_admins("Joao crashed! Error: [packet.err.what]")
+ return;
+ if(packet.err.code)
+ message_admins("Joao runtimed! Error: [packet.err.what]")
+ return;
+ if(!ret)
+ message_admins("Joao execution failed in a mysterious way!")
+ return;
+ message_admins("Joao execution successful!")
+ message_admins(packet.signal.data["message"])
+
+/proc/run_script(script, datum/script_packet/sig) // Dummy proc; the real proc is within extools.
+ return "Joao has not been initialized!"
\ No newline at end of file