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
+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