From 6122ab9b46b2d9f004c96f274c1b649ff4ff03cb Mon Sep 17 00:00:00 2001 From: Matt Atlas Date: Sun, 18 Sep 2022 21:53:18 +0200 Subject: [PATCH] Fixes being able to use binoculars while looking up or down. (#14829) --- code/game/objects/items.dm | 14 +++++-- code/game/objects/items/devices/binoculars.dm | 2 +- html/changelogs/mattatlas-exploit.yml | 42 +++++++++++++++++++ 3 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 html/changelogs/mattatlas-exploit.yml diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm index 32f2070f0f4..07c71d6c933 100644 --- a/code/game/objects/items.dm +++ b/code/game/objects/items.dm @@ -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("[M] peers through \the [zoomdevicename ? "[zoomdevicename] of \the [src.name]" : "[src.name]"].") + if(show_zoom_message) + M.visible_message("[M] 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 ? "[M] looks up from \the [src.name]" : "[M] lowers \the [src.name]"].") + if(show_zoom_message) + M.visible_message("[zoomdevicename ? "[M] looks up from \the [src.name]" : "[M] lowers \the [src.name]"].") if(ishuman(M)) var/mob/living/carbon/human/H = M diff --git a/code/game/objects/items/devices/binoculars.dm b/code/game/objects/items/devices/binoculars.dm index c6b5389002c..a3ef48d0a76 100644 --- a/code/game/objects/items/devices/binoculars.dm +++ b/code/game/objects/items/devices/binoculars.dm @@ -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" diff --git a/html/changelogs/mattatlas-exploit.yml b/html/changelogs/mattatlas-exploit.yml new file mode 100644 index 00000000000..d0e59831abe --- /dev/null +++ b/html/changelogs/mattatlas-exploit.yml @@ -0,0 +1,42 @@ +################################ +# Example Changelog File +# +# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb. +# +# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.) +# When it is, any changes listed below will disappear. +# +# Valid Prefixes: +# bugfix +# wip (For works in progress) +# tweak +# soundadd +# sounddel +# rscadd (general adding of nice things) +# rscdel (general deleting of nice things) +# imageadd +# imagedel +# maptweak +# spellcheck (typo fixes) +# experiment +# balance +# admin +# backend +# security +# refactor +################################# + +# Your name. +author: MattAtlas + +# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again. +delete-after: True + +# Any changes you've made. See valid prefix list above. +# INDENT WITH TWO SPACES. NOT TABS. SPACES. +# SCREW THIS UP AND IT WON'T WORK. +# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries. +# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog. +changes: + - bugfix: "Fixed binocular message spam." + - bugfix: "Fixed being able to use your binoculars while looking down or up."