Revert camera caching

This commit is contained in:
Markolie
2015-02-11 16:11:32 +01:00
parent a7ab903b4e
commit 2250aeddff
4 changed files with 30 additions and 39 deletions
+7 -7
View File
@@ -39,7 +39,7 @@
assembly = new(src)
assembly.state = 4
invalidateCameraCache()
//invalidateCameraCache()
/* // Use this to look for cameras that have the same c_tag.
for(var/obj/machinery/camera/C in cameranet.cameras)
@@ -66,7 +66,7 @@
/obj/machinery/camera/emp_act(severity)
if(!isEmpProof())
if(prob(100/severity))
invalidateCameraCache()
//invalidateCameraCache()
stat |= EMPED
SetLuminosity(0)
kick_viewers()
@@ -77,7 +77,7 @@
stat &= ~EMPED
cancelCameraAlarm()
update_icon()
invalidateCameraCache()
//invalidateCameraCache()
..()
/obj/machinery/camera/bullet_act(var/obj/item/projectile/P)
@@ -123,7 +123,7 @@
cameranet.updateVisibility(src, 0)
/obj/machinery/camera/attackby(obj/W as obj, mob/living/user as mob)
invalidateCameraCache()
//invalidateCameraCache()
// DECONSTRUCTION
if(isscrewdriver(W))
//user << "<span class='notice'>You start to [panel_open ? "close" : "open"] the camera's panel.</span>"
@@ -215,7 +215,7 @@
//legacy support, if choice is != 1 then just kick viewers without changing status
kick_viewers()
else
invalidateCameraCache()
//invalidateCameraCache()
set_status( !src.status )
if (!(src.status))
visible_message("\red [user] has deactivated [src]!")
@@ -235,7 +235,7 @@
//Used when someone breaks a camera
/obj/machinery/camera/proc/destroy()
invalidateCameraCache()
//invalidateCameraCache()
stat |= BROKEN
kick_viewers()
triggerCameraAlarm()
@@ -250,7 +250,7 @@
/obj/machinery/camera/proc/set_status(var/newstatus)
if (status != newstatus)
status = newstatus
invalidateCameraCache()
//invalidateCameraCache()
// now disconnect anyone using the camera
//Apparently, this will disconnect anyone even if the camera was re-activated.
//I guess that doesn't matter since they couldn't use it anyway?
+21 -30
View File
@@ -81,46 +81,38 @@
var/data[0]
data["current"] = null
if(isnull(camera_cache))
cameranet.process_sort()
var/list/L = list()
for (var/obj/machinery/camera/C in cameranet.cameras)
if(can_access_camera(C))
L.Add(C)
var/cameras[0]
for(var/obj/machinery/camera/C in cameranet.cameras)
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
cameranet.process_sort()
cameras[++cameras.len] = cam
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
if(C == current)
data["current"] = cam
var/list/camera_list = list("cameras" = cameras)
camera_cache=list2json(camera_list)
else
if(current)
var/cam[0]
cam["name"] = current.c_tag
cam["deact"] = !current.can_use()
cam["camera"] = "\ref[current]"
cam["x"] = current.x
cam["y"] = current.y
cam["z"] = current.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))
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.
@@ -145,8 +137,7 @@
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.load_cached_data(camera_cache)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)