Corrects AI sight.

Fixes #11450.
This commit is contained in:
PsiOmegaDelta
2015-11-15 10:51:13 +01:00
parent 7c1fb1fde9
commit dbedb0b414
2 changed files with 34 additions and 39 deletions
+12 -10
View File
@@ -136,7 +136,6 @@
/mob/living/proc/handle_vision()
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask, global_hud.nvg, global_hud.thermal, global_hud.meson, global_hud.science)
update_sight()
if(stat == DEAD)
@@ -159,24 +158,27 @@
reset_view(null, 0)
else if(viewflags)
sight |= viewflags
else if(eyeobj && eyeobj.owner != src)
reset_view(null)
else
if(!client.adminobs)
else if(eyeobj)
if(eyeobj.owner != src)
reset_view(null)
else if(!client.adminobs)
reset_view(null)
/mob/living/proc/update_sight()
if(stat == DEAD)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
update_dead_sight()
else
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
/mob/living/proc/update_dead_sight()
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
/mob/living/proc/handle_hud_icons()
handle_hud_icons_health()
handle_hud_glasses()
+22 -29
View File
@@ -38,21 +38,7 @@
src << "<span class='notice'><b>APU GENERATOR FAILURE! (System Damaged)</b></span>"
stop_apu(1)
var/blind = 0
var/area/loc = null
if (istype(T, /turf))
loc = T.loc
if (istype(loc, /area))
if (!loc.power_equip && !istype(src.loc,/obj/item) && !APU_power)
blind = 1
if (!blind)
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LIVING
if (!is_blinded())
if (aiRestorePowerRoutine==2)
src << "Alert cancelled. Power has been restored without our assistance."
aiRestorePowerRoutine = 0
@@ -77,25 +63,13 @@
if (aiRestorePowerRoutine==0)
aiRestorePowerRoutine = 1
//Blind the AI
updateicon()
src.blind.screen_loc = ui_entire_screen
if (src.blind.layer!=18)
src.blind.layer = 18
src.sight = src.sight&~SEE_TURFS
src.sight = src.sight&~SEE_MOBS
src.sight = src.sight&~SEE_OBJS
src.see_in_dark = 0
src.see_invisible = SEE_INVISIBLE_LIVING
//Now to tell the AI why they're blind and dying slowly.
src << "You've lost power!"
spawn(20)
src << "Backup battery online. Scanners, camera, and radio interface offline. Beginning fault-detection."
sleep(50)
if (loc.power_equip)
if (current_area.power_equip)
if (!istype(T, /turf/space))
src << "Alert cancelled. Power has been restored without our assistance."
aiRestorePowerRoutine = 0
@@ -125,7 +99,7 @@
else src << "Lost connection with the APC!"
src:aiRestorePowerRoutine = 2
return
if (loc.power_equip)
if (current_area.power_equip)
if (!istype(T, /turf/space))
src << "Alert cancelled. Power has been restored without our assistance."
aiRestorePowerRoutine = 0
@@ -177,3 +151,22 @@
..()
add_ai_verbs(src)
/mob/living/silicon/ai/update_sight()
if(is_blinded())
updateicon()
src.blind.screen_loc = ui_entire_screen
if (src.blind.layer!=18)
src.blind.layer = 18
src.sight = src.sight&~SEE_TURFS
src.sight = src.sight&~SEE_MOBS
src.sight = src.sight&~SEE_OBJS
src.see_in_dark = 0
src.see_invisible = SEE_INVISIBLE_LIVING
else
update_dead_sight()
/mob/living/silicon/ai/proc/is_blinded()
var/area/A = get_area(src)
if (A && !A.power_equip && !istype(src.loc,/obj/item) && !APU_power)
return 1
return 0