From f1ae2e3f3a99c9c51deb43f459a0efcaafe1798f Mon Sep 17 00:00:00 2001 From: davipatury Date: Sat, 18 Feb 2017 20:49:38 -0200 Subject: [PATCH 1/2] Shuttle Console nano-ui. --- code/modules/shuttle/shuttle.dm | 48 +++++++++++++++-------------- nano/templates/shuttle_console.tmpl | 28 +++++++++++++++++ 2 files changed, 53 insertions(+), 23 deletions(-) create mode 100644 nano/templates/shuttle_console.tmpl diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index d48d892a86f..72f83153687 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -676,41 +676,41 @@ return if(!shuttleId) return - src.add_fingerprint(usr) - connect() + add_fingerprint(user) + ui_interact(user) - var/list/options = params2list(possible_destinations) +/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 = shuttle_master.getShuttle(shuttleId) - var/dat = "Status: [M ? M.getStatusText() : "*Missing*"]

" + ui = nanomanager.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 = default_state) + var/data[0] + var/obj/docking_port/mobile/M = shuttle_master.getShuttle(shuttleId) + data["status"] = M ? M.getStatusText() : null if(M) - var/destination_found + 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 shuttle_master.stationary) if(!options.Find(S.id)) continue if(!M.check_dock(S)) continue - destination_found = 1 - dat += "Send to [S.name]
" - if(!destination_found) - dat += "Shuttle Locked
" - if(admin_controlled) - dat += "Authorized personnel only
" - dat += "Request Authorization
" - if(docking_request) - dat += "Request docking at NSS Cyberiad
" - dat += "Close" + docking_ports[++docking_ports.len] = list("name" = S.name, "id" = S.id) + data["admin_controlled"] = admin_controlled + data["docking_request"] = docking_request - var/datum/browser/popup = new(user, "computer", M ? M.name : "shuttle", 300, 200) - popup.set_content("
[dat]
") - popup.set_title_image(usr.browse_rsc_icon(src.icon, src.icon_state)) - popup.open() + return data /obj/machinery/computer/shuttle/Topic(href, href_list) if(..()) return 1 - usr.set_machine(src) - src.add_fingerprint(usr) + if(!allowed(usr)) to_chat(usr, "Access denied.") return @@ -728,7 +728,7 @@ to_chat(usr, "Invalid shuttle requested.") else to_chat(usr, "Unable to comply.") - updateUsrDialog() + return 1 /obj/machinery/computer/shuttle/emag_act(mob/user) if(!emagged) @@ -760,10 +760,11 @@ 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 + nanomanager.update_uis(src) spawn(600) //One minute cooldown cooldown = 0 - /obj/machinery/computer/shuttle/ert name = "specops shuttle console" //circuit = /obj/item/weapon/circuitboard/ert @@ -846,6 +847,7 @@ var/global/trade_dockrequest_timelimit = 0 to_chat(usr, "Request sent.") event_announcement.Announce(docking_request_message, "Docking Request") trade_dockrequest_timelimit = world.time + 1200 // They have 2 minutes to approve the request. + return 1 /obj/machinery/computer/shuttle/trade/sol req_access = list(access_trade_sol) diff --git a/nano/templates/shuttle_console.tmpl b/nano/templates/shuttle_console.tmpl new file mode 100644 index 00000000000..2b16495d522 --- /dev/null +++ b/nano/templates/shuttle_console.tmpl @@ -0,0 +1,28 @@ + + +
+
Status: {{:data.status ? data.status : '*Missing*'}}
+ {{if data.shuttle}} + {{for data.docking_ports}} +
+
{{:helper.link('Send to ' + value.name, 'sign-out', {'move' : value.id})}}
+
+ {{empty}} +

Shuttle Locked

+ {{if data.admin_controlled}} +
Authorized personnel only
+
+
{{:helper.link('Request Authorization', 'share-square-o', {'request' : 1})}}
+
+ {{/if}} + {{/for}} + {{if data.docking_request}} +
+
{{:helper.link('Request docking at NSS Cyberiad', 'share-square-o', {'request' : 1})}}
+
+ {{/if}} + {{/if}} +
\ No newline at end of file From d4338bed12b0b98edb6b559dd7b976f663d7a5df Mon Sep 17 00:00:00 2001 From: davipatury Date: Sat, 18 Feb 2017 22:18:01 -0200 Subject: [PATCH 2/2] Some changes! --- code/modules/shuttle/shuttle.dm | 5 +-- nano/templates/shuttle_console.tmpl | 47 +++++++++++++++++------------ 2 files changed, 31 insertions(+), 21 deletions(-) diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index 72f83153687..6f019350217 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -174,7 +174,7 @@ */ /obj/docking_port/stationary/transit - name = "In Transit" + name = "In transit" turf_type = /turf/space/transit lock_shuttle_doors = 1 @@ -183,7 +183,7 @@ if(!..()) return 0 - name = "In Transit" //This looks weird, but- it means that the on-map instances can be named something actually usable to search for, but still appear correctly in terminals. + name = "In transit" //This looks weird, but- it means that the on-map instances can be named something actually usable to search for, but still appear correctly in terminals. shuttle_master.transit += src return 1 @@ -702,6 +702,7 @@ 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 diff --git a/nano/templates/shuttle_console.tmpl b/nano/templates/shuttle_console.tmpl index 2b16495d522..d16f39a8b20 100644 --- a/nano/templates/shuttle_console.tmpl +++ b/nano/templates/shuttle_console.tmpl @@ -3,26 +3,35 @@ Title: Shuttle Console Used In File(s): /code/modules/shuttle/shuttle.dm --> -
-
Status: {{:data.status ? data.status : '*Missing*'}}
- {{if data.shuttle}} - {{for data.docking_ports}} -
-
{{:helper.link('Send to ' + value.name, 'sign-out', {'move' : value.id})}}
-
- {{empty}} -

Shuttle Locked

- {{if data.admin_controlled}} -
Authorized personnel only
-
-
{{:helper.link('Request Authorization', 'share-square-o', {'request' : 1})}}
+
+
Location:
+
{{:data.status ? data.status : '*Missing*'}}
+
+{{if data.shuttle}} + {{if data.docking_ports_len}} +
+
+ {{for data.docking_ports}} +
{{:helper.link('Send to ' + value.name, 'sign-out', {'move' : value.id})}}
+ {{/for}} +
+ {{else}} +
+
Status:
+
Shuttle locked + {{if data.admin_controlled}} + , authorized personnel only +
+
+
{{:helper.link('Request authorization', 'share-square-o', {'request' : 1})}}
+ {{else}}
- {{/if}} - {{/for}} - {{if data.docking_request}} -
-
{{:helper.link('Request docking at NSS Cyberiad', 'share-square-o', {'request' : 1})}}
+
{{/if}} {{/if}} -
\ No newline at end of file + + {{if data.docking_request}} +
{{:helper.link('Request docking at NSS Cyberiad', 'share-square-o', {'request' : 1})}}
+ {{/if}} +{{/if}} \ No newline at end of file