mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-25 04:57:12 +01:00
Ports over NanoUI camera console map from Baystation12
This commit is contained in:
@@ -35,10 +35,7 @@
|
||||
networks["Thunderdome"] = list(access_cent_captain)
|
||||
|
||||
attack_ai(var/mob/user as mob)
|
||||
if(isAI(user))
|
||||
return ui_interact(user)
|
||||
else
|
||||
return attack_hand(user)
|
||||
return attack_hand(user)
|
||||
|
||||
attack_paw(var/mob/user as mob)
|
||||
return attack_hand(user)
|
||||
@@ -51,6 +48,7 @@
|
||||
|
||||
// Network configuration
|
||||
attackby(I as obj, user as mob)
|
||||
access = list()
|
||||
if(istype(I,/obj/item/weapon/card/emag)) // If hit by an emag.
|
||||
var/obj/item/weapon/card/emag/E = I
|
||||
if(!emagged)
|
||||
@@ -71,18 +69,45 @@
|
||||
..()
|
||||
|
||||
ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
|
||||
if(..())
|
||||
return
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
return
|
||||
if(src.z > 6) return
|
||||
if(stat & (NOPOWER|BROKEN)) return
|
||||
if(user.stat) return
|
||||
|
||||
var/data[0]
|
||||
|
||||
data["current"] = null
|
||||
|
||||
var/list/L = list()
|
||||
for (var/obj/machinery/camera/C in cameranet.viewpoints)
|
||||
if(can_access_camera(C))
|
||||
L.Add(C)
|
||||
|
||||
camera_sort(L)
|
||||
|
||||
var/cameras[0]
|
||||
for(var/obj/machinery/camera/C in L)
|
||||
var/cam[0]
|
||||
cam["name"] = C.c_tag
|
||||
cam["deact"] = !C.can_use()
|
||||
cam["camera"] = "\ref[C]"
|
||||
cam["x"] = C.x
|
||||
cam["y"] = C.y
|
||||
cam["z"] = C.z
|
||||
|
||||
cameras[++cameras.len] = cam
|
||||
|
||||
if(C == current)
|
||||
data["current"] = cam
|
||||
|
||||
data["cameras"] = cameras
|
||||
|
||||
data.Cut()
|
||||
tempnets.Cut()
|
||||
if(emagged)
|
||||
access = list(access_captain) // Assume captain level access when emagged
|
||||
data["emagged"] = 1
|
||||
if(isAI(user))
|
||||
if(isAI(user) || isrobot (user))
|
||||
access = list(access_captain) // Assume captain level access when AI
|
||||
|
||||
// Loop through the ID's permission, and check which networks the ID has access to.
|
||||
for(var/l in networks) // Loop through networks.
|
||||
for(var/m in networks[l]) // Loop through access levels of the networks.
|
||||
@@ -93,16 +118,36 @@
|
||||
tempnets.Add(list(list("name" = l, "active" = 0)))
|
||||
break
|
||||
data["networks"] = tempnets
|
||||
|
||||
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "camera_console.tmpl", "Camera Monitor UI", 670, 280)
|
||||
if (!ui)
|
||||
ui = new(user, src, ui_key, "sec_camera.tmpl", "Camera Console", 900, 800)
|
||||
|
||||
// adding a template with the key "mapContent" enables the map ui functionality
|
||||
ui.add_template("mapContent", "sec_camera_map_content.tmpl")
|
||||
// adding a template with the key "mapHeader" replaces the map header content
|
||||
ui.add_template("mapHeader", "sec_camera_map_header.tmpl")
|
||||
|
||||
ui.set_initial_data(data)
|
||||
ui.open()
|
||||
|
||||
ui.set_auto_update(1)
|
||||
|
||||
Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
if(href_list["activate"]) // Activate: enable or disable networks
|
||||
if(href_list["switchTo"])
|
||||
if(src.z>6 || stat&(NOPOWER|BROKEN)) return
|
||||
if(usr.stat || ((get_dist(usr, src) > 1 || !( usr.canmove ) || usr.blinded) && !istype(usr, /mob/living/silicon))) return
|
||||
var/obj/machinery/camera/C = locate(href_list["switchTo"]) in cameranet.viewpoints
|
||||
if(!C) return
|
||||
|
||||
switch_to_camera(usr, C)
|
||||
return 1
|
||||
else if(href_list["reset"])
|
||||
if(src.z>6 || stat&(NOPOWER|BROKEN)) return
|
||||
if(usr.stat || ((get_dist(usr, src) > 1 || !( usr.canmove ) || usr.blinded) && !istype(usr, /mob/living/silicon))) return
|
||||
current = null
|
||||
usr.check_eye(current)
|
||||
return 1
|
||||
else if(href_list["activate"]) // Activate: enable or disable networks
|
||||
var/net = href_list["activate"] // Network to be enabled or disabled.
|
||||
var/active = href_list["active"] // Is the network currently active.
|
||||
for(var/a in networks[net])
|
||||
@@ -114,50 +159,26 @@
|
||||
src.network += net
|
||||
break
|
||||
nanomanager.update_uis(src)
|
||||
else
|
||||
. = ..()
|
||||
|
||||
attack_hand(var/mob/user as mob)
|
||||
if(src.z > 6)
|
||||
user << "\red <b>Unable to establish a connection:</b> \black You're too far away from the station!"
|
||||
return
|
||||
if(stat & (NOPOWER|BROKEN))
|
||||
access = list()
|
||||
if (src.z > 6)
|
||||
user << "\red <b>Unable to establish a connection</b>: \black You're too far away from the station!"
|
||||
return
|
||||
if(stat & (NOPOWER|BROKEN)) return
|
||||
|
||||
if(!isAI(user))
|
||||
user.set_machine(src)
|
||||
|
||||
if(network.len == 0)
|
||||
user << "\red No networks configured! Swipe the monitor with an authorized ID to configure them."
|
||||
return
|
||||
|
||||
// Camera listing
|
||||
var/list/L = list()
|
||||
for (var/obj/machinery/camera/C in cameranet.viewpoints)
|
||||
L.Add(C)
|
||||
camera_sort(L)
|
||||
|
||||
var/list/D = list()
|
||||
D["Cancel"] = "Cancel"
|
||||
for(var/obj/machinery/camera/C in L)
|
||||
if(can_access_camera(C))
|
||||
D[text("[][]", C.c_tag, (C.status ? null : " (Deactivated)"))] = C
|
||||
C.watcherslist -= user
|
||||
var/t = input(user, "Which camera should you change to?") as null|anything in D
|
||||
if(!t)
|
||||
user.unset_machine()
|
||||
return 0
|
||||
|
||||
var/obj/machinery/camera/C = D[t]
|
||||
if(ishuman(user))
|
||||
var/mob/living/carbon/human/H = user
|
||||
if(H.wear_id)
|
||||
var/obj/item/weapon/card/id/gold/C = H.wear_id
|
||||
access = C.access
|
||||
|
||||
if(t == "Cancel")
|
||||
user.unset_machine()
|
||||
return 0
|
||||
|
||||
if(C)
|
||||
C.watcherslist += user
|
||||
switch_to_camera(user, C)
|
||||
spawn(5)
|
||||
attack_hand(user)
|
||||
return
|
||||
ui_interact(user)
|
||||
|
||||
// Check if camera is accessible when jumping
|
||||
proc/can_access_camera(var/obj/machinery/camera/C)
|
||||
|
||||
+1
-1
@@ -3227,7 +3227,7 @@
|
||||
"bkc" = (/turf/simulated/floor/bluegrid,/area/turret_protected/ai)
|
||||
"bkd" = (/obj/machinery/atmospherics/pipe/simple/supply/hidden,/obj/structure/cable{d1 = 4; d2 = 8; icon_state = "4-8"; tag = ""},/obj/item/device/radio/beacon,/turf/simulated/floor,/area/bridge)
|
||||
"bke" = (/obj/machinery/computer/prisoner{req_access = null; req_access_txt = "2"},/turf/simulated/floor{icon_state = "red"; dir = 9},/area/bridge)
|
||||
"bkf" = (/obj/machinery/computer/security{network = list("SS13","Research Outpost","Mining Outpost")},/obj/machinery/camera{c_tag = "Bridge West"; dir = 2; network = list("SS13")},/turf/simulated/floor{icon_state = "red"; dir = 1},/area/bridge)
|
||||
"bkf" = (/obj/machinery/computer/security{network = list("SS13","Research Outpost","Mining Outpost","Telecomms")},/obj/machinery/camera{c_tag = "Bridge West"; dir = 2; network = list("SS13")},/turf/simulated/floor{icon_state = "red"; dir = 1},/area/bridge)
|
||||
"bkg" = (/obj/structure/table/reinforced,/obj/machinery/recharger{pixel_y = 0},/turf/simulated/floor{icon_state = "redcorner"; dir = 1},/area/bridge)
|
||||
"bkh" = (/obj/structure/filingcabinet,/obj/machinery/alarm{dir = 1; icon_state = "alarm0"; pixel_y = -22},/turf/simulated/floor{icon_state = "blue"; dir = 10},/area/bridge)
|
||||
"bki" = (/obj/machinery/disposal,/obj/structure/disposalpipe/trunk{dir = 4},/turf/simulated/floor/wood,/area/crew_quarters/captain)
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -1,18 +0,0 @@
|
||||
<!--
|
||||
Title: Camera Monitor UI
|
||||
Used In File(s): \code\game\machinery\computer\camera.dm
|
||||
-->
|
||||
<div class="item">
|
||||
<h2>Networks</h2>
|
||||
Please select the networks you'd like this console to monitor.
|
||||
{{if data.emagged}}
|
||||
<div class="bad">WARNING: Unauthorized access detected.</div>
|
||||
{{/if}}
|
||||
<div class="item">
|
||||
{{for data.networks}}
|
||||
{{:helper.link(value.name, value.active ? 'minus' : 'plus', { 'activate' : value.name, 'active' : value.active }, '', value.active ? 'linkOn' : '')}}
|
||||
{{empty}}
|
||||
<div class="bad">No accessible networks were found. Please make sure your ID has sufficient access.</div>
|
||||
{{/for}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,37 @@
|
||||
<!--
|
||||
Title: Security Camera Console (Main content)
|
||||
Used In File(s): \code\game\machinery\computer\camera.dm
|
||||
-->
|
||||
{{:helper.link('Show Map', 'pin-s', {'showMap' : 1})}}
|
||||
{{:helper.link('Reset', 'refresh', {'reset' : 1})}}
|
||||
<div class='item'>
|
||||
<div class='itemLabel'>Current Camera: </div>
|
||||
{{if data.current}}
|
||||
<div class='itemContent'><b>{{:data.current.name}}</b></div>
|
||||
{{else}}
|
||||
<div class='itemContent'>None</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
{{for data.cameras}}
|
||||
{{if data.current && value.name == data.current.name}}
|
||||
{{:helper.link(value.name, '', {'switchTo' : value.camera}, 'selected')}}
|
||||
{{else value.deact}}
|
||||
{{:helper.link(value.name + " (deactivated)", '', {}, 'inactive')}}
|
||||
{{else}}
|
||||
{{:helper.link(value.name, '', {'switchTo' : value.camera})}}
|
||||
{{/if}}
|
||||
{{/for}}
|
||||
<div class="item">
|
||||
<h2>Networks</h2>
|
||||
Please select the networks you'd like this console to monitor.
|
||||
{{if data.emagged}}
|
||||
<div class="bad">WARNING: Unauthorized access detected.</div>
|
||||
{{/if}}
|
||||
<div class="item">
|
||||
{{for data.networks}}
|
||||
{{:helper.link(value.name, value.active ? 'minus' : 'plus', { 'activate' : value.name, 'active' : value.active }, '', value.active ? 'linkOn' : '')}}
|
||||
{{empty}}
|
||||
<div class="bad">No accessible networks were found. Please make sure your ID has sufficient access.</div>
|
||||
{{/for}}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
<!--
|
||||
Title: Security Camera Console (Map content)
|
||||
Used In File(s): \code\game\machinery\computer\camera.dm
|
||||
-->
|
||||
{{for data.cameras}}
|
||||
{{if value.z == 1}}
|
||||
<div class="mapIcon mapIcon16" style="left: {{:(value.x)}}px; bottom: {{:(value.y - 1)}}px;">
|
||||
{{if data.current && value.name == data.current.name}}
|
||||
{{:helper.link("#", '', {'switchTo' : value.camera}, 'selected')}}
|
||||
{{else value.deact}}
|
||||
{{:helper.link('#', '', {}, 'inactive')}}
|
||||
{{else}}
|
||||
{{:helper.link("#", '', {'switchTo' : value.camera})}}
|
||||
{{/if}}
|
||||
<div class="tooltip hidden">
|
||||
{{:value.name}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/for}}
|
||||
@@ -0,0 +1,23 @@
|
||||
<!--
|
||||
Title: Security Camera Console (Map header)
|
||||
Used In File(s): \code\game\machinery\computer\camera.dm
|
||||
-->
|
||||
{{:helper.link('Show Camera List', 'script', {'showMap' : 0})}}
|
||||
{{:helper.link('Reset', 'refresh', {'reset' : 1})}}
|
||||
<div style="float:left;">
|
||||
<div class='item'>
|
||||
<div class='itemLabel'>Current Camera: </div>
|
||||
{{if data.current}}
|
||||
<div class='itemContent'><b>{{:data.current.name}}</b></div>
|
||||
{{else}}
|
||||
<div class='itemContent'>None</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
<div style="float: right; width: 240px;">
|
||||
<span style="float: left;">Zoom Level: </span>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="4">x1.0</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="6">x1.5</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="8">x2.0</div>
|
||||
<div unselectable="on" class="link zoomLink" data-zoom-level="12">x2.5</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user