From b79edf513cad58c2e75b5453e32bdaf04ef3e845 Mon Sep 17 00:00:00 2001 From: Ccomp5950 Date: Wed, 22 Jan 2014 22:40:21 -0600 Subject: [PATCH] Sniper Rifle fix. You have no HUD when zoomed. None, I'm unable to move every HUD element while zoomed in so you lose it. Consider it part of your concentration while zoomed in. If you move while zoomed in you automatically zoom out, you lose concentration. If the rifle isn't in your active hand you can't zoom in. Conflicts: code/modules/projectiles/guns/energy/special.dm --- code/_onclick/hud/hud.dm | 27 +++++--- code/modules/mob/mob_movement.dm | 8 ++- .../projectiles/guns/energy/special.dm | 61 ++++++++++--------- 3 files changed, 59 insertions(+), 37 deletions(-) diff --git a/code/_onclick/hud/hud.dm b/code/_onclick/hud/hud.dm index 9dd3fe9d2ea..687f3b6cac2 100644 --- a/code/_onclick/hud/hud.dm +++ b/code/_onclick/hud/hud.dm @@ -197,14 +197,15 @@ datum/hud/New(mob/owner) vampire_hud() //Triggered when F12 is pressed (Unless someone changed something in the DMF) -/mob/verb/button_pressed_F12() +/mob/verb/button_pressed_F12(var/full = 0 as null) set name = "F12" set hidden = 1 if(hud_used) if(ishuman(src)) - if(!src.client) return - + if(!client) return + if(client.view != world.view) + return if(hud_used.hud_shown) hud_used.hud_shown = 0 if(src.hud_used.adding) @@ -218,10 +219,15 @@ datum/hud/New(mob/owner) //Due to some poor coding some things need special treatment: //These ones are a part of 'adding', 'other' or 'hotkeybuttons' but we want them to stay - src.client.screen += src.hud_used.l_hand_hud_object //we want the hands to be visible - src.client.screen += src.hud_used.r_hand_hud_object //we want the hands to be visible - src.client.screen += src.hud_used.action_intent //we want the intent swticher visible - src.hud_used.action_intent.screen_loc = ui_acti_alt //move this to the alternative position, where zone_select usually is. + if(!full) + src.client.screen += src.hud_used.l_hand_hud_object //we want the hands to be visible + src.client.screen += src.hud_used.r_hand_hud_object //we want the hands to be visible + src.client.screen += src.hud_used.action_intent //we want the intent swticher visible + src.hud_used.action_intent.screen_loc = ui_acti_alt //move this to the alternative position, where zone_select usually is. + else + src.client.screen -= src.healths + src.client.screen -= src.internals + src.client.screen -= src.gun_setting_icon //These ones are not a part of 'adding', 'other' or 'hotkeybuttons' but we want them gone. src.client.screen -= src.zone_sel //zone_sel is a mob variable for some reason. @@ -234,7 +240,12 @@ datum/hud/New(mob/owner) src.client.screen += src.hud_used.other if(src.hud_used.hotkeybuttons && !src.hud_used.hotkey_ui_hidden) src.client.screen += src.hud_used.hotkeybuttons - + if(src.healths) + src.client.screen |= src.healths + if(src.internals) + src.client.screen |= src.internals + if(src.gun_setting_icon) + src.client.screen |= src.gun_setting_icon src.hud_used.action_intent.screen_loc = ui_acti //Restore intent selection to the original position src.client.screen += src.zone_sel //This one is a special snowflake diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 68af4e64484..b2b77756370 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -187,6 +187,12 @@ if(L.incorporeal_move)//Move though walls Process_Incorpmove(direct) return + if(mob.client) + if(mob.client.view != world.view) + if(locate(/obj/item/weapon/gun/energy/sniperrifle, mob.contents)) // If mob moves while zoomed in with sniper rifle, unzoom them. + var/obj/item/weapon/gun/energy/sniperrifle/s = locate() in mob + if(s.zoom) + s.zoom() if(Process_Grab()) return @@ -450,4 +456,4 @@ prob_slip = 0 // Changing this to zero to make it line up with the comment. prob_slip = round(prob_slip) - return(prob_slip) \ No newline at end of file + return(prob_slip) diff --git a/code/modules/projectiles/guns/energy/special.dm b/code/modules/projectiles/guns/energy/special.dm index 4d3d0f02d38..a8af94eeb6a 100644 --- a/code/modules/projectiles/guns/energy/special.dm +++ b/code/modules/projectiles/guns/energy/special.dm @@ -163,40 +163,45 @@ obj/item/weapon/gun/energy/staff/focus projectile_type = "/obj/item/projectile/energy/plasma" /obj/item/weapon/gun/energy/sniperrifle - name = "L.W.A.P. Sniper Rifle" - desc = "A rifle constructed of lightweight materials, fitted with a SMART aiming-system scope." - icon = 'icons/obj/gun.dmi' - icon_state = "sniper" - fire_sound = 'sound/weapons/marauder.ogg' - origin_tech = "combat=6;materials=5;powerstorage=4" - projectile_type = "/obj/item/projectile/beam/sniper" - slot_flags = SLOT_BACK - charge_cost = 250 - fire_delay = 35 - w_class = 4.0 - - var/zoom = 0 + name = "L.W.A.P. Sniper Rifle" + desc = "A rifle constructed of lightweight materials, fitted with a SMART aiming-system scope." + icon = 'icons/obj/gun.dmi' + icon_state = "sniper" + fire_sound = 'sound/weapons/marauder.ogg' + origin_tech = "combat=6;materials=5;powerstorage=4" + projectile_type = "/obj/item/projectile/beam/sniper" + slot_flags = SLOT_BACK + charge_cost = 250 + fire_delay = 35 + w_class = 4.0 + var/zoom = 0 /obj/item/weapon/gun/energy/sniperrifle/dropped(mob/user) user.client.view = world.view - zoom = 0 /obj/item/weapon/gun/energy/sniperrifle/verb/zoom() - set category = "Object" - set name = "Zoom" - set popup_menu = 0 - if(usr.stat || !(istype(usr,/mob/living/carbon/human))) - usr << "No." - return + 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 && 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 - src.zoom = !src.zoom - usr << ("Zoom mode [zoom?"en":"dis"]abled.") - if(zoom) - usr.client.view = 12 - usr << sound('sound/mecha/imag_enh.ogg',volume=50) - else - usr.client.view = world.view//world.view - default mob view size - 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." /obj/item/weapon/gun/energy/kinetic_accelerator