Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shotgun tube toggle hotkey #4794

Merged
merged 3 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__DEFINES/keybinding.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
#define COMSIG_KB_HUMAN_WEAPON_UNLOAD "keybinding_human_weapon_unload"
#define COMSIG_KB_HUMAN_WEAPON_ATTACHMENT "keybinding_human_weapon_attachment"
#define COMSIG_KB_HUMAN_WEAPON_ATTACHMENT_RAIL "keybinding_human_weapon_attachment_rail"
#define COMSIG_KB_HUMAN_WEAPON_SHOTGUN_TUBE "keybinding_human_weapon_shotgun_tube"

#define COMSIG_KB_HUMAN_WEAPON_TOGGLE_IFF "keybinding_human_weapon_toggle_iff"

Expand Down
17 changes: 17 additions & 0 deletions code/datums/keybinding/human_combat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,20 @@
var/obj/item/weapon/gun/rifle/m46c/COgun = held_item
COgun.toggle_iff(human)
return TRUE

/datum/keybinding/human/combat/toggle_shotgun_tube
hotkey_keys = list("Unbound")
classic_keys = list("Unbound")
name = "toggle_shotgun_tube"
full_name = "Toggle Shotgun Tube"
keybind_signal = COMSIG_KB_HUMAN_WEAPON_SHOTGUN_TUBE

/datum/keybinding/human/combat/toggle_shotgun_tube/down(client/user)
. = ..()
if(.)
return
var/mob/living/carbon/human/human = user.mob
var/obj/item/weapon/gun/shotgun/pump/dual_tube/held_item = human.get_held_item()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to check if what they're holding exists and is this type

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also if client is valid

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also why all this isn't a case for other hotkeys?

if(istype(held_item, /obj/item/weapon/gun/shotgun/pump/dual_tube))
Zonespace27 marked this conversation as resolved.
Show resolved Hide resolved
held_item.toggle_tube()
return TRUE