Nearsighted Camera Fix (#17124)

* Nearsighted Camera Fix

* fluffy changes
This commit is contained in:
Geeves
2023-09-09 14:20:56 +02:00
committed by GitHub
parent 67c03110c1
commit 4c7e9e4ff2
10 changed files with 55 additions and 5 deletions
+4
View File
@@ -86,6 +86,10 @@
return 0
return -1
/// Primarily used on machinery, when this returns TRUE, equipment that helps with vision, such as prescription glasses for nearsighted characters, have an effect despite the client eye not being on the mob
/atom/proc/grants_equipment_vision(var/mob/user)
return
/atom/proc/additional_sight_flags()
return 0
+3
View File
@@ -285,6 +285,9 @@
if(isXRay()) return SEE_TURFS|SEE_MOBS|SEE_OBJS
return 0
/obj/machinery/camera/grants_equipment_vision(mob/user)
return can_use()
//This might be redundant, because of check_eye()
/obj/machinery/camera/proc/kick_viewers()
for(var/mob/O in player_list)
+10
View File
@@ -35,6 +35,16 @@
reset_current()
return viewflag
/obj/machinery/computer/security/grants_equipment_vision(var/mob/user as mob)
if(user.stat || user.blinded || inoperable())
return FALSE
if(!current_camera)
return FALSE
var/viewflag = current_camera.check_eye(user)
if (viewflag < 0) //camera doesn't work
return FALSE
return TRUE
/obj/machinery/computer/security/ui_interact(mob/user, ui_key = "main", datum/nanoui/ui = null, force_open = 1)
if(..())
return
@@ -47,7 +47,7 @@
return
..()
/mob/living/carbon/human/proc/update_equipment_vision()
/mob/living/carbon/human/proc/update_equipment_vision(var/machine_grants_equipment_vision = FALSE)
flash_protection = 0
equipment_tint_total = 0
equipment_see_invis = 0
@@ -62,7 +62,7 @@
else
binoc_check = TRUE
if(((!client || client.eye == src || client.eye == loc || client.eye == z_eye) && binoc_check) || HAS_TRAIT(src, TRAIT_COMPUTER_VIEW)) // !client is so the unit tests function
if(((!client || client.eye == src || client.eye == loc || client.eye == z_eye) && binoc_check) || machine_grants_equipment_vision || HAS_TRAIT(src, TRAIT_COMPUTER_VIEW)) // !client is so the unit tests function
if(istype(src.head, /obj/item/clothing/head))
add_clothing_protection(head)
if(istype(src.glasses, /obj/item/clothing/glasses))
+3 -1
View File
@@ -1398,12 +1398,14 @@
/mob/living/carbon/human/handle_vision()
if(client)
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)
var/machine_has_equipment_vision = FALSE
if(machine)
var/viewflags = machine.check_eye(src)
if(viewflags < 0)
reset_view(null, 0)
else if(viewflags)
set_sight(sight, viewflags)
machine_has_equipment_vision = machine.grants_equipment_vision(src)
else if(eyeobj)
if(eyeobj.owner != src)
reset_view(null)
@@ -1418,7 +1420,7 @@
remoteview_target = null
reset_view(null, 0)
update_equipment_vision()
update_equipment_vision(machine_has_equipment_vision)
species.handle_vision(src)
/mob/living/carbon/human/handle_hearing()
@@ -355,8 +355,13 @@
/obj/item/modular_computer/check_eye(var/mob/user)
if(active_program)
return active_program.check_eye(user)
else
return ..()
return ..()
// Used by camera monitor program
/obj/item/modular_computer/grants_equipment_vision(var/mob/user)
if(active_program)
return active_program.grants_equipment_vision(user)
return ..()
/obj/item/modular_computer/get_cell()
return battery_module ? battery_module.get_cell() : DEVICE_NO_CELL
@@ -236,6 +236,11 @@
else
return -1
/// Relays the call to nano module, if we have one
/datum/computer_file/program/proc/grants_equipment_vision(var/mob/user)
if(NM)
return NM.grants_equipment_vision(user)
/datum/computer_file/program/proc/message_dead(var/message)
for(var/mob/M in player_list)
if(M.stat == DEAD && (M.client && M.client.prefs.toggles & CHAT_GHOSTEARS))
@@ -191,6 +191,18 @@
reset_current()
return viewflag
/datum/computer_file/program/camera_monitor/grants_equipment_vision(mob/user)
var/obj/item/modular_computer/MC = user.machine
if(istype(MC) && ui_host() == MC)
if(!MC.working || user.blinded || user.stat)
return FALSE
if(!current_camera)
return FALSE
var/viewflag = current_camera.check_eye(user)
if (viewflag < 0) //camera doesn't work
return FALSE
return TRUE
// ERT Variant of the program
/datum/computer_file/program/camera_monitor/ert
+3
View File
@@ -18,6 +18,9 @@
/datum/nano_module/proc/check_eye(var/mob/user)
return -1
/datum/nano_module/proc/grants_equipment_vision(var/mob/user)
return FALSE
/datum/nano_module/proc/check_access(var/mob/user, var/access)
if(!access)
return 1
@@ -0,0 +1,6 @@
author: Geeves
delete-after: True
changes:
- bugfix: "Using cameras while wearing glasses as a nearsighted character no longer reduces your vision radius."