* fixing the visibility update loop through the dictionary

* moving the standard turf and object update triggers to the visibility_network update_triggers.dm file
This commit is contained in:
jack-fractal
2013-10-26 17:33:53 -04:00
parent 6764c54989
commit d370c6f81e
4 changed files with 58 additions and 61 deletions
@@ -3,5 +3,7 @@ var/datum/visibility_network/list/visibility_networks = list("ALL_CAMERAS"=camer
// used by turfs and objects to update all visibility networks
/proc/updateVisibilityNetworks(atom/A, var/opacity_check = 1)
for (var/datum/visibility_network/currentNetwork in visibility_networks)
var/datum/visibility_network/currentNetwork
for (var/networkName in visibility_networks)
currentNetwork = visibility_networks[networkName]
currentNetwork.updateVisibility(A, opacity_check)
@@ -0,0 +1,55 @@
//UPDATE TRIGGERS, when the chunk (and the surrounding chunks) should update.
// TURFS
/turf
var/image/obscured
/turf/proc/visibilityChanged()
if(ticker)
updateVisibilityNetworks(src)
/turf/simulated/Del()
visibilityChanged()
..()
/turf/simulated/New()
..()
visibilityChanged()
// STRUCTURES
/obj/structure/Del()
if(ticker)
updateVisibilityNetworks(src)
..()
/obj/structure/New()
..()
if(ticker)
updateVisibilityNetworks(src)
// EFFECTS
/obj/effect/Del()
if(ticker)
updateVisibilityNetworks(src)
..()
/obj/effect/New()
..()
if(ticker)
updateVisibilityNetworks(src)
// DOORS
// Simply updates the visibility of the area when it opens/closes/destroyed.
/obj/machinery/door/update_nearby_tiles(need_rebuild)
. = ..(need_rebuild)
// Glass door glass = 1
// don't check then?
if(!glass)
updateVisibilityNetworks(src,0)
@@ -109,8 +109,6 @@
var/x2 = min(world.maxx, T.x + 8) & ~0xf
var/y2 = min(world.maxy, T.y + 8) & ~0xf
//world << "X1: [x1] - Y1: [y1] - X2: [x2] - Y2: [y2]"
for(var/x = x1; x <= x2; x += 16)
for(var/y = y1; y <= y2; y += 16)
if(chunkGenerated(x, y, T.z))
@@ -1,63 +1,5 @@
#define BORG_CAMERA_BUFFER 30
//UPDATE TRIGGERS, when the chunk (and the surrounding chunks) should update.
// TURFS
/turf
var/image/obscured
/turf/proc/visibilityChanged()
if(ticker)
updateVisibilityNetworks(src)
/turf/simulated/Del()
visibilityChanged()
..()
/turf/simulated/New()
..()
visibilityChanged()
// STRUCTURES
/obj/structure/Del()
if(ticker)
updateVisibilityNetworks(src)
..()
/obj/structure/New()
..()
if(ticker)
updateVisibilityNetworks(src)
// EFFECTS
/obj/effect/Del()
if(ticker)
updateVisibilityNetworks(src)
..()
/obj/effect/New()
..()
if(ticker)
updateVisibilityNetworks(src)
// DOORS
// Simply updates the visibility of the area when it opens/closes/destroyed.
/obj/machinery/door/update_nearby_tiles(need_rebuild)
. = ..(need_rebuild)
// Glass door glass = 1
// don't check then?
if(!glass)
world << "Updating visibility for [src]"
updateVisibilityNetworks(src,0)
// ROBOT MOVEMENT
// Update the portable camera everytime the Robot moves.