Make more consoles accessible to ghosts

This commit is contained in:
Markolie
2015-07-27 23:40:23 +02:00
parent ef3e2e8c7b
commit 483d2b5864
7 changed files with 240 additions and 229 deletions
+5
View File
@@ -1106,6 +1106,11 @@ FIRE ALARM
if(temperature > T0C+200)
src.alarm() // added check of detector status here
return
/obj/machinery/alarm/attack_ghost(user as mob)
if(stat & (BROKEN|MAINT))
return
return ui_interact(user)
/obj/machinery/firealarm/attack_ai(mob/user as mob)
src.add_hiddenprint(user)
+6 -3
View File
@@ -28,14 +28,17 @@
/obj/machinery/computer/operating/attack_hand(mob/user)
add_fingerprint(user)
if(stat & (BROKEN|NOPOWER))
if(..(user))
return
if(stat & (NOPOWER|BROKEN))
return
interact(user)
/obj/machinery/computer/operating/interact(mob/user)
if ( (get_dist(src, user) > 1 ) || (stat & (BROKEN|NOPOWER)) )
if ( ((get_dist(src, user) > 1) && !isobserver(user)) || (stat & (BROKEN|NOPOWER)) )
if (!istype(user, /mob/living/silicon))
user.unset_machine()
user << browse(null, "window=op")
+210 -209
View File
@@ -21,225 +21,226 @@ var/camera_cache_id = 1
var/list/access[0]
var/camera_cache = null
New() // Lists existing networks and their required access. Format: networks[<name>] = list(<access>)
networks["SS13"] = list(access_hos,access_captain)
networks["Telecomms"] = list(access_hos,access_captain)
networks["Research Outpost"] = list(access_rd,access_hos,access_captain)
networks["Mining Outpost"] = list(access_qm,access_hop,access_hos,access_captain)
networks["Research"] = list(access_rd,access_hos,access_captain)
networks["Prison"] = list(access_hos,access_captain)
networks["Labor"] = list(access_hos,access_captain)
networks["Interrogation"] = list(access_hos,access_captain)
networks["Atmosphere Alarms"] = list(access_ce,access_hos,access_captain)
networks["Fire Alarms"] = list(access_ce,access_hos,access_captain)
networks["Power Alarms"] = list(access_ce,access_hos,access_captain)
networks["Supermatter"] = list(access_ce,access_hos,access_captain)
networks["MiniSat"] = list(access_rd,access_hos,access_captain)
networks["Singularity"] = list(access_ce,access_hos,access_captain)
networks["Anomaly Isolation"] = list(access_rd,access_hos,access_captain)
networks["Toxins"] = list(access_rd,access_hos,access_captain)
networks["Telepad"] = list(access_rd,access_hos,access_captain)
networks["TestChamber"] = list(access_rd,access_hos,access_captain)
networks["ERT"] = list(access_cent_specops_commander,access_cent_commander)
networks["CentCom"] = list(access_cent_security,access_cent_commander)
networks["Thunderdome"] = list(access_cent_thunder,access_cent_commander)
/obj/machinery/computer/security/New() // Lists existing networks and their required access. Format: networks[<name>] = list(<access>)
networks["SS13"] = list(access_hos,access_captain)
networks["Telecomms"] = list(access_hos,access_captain)
networks["Research Outpost"] = list(access_rd,access_hos,access_captain)
networks["Mining Outpost"] = list(access_qm,access_hop,access_hos,access_captain)
networks["Research"] = list(access_rd,access_hos,access_captain)
networks["Prison"] = list(access_hos,access_captain)
networks["Labor"] = list(access_hos,access_captain)
networks["Interrogation"] = list(access_hos,access_captain)
networks["Atmosphere Alarms"] = list(access_ce,access_hos,access_captain)
networks["Fire Alarms"] = list(access_ce,access_hos,access_captain)
networks["Power Alarms"] = list(access_ce,access_hos,access_captain)
networks["Supermatter"] = list(access_ce,access_hos,access_captain)
networks["MiniSat"] = list(access_rd,access_hos,access_captain)
networks["Singularity"] = list(access_ce,access_hos,access_captain)
networks["Anomaly Isolation"] = list(access_rd,access_hos,access_captain)
networks["Toxins"] = list(access_rd,access_hos,access_captain)
networks["Telepad"] = list(access_rd,access_hos,access_captain)
networks["TestChamber"] = list(access_rd,access_hos,access_captain)
networks["ERT"] = list(access_cent_specops_commander,access_cent_commander)
networks["CentCom"] = list(access_cent_security,access_cent_commander)
networks["Thunderdome"] = list(access_cent_thunder,access_cent_commander)
attack_ai(var/mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/security/attack_ai(var/mob/user as mob)
return attack_hand(user)
check_eye(var/mob/user as mob)
if ((get_dist(user, src) > 1 || !( user.canmove ) || user.blinded || !( current ) || !( current.status )) && (!istype(user, /mob/living/silicon)))
return null
user.reset_view(current)
return 1
/obj/machinery/computer/security/check_eye(var/mob/user as mob)
if ((get_dist(user, src) > 1 || !( user.canmove ) || user.blinded || !( current ) || !( current.status )) && (!istype(user, /mob/living/silicon)))
return null
user.reset_view(current)
return 1
// Network configuration
attackby(I as obj, user as mob, params)
access = list()
if(istype(I,/obj/item/weapon/card/id)) // If hit by a regular ID card.
var/obj/item/weapon/card/id/E = I
access = E.access
ui_interact(user)
else
..()
emag_act(user as mob)
if(!emagged)
emagged = 1
user << "\blue You have authorized full network access!"
ui_interact(user)
else
ui_interact(user)
ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
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.cameras)
if(can_access_camera(C))
L.Add(C)
cameranet.process_sort()
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
tempnets.Cut()
if(emagged)
access = list(access_captain) // Assume captain level access when emagged
data["emagged"] = 1
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.
if(m in access)
if(l in network) // Checks if the network is currently active.
tempnets.Add(list(list("name" = l, "active" = 1)))
else
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, "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(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.cameras
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])
if(a in access) // Re-check for authorization.
if(text2num(active) == 1)
src.network -= net
break
else
src.network += net
break
nanomanager.update_uis(src)
else
. = ..()
attack_hand(var/mob/user as mob)
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(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
// Network configuration
/obj/machinery/computer/security/attackby(I as obj, user as mob, params)
access = list()
if(istype(I,/obj/item/weapon/card/id)) // If hit by a regular ID card.
var/obj/item/weapon/card/id/E = I
access = E.access
ui_interact(user)
else
..()
/obj/machinery/computer/security/emag_act(user as mob)
if(!emagged)
emagged = 1
user << "\blue You have authorized full network access!"
ui_interact(user)
else
ui_interact(user)
// Check if camera is accessible when jumping
proc/can_access_camera(var/obj/machinery/camera/C)
var/list/shared_networks = src.network & C.network
if(shared_networks.len)
return 1
/obj/machinery/computer/security/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
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.cameras)
if(can_access_camera(C))
L.Add(C)
cameranet.process_sort()
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
tempnets.Cut()
if(emagged)
access = list(access_captain) // Assume captain level access when emagged
data["emagged"] = 1
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.
if(m in access)
if(l in network) // Checks if the network is currently active.
tempnets.Add(list(list("name" = l, "active" = 1)))
else
tempnets.Add(list(list("name" = l, "active" = 0)))
break
if(tempnets.len)
data["networks"] = tempnets
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
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)
/obj/machinery/computer/security/Topic(href, href_list)
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.cameras
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])
if(a in access) // Re-check for authorization.
if(text2num(active) == 1)
src.network -= net
break
else
src.network += net
break
nanomanager.update_uis(src)
else
. = ..()
/obj/machinery/computer/security/attack_hand(var/mob/user as mob)
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(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
ui_interact(user)
// Check if camera is accessible when jumping
/obj/machinery/computer/security/proc/can_access_camera(var/obj/machinery/camera/C)
var/list/shared_networks = src.network & C.network
if(shared_networks.len)
return 1
return 0
// Switching to cameras
/obj/machinery/computer/security/proc/switch_to_camera(var/mob/user, var/obj/machinery/camera/C)
if ((get_dist(user, src) > 1 || user.machine != src || user.blinded || !( user.canmove ) || !( C.can_use() )) && (!istype(user, /mob/living/silicon/ai)))
if(!C.can_use() && !isAI(user))
src.current = null
return 0
// Switching to cameras
proc/switch_to_camera(var/mob/user, var/obj/machinery/camera/C)
if ((get_dist(user, src) > 1 || user.machine != src || user.blinded || !( user.canmove ) || !( C.can_use() )) && (!istype(user, /mob/living/silicon/ai)))
if(!C.can_use() && !isAI(user))
src.current = null
return 0
else
if(isAI(user))
var/mob/living/silicon/ai/A = user
// Only allow non-carded AIs to view because the interaction with the eye gets all wonky otherwise.
if(!A.is_in_chassis())
return 0
A.eyeobj.setLoc(get_turf(C))
A.client.eye = A.eyeobj
else
if(isAI(user))
var/mob/living/silicon/ai/A = user
// Only allow non-carded AIs to view because the interaction with the eye gets all wonky otherwise.
if(!A.is_in_chassis())
return 0
A.eyeobj.setLoc(get_turf(C))
A.client.eye = A.eyeobj
else
src.current = C
use_power(50)
return 1
src.current = C
use_power(50)
return 1
//Camera control: moving.
proc/jump_on_click(var/mob/user,var/A)
if(user.machine != src)
return
var/obj/machinery/camera/jump_to
if(istype(A,/obj/machinery/camera))
jump_to = A
else if(ismob(A))
if(ishuman(A))
jump_to = locate() in A:head
else if(isrobot(A))
jump_to = A:camera
else if(isobj(A))
jump_to = locate() in A
else if(isturf(A))
var/best_dist = INFINITY
for(var/obj/machinery/camera/camera in get_area(A))
if(!camera.can_use())
continue
if(!can_access_camera(camera))
continue
var/dist = get_dist(camera,A)
if(dist < best_dist)
best_dist = dist
jump_to = camera
if(isnull(jump_to))
return
if(can_access_camera(jump_to))
switch_to_camera(user,jump_to)
//Camera control: moving.
/obj/machinery/computer/security/proc/jump_on_click(var/mob/user,var/A)
if(user.machine != src)
return
var/obj/machinery/camera/jump_to
if(istype(A,/obj/machinery/camera))
jump_to = A
else if(ismob(A))
if(ishuman(A))
jump_to = locate() in A:head
else if(isrobot(A))
jump_to = A:camera
else if(isobj(A))
jump_to = locate() in A
else if(isturf(A))
var/best_dist = INFINITY
for(var/obj/machinery/camera/camera in get_area(A))
if(!camera.can_use())
continue
if(!can_access_camera(camera))
continue
var/dist = get_dist(camera,A)
if(dist < best_dist)
best_dist = dist
jump_to = camera
if(isnull(jump_to))
return
if(can_access_camera(jump_to))
switch_to_camera(user,jump_to)
// Camera control: mouse.
/atom/DblClick()
+5 -2
View File
@@ -77,8 +77,11 @@
/obj/machinery/computer/card/attack_hand(mob/user as mob)
if(..()) return
if(stat & (NOPOWER|BROKEN)) return
if(..())
return
if(stat & (NOPOWER|BROKEN))
return
ui_interact(user)
/obj/machinery/computer/card/ui_interact(mob/user, ui_key="main", var/datum/nanoui/ui = null, var/force_open = 1)
@@ -262,16 +262,16 @@ var/shuttle_call/shuttle_calls[0]
if(..(user))
return
if(stat & (NOPOWER|BROKEN))
return
if (!(src.z in list(ZLEVEL_STATION, ZLEVEL_CENTCOMM)))
user << "\red <b>Unable to establish a connection</b>: \black You're too far away from the station!"
return
ui_interact(user)
/obj/machinery/computer/communications/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
if(user.stat)
return
// this is the data which will be sent to the ui
var/data[0]
data["is_ai"] = issilicon(user)
+4 -8
View File
@@ -86,10 +86,10 @@
linkedServer = message_servers[1]
return
/obj/machinery/computer/message_monitor/attack_hand(var/mob/living/user as mob)
if(stat & (NOPOWER|BROKEN))
/obj/machinery/computer/message_monitor/attack_hand(var/mob/user as mob)
if(..())
return
if(!istype(user))
if(stat & (NOPOWER|BROKEN))
return
//If the computer is being hacked or is emagged, display the reboot message.
if(hacking || emag)
@@ -276,12 +276,8 @@
customjob = "Admin"
/obj/machinery/computer/message_monitor/Topic(href, href_list)
if(..())
if(..(href, href_list))
return 1
if(stat & (NOPOWER|BROKEN))
return
if(!istype(usr, /mob/living))
return
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon)))
//Authenticate
if (href_list["auth"])
@@ -30,6 +30,9 @@
if(active)
toggle_power()
return ..()
/obj/machinery/particle_accelerator/control_box/attack_ghost(user as mob)
return src.attack_hand(user)
/obj/machinery/particle_accelerator/control_box/attack_hand(mob/user as mob)
if(construction_state >= 3)
@@ -77,8 +80,8 @@
return
/obj/machinery/particle_accelerator/control_box/Topic(href, href_list)
if(..())
return
if(..(href, href_list))
return 1
if(!interface_control)
usr << "<span class='error'>ERROR: Request timed out. Check wire contacts.</span>"
@@ -231,7 +234,7 @@
/obj/machinery/particle_accelerator/control_box/interact(mob/user)
if((get_dist(src, user) > 1) || (stat & (BROKEN|NOPOWER)))
if(((get_dist(src, user) > 1) && !isobserver(user)) || (stat & (BROKEN|NOPOWER)))
if(!istype(user, /mob/living/silicon))
user.unset_machine()
user << browse(null, "window=pacontrol")