Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified byond-extools.dll
Binary file not shown.
Binary file modified byond-extools.pdb
Binary file not shown.
2 changes: 1 addition & 1 deletion code/__DEFINES/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)){\
Expand Down
10 changes: 8 additions & 2 deletions code/game/machinery/telecomms/machines/server.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion code/modules/admin/verbs/debug.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
1 change: 1 addition & 0 deletions code/modules/admin/verbs/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
247 changes: 247 additions & 0 deletions tgui/packages/tgui/interfaces/TrafficControl.js
Original file line number Diff line number Diff line change
@@ -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 (<pre>Couldn't understand what the keyword was!</pre>);
}
//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 (
<font>
{recurse(header,lvl+1)}
<font color={colour}>{keyword}</font>
{recurse(footer,lvl+1)}
</font>
);
}

return (
<pre>{recurse(txt,0)}</pre>
);
}
}

getValue() {
return this.state.text;
}

render() {
const { text } = this.state;
return (
<Box>
<textarea ref={this.textareaRef} onInput={this.handleOnInput} id='joao_textarea'
maxlength={32000} scrollable={false}>{text}</textarea>
<code id='joao_code' ref={this.codeRef} scrollable={false}>
{this.lexify(text)}
</code>
<Button ref={this.buttonRef} onClick={() => {this.act('savecode',{"code": this.state.text})}}>Save Code</Button>
</Box>
);
}
}

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 (
<Window title="Traffic Control Computer" width={480} height={480}>
<Window.Content>

Identification: <Button onClick={() => act('auth', {})} color={(auth)
? 'good'
: 'bad'}><Icon name="address-card"> </Icon>{cooler_auth}</Button>
<Divider></Divider>
<NoticeBox textAlign='center' danger>
<Icon name='exclamation-triangle' size={5}></Icon><br></br>
No Authorization Found!<br></br>
Please insert identification card to continue.
</NoticeBox>
</Window.Content>
</Window>
);
}

if(screen_state == 0) // MAIN MENU
{
const server_list = (servers && servers.map((server) => {
let should_be_disabled = serverSelected_id != -1 && server == serverSelected_id;
return <LabeledList.Item
label={server}
buttons={(
<Button onClick ={() => act('select', {'server_id': server})} disabled={should_be_disabled}>
{should_be_disabled ? "Server Selected" : "Select Server"}
</Button>
)}>
</LabeledList.Item>
})) || "";

const server_display = (serverSelected_id != -1 && (
<Section title='Server Information'>
<Box>Name: {serverSelected_id}</Box>
<Box>Code execution status: <Button onClick={() => act('toggle_code', {})} color={(serverSelected_enabledcode)
? 'good'
: 'bad'}>
{(serverSelected_enabledcode ? "Enabled" : "Disabled")}</Button></Box>
<Button onClick={() => act('goto', {"screen_state":3})}>View Code</Button>
</Section>
)) || (<NoticeBox textAlign='center' warning>No Server Selected!</NoticeBox>);
return (
<Window resizable title="Traffic Control Computer">
<Window.Content scrollable>
Identification: <Button onClick={() => act('auth', {})} color={(auth)
? 'good'
: 'bad'}><Icon name="address-card"></Icon>{cooler_auth}</Button>
<Divider></Divider>
<Tabs>
<Tabs.Tab selected={1}>
Server List
</Tabs.Tab>
<Tabs.Tab selected={0} onClick={() => {act('goto',{"screen_state":2})}}>
Computer Logs
</Tabs.Tab>
</Tabs>
<LabeledList>
<Button onClick={() => {act('scan',{})}}><Icon name='binoculars'></Icon>Scan for Servers</Button>
{server_list}
</LabeledList>
<Divider></Divider>
{server_display}
</Window.Content>
</Window>
);
}
if(screen_state == 2) // COMPUTER LOGS
{
const log_list = (logs && logs.map((log) => {
return <Box>
{log}
</Box>
})) || "";
return (<Window resizable title="Traffic Control Computer">
<Window.Content scrollable>
Identification: <Button onClick={() => act('auth', {})} color={(auth)
? 'good'
: 'bad'}><Icon name="address-card"> </Icon>{cooler_auth}</Button>
<Divider></Divider>
<Tabs>
<Tabs.Tab selected={0} onClick={() => {act('goto',{"screen_state":0})}}>
Server List
</Tabs.Tab>
<Tabs.Tab selected={1}>
Computer Logs
</Tabs.Tab>
</Tabs>
{log_list}
</Window.Content>
</Window>);
}
if(screen_state == 3) // SCREEN_CODING
{
return (
<Window resizable title="Traffic Control Computer" theme="hackerman">
<Window.Content>
<JoaoBox act={act}>Input code here...</JoaoBox>
<Button onClick = {() => {act('back',{})}}>Back</Button>
</Window.Content>
</Window>);
}

return (
<Window resizable title="Traffic Control Computer">
<Window.Content scrollable>

Identification: <Button onClick={() => act('auth', {})} color={(auth)
? 'good'
: 'bad'}><Icon name="address-card"> </Icon>{cooler_auth}</Button>
<Divider></Divider>
<Tabs>
<Tabs.Tab selected={0}>
<Button onClick={() => act('goto', {screen_state: 0})}>Server List</Button>
</Tabs.Tab>
<Tabs.Tab selected={0}>
<Button onClick={() => act('goto', {screen_state: 2})}>Computer Logs</Button>
</Tabs.Tab>
</Tabs>
<NoticeBox textAlign='center' danger>
<Icon name='bug' size={5}></Icon><br></br>
You found a bug!<br></br>
Please report this to Altoids on the Yogstation Discord.
</NoticeBox>
</Window.Content>
</Window>);
};
32 changes: 32 additions & 0 deletions tgui/packages/tgui/styles/interfaces/TrafficControl.scss
Original file line number Diff line number Diff line change
@@ -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);
}
1 change: 1 addition & 0 deletions tgui/packages/tgui/styles/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion yogstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions yogstation/code/controllers/subsystem/yogs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading