diff --git a/code/modules/mining/laborcamp/laborshuttle.dm b/code/modules/mining/laborcamp/laborshuttle.dm index 26ffc7b352e..087ffdb87db 100644 --- a/code/modules/mining/laborcamp/laborshuttle.dm +++ b/code/modules/mining/laborcamp/laborshuttle.dm @@ -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, "Cannot locate shuttle!") @@ -24,4 +24,5 @@ if(S && S.name == "laborcamp_away") to_chat(usr, "Shuttle is already at the outpost!") 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 ..() diff --git a/code/modules/shuttle/ert.dm b/code/modules/shuttle/ert.dm index 4340a9e2f96..32af5e429fa 100644 --- a/code/modules/shuttle/ert.dm +++ b/code/modules/shuttle/ert.dm @@ -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." diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 9ec2375d548..53ce4e294bd 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -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("EXPLOIT: [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, "Invalid shuttle requested.") else to_chat(usr, "Unable to comply.") 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, "Access denied.") - 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("EXPLOIT: [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, "Invalid shuttle requested.") - else - to_chat(usr, "Unable to comply.") - 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, "Your request has been recieved by Centcom.") log_admin("[key_name(usr)] requested to move the transport ferry to Centcom.") message_admins("FERRY: [key_name_admin(usr)] (Move Ferry) is requesting to move the transport ferry to Centcom.") - . = 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" diff --git a/code/modules/shuttle/syndicate.dm b/code/modules/shuttle/syndicate.dm index 6197f3c10f6..8f3eaa1cea7 100644 --- a/code/modules/shuttle/syndicate.dm +++ b/code/modules/shuttle/syndicate.dm @@ -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, "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.") 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, "Pods are one way!") return 0 diff --git a/tgui/packages/tgui/interfaces/ShuttleConsole.js b/tgui/packages/tgui/interfaces/ShuttleConsole.js index 793442e6040..97d122a528f 100644 --- a/tgui/packages/tgui/interfaces/ShuttleConsole.js +++ b/tgui/packages/tgui/interfaces/ShuttleConsole.js @@ -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 ( - + {data.status ? ( data.status ) : ( - + *MISSING* )} - - {!!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 + + {!!data.docking_ports_len && ( // I am not sure if I am nesting this stuff right... - <> - {data.docking_ports.map(port => ( -