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

Old gun firemode verb deletion and some keybind unshittening (#16543) #870

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion code/datums/actions/item_action.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
/datum/action/item_action/firemode
// just here so players see what key is it bound to
keybinding_signals = list(
KEYBINDING_ALTERNATE = COMSIG_KB_FIREMODE,
KEYBINDING_NORMAL = COMSIG_KB_FIREMODE,
)
use_obj_appeareance = FALSE
var/action_firemode
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/deployable_item.dm
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
return
user.temporarilyRemoveItemFromInventory(item_to_deploy)

item_to_deploy.UnregisterSignal(user, list(COMSIG_MOB_MOUSEDOWN, COMSIG_MOB_MOUSEUP, COMSIG_MOB_MOUSEDRAG, COMSIG_KB_RAILATTACHMENT, COMSIG_KB_UNDERRAILATTACHMENT, COMSIG_KB_UNLOADGUN, COMSIG_KB_FIREMODE, COMSIG_KB_AUTOEJECT, COMSIG_MOB_CLICK_RIGHT)) //This unregisters Signals related to guns, its for safety
item_to_deploy.UnregisterSignal(user, list(COMSIG_MOB_MOUSEDOWN, COMSIG_MOB_MOUSEUP, COMSIG_MOB_MOUSEDRAG, COMSIG_KB_RAILATTACHMENT, COMSIG_KB_UNDERRAILATTACHMENT, COMSIG_KB_UNLOADGUN, COMSIG_KB_AUTOEJECT, COMSIG_MOB_CLICK_RIGHT)) //This unregisters Signals related to guns, its for safety

direction_to_deploy = newdir

Expand Down
2 changes: 1 addition & 1 deletion code/modules/projectiles/attachables/_attachable.dm
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ inaccurate. Don't worry if force is ever negative, it won't runtime.
master_gun = attached_to
master_gun.wield_delay += wield_delay_mod
if(gun_user)
UnregisterSignal(gun_user, list(COMSIG_MOB_MOUSEDOWN, COMSIG_MOB_MOUSEUP, COMSIG_ITEM_ZOOM, COMSIG_ITEM_UNZOOM, COMSIG_MOB_MOUSEDRAG, COMSIG_KB_RAILATTACHMENT, COMSIG_KB_UNDERRAILATTACHMENT, COMSIG_KB_UNLOADGUN, COMSIG_KB_FIREMODE, COMSIG_KB_GUN_SAFETY, COMSIG_KB_AUTOEJECT, COMSIG_KB_UNIQUEACTION, COMSIG_QDELETING, COMSIG_MOB_CLICK_RIGHT))
UnregisterSignal(gun_user, list(COMSIG_MOB_MOUSEDOWN, COMSIG_MOB_MOUSEUP, COMSIG_ITEM_ZOOM, COMSIG_ITEM_UNZOOM, COMSIG_MOB_MOUSEDRAG, COMSIG_KB_RAILATTACHMENT, COMSIG_KB_UNDERRAILATTACHMENT, COMSIG_KB_UNLOADGUN, COMSIG_KB_GUN_SAFETY, COMSIG_KB_AUTOEJECT, COMSIG_KB_UNIQUEACTION, COMSIG_QDELETING, COMSIG_MOB_CLICK_RIGHT))
var/datum/action/item_action/toggle/new_action = new /datum/action/item_action/toggle(src, master_gun)
if(!isliving(user))
return
Expand Down
86 changes: 5 additions & 81 deletions code/modules/projectiles/gun_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -236,93 +236,17 @@ As sniper rifles have both and weapon mods can change them as well. ..() deals w
activate(user)
return
return ..()
do_toggle_firemode()
user.update_action_buttons()


/mob/living/carbon/human/verb/toggle_autofire()
set category = "Weapons"
set name = "Toggle Auto Fire"
set desc = "Toggle automatic firemode, if the gun has it."

var/obj/item/weapon/gun/G = get_active_firearm(usr)
if(!G)
return
G.toggle_autofire()


/obj/item/weapon/gun/verb/toggle_autofire()
set category = null
set name = "Toggle Auto Fire (Weapon)"
set desc = "Toggle automatic firemode, if the gun has it."

var/new_firemode
switch(gun_firemode)
if(GUN_FIREMODE_SEMIAUTO)
new_firemode = GUN_FIREMODE_AUTOMATIC
if(GUN_FIREMODE_BURSTFIRE)
new_firemode = GUN_FIREMODE_AUTOBURST
if(GUN_FIREMODE_AUTOMATIC)
new_firemode = GUN_FIREMODE_SEMIAUTO
if(GUN_FIREMODE_AUTOBURST)
new_firemode = GUN_FIREMODE_BURSTFIRE
if(!(new_firemode in gun_firemode_list))
to_chat(usr, span_warning("[src] lacks a [new_firemode]!"))
return
do_toggle_firemode(new_firemode = new_firemode)


/mob/living/carbon/human/verb/toggle_burstfire()
set category = "Weapons"
set name = "Toggle Burst Fire"
set desc = "Toggle burst firemode, if the gun has it."

var/obj/item/weapon/gun/G = get_active_firearm(usr)
if(!G)
return
G.toggle_burstfire()


/obj/item/weapon/gun/verb/toggle_burstfire()
set category = null
set name = "Toggle Burst Fire (Weapon)"
set desc = "Toggle burst firemode, if the gun has it."

var/new_firemode
switch(gun_firemode)
if(GUN_FIREMODE_SEMIAUTO)
new_firemode = GUN_FIREMODE_BURSTFIRE
if(GUN_FIREMODE_BURSTFIRE)
new_firemode = GUN_FIREMODE_SEMIAUTO
if(GUN_FIREMODE_AUTOMATIC)
new_firemode = GUN_FIREMODE_AUTOBURST
if(GUN_FIREMODE_AUTOBURST)
new_firemode = GUN_FIREMODE_AUTOMATIC
if(!(new_firemode in gun_firemode_list))
to_chat(usr, span_warning("[src] lacks a [new_firemode]!"))
return
do_toggle_firemode(new_firemode = new_firemode)


/mob/living/carbon/human/verb/toggle_firemode()
set category = "Weapons"
set name = "Toggle Fire Mode"
set desc = "Toggle between fire modes, if the gun has more than has one."

var/obj/item/weapon/gun/G = get_active_firearm(usr)
if(!G)
return
G.toggle_firemode()

return do_toggle_firemode(user)

/// A verb in the right click context menu of the weapon for toggling firemode
/obj/item/weapon/gun/verb/toggle_firemode()
set category = null
set name = "Toggle Fire Mode (Weapon)"
set desc = "Toggle between fire modes, if the gun has more than has one."

do_toggle_firemode()
set desc = "Toggle between fire modes, if the gun has more than one."

do_toggle_firemode(usr)

/// Actually does the toggling of the fire mode
/obj/item/weapon/gun/proc/do_toggle_firemode(datum/source, datum/keybinding, new_firemode)
SIGNAL_HANDLER
if(HAS_TRAIT(src, TRAIT_GUN_BURST_FIRING))//can't toggle mid burst
Expand Down
2 changes: 0 additions & 2 deletions code/modules/projectiles/gun_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,6 @@
COMSIG_KB_RAILATTACHMENT,
COMSIG_KB_UNDERRAILATTACHMENT,
COMSIG_KB_UNLOADGUN,
COMSIG_KB_FIREMODE,
COMSIG_KB_GUN_SAFETY,
COMSIG_KB_UNIQUEACTION,
COMSIG_KB_AUTOEJECT,
Expand Down Expand Up @@ -496,7 +495,6 @@
RegisterSignal(gun_user, COMSIG_KB_RAILATTACHMENT, PROC_REF(activate_rail_attachment))
RegisterSignal(gun_user, COMSIG_KB_UNDERRAILATTACHMENT, PROC_REF(activate_underrail_attachment))
RegisterSignal(gun_user, COMSIG_KB_UNLOADGUN, PROC_REF(unload_gun))
RegisterSignal(gun_user, COMSIG_KB_FIREMODE, PROC_REF(do_toggle_firemode))
RegisterSignal(gun_user, COMSIG_KB_GUN_SAFETY, PROC_REF(toggle_gun_safety_keybind))
RegisterSignal(gun_user, COMSIG_KB_AUTOEJECT, PROC_REF(toggle_auto_eject_keybind))

Expand Down
Loading