From fe71e2984c5d443a4358d31f5e9ba4a34d74ff65 Mon Sep 17 00:00:00 2001 From: Ghommie <42542238+Ghommie@users.noreply.github.com> Date: Sat, 19 Oct 2019 16:40:01 +0200 Subject: [PATCH] Fixing sniper rifles scope datum action oddities. --- code/modules/projectiles/gun.dm | 21 +++++++------------ .../projectiles/guns/ballistic/automatic.dm | 3 ++- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm index 0a5e3c30cd..13fd834657 100644 --- a/code/modules/projectiles/gun.dm +++ b/code/modules/projectiles/gun.dm @@ -377,7 +377,6 @@ zoom(user) else if(istype(action, alight)) toggle_gunlight() - return ..() /obj/item/gun/proc/toggle_gunlight() if(!gun_light) @@ -469,10 +468,6 @@ icon_icon = 'icons/mob/actions/actions_items.dmi' button_icon_state = "sniper_zoom" -/datum/action/item_action/toggle_scope_zoom/Trigger() - var/obj/item/gun/G = target - G.zoom(owner) - /datum/action/item_action/toggle_scope_zoom/IsAvailable() . = ..() if(!.) @@ -485,16 +480,15 @@ return ..() /obj/item/gun/proc/zoom(mob/living/user, forced_zoom) - if(!user || !user.client) + if(!(user?.client)) return - switch(forced_zoom) - if(FALSE) - zoomed = FALSE - if(TRUE) - zoomed = TRUE - else - zoomed = !zoomed + if(!isnull(forced_zoom)) + if(zoomed == forced_zoom) + return + zoomed = forced_zoom + else + zoomed = !zoomed if(zoomed) var/_x = 0 @@ -516,7 +510,6 @@ user.client.change_view(CONFIG_GET(string/default_view)) user.client.pixel_x = 0 user.client.pixel_y = 0 - return zoomed /obj/item/gun/handle_atom_del(atom/A) if(A == chambered) diff --git a/code/modules/projectiles/guns/ballistic/automatic.dm b/code/modules/projectiles/guns/ballistic/automatic.dm index fda58784fa..cd86b0b06c 100644 --- a/code/modules/projectiles/guns/ballistic/automatic.dm +++ b/code/modules/projectiles/guns/ballistic/automatic.dm @@ -52,9 +52,10 @@ to_chat(user, "You cannot seem to get \the [src] out of your hands!") /obj/item/gun/ballistic/automatic/ui_action_click(mob/user, action) - . = ..() if(istype(action, /datum/action/item_action/toggle_firemode)) burst_select() + else + return ..() /obj/item/gun/ballistic/automatic/proc/burst_select() var/mob/living/carbon/human/user = usr