mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 18:22:39 +00:00
Merge pull request #5669 from VOREStation/pol-binocs
Stop usage of multiple vision modifiers
This commit is contained in:
@@ -629,7 +629,7 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
|
||||
|
||||
var/cannotzoom
|
||||
|
||||
if(usr.stat || !(istype(usr,/mob/living/carbon/human)))
|
||||
if((usr.stat && !zoom) || !(istype(usr,/mob/living/carbon/human)))
|
||||
usr << "You are unable to focus through the [devicename]"
|
||||
cannotzoom = 1
|
||||
else if(!zoom && global_hud.darkMask[1] in usr.client.screen)
|
||||
@@ -639,39 +639,46 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
|
||||
usr << "You are too distracted to look through the [devicename], perhaps if it was in your active hand this might work better"
|
||||
cannotzoom = 1
|
||||
|
||||
//We checked above if they are a human and returned already if they weren't.
|
||||
var/mob/living/carbon/human/H = usr
|
||||
|
||||
if(!zoom && !cannotzoom)
|
||||
if(usr.hud_used.hud_shown)
|
||||
usr.toggle_zoom_hud() // If the user has already limited their HUD this avoids them having a HUD when they zoom in
|
||||
usr.client.view = viewsize
|
||||
if(H.hud_used.hud_shown)
|
||||
H.toggle_zoom_hud() // If the user has already limited their HUD this avoids them having a HUD when they zoom in
|
||||
H.client.view = viewsize
|
||||
zoom = 1
|
||||
|
||||
var/tilesize = 32
|
||||
var/viewoffset = tilesize * tileoffset
|
||||
|
||||
switch(usr.dir)
|
||||
switch(H.dir)
|
||||
if (NORTH)
|
||||
usr.client.pixel_x = 0
|
||||
usr.client.pixel_y = viewoffset
|
||||
H.client.pixel_x = 0
|
||||
H.client.pixel_y = viewoffset
|
||||
if (SOUTH)
|
||||
usr.client.pixel_x = 0
|
||||
usr.client.pixel_y = -viewoffset
|
||||
H.client.pixel_x = 0
|
||||
H.client.pixel_y = -viewoffset
|
||||
if (EAST)
|
||||
usr.client.pixel_x = viewoffset
|
||||
usr.client.pixel_y = 0
|
||||
H.client.pixel_x = viewoffset
|
||||
H.client.pixel_y = 0
|
||||
if (WEST)
|
||||
usr.client.pixel_x = -viewoffset
|
||||
usr.client.pixel_y = 0
|
||||
H.client.pixel_x = -viewoffset
|
||||
H.client.pixel_y = 0
|
||||
|
||||
usr.visible_message("[usr] peers through the [zoomdevicename ? "[zoomdevicename] of the [src.name]" : "[src.name]"].")
|
||||
H.visible_message("[usr] peers through the [zoomdevicename ? "[zoomdevicename] of the [src.name]" : "[src.name]"].")
|
||||
H.looking_elsewhere = TRUE
|
||||
H.handle_vision()
|
||||
|
||||
else
|
||||
usr.client.view = world.view
|
||||
if(!usr.hud_used.hud_shown)
|
||||
usr.toggle_zoom_hud()
|
||||
H.client.view = world.view
|
||||
if(!H.hud_used.hud_shown)
|
||||
H.toggle_zoom_hud()
|
||||
zoom = 0
|
||||
|
||||
usr.client.pixel_x = 0
|
||||
usr.client.pixel_y = 0
|
||||
H.client.pixel_x = 0
|
||||
H.client.pixel_y = 0
|
||||
H.looking_elsewhere = FALSE
|
||||
H.handle_vision()
|
||||
|
||||
if(!cannotzoom)
|
||||
usr.visible_message("[zoomdevicename ? "[usr] looks up from the [src.name]" : "[usr] lowers the [src.name]"].")
|
||||
|
||||
@@ -156,6 +156,7 @@ Works together with spawning an observer, noted above.
|
||||
if(!client) return 0
|
||||
|
||||
handle_regular_hud_updates()
|
||||
handle_vision()
|
||||
|
||||
/mob/proc/ghostize(var/can_reenter_corpse = 1)
|
||||
if(key)
|
||||
|
||||
@@ -103,6 +103,7 @@
|
||||
|
||||
updateicon()
|
||||
handle_regular_hud_updates()
|
||||
handle_vision()
|
||||
|
||||
if(ticker && ticker.mode)
|
||||
ticker.mode.check_win()
|
||||
|
||||
@@ -1077,38 +1077,41 @@
|
||||
var/obj/machinery/camera/cam = client.eye
|
||||
client.screen |= cam.client_huds
|
||||
|
||||
if(stat != DEAD)
|
||||
if(stat == UNCONSCIOUS && health <= 0)
|
||||
//Critical damage passage overlay
|
||||
if(stat == DEAD) //Dead
|
||||
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
if(healths) healths.icon_state = "health7" //DEAD healthmeter
|
||||
|
||||
else if(stat == UNCONSCIOUS && health <= 0) //Crit
|
||||
//Critical damage passage overlay
|
||||
var/severity = 0
|
||||
switch(health)
|
||||
if(-20 to -10) severity = 1
|
||||
if(-30 to -20) severity = 2
|
||||
if(-40 to -30) severity = 3
|
||||
if(-50 to -40) severity = 4
|
||||
if(-60 to -50) severity = 5
|
||||
if(-70 to -60) severity = 6
|
||||
if(-80 to -70) severity = 7
|
||||
if(-90 to -80) severity = 8
|
||||
if(-95 to -90) severity = 9
|
||||
if(-INFINITY to -95) severity = 10
|
||||
overlay_fullscreen("crit", /obj/screen/fullscreen/crit, severity)
|
||||
else //Alive
|
||||
clear_fullscreen("crit")
|
||||
//Oxygen damage overlay
|
||||
if(oxyloss)
|
||||
var/severity = 0
|
||||
switch(health)
|
||||
if(-20 to -10) severity = 1
|
||||
if(-30 to -20) severity = 2
|
||||
if(-40 to -30) severity = 3
|
||||
if(-50 to -40) severity = 4
|
||||
if(-60 to -50) severity = 5
|
||||
if(-70 to -60) severity = 6
|
||||
if(-80 to -70) severity = 7
|
||||
if(-90 to -80) severity = 8
|
||||
if(-95 to -90) severity = 9
|
||||
if(-INFINITY to -95) severity = 10
|
||||
overlay_fullscreen("crit", /obj/screen/fullscreen/crit, severity)
|
||||
switch(oxyloss)
|
||||
if(10 to 20) severity = 1
|
||||
if(20 to 25) severity = 2
|
||||
if(25 to 30) severity = 3
|
||||
if(30 to 35) severity = 4
|
||||
if(35 to 40) severity = 5
|
||||
if(40 to 45) severity = 6
|
||||
if(45 to INFINITY) severity = 7
|
||||
overlay_fullscreen("oxy", /obj/screen/fullscreen/oxy, severity)
|
||||
else
|
||||
clear_fullscreen("crit")
|
||||
//Oxygen damage overlay
|
||||
if(oxyloss)
|
||||
var/severity = 0
|
||||
switch(oxyloss)
|
||||
if(10 to 20) severity = 1
|
||||
if(20 to 25) severity = 2
|
||||
if(25 to 30) severity = 3
|
||||
if(30 to 35) severity = 4
|
||||
if(35 to 40) severity = 5
|
||||
if(40 to 45) severity = 6
|
||||
if(45 to INFINITY) severity = 7
|
||||
overlay_fullscreen("oxy", /obj/screen/fullscreen/oxy, severity)
|
||||
else
|
||||
clear_fullscreen("oxy")
|
||||
clear_fullscreen("oxy")
|
||||
|
||||
//Fire and Brute damage overlay (BSSR)
|
||||
var/hurtdamage = src.getShockBruteLoss() + src.getShockFireLoss() + damageoverlaytemp //Doesn't call the overlay if you can't actually feel it
|
||||
@@ -1126,66 +1129,6 @@
|
||||
else
|
||||
clear_fullscreen("brute")
|
||||
|
||||
if( stat == DEAD )
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS|SEE_SELF
|
||||
see_in_dark = 8
|
||||
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
if(healths) healths.icon_state = "health7" //DEAD healthmeter
|
||||
if(client)
|
||||
if(client.view != world.view) // If mob dies while zoomed in with device, unzoom them.
|
||||
for(var/obj/item/item in contents)
|
||||
if(item.zoom)
|
||||
item.zoom()
|
||||
break
|
||||
|
||||
else
|
||||
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : see_invisible_default
|
||||
|
||||
if(XRAY in mutations)
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
|
||||
see_in_dark = 8
|
||||
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
|
||||
if(seer==1)
|
||||
var/obj/effect/rune/R = locate() in loc
|
||||
if(R && R.word1 == cultwords["see"] && R.word2 == cultwords["hell"] && R.word3 == cultwords["join"])
|
||||
see_invisible = SEE_INVISIBLE_CULT
|
||||
else
|
||||
see_invisible = see_invisible_default
|
||||
seer = 0
|
||||
|
||||
if(!seedarkness)
|
||||
sight = species.get_vision_flags(src)
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_NOLIGHTING
|
||||
|
||||
else
|
||||
sight = species.get_vision_flags(src)
|
||||
see_in_dark = species.darksight
|
||||
see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : see_invisible_default
|
||||
|
||||
var/tmp/glasses_processed = 0
|
||||
var/obj/item/weapon/rig/rig = back
|
||||
if(istype(rig) && rig.visor)
|
||||
if(!rig.helmet || (head && rig.helmet == head))
|
||||
if(rig.visor && rig.visor.vision && rig.visor.active && rig.visor.vision.glasses)
|
||||
glasses_processed = 1
|
||||
process_glasses(rig.visor.vision.glasses)
|
||||
|
||||
if(glasses && !glasses_processed)
|
||||
glasses_processed = 1
|
||||
process_glasses(glasses)
|
||||
if(XRAY in mutations)
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
|
||||
see_in_dark = 8
|
||||
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
|
||||
if(!glasses_processed && (species.get_vision_flags(src) > 0))
|
||||
sight |= species.get_vision_flags(src)
|
||||
if(!seer && !glasses_processed && seedarkness)
|
||||
see_invisible = see_invisible_default
|
||||
|
||||
if(healths)
|
||||
if (chem_effects[CE_PAINKILLER] > 100)
|
||||
healths.icon_state = "health_numb"
|
||||
@@ -1333,11 +1276,70 @@
|
||||
if(found_welder)
|
||||
client.screen |= global_hud.darkMask
|
||||
|
||||
/mob/living/carbon/human/handle_vision()
|
||||
if(stat == DEAD)
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS|SEE_SELF
|
||||
see_in_dark = 8
|
||||
if(client)
|
||||
if(client.view != world.view) // If mob dies while zoomed in with device, unzoom them.
|
||||
for(var/obj/item/item in contents)
|
||||
if(item.zoom)
|
||||
item.zoom()
|
||||
break
|
||||
|
||||
else //We aren't dead
|
||||
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : see_invisible_default
|
||||
|
||||
if(XRAY in mutations)
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
|
||||
see_in_dark = 8
|
||||
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
|
||||
if(seer==1)
|
||||
var/obj/effect/rune/R = locate() in loc
|
||||
if(R && R.word1 == cultwords["see"] && R.word2 == cultwords["hell"] && R.word3 == cultwords["join"])
|
||||
see_invisible = SEE_INVISIBLE_CULT
|
||||
else
|
||||
see_invisible = see_invisible_default
|
||||
seer = 0
|
||||
|
||||
if(!seedarkness)
|
||||
sight = species.get_vision_flags(src)
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_NOLIGHTING
|
||||
|
||||
else
|
||||
sight = species.get_vision_flags(src)
|
||||
see_in_dark = species.darksight
|
||||
see_invisible = see_in_dark>2 ? SEE_INVISIBLE_LEVEL_ONE : see_invisible_default
|
||||
|
||||
var/tmp/glasses_processed = 0
|
||||
var/obj/item/weapon/rig/rig = back
|
||||
if(istype(rig) && rig.visor && !looking_elsewhere)
|
||||
if(!rig.helmet || (head && rig.helmet == head))
|
||||
if(rig.visor && rig.visor.vision && rig.visor.active && rig.visor.vision.glasses)
|
||||
glasses_processed = 1
|
||||
process_glasses(rig.visor.vision.glasses)
|
||||
|
||||
if(glasses && !glasses_processed && !looking_elsewhere)
|
||||
glasses_processed = 1
|
||||
process_glasses(glasses)
|
||||
if(XRAY in mutations)
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
|
||||
see_in_dark = 8
|
||||
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
|
||||
if(!glasses_processed && (species.get_vision_flags(src) > 0))
|
||||
sight |= species.get_vision_flags(src)
|
||||
if(!seer && !glasses_processed && seedarkness)
|
||||
see_invisible = see_invisible_default
|
||||
|
||||
if(machine)
|
||||
var/viewflags = machine.check_eye(src)
|
||||
if(viewflags < 0)
|
||||
reset_view(null, 0)
|
||||
else if(viewflags)
|
||||
else if(viewflags && !looking_elsewhere)
|
||||
sight |= viewflags
|
||||
else if(eyeobj)
|
||||
if(eyeobj.owner != src)
|
||||
|
||||
@@ -62,6 +62,8 @@
|
||||
|
||||
handle_regular_hud_updates()
|
||||
|
||||
handle_vision()
|
||||
|
||||
/mob/living/proc/handle_breathing()
|
||||
return
|
||||
|
||||
@@ -173,9 +175,6 @@
|
||||
|
||||
return 1
|
||||
|
||||
/mob/living/proc/handle_vision()
|
||||
return
|
||||
|
||||
/mob/living/proc/update_sight()
|
||||
if(!seedarkness)
|
||||
see_invisible = SEE_INVISIBLE_NOLIGHTING
|
||||
|
||||
@@ -61,4 +61,7 @@
|
||||
var/list/hud_list //Holder for health hud, status hud, wanted hud, etc (not like inventory slots)
|
||||
var/has_huds = FALSE //Whether or not we should bother initializing the above list
|
||||
|
||||
var/makes_dirt = TRUE //FALSE if the mob shouldn't be making dirt on the ground when it walks
|
||||
var/makes_dirt = TRUE //FALSE if the mob shouldn't be making dirt on the ground when it walks
|
||||
|
||||
var/looking_elsewhere = FALSE //If the mob's view has been relocated to somewhere else, like via a camera or with binocs
|
||||
|
||||
@@ -152,6 +152,7 @@
|
||||
|
||||
process_queued_alarms()
|
||||
handle_regular_hud_updates()
|
||||
handle_vision()
|
||||
|
||||
/mob/living/silicon/ai/proc/lacks_power()
|
||||
if(APU_power)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
src.cable = null
|
||||
|
||||
handle_regular_hud_updates()
|
||||
handle_vision()
|
||||
|
||||
if(silence_time)
|
||||
if(world.timeofday >= silence_time)
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
if(client)
|
||||
handle_regular_hud_updates()
|
||||
handle_vision()
|
||||
update_items()
|
||||
if (src.stat != DEAD) //still using power
|
||||
use_power()
|
||||
|
||||
@@ -617,6 +617,10 @@ var/list/global/organ_rel_size = list(
|
||||
/mob/proc/handle_regular_hud_updates()
|
||||
return
|
||||
|
||||
//Handle eye things like the Byond SEE_TURFS, SEE_OBJS, etc.
|
||||
/mob/proc/handle_vision()
|
||||
return
|
||||
|
||||
//Icon is used to occlude things like huds from the faulty byond context menu.
|
||||
// http://www.byond.com/forum/?post=2336679
|
||||
var/global/image/backplane
|
||||
|
||||
Reference in New Issue
Block a user