Skip to content

Commit

Permalink
Aiming Hotkey (#4123)
Browse files Browse the repository at this point in the history
## About The Pull Request

adds an aiming hotkey for mechs/guns

## Changelog

:cl:
add: aiming hotkey. default bound is shift+z
/:cl:
  • Loading branch information
Erikafox authored Feb 21, 2025
1 parent 4f35109 commit 1eabf98
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 5 deletions.
1 change: 1 addition & 0 deletions code/__DEFINES/keybinding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#define COMSIG_KB_HUMAN_BAGEQUIP_DOWN "keybinding_human_bagequip_down"
#define COMSIG_KB_HUMAN_EQUIPMENTSWAP_DOWN "keybinding_human_equipmentswap_down"
#define COMSIG_KB_HUMAN_SUITEQUIP_DOWN "keybinding_human_suitequip_down"
#define COMSIG_KB_HUMAN_ADS "keybinding_human_ads"

//Living
#define COMSIG_KB_LIVING_RESIST_DOWN "keybinding_living_resist_down"
Expand Down
17 changes: 15 additions & 2 deletions code/datums/keybinding/human.dm
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,28 @@
current_human.do_unique_action()
return TRUE

/datum/keybinding/human/ads
hotkey_keys = list("ShiftZ")
name = "aim_down_sights"
full_name = "Aim down sighs"
description = "Aim down the sights of the currently wielded weapon."
keybind_signal = COMSIG_KB_HUMAN_ADS

/datum/keybinding/human/ads/down(client/user)
. = ..()
if(.)
return
var/mob/living/carbon/human/current_human = user.mob
current_human.do_zoom()
return TRUE

/datum/keybinding/human/secondary_action
hotkey_keys = list("ShiftSpace")
name = "secondary_action"
full_name = "Perform secondary action"
description = ""
keybind_signal = COMSIG_KB_HUMAN_SECONDARYACTION


/datum/keybinding/human/secondary_action/down(client/user)
. = ..()
if(.)
Expand All @@ -52,7 +66,6 @@
current_human.do_secondary_action()
return TRUE


/datum/keybinding/human/quick_equip_belt
hotkey_keys = list("ShiftE")
name = "quick_equip_belt"
Expand Down
24 changes: 23 additions & 1 deletion code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,7 @@
return
limb_attack_self()

///proc to call unique action on whatever we're holding.
/mob/verb/do_unique_action()
set name = "Do Unique Action"
set category = "Object"
Expand All @@ -682,14 +683,35 @@
I.unique_action(src)
update_inv_hands()

///proc to call zoom on whatever we're holding.
/mob/verb/do_zoom()
set name = "Aim Down Sights"
set category = "Object"
set src = usr

if(ismecha(loc))
var/obj/mecha/mecha = loc
if(mecha.zoom_action)
mecha.zoom_action.Activate()
return
return

var/obj/item/I = get_active_held_item()
if(istype(I, /obj/item/gun))
var/obj/item/gun/our_gun = I
if(our_gun.wielded_fully)
our_gun.zoom(src, src.dir)
update_inv_hands()
return
return

/mob/verb/do_secondary_action()
set name = "Do Secondary Action"
set category = "Object"
set src = usr

if(ismecha(loc))
return

if(incapacitated())
return

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,8 @@ EMPTY_GUN_HELPER(shotgun/doublebarrel)

// sawn off beforehand
/obj/item/gun/ballistic/shotgun/doublebarrel/presawn
name = "sawn-off double-barreled shotgun"
//init gives it the sawn_off name
name = "double-barreled shotgun"
desc = "A break action shotgun cut down to the size of a sidearm. While the recoil is even harsher, it offers a lot of power in a very small package. Chambered in 12g."
sawn_off = TRUE
weapon_weight = WEAPON_MEDIUM
Expand Down Expand Up @@ -883,7 +884,7 @@ EMPTY_GUN_HELPER(shotgun/doublebarrel/beacon)

//pre sawn off beacon
/obj/item/gun/ballistic/shotgun/doublebarrel/beacon/presawn
name = "sawn-off HP Beacon"
name = "HP Beacon"
sawn_desc= "A single-shot break-action pistol chambered in .45-70. A bit difficult to aim."
sawn_off = TRUE
w_class = WEIGHT_CLASS_NORMAL
Expand Down

0 comments on commit 1eabf98

Please sign in to comment.