Files
Polaris/code/modules/mob/freelook/eye.dm
Kelenius acc78a8000 Changes types of ghosts and eyes
``/mob/dead/observer`` -> ``/mob/observer/dead``
``/mob/eye`` -> ``/mob/observer/eye``

Reason being that they are similar in that they both don't interact with
the world in any way. Some procs were shared, some checks as well, and
it overall makes more sense this way. Plus, there were no ``/mob/dead``
mobs.
2016-02-20 15:36:05 +03:00

116 lines
2.5 KiB
Plaintext

// EYE
//
// A mob that another mob controls to look around the station with.
// It streams chunks as it moves around, which will show it what the controller can and cannot see.
/mob/observer/eye
name = "Eye"
icon = 'icons/mob/eye.dmi'
icon_state = "default-eye"
alpha = 127
var/sprint = 10
var/cooldown = 0
var/acceleration = 1
var/owner_follows_eye = 0
see_in_dark = 7
status_flags = GODMODE
invisibility = INVISIBILITY_EYE
var/mob/owner = null
var/list/visibleChunks = list()
var/ghostimage = null
var/datum/visualnet/visualnet
/mob/observer/eye/New()
ghostimage = image(src.icon,src,src.icon_state)
ghost_darkness_images |= ghostimage //so ghosts can see the eye when they disable darkness
ghost_sightless_images |= ghostimage //so ghosts can see the eye when they disable ghost sight
updateallghostimages()
..()
mob/observer/eye/Destroy()
if (ghostimage)
ghost_darkness_images -= ghostimage
ghost_sightless_images -= ghostimage
qdel(ghostimage)
ghostimage = null
updateallghostimages()
..()
/mob/observer/eye/Move(n, direct)
if(owner == src)
return EyeMove(n, direct)
return 0
/mob/observer/eye/airflow_hit(atom/A)
airflow_speed = 0
airflow_dest = null
/mob/observer/eye/examinate()
set popup_menu = 0
set src = usr.contents
return 0
/mob/observer/eye/pointed()
set popup_menu = 0
set src = usr.contents
return 0
/mob/observer/eye/examine(mob/user)
// Use this when setting the eye's location.
// It will also stream the chunk that the new loc is in.
/mob/observer/eye/proc/setLoc(var/T)
if(owner)
T = get_turf(T)
if(T != loc)
loc = T
if(owner.client)
owner.client.eye = src
if(owner_follows_eye)
visualnet.updateVisibility(owner, 0)
owner.loc = loc
visualnet.updateVisibility(owner, 0)
visualnet.visibility(src)
return 1
return 0
/mob/observer/eye/proc/getLoc()
if(owner)
if(!isturf(owner.loc) || !owner.client)
return
return loc
/mob
var/mob/observer/eye/eyeobj
/mob/proc/EyeMove(n, direct)
if(!eyeobj)
return
return eyeobj.EyeMove(n, direct)
/mob/observer/eye/EyeMove(n, direct)
var/initial = initial(sprint)
var/max_sprint = 50
if(cooldown && cooldown < world.timeofday)
sprint = initial
for(var/i = 0; i < max(sprint, initial); i += 20)
var/turf/step = get_turf(get_step(src, direct))
if(step)
setLoc(step)
cooldown = world.timeofday + 5
if(acceleration)
sprint = min(sprint + 0.5, max_sprint)
else
sprint = initial
return 1