Zooming with an item is now done with a general proc zoom(). This applies to binoculars and sniper rifle.

This commit is contained in:
RavingManiac
2014-10-04 17:38:38 +08:00
parent 2aab019cba
commit 756e9ae030
5 changed files with 101 additions and 140 deletions

View File

@@ -225,69 +225,11 @@ obj/item/weapon/gun/energy/staff/focus
charge_cost = 250
fire_delay = 35
w_class = 4.0
var/zoom = 0
zoomdevicename = "sniper scope"
/obj/item/weapon/gun/energy/sniperrifle/dropped(mob/user)
user.client.view = world.view
user.client.pixel_x = 0
user.client.pixel_y = 0
/*
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/sniperrifle/verb/zoom()
/obj/item/weapon/gun/energy/sniperrifle/verb/scope()
set category = "Object"
set name = "Use Sniper Scope"
set name = "Use Scope"
set popup_menu = 1
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
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
var/tileoffset = 11 //client view offset in the direction the user is facing
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
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
usr << "<font color='[zoom?"blue":"red"]'>Zoom mode [zoom?"en":"dis"]abled.</font>"
return
zoom()