Merge pull request #462 from SueTheCake/guncode

Zoom optimizations.
This commit is contained in:
skull132
2015-03-29 19:38:33 +03:00
7 changed files with 126 additions and 81 deletions
+9 -2
View File
@@ -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
+7
View File
@@ -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
@@ -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 << "<font color='[zoom?"blue":"red"]'>Zoom mode [zoom?"en":"dis"]abled.</font>"
return
zoom()
///////////LASER CANNON//////////////
@@ -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 << "<font color='[zoom?"blue":"red"]'>Zoom mode [zoom?"en":"dis"]abled.</font>"
return
zoom()