Fixes virtualhearers sight flags (#11544)

Adds a wrapper proc for changing sight flags

When sight flags are changed, it checks if the sight flags have actually been changed and then if so modifies the virtualhearer's sight flags.
This commit is contained in:
clusterfack
2016-08-23 09:32:16 -05:00
committed by GitHub
parent 72196b19c9
commit e1fc7f692f
24 changed files with 60 additions and 98 deletions

View File

@@ -362,12 +362,12 @@ You are weak to holy things and starlight. Don't go into space and avoid the Cha
owner.see_invisible = SEE_INVISIBLE_LEVEL_TWO
if(VAMP_MATURE in powers)
owner.sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
owner.change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
owner.see_in_dark = 8
owner.see_invisible = SEE_INVISIBLE_MINIMUM
else if(VAMP_VISION in powers)
owner.sight |= SEE_MOBS
owner.change_sight(adding = SEE_MOBS)
/mob/proc/handle_bloodsucking(mob/living/carbon/human/H)
src.mind.vampire.draining = H

View File

@@ -129,7 +129,7 @@
new /obj/item/weapon/scrying(get_turf(H))
if (!(M_XRAY in H.mutations))
H.mutations.Add(M_XRAY)
H.sight |= (SEE_MOBS|SEE_OBJS|SEE_TURFS)
H.change_sight(adding = SEE_MOBS|SEE_OBJS|SEE_TURFS)
H.see_in_dark = 8
H.see_invisible = SEE_INVISIBLE_LEVEL_TWO
to_chat(H, "<span class='notice'>The walls suddenly disappear.</span>")

View File

@@ -377,7 +377,7 @@
new /obj/item/weapon/scrying(get_turf(H))
if (!(M_XRAY in H.mutations))
H.mutations.Add(M_XRAY)
H.sight |= (SEE_MOBS|SEE_OBJS|SEE_TURFS)
H.change_sight(adding = SEE_MOBS|SEE_OBJS|SEE_TURFS)
H.see_in_dark = 8
H.see_invisible = SEE_INVISIBLE_LEVEL_TWO
to_chat(H, "<span class='notice'>The walls suddenly disappear.</span>")

View File

@@ -46,7 +46,7 @@
if (!(M_XRAY in user.mutations))
user.mutations.Add(M_XRAY)
user.sight |= (SEE_MOBS|SEE_OBJS|SEE_TURFS)
user.change_sight(adding = SEE_MOBS|SEE_OBJS|SEE_TURFS)
user.see_in_dark = 8
user.see_invisible = SEE_INVISIBLE_LEVEL_TWO

View File

@@ -39,7 +39,7 @@
var/lastchairspin
/mob/dead/observer/New(var/mob/body=null, var/flags=1)
sight |= SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF
change_sight(adding = SEE_TURFS | SEE_MOBS | SEE_OBJS | SEE_SELF)
see_invisible = SEE_INVISIBLE_OBSERVER
see_in_dark = 100
verbs += /mob/dead/observer/proc/dead_tele

View File

@@ -29,6 +29,11 @@ var/list/stationary_hearers = list( /obj/item/device/radio/intercom,
virtualhearers += src
loc = get_turf(attachedto)
attached = attachedto
var/mob/M = attachedto
if(istype(M))
sight = M.sight
attached_type = attachedto.type //record the attached's typepath in case something goes wrong
attached_ref = "/ref[attachedto]" //record attached's text ref to see what is happening
if(is_type_in_list(attachedto,stationary_hearers))
@@ -60,4 +65,17 @@ var/list/stationary_hearers = list( /obj/item/device/radio/intercom,
return
/mob/virtualhearer/blob_act()
return
return
/mob/proc/change_sight(adding, removing, copying)
var/oldsight = sight
if(copying)
sight = copying
if(adding)
sight |= adding
if(removing)
sight &= ~removing
if(sight != oldsight)
for(var/mob/virtualhearer/VH in virtualhearers)
if(VH.attached == src)
VH.sight = sight

View File

@@ -385,15 +385,11 @@
if (stat == 2 || (M_XRAY in mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else if (stat != 2)
sight |= SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
change_sight(adding = SEE_MOBS, removing = SEE_TURFS|SEE_OBJS)
see_in_dark = 4
see_invisible = SEE_INVISIBLE_MINIMUM

View File

@@ -306,15 +306,11 @@
if (stat == 2 || (M_XRAY in mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else if (stat != 2)
sight |= SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
change_sight(adding = SEE_MOBS, removing = SEE_TURFS|SEE_OBJS)
see_in_dark = 4
see_invisible = SEE_INVISIBLE_MINIMUM

View File

@@ -6,7 +6,7 @@
stat = DEAD
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO

View File

@@ -215,15 +215,11 @@
if (stat == 2 || (M_XRAY in src.mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (stat != 2)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
change_sight(removing = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING

View File

@@ -4,7 +4,7 @@
if(!client)
return 0
sight &= ~BLIND
change_sight(removing = BLIND)
regular_hud_updates()
@@ -79,7 +79,7 @@
clear_fullscreen("brute")
//damageoverlay.overlays += I
if(stat == DEAD)
sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
if(!druggy)
see_invisible = SEE_INVISIBLE_LEVEL_TWO
@@ -87,7 +87,7 @@
healths.icon_state = "health7" //DEAD healthmeter
return
else
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
change_sight(removing = SEE_TURFS|SEE_MOBS|SEE_OBJS)
var/datum/organ/internal/eyes/E = src.internal_organs_by_name["eyes"]
if(E)
@@ -106,7 +106,7 @@
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_ONE
if(M_XRAY in mutations)
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
if(!druggy)
see_invisible = SEE_INVISIBLE_LEVEL_TWO
@@ -127,7 +127,7 @@
see_in_dark = max(see_in_dark, G.see_in_dark)
see_in_dark += G.darkness_view
if(G.vision_flags) //MESONS
sight |= G.vision_flags
change_sight(adding = G.vision_flags)
if(!druggy)
see_invisible = SEE_INVISIBLE_MINIMUM
if(G.see_invisible)
@@ -327,7 +327,7 @@
reset_view(null)
if(iscamera(client.eye))
var/obj/machinery/camera/C = client.eye
sight = C.vision_flags
change_sight(copying = C.vision_flags)
else
var/isRemoteObserve = 0

View File

@@ -642,15 +642,11 @@
/mob/living/carbon/monkey/proc/handle_regular_hud_updates()
if (stat == 2 || (M_XRAY in mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (stat != 2)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
change_sight(removing = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING

View File

@@ -10,7 +10,7 @@
src.eyeobj.forceMove(get_turf(src))
if(blind)
blind.layer = 0
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO

View File

@@ -26,9 +26,7 @@
cameranet.visibility(src)
if(ai.client && ai.client.eye != src) // Set the eye to us and give the AI the sight & visibility flags it needs.
ai.client.eye = src
ai.sight |= SEE_TURFS
ai.sight |= SEE_MOBS
ai.sight |= SEE_OBJS
ai.change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
ai.see_in_dark = 8
ai.see_invisible = SEE_INVISIBLE_LEVEL_TWO
@@ -39,13 +37,13 @@
/mob/camera/aiEye/Move()
return 0
/mob/camera/aiEye/on_see(var/message, var/blind_message, var/drugged_message, var/blind_drugged_message, atom/A) //proc for eye seeing visible messages from atom A, only possible with the high_res camera module
if(!high_res)
return
if(ai && cameranet.checkCameraVis(A)) //check it's actually in view of a camera
ai.show_message( message, 1, blind_message, 2)
//An AI eyeobj mob cant hear unless it updates high_res with a Malf Module
/mob/camera/aiEye/Hear(var/datum/speech/speech, var/rendered_speech="")
if(!high_res)
@@ -159,7 +157,7 @@
if(client && client.eye) // Reset these things so the AI can't view through walls and stuff.
client.eye = src
sight &= ~(SEE_TURFS | SEE_MOBS | SEE_OBJS)
change_sight(removing = SEE_TURFS | SEE_MOBS | SEE_OBJS)
see_in_dark = 0
see_invisible = SEE_INVISIBLE_LIVING

View File

@@ -59,9 +59,7 @@
//I'll get back to this when I find out how this is -supposed- to work ~Carn //removed this shit since it was confusing as all hell --39kk9t
//stage = 4.5
if(client && client.eye == eyeobj) // We are viewing the world through our "eye" mob.
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO
@@ -97,9 +95,7 @@
src.blind.screen_loc = "1,1 to 15,15"
if (src.blind.layer != 18)
src.blind.layer = UNDER_HUD_LAYER
src.sight = src.sight&~SEE_TURFS
src.sight = src.sight&~SEE_MOBS
src.sight = src.sight&~SEE_OBJS
change_sight(removing = SEE_TURFS|SEE_MOBS|SEE_OBJS)
src.see_in_dark = 0
src.see_invisible = SEE_INVISIBLE_LIVING

View File

@@ -51,7 +51,7 @@
if(blind)
blind.layer = 0
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
updateicon()

View File

@@ -5,7 +5,7 @@
canmove = 0
if(blind)
blind.layer = 0
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO

View File

@@ -63,7 +63,7 @@
var/obj/item/radio/integrated/signal/sradio // AI's signaller
/mob/living/silicon/pai/New(var/obj/item/device/paicard)
sight &= ~BLIND
change_sight(removing = BLIND)
canmove = 0
src.loc = paicard
card = paicard

View File

@@ -51,7 +51,7 @@
if(blind)
blind.layer = 0
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
updateicon()

View File

@@ -147,61 +147,33 @@
return 1
/mob/living/silicon/robot/proc/handle_sensor_modes()
src.sight &= ~SEE_MOBS
src.sight &= ~SEE_TURFS
src.sight &= ~SEE_OBJS
src.sight &= ~BLIND
change_sight(removing = SEE_TURFS|SEE_MOBS|SEE_OBJS|BLIND)
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO
if (src.stat == DEAD)
sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO
else
if (M_XRAY in mutations || src.sight_mode & BORGXRAY)
sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO
if ((src.sight_mode & BORGTHERM) || sensor_mode == THERMAL_VISION)
src.sight |= SEE_MOBS
change_sight(adding = SEE_MOBS)
src.see_in_dark = 4
src.see_invisible = SEE_INVISIBLE_MINIMUM
if (sensor_mode == NIGHT)
see_invisible = SEE_INVISIBLE_MINIMUM
see_in_dark = 8
if ((src.sight_mode & BORGMESON) || (sensor_mode == MESON_VISION))
src.sight |= SEE_TURFS
change_sight(adding = SEE_TURFS)
src.see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
/mob/living/silicon/robot/proc/handle_regular_hud_updates()
handle_sensor_modes()
/*if (src.stat == 2 || M_XRAY in mutations || src.sight_mode & BORGXRAY)
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.sight |= SEE_OBJS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_MINIMUM
else if ((src.sight_mode & BORGMESON || sensor_mode == MESON_VISION) && src.sight_mode & BORGTHERM)
src.sight |= SEE_TURFS
src.sight |= SEE_MOBS
src.see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else if (src.sight_mode & BORGMESON || sensor_mode == MESON_VISION)
src.sight |= SEE_TURFS
src.see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else if (src.sight_mode & BORGTHERM)
src.sight |= SEE_MOBS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if (src.stat != 2)
src.sight &= ~SEE_MOBS
src.sight &= ~SEE_TURFS
src.sight &= ~SEE_OBJS
src.see_in_dark = 8
src.see_invisible = SEE_INVISIBLE_LEVEL_TWO*/
regular_hud_updates() //Handles MED/SEC HUDs for borgs.
switch(sensor_mode)
@@ -210,12 +182,6 @@
if (MED_HUD)
process_med_hud(src)
/*switch(sensor_mode)
if (SEC_HUD)
process_sec_hud(src, 1)
if (MED_HUD)
process_med_hud(src)*/
if (src.healths)
if (src.stat != 2)
switch(health)

View File

@@ -334,7 +334,7 @@
/mob/living/simple_animal/construct/harvester/New()
..()
sight |= SEE_MOBS
change_sight(adding = SEE_MOBS)
////////////////Glow//////////////////
/mob/living/simple_animal/construct/proc/updateicon()

View File

@@ -49,7 +49,7 @@
delayNextMove(0)
sight |= SEE_SELF
change_sight(adding = SEE_SELF)
..()

View File

@@ -13,7 +13,7 @@
else
loc = locate(1,1,1)
sight |= SEE_TURFS
change_sight(adding = SEE_TURFS)
player_list |= src
/*

View File

@@ -57,7 +57,7 @@
to_chat(user, "\blue Your skin feels icy to the touch.")
if (!(M_XRAY in user.mutations))
user.mutations.Add(M_XRAY)
user.sight |= (SEE_MOBS|SEE_OBJS|SEE_TURFS)
user.change_sight(adding = SEE_TURFS|SEE_MOBS|SEE_OBJS)
user.see_in_dark = 8
user.see_invisible = SEE_INVISIBLE_LEVEL_TWO
to_chat(user, "\blue The walls suddenly disappear.")