Skip to content

Commit 9fb5dc3

Browse files
Sniping and Spotting QoL (#10896)
# About the pull request Every time a sniper rifle or a spotter designator are stored in inventory or dropped on the ground, their abilities are deactivated and have to be toggled back on which is quite annoying. With this PR "Aimed Shot" and "Spot Target" are activated when their respective items are equipped in hands. Works with all "Aimed Shot" capable sniper rifles. # Explain why it's good for the game The good: QoL. Smoother sniping and spotting experience. The bad: If by chance you have another item which grants you a middle/right click ability, picking up spotter designator or sniper rifle will override the active ability. # Testing Photographs and Procedure <details> <summary>Screenshots & Videos</summary> https://github.com/user-attachments/assets/ca94cd0f-9c86-4fe7-b71d-0e950922461c </details> # Changelog :cl: Labeo0 qol: auto-toggle "Aimed Shot"/"Spot Target" with sniper rifle/spotter designator in hands /:cl:
1 parent a88b37e commit 9fb5dc3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

code/game/objects/items/devices/binoculars.dm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,13 @@
540540

541541
COOLDOWN_START(designator, spotting_cooldown, designator.spotting_cooldown_delay)
542542
return TRUE
543-
543+
/obj/item/device/binoculars/range/designator/spotter/equipped(mob/living/user, slot)
544+
. = ..()
545+
//Toggle Spot Target on equip in hands. Avoids toggle in pockets
546+
if(slot == WEAR_R_HAND || slot == WEAR_L_HAND)
547+
var /datum/action/toggling_action = locate(/datum/action/item_action/specialist/spotter_target) in user.actions
548+
if(toggling_action)
549+
toggling_action.action_activate()
544550
//ADVANCED LASER DESIGNATER, was used for WO.
545551
/obj/item/device/binoculars/designator
546552
name = "advanced laser designator" // Make sure they know this will kill people in the desc below.

code/modules/projectiles/guns/specialist/sniper.dm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,13 @@
247247
break
248248

249249
return blocked
250-
250+
/obj/item/weapon/gun/rifle/sniper/equipped(mob/living/user, slot)
251+
. = ..()
252+
//Toggle Aimed Shot on equip in hands. Skips back and armour slot equips
253+
if(slot == WEAR_R_HAND || slot == WEAR_L_HAND)
254+
var /datum/action/toggling_action = locate(/datum/action/item_action/specialist/aimed_shot) in user.actions
255+
if(toggling_action)
256+
toggling_action.action_activate()
251257
// Snipers may enable or disable their laser tracker at will.
252258
/datum/action/item_action/specialist/toggle_laser
253259

0 commit comments

Comments
 (0)