AI freelook! I am no longer aware of any issues with it (other than one minor one involving it not removing the dim overlay sometimes, but that is very easy to ignore)

If someone goes over the map and fixes the camera coverage, I suggest we force AIs to use this (and I'll be making a thread about it)
This commit is contained in:
Miniature
2012-02-03 20:28:43 +10:30
parent 00ef9657a2
commit 4aa8f73128
4 changed files with 44 additions and 0 deletions

View File

@@ -7,6 +7,14 @@
/turf/proc/visibilityChanged()
cameranet.updateVisibility(src)
/turf/New()
..()
cameranet.updateVisibility(src)
/*
/turf/Del()
..()
cameranet.updateVisibility(src)
*/
/datum/camerachunk
var/list/obscuredTurfs = list()
var/list/visibleTurfs = list()
@@ -246,6 +254,21 @@ var/datum/cameranet/cameranet = new()
chunk.cameras += c
chunk.hasChanged()
/datum/cameranet/proc/removeCamera(obj/machinery/camera/c)
var/x1 = max(0, c.x - 16) & ~0xf
var/y1 = max(0, c.y - 16) & ~0xf
var/x2 = min(world.maxx, c.x + 16) & ~0xf
var/y2 = min(world.maxy, c.y + 16) & ~0xf
for(var/x = x1; x <= x2; x += 16)
for(var/y = y1; y <= y2; y += 16)
if(chunkGenerated(x, y, c.z))
var/datum/camerachunk/chunk = getCameraChunk(x, y, c.z)
if(!c)
chunk.hasChanged()
if(c in chunk.cameras)
chunk.cameras -= c
chunk.hasChanged()
/mob/living/silicon/ai/var/mob/aiEye/eyeobj = new()
@@ -318,6 +341,18 @@ var/datum/cameranet/cameranet = new()
..()
cameranet.addCamera(src)
/obj/machinery/camera/Del()
cameranet.removeCamera(src)
..()
/obj/machinery/camera/attackby(var/obj/item/weapon/W as obj, var/mob/user as mob)
. = ..(W, user)
if(istype(W, /obj/item/weapon/wirecutters))
if(status)
cameranet.addCamera(src)
else
cameranet.removeCamera(src)
/proc/checkcameravis(atom/A)
for(var/obj/machinery/camera/C in view(A,7))
if(!C.status || C.stat == 2)

View File

@@ -46,6 +46,7 @@
/turf/space/New()
// icon = 'space.dmi'
..()
icon_state = "[pick(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25)]"
/turf/simulated

View File

@@ -132,6 +132,7 @@
for(var/obj/structure/lattice/L in locate(src.x, src.y, src.z))
del(L)
var/turf/simulated/floor/W = new /turf/simulated/floor( locate(src.x, src.y, src.z) )
W.New()
W.dir = old_dir
if(prior_icon) W.icon_state = prior_icon
@@ -151,6 +152,7 @@
for(var/obj/structure/lattice/L in locate(src.x, src.y, src.z))
del(L)
var/turf/simulated/floor/plating/W = new /turf/simulated/floor/plating( locate(src.x, src.y, src.z) )
W.New()
W.dir = old_dir
if(prior_icon) W.icon_state = prior_icon
@@ -166,6 +168,7 @@
for(var/obj/structure/lattice/L in locate(src.x, src.y, src.z))
del(L)
var/turf/simulated/floor/engine/E = new /turf/simulated/floor/engine( locate(src.x, src.y, src.z) )
E.New()
E.dir = old_dir
E.icon_state = "engine"
@@ -228,12 +231,14 @@
/turf/proc/ReplaceWithSpace()
var/old_dir = dir
var/turf/space/S = new /turf/space( locate(src.x, src.y, src.z) )
S.New()
S.dir = old_dir
return S
/turf/proc/ReplaceWithLattice()
var/old_dir = dir
var/turf/space/S = new /turf/space( locate(src.x, src.y, src.z) )
S.New()
S.dir = old_dir
new /obj/structure/lattice( locate(src.x, src.y, src.z) )
return S
@@ -241,6 +246,7 @@
/turf/proc/ReplaceWithWall()
var/old_icon = icon_state
var/turf/simulated/wall/S = new /turf/simulated/wall( locate(src.x, src.y, src.z) )
S.New()
S.icon_old = old_icon
S.opacity = 0
S.sd_NewOpacity(1)
@@ -249,6 +255,7 @@
/turf/proc/ReplaceWithRWall()
var/old_icon = icon_state
var/turf/simulated/wall/r_wall/S = new /turf/simulated/wall/r_wall( locate(src.x, src.y, src.z) )
S.New()
S.icon_old = old_icon
S.opacity = 0
S.sd_NewOpacity(1)

View File

@@ -194,6 +194,7 @@
shroom.pixel_y = 0
W = new /turf/simulated/floor/plating/airless/asteroid( locate(src.x, src.y, src.z) )
W.New()
W.dir = old_dir
W.fullUpdateMineralOverlays()