diff --git a/code/game/objects/items.dm b/code/game/objects/items.dm
index 71311338..5f1686e8 100644
--- a/code/game/objects/items.dm
+++ b/code/game/objects/items.dm
@@ -39,6 +39,8 @@
var/armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 0, rad = 0)
var/list/allowed = null //suit storage stuff.
var/obj/item/device/uplink/hidden/hidden_uplink = null // All items can have an uplink hidden inside, just remember to add the triggers.
+ var/zoomdevicename = null //name used for message when binoculars/scope is used
+ var/zoom = 0 //1 if item is actively being used to zoom. For scoped guns and binoculars.
/* Species-specific sprites, concept stolen from Paradise//vg/.
ex:
@@ -219,6 +221,11 @@
// apparently called whenever an item is removed from a slot, container, or anything else.
/obj/item/proc/dropped(mob/user as mob)
..()
+ if(zoom) //binoculars, scope, etc
+ user.client.view = world.view
+ user.client.pixel_x = 0
+ user.client.pixel_y = 0
+ zoom = 0
// called just as an item is picked up (loc is not yet changed)
/obj/item/proc/pickup(mob/user)
@@ -644,3 +651,78 @@
if(I && !I.abstract)
I.showoff(src)
+/*
+For zooming with scope or binoculars. This is called from
+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.
+*/
+
+/obj/item/proc/zoom(var/tileoffset = 11,var/viewsize = 12) //tileoffset is client view offset in the direction the user is facing. viewsize is how far out this thing zooms. 7 is normal view
+
+ var/devicename
+
+ if(zoomdevicename)
+ devicename = zoomdevicename
+ else
+ devicename = src.name
+
+ var/cannotzoom
+
+ if(usr.stat || !(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)
+ usr << "Your welding equipment gets in the way of you looking through the [devicename]"
+ cannotzoom = 1
+ else if(!zoom && usr.get_active_hand() != src)
+ usr << "You are too distracted to look through the [devicename], perhaps if it was in your active hand this might work better"
+ cannotzoom = 1
+
+ if(!zoom && !cannotzoom)
+ if(!usr.hud_used.hud_shown)
+ usr.button_pressed_F12(1) // If the user has already limited their HUD this avoids them having a HUD when they zoom in
+ usr.button_pressed_F12(1)
+ usr.client.view = viewsize
+ zoom = 1
+
+ var/tilesize = 32
+ var/viewoffset = tilesize * tileoffset
+
+ switch(usr.dir)
+ if (NORTH)
+ usr.client.pixel_x = 0
+ usr.client.pixel_y = viewoffset
+ if (SOUTH)
+ usr.client.pixel_x = 0
+ usr.client.pixel_y = -viewoffset
+ if (EAST)
+ usr.client.pixel_x = viewoffset
+ usr.client.pixel_y = 0
+ if (WEST)
+ usr.client.pixel_x = -viewoffset
+ usr.client.pixel_y = 0
+
+ usr.visible_message("[usr] peers through the [zoomdevicename ? "[zoomdevicename] of the [src.name]" : "[src.name]"].")
+
+ /*
+ if(istype(usr,/mob/living/carbon/human/))
+ var/mob/living/carbon/human/H = usr
+ usr.visible_message("[usr] holds [devicename] up to [H.get_visible_gender() == MALE ? "his" : H.get_visible_gender() == FEMALE ? "her" : "their"] eyes.")
+ else
+ usr.visible_message("[usr] holds [devicename] up to its eyes.")
+ */
+
+ else
+ usr.client.view = world.view
+ if(!usr.hud_used.hud_shown)
+ usr.button_pressed_F12(1)
+ zoom = 0
+
+ usr.client.pixel_x = 0
+ usr.client.pixel_y = 0
+
+ if(!cannotzoom)
+ usr.visible_message("[zoomdevicename ? "[usr] looks up from the [zoomdevicename] of the [src.name]" : "[usr] lowers the [src.name]"].")
+
+ return
+
diff --git a/code/game/objects/items/devices/binoculars.dm b/code/game/objects/items/devices/binoculars.dm
new file mode 100644
index 00000000..e1c7b18a
--- /dev/null
+++ b/code/game/objects/items/devices/binoculars.dm
@@ -0,0 +1,18 @@
+/obj/item/device/binoculars
+
+ name = "binoculars"
+ desc = "A pair of binoculars."
+ icon_state = "binoculars"
+
+ flags = FPRINT | TABLEPASS| CONDUCT
+ force = 5.0
+ w_class = 2.0
+ throwforce = 5.0
+ throw_range = 15
+ throw_speed = 3
+
+ //matter = list("metal" = 50,"glass" = 50)
+
+
+/obj/item/device/binoculars/attack_self(mob/user)
+ zoom()
\ No newline at end of file
diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm
index 0ce5fd0d..1a196a7c 100644
--- a/code/modules/mob/living/carbon/human/life.dm
+++ b/code/modules/mob/living/carbon/human/life.dm
@@ -1336,7 +1336,14 @@
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
if(healths) healths.icon_state = "health7" //DEAD healthmeter
if(client)
- if(client.view != world.view)if(client.view != world.view) // If mob moves while zoomed in with device, unzoom them.
+ if(client.view != world.view) // If mob moves while zoomed in with device, unzoom them.
+ for(var/obj/item/item in contents)
+ if(item.zoom)
+ item.zoom()
+ break
+
+
+ /*
if(locate(/obj/item/weapon/gun/energy/rifle/sniperrifle, contents))
var/obj/item/weapon/gun/energy/rifle/sniperrifle/s = locate() in src
if(s.zoom)
@@ -1345,7 +1352,7 @@
var/obj/item/weapon/gun/energy/laser/modular/s = locate() in src
if(s.zoom)
s.zoom()
-
+ */
else
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_in_dark = species.darksight
diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm
index 3e58626b..3fcdecb0 100644
--- a/code/modules/mob/mob_movement.dm
+++ b/code/modules/mob/mob_movement.dm
@@ -190,6 +190,12 @@
return
if(mob.client)
if(mob.client.view != world.view)
+ for(var/obj/item/item in mob.contents)
+ if(item.zoom)
+ item.zoom()
+ break
+
+ /*
if(locate(/obj/item/weapon/gun/energy/rifle/sniperrifle, mob.contents)) // If mob moves while zoomed in with sniper rifle, unzoom them.
var/obj/item/weapon/gun/energy/rifle/sniperrifle/s = locate() in mob
if(s.zoom)
@@ -198,6 +204,7 @@
var/obj/item/weapon/gun/energy/laser/modular/s = locate() in mob
if(s.zoom)
s.zoom()
+ */
if(Process_Grab()) return
diff --git a/code/modules/projectiles/guns/energy/erifles.dm b/code/modules/projectiles/guns/energy/erifles.dm
index 1ef01d0d..230f1119 100644
--- a/code/modules/projectiles/guns/energy/erifles.dm
+++ b/code/modules/projectiles/guns/energy/erifles.dm
@@ -133,61 +133,17 @@ Commenting out right now, due to a lack of sprites existing. I hate on-mob weapo
w_class = 4.0
fire_delay_wielded = 35 //35 is normal fire_delay -- this is going to suck. Yiss, what we want!
fire_delay_unwielded = 105 //3x difference, let's be an arse about this, and push the issue
- var/zoom = 0
+ zoomdevicename = "sniper scope"
accuracy = -110
- rangedrop = -5 // fully accurate up to first 10 tiles. the last 4 zoomed tiles you are on your
+ rangedrop = -2 // fully accurate up to first 10 tiles. the last 4 zoomed tiles you are on your
-/obj/item/weapon/gun/energy/rifle/sniperrifle/dropped(mob/user)
- user.client.view = world.view
- ..()
-
-/obj/item/weapon/gun/energy/rifle/sniperrifle/ready_to_fire()
- if(!zoom)
- return 0
- if(world.time >= last_fired + fire_delay)
- last_fired = world.time
- return 1
- else
- return 0
-
-///obj/item/weapon/gun/energy/rifle/sniperrifle/update_icon() //Currently only here to fuck with the on-mob icons.
-// icon_state = "sniper[wielded]"
-// return
-
-/*
-This is called from
-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.
-*/
-
-/obj/item/weapon/gun/energy/rifle/sniperrifle/verb/zoom()
+/obj/item/weapon/gun/energy/rifle/sniperrifle/verb/scope()
set category = "Object"
- set name = "Use Sniper Scope"
- set popup_menu = 0
- if(usr.stat || !(istype(usr,/mob/living/carbon/human)))
- usr << "You are unable to focus down the scope of the rifle."
- return
- if(!zoom && global_hud.darkMask[1] in usr.client.screen)
- usr << "Your welding equipment gets in the way of you looking down the scope"
- return
- if(!zoom && usr.get_active_hand() != src)
- usr << "You are too distracted to look down the scope, perhaps if it was in your active hand this might work better"
- return
+ set name = "Use Scope"
+ set popup_menu = 1
- if(usr.client.view == world.view)
- if(!usr.hud_used.hud_shown)
- usr.button_pressed_F12(1) // If the user has already limited their HUD this avoids them having a HUD when they zoom in
- usr.button_pressed_F12(1)
- usr.client.view = 12
- zoom = 1
- else
- usr.client.view = world.view
- if(!usr.hud_used.hud_shown)
- usr.button_pressed_F12(1)
- zoom = 0
- usr << "Zoom mode [zoom?"en":"dis"]abled."
- return
+ zoom()
///////////LASER CANNON//////////////
diff --git a/code/modules/projectiles/guns/energy/modular.dm b/code/modules/projectiles/guns/energy/modular.dm
index 87564873..0f41b1d7 100644
--- a/code/modules/projectiles/guns/energy/modular.dm
+++ b/code/modules/projectiles/guns/energy/modular.dm
@@ -13,7 +13,7 @@
cell_type = "/obj/item/weapon/cell"
var/canzoom = 0
- var/zoom = 0
+ zoomdevicename = "scan screen"
var/open = 0
var/upgradepointtotal = 16 //KNOWN BUG: Crashes if you try to VV it with a lot of stuff inside. By a lot, I mean 'everything.' At least in all my tests.
@@ -358,34 +358,9 @@
/obj/item/weapon/gun/energy/laser/modular/dropped(mob/user)
user.client.view = world.view
-/obj/item/weapon/gun/energy/laser/modular/verb/zoom()
+/obj/item/weapon/gun/energy/laser/modular/verb/scope()
set category = "Object"
set name = "Use Scan-Screen"
- set popup_menu = 0
+ set popup_menu = 1
- if(usr.stat || !(istype(usr,/mob/living/carbon/human)))
- usr << "You are unable to focus on the screen."
- return
- if(!zoom && global_hud.darkMask[1] in usr.client.screen)
- usr << "Your welding equipment makes it hard to see the screen."
- return
- if(!zoom && usr.get_active_hand() != src)
- usr << "You are too distracted to watch the screen, perhaps if it was in your active hand this might work better"
- return
- if((hasscreen == 0) || (canzoom == 0))
- usr << "This gun lacks the parts for components for zooming."
- return
-
- if(usr.client.view == world.view)
- if(!usr.hud_used.hud_shown)
- usr.button_pressed_F12(1) // If the user has already limited their HUD this avoids them having a HUD when they zoom in
- usr.button_pressed_F12(1)
- usr.client.view = 12
- zoom = 1
- else
- usr.client.view = world.view
- if(!usr.hud_used.hud_shown)
- usr.button_pressed_F12(1)
- zoom = 0
- usr << "Zoom mode [zoom?"en":"dis"]abled."
- return
\ No newline at end of file
+ zoom()
\ No newline at end of file
diff --git a/icons/obj/device.dmi b/icons/obj/device.dmi
index 449854fb..db13b108 100644
Binary files a/icons/obj/device.dmi and b/icons/obj/device.dmi differ