Fixes being able to use binoculars while looking up or down. (#14829)

This commit is contained in:
Matt Atlas
2022-09-18 21:53:18 +02:00
committed by GitHub
parent 5dec38d327
commit 6122ab9b46
3 changed files with 54 additions and 4 deletions
+11 -3
View File
@@ -682,9 +682,15 @@ modules/mob/mob_movement.dm if you move you will be zoomed out
modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
*/
//Looking through a scope or binoculars should /not/ improve your periphereal vision. Still, increase viewsize a tiny bit so that sniping isn't as restricted to NSEW
/obj/item/proc/zoom(var/mob/M, var/tileoffset = 14, var/viewsize = 9, var/do_device_check = TRUE) //tileoffset is client view offset in the direction the user is facing. viewsize is how far out this thing zooms. 7 is normal view
/obj/item/proc/zoom(var/mob/M, var/tileoffset = 14, var/viewsize = 9, var/do_device_check = TRUE, var/show_zoom_message = TRUE) //tileoffset is client view offset in the direction the user is facing. viewsize is how far out this thing zooms. 7 is normal view
if (!M)
return
if(!isliving(M))
return
var/mob/living/L = M
if(L.z_eye)
to_chat(L, SPAN_WARNING("You can't do that from here!"))
return
var/devicename
@@ -728,7 +734,8 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
M.client.pixel_x = -viewoffset
M.client.pixel_y = 0
M.visible_message("<b>[M]</b> peers through \the [zoomdevicename ? "[zoomdevicename] of \the [src.name]" : "[src.name]"].")
if(show_zoom_message)
M.visible_message("<b>[M]</b> peers through \the [zoomdevicename ? "[zoomdevicename] of \the [src.name]" : "[src.name]"].")
else
M.client.view = world.view
@@ -740,7 +747,8 @@ modules/mob/living/carbon/human/life.dm if you die, you will be zoomed out.
M.client.pixel_y = 0
if(!cannotzoom)
M.visible_message("[zoomdevicename ? "<b>[M]</b> looks up from \the [src.name]" : "<b>[M]</b> lowers \the [src.name]"].")
if(show_zoom_message)
M.visible_message("[zoomdevicename ? "<b>[M]</b> looks up from \the [src.name]" : "<b>[M]</b> lowers \the [src.name]"].")
if(ishuman(M))
var/mob/living/carbon/human/H = M
@@ -15,7 +15,7 @@
var/viewsize = 7
/obj/item/device/binoculars/attack_self(mob/user)
zoom(user,tileoffset,viewsize)
zoom(user,tileoffset,viewsize, show_zoom_message = FALSE)
/obj/item/device/binoculars/high_power
name = "high power binoculars"