It works!

This commit is contained in:
TDSSS
2020-08-11 23:54:39 +02:00
parent cfe665842e
commit f18f34eb2d
6 changed files with 68 additions and 129 deletions
@@ -14,8 +14,8 @@
circuit = /obj/item/circuitboard/labor_shuttle/one_way
req_access = list( )
/obj/machinery/computer/shuttle/labor/one_way/Topic(href, href_list) //TODO make those work, too
if(href_list["move"])
/obj/machinery/computer/shuttle/labor/one_way/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(action == "move")
var/obj/docking_port/mobile/M = SSshuttle.getShuttle("laborcamp")
if(!M)
to_chat(usr, "<span class='warning'>Cannot locate shuttle!</span>")
@@ -24,4 +24,5 @@
if(S && S.name == "laborcamp_away")
to_chat(usr, "<span class='warning'>Shuttle is already at the outpost!</span>")
return 0
..()
..() //I know the tutorial says if(..()) should always be at the start, but that won't work here
//and this doesn't move the shuttle, so any exploit is getting caught in the ..()
+2 -3
View File
@@ -6,14 +6,13 @@
resistance_flags = INDESTRUCTIBLE
flags = NODECONSTRUCT
/obj/machinery/computer/shuttle/ert/Topic(href, href_list) //TODO convert this, too
if(href_list["move"])
/obj/machinery/computer/shuttle/ert/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(action == "move")
var/authorized_roles = list(SPECIAL_ROLE_ERT, SPECIAL_ROLE_DEATHSQUAD)
if(!((usr.mind.assigned_role in authorized_roles) || is_admin(usr)))
message_admins("Potential ERT shuttle hijack, ERT shuttle moved by unauthorized user: [key_name_admin(usr)]")
..()
/obj/machinery/computer/camera_advanced/shuttle_docker/ert
name = "specops navigation computer"
desc = "Used to designate a precise transit location for the specops shuttle."
+15 -74
View File
@@ -727,13 +727,13 @@
name = "Shuttle Console"
icon_screen = "shuttle"
icon_keyboard = "tech_key"
req_access = list( )
req_access = list()
circuit = /obj/item/circuitboard/shuttle
var/shuttleId
var/possible_destinations = ""
var/admin_controlled
var/max_connect_range = 7
var/docking_request = 0
var/moved = FALSE //workaround for nukie shuttle, hope I find a better way to do this...
/obj/machinery/computer/shuttle/New(location, obj/item/circuitboard/shuttle/C)
..()
@@ -775,16 +775,15 @@
add_fingerprint(user)
tgui_interact(user)
//note to self, new stuff. Also TODO: remove dumb comments once you know how tgui works, ya dork
/obj/machinery/computer/shuttle/tgui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/tgui_state/state = GLOB.tgui_default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "ShuttleConsole", name, 300, 300, master_ui, state)
ui = new(user, src, ui_key, "ShuttleConsole", name, 300, 150, master_ui, state)
ui.open()
/obj/machinery/computer/shuttle/tgui_data(mob/user)
var/list/data = list()
var/obj/docking_port/mobile/M = SSshuttle.getShuttle(shuttleId) //attempt one, use old data, let's see if this works
var/obj/docking_port/mobile/M = SSshuttle.getShuttle(shuttleId)
data["status"] = M ? M.getStatusText() : null
if(M)
data["shuttle"] = TRUE //this should just be boolean, right?
@@ -799,10 +798,8 @@
docking_ports[++docking_ports.len] = list("name" = S.name, "id" = S.id)
data["docking_ports_len"] = docking_ports.len
data["admin_controlled"] = admin_controlled
data["docking_request"] = docking_request
return data
//default vscode params, may need change
/obj/machinery/computer/shuttle/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(..()) //we can't actually interact, so no action
return TRUE
@@ -812,77 +809,21 @@
var/list/options = params2list(possible_destinations)
if(action == "move")
var/destination = params["move"]
if(!options.Find(destination))//TODO figure out if this translation works
if(!options.Find(destination))//figure out if this translation works
message_admins("<span class='boldannounce'>EXPLOIT:</span> [ADMIN_LOOKUPFLW(usr)] attempted to move [src] to an invalid location! [ADMIN_COORDJMP(src)]")
return
switch(SSshuttle.moveShuttle(shuttleId, destination, 1, usr))
if(0)
atom_say("Shuttle departing! Please stand away from the doors.")
usr.create_log(MISC_LOG, "used [src] to call the [shuttleId] shuttle")
if(!moved)
moved = TRUE
if(1)
to_chat(usr, "<span class='warning'>Invalid shuttle requested.</span>")
else
to_chat(usr, "<span class='notice'>Unable to comply.</span>")
return TRUE
//old crap, delete before push/when done lmao
/obj/machinery/computer/shuttle/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/obj/docking_port/mobile/M = SSshuttle.getShuttle(shuttleId)
ui = SSnanoui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "shuttle_console.tmpl", M ? M.name : "shuttle", 300, 200)
ui.open()
/obj/machinery/computer/shuttle/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state)
var/data[0]
var/obj/docking_port/mobile/M = SSshuttle.getShuttle(shuttleId)
data["status"] = M ? M.getStatusText() : null
if(M)
data["shuttle"] = 1
var/list/docking_ports = list()
data["docking_ports"] = docking_ports
var/list/options = params2list(possible_destinations)
for(var/obj/docking_port/stationary/S in SSshuttle.stationary)
if(!options.Find(S.id))
continue
if(!M.check_dock(S))
continue
docking_ports[++docking_ports.len] = list("name" = S.name, "id" = S.id)
data["docking_ports_len"] = docking_ports.len
data["admin_controlled"] = admin_controlled
data["docking_request"] = docking_request
return data
/obj/machinery/computer/shuttle/Topic(href, href_list)
if(..())
return 1
if(!allowed(usr))
to_chat(usr, "<span class='danger'>Access denied.</span>")
return
var/list/options = params2list(possible_destinations)
if(href_list["move"])
if(!options.Find(href_list["move"])) //I see you're trying Href exploits, I see you're failing, I SEE ADMIN WARNING.
// Seriously, though, NEVER trust a Topic with something like this. Ever.
// Sidenote for whoever did this last. Why did you set it to echo whatever the user entered to admin chat? You solved one exploit and created another.
message_admins("<span class='boldannounce'>EXPLOIT:</span> [ADMIN_LOOKUPFLW(usr)] attempted to move [src] to an invalid location! [ADMIN_COORDJMP(src)]")
return
switch(SSshuttle.moveShuttle(shuttleId, href_list["move"], 1, usr))
if(0)
atom_say("Shuttle departing! Please stand away from the doors.")
usr.create_log(MISC_LOG, "used [src] to call the [shuttleId] shuttle")
if(1)
to_chat(usr, "<span class='warning'>Invalid shuttle requested.</span>")
else
to_chat(usr, "<span class='notice'>Unable to comply.</span>")
return 1
/obj/machinery/computer/shuttle/emag_act(mob/user)
if(!emagged)
src.req_access = list()
@@ -904,21 +845,21 @@
admin_controlled = 1
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF
//TODO remember the ferry has its own topic to update. Don't miss it
/obj/machinery/computer/shuttle/ferry/request/Topic(href, href_list)
/obj/machinery/computer/shuttle/ferry/request/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(..())
return 1
if(href_list["request"])
return
if(action == "request")
if(cooldown)
return
cooldown = 1
cooldown = TRUE
to_chat(usr, "<span class='notice'>Your request has been recieved by Centcom.</span>")
log_admin("[key_name(usr)] requested to move the transport ferry to Centcom.")
message_admins("<b>FERRY: <font color='blue'>[key_name_admin(usr)] (<A HREF='?_src_=holder;secretsfun=moveferry'>Move Ferry</a>)</b> is requesting to move the transport ferry to Centcom.</font>")
. = 1
SSnanoui.update_uis(src)
. = TRUE
SStgui.update_uis(src)
spawn(600) //One minute cooldown
cooldown = 0
cooldown = FALSE
/obj/machinery/computer/shuttle/white_ship
name = "White Ship Console"
+5 -6
View File
@@ -11,19 +11,18 @@
resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | ACID_PROOF
flags = NODECONSTRUCT
var/challenge = FALSE
var/moved = FALSE
/obj/machinery/computer/shuttle/syndicate/recall
name = "syndicate shuttle recall terminal"
circuit = /obj/item/circuitboard/shuttle/syndicate/recall
possible_destinations = "syndicate_away"
/obj/machinery/computer/shuttle/syndicate/Topic(href, href_list) // TODO convert this too
if(href_list["move"])
/obj/machinery/computer/shuttle/syndicate/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(action == "move")
if(challenge && world.time < SYNDICATE_CHALLENGE_TIMER)
to_chat(usr, "<span class='warning'>You've issued a combat challenge to the station! You've got to give them at least [round(((SYNDICATE_CHALLENGE_TIMER - world.time) / 10) / 60)] more minutes to allow them to prepare.</span>")
return 0
moved = TRUE
moved = TRUE //MYTODO safety check this somehow, don't make affected cry
..()
/obj/machinery/computer/shuttle/syndicate/drop_pod
@@ -35,8 +34,8 @@
shuttleId = "steel_rain"
possible_destinations = null
/obj/machinery/computer/shuttle/syndicate/drop_pod/Topic(href, href_list)
if(href_list["move"])
/obj/machinery/computer/shuttle/syndicate/drop_pod/tgui_act(action, list/params, datum/tgui/ui, datum/tgui_state/state)
if(action == "move")
if(z != level_name_to_num(CENTCOMM))
to_chat(usr, "<span class='warning'>Pods are one way!</span>")
return 0
+40 -41
View File
@@ -1,5 +1,5 @@
import { useBackend } from '../backend';
import { Button, LabeledList, Box, Section } from '../components';
import { Button, LabeledList, Box, Fragment, Section } from '../components';
import { Window } from '../layouts';
import { LabeledListItem } from '../components/LabeledList';
@@ -7,65 +7,64 @@ export const ShuttleConsole = (props, context) => {
const { act, data } = useBackend(context);
// get stuff
return (
<Window>
<Window resizable>
<Window.Content>
<LabeledList>
<LabeledList.Item label="Location">
{data.status ? (
data.status
) : (
<Box bold lineHeight={2} color="red">
<Box color="red">
*MISSING*
</Box>
)}
</LabeledList.Item>
</LabeledList>
{!!data.shuttle && (// only show this stuff if there's a shuttle
<>
{!!data.docking_ports_len && (
{!!data.shuttle && (// only show this stuff if there's a shuttle
<Fragment>
{!!data.docking_ports_len && (
// I am not sure if I am nesting this stuff right...
<>
{data.docking_ports.map(port => (
<Button key={port.name} // IDK man
content={"Send to " + port.name}
// TODO: should button have icon?
disabled={!data.status}
// I am not sure if there's any conditions
// where this should be locked
onClick={() => act('move', {
move: port.id,
})} />
)
)}
{/* Apparently I need to comment like this sometimes??
<Fragment>
<LabeledList.Item label={"Send to "}>
{data.docking_ports.map(port => (
<Button
icon="chevron-right"
key={port.name}
content={port.name}
// TODO: should button have icon?
onClick={() => act('move', {
move: port.id,
})} />
)
)}
</LabeledList.Item>
{/* Apparently I need to comment like this sometimes??
Also end of the button at /> up there.*/}
</>
) || (// ELSE, if there's no docking ports.
<>
<LabeledList>
</Fragment>
) || (// ELSE, if there's no docking ports.
<Fragment>
<LabeledListItem label="Status" color="red">
Shuttle Locked
</LabeledListItem>
</LabeledList>
{!!data.admin_controlled && (
<LabeledListItem label="Authorized Personnel Only">
<Button
content="Request Authorization"
// TODO: should button have icon?
disabled={!data.status}// I am not sure if there's
// any conditions this should be locked
onClick={() => act('request')} />
</LabeledListItem>
)}
</>
)}
{/* end of the docking_ports_len if/else block
{!!data.admin_controlled && (
<LabeledListItem label="Authorized Personnel Only">
<Button
icon="exclamation-circle"
content="Request Authorization"
disabled={!data.status}// I am not sure if there's
// any conditions this should be locked
onClick={() => act('request')} />
</LabeledListItem>
)}
</Fragment>
)}
{/* end of the docking_ports_len if/else block
there is an (as far as I can tell) unreachable
piece of code in the original tmpl since
docking_request doesn't seem to be ever set
so it's probably not needed?*/}
</>
)}
</Fragment>
)}
</LabeledList>
</Window.Content>
</Window>
);
File diff suppressed because one or more lines are too long