An active AI core now provides camera coverage.

This commit is contained in:
PsiOmegaDelta
2015-07-03 09:46:02 +02:00
parent 41d86361a0
commit 92a3d3f9ae
8 changed files with 69 additions and 17 deletions
+1
View File
@@ -1264,6 +1264,7 @@
#include "code\modules\mob\living\silicon\silicon.dm"
#include "code\modules\mob\living\silicon\subystems.dm"
#include "code\modules\mob\living\silicon\ai\ai.dm"
#include "code\modules\mob\living\silicon\ai\ai_movement.dm"
#include "code\modules\mob\living\silicon\ai\death.dm"
#include "code\modules\mob\living\silicon\ai\examine.dm"
#include "code\modules\mob\living\silicon\ai\icons.dm"
+4 -1
View File
@@ -579,10 +579,13 @@ proc/anim(turf/location as turf,target as mob|obj,a_icon,a_icon_state as text,fl
return toReturn
//Step-towards method of determining whether one atom can see another. Similar to viewers()
/proc/can_see(var/atom/source, var/atom/target, var/length=5) // I couldnt be arsed to do actual raycasting :I This is horribly inaccurate.
/proc/can_see(var/atom/source, var/atom/target, var/length=5) // I couldn't be arsed to do actual raycasting :I This is horribly inaccurate.
var/turf/current = get_turf(source)
var/turf/target_turf = get_turf(target)
var/steps = 0
if(!current || !target_turf)
return 0
while(current != target_turf)
if(steps > length) return 0
+3
View File
@@ -305,6 +305,9 @@
/obj/machinery/camera/proc/can_see()
var/list/see = null
var/turf/pos = get_turf(src)
if(!pos)
return list()
if(isXRay())
see = range(view_range, pos)
else
+16
View File
@@ -24,6 +24,10 @@
for(var/turf/t in c.can_see())
visible[t] = t
for(var/mob/living/silicon/ai/AI in living_mob_list)
for(var/turf/t in AI.seen_camera_turfs())
visible[t] = t
// Create a new camera chunk, since the chunks are made as they are needed.
/datum/chunk/camera/New(loc, x, y, z)
@@ -31,3 +35,15 @@
if(c.can_use())
cameras += c
..()
/mob/living/silicon/proc/provides_camera_vision()
return 0
/mob/living/silicon/ai/provides_camera_vision()
return stat != DEAD
/mob/living/silicon/robot/provides_camera_vision()
return src.camera && src.camera.network.len
/mob/living/silicon/ai/proc/seen_camera_turfs()
return seen_turfs_in_range(src, world.view)
@@ -4,13 +4,13 @@
// Update the portable camera everytime the Robot moves.
// This might be laggy, comment it out if there are problems.
/mob/living/silicon/robot/var/updating = 0
/mob/living/silicon/var/updating = 0
/mob/living/silicon/robot/Move()
var/oldLoc = src.loc
. = ..()
if(.)
if(src.camera && src.camera.network.len)
if(provides_camera_vision())
if(!updating)
updating = 1
spawn(BORG_CAMERA_BUFFER)
@@ -18,6 +18,21 @@
cameranet.updatePortableCamera(src.camera)
updating = 0
/mob/living/silicon/AI/Move()
var/oldLoc = src.loc
. = ..()
if(.)
if(provides_camera_vision())
if(!updating)
updating = 1
spawn(BORG_CAMERA_BUFFER)
if(oldLoc != src.loc)
cameranet.updateVisibility(oldLoc, 0)
cameranet.updateVisibility(loc, 0)
updating = 0
#undef BORG_CAMERA_BUFFER
// CAMERA
// An addition to deactivate which removes/adds the camera from the chunk list based on if it works or not.
@@ -42,8 +57,19 @@
update_coverage(1)
/obj/machinery/camera/Destroy()
cameranet.cameras -= src
clear_all_networks()
cameranet.cameras -= src
..()
#undef BORG_CAMERA_BUFFER
// Mobs
/mob/living/silicon/ai/rejuvenate()
var/was_dead = stat == DEAD
..()
if(was_dead && stat != DEAD)
// Arise!
cameranet.updateVisibility(src, 0)
/mob/living/silicon/ai/death(gibbed)
if(..())
// If true, the mob went from living to dead (assuming everyone has been overriding as they should...)
cameranet.updateVisibility(src, 0)
+6 -2
View File
@@ -41,12 +41,15 @@ mob/eye/Destroy()
updateallghostimages()
..()
// Movement code. Returns 0 to stop air movement from moving it.
/mob/eye/Move(n, direct)
if(owner == src)
EyeMove(n, direct)
return EyeMove(n, direct)
return 0
/mob/eye/airflow_hit(atom/A)
airflow_speed = 0
airflow_dest = null
/mob/eye/examinate()
set popup_menu = 0
set src = usr.contents
@@ -110,3 +113,4 @@ mob/eye/Destroy()
sprint = min(sprint + 0.5, max_sprint)
else
sprint = initial
return 1
+7 -10
View File
@@ -11,27 +11,24 @@
/datum/chunk/cult/acquireVisibleTurfs(var/list/visible)
for(var/mob/living/L in living_mob_list)
for(var/turf/t in L.seen_turfs())
for(var/turf/t in L.seen_cult_turfs())
visible[t] = t
/mob/living/proc/seen_turfs()
/mob/living/proc/seen_cult_turfs()
return seen_turfs_in_range(src, 3)
/mob/living/carbon/human/seen_turfs()
/*if(src.isSynthetic())
return list()*/
/mob/living/carbon/human/seen_cult_turfs()
if(mind in cult.current_antagonists)
return seen_turfs_in_range(src, client ? client.view : 7)
return seen_turfs_in_range(src, world.view)
return ..()
/mob/living/silicon/seen_turfs()
/mob/living/silicon/seen_cult_turfs()
return list()
/mob/living/simple_animal/seen_turfs()
/mob/living/simple_animal/seen_cult_turfs()
return seen_turfs_in_range(src, 1)
/mob/living/simple_animal/shade/narsie/seen_turfs()
/mob/living/simple_animal/shade/narsie/seen_cult_turfs()
return view(2, src)
/proc/seen_turfs_in_range(var/source, var/range)
@@ -0,0 +1,2 @@
/mob/living/silicon/ai/SelfMove(turf/n, direct)
return 0