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

Fixes akimbo bug #4503

Merged
merged 1 commit into from
Sep 26, 2023
Merged
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
16 changes: 12 additions & 4 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1109,20 +1109,24 @@ and you're good to go.
if(PB_burst_bullets_fired) //Has a burst been carried over from a PB?
PB_burst_bullets_fired = 0 //Don't need this anymore. The torch is passed.

var/fired_by_akimbo = FALSE
if(dual_wield)
fired_by_akimbo = TRUE

//Dual wielding. Do we have a gun in the other hand and is it the same category?
var/obj/item/weapon/gun/akimbo = user.get_inactive_hand()
if(!reflex && !dual_wield && user)
if(istype(akimbo) && akimbo.gun_category == gun_category && !(akimbo.flags_gun_features & GUN_WIELDED_FIRING_ONLY))
dual_wield = TRUE //increases recoil, increases scatter, and reduces accuracy.

var/fire_return = handle_fire(target, user, params, reflex, dual_wield, check_for_attachment_fire, akimbo)
var/fire_return = handle_fire(target, user, params, reflex, dual_wield, check_for_attachment_fire, akimbo, fired_by_akimbo)
if(!fire_return)
return fire_return

flags_gun_features &= ~GUN_BURST_FIRING // We always want to turn off bursting when we're done, mainly for when we break early mid-burstfire.
return AUTOFIRE_CONTINUE

/obj/item/weapon/gun/proc/handle_fire(atom/target, mob/living/user, params, reflex = FALSE, dual_wield, check_for_attachment_fire, akimbo)
/obj/item/weapon/gun/proc/handle_fire(atom/target, mob/living/user, params, reflex = FALSE, dual_wield, check_for_attachment_fire, akimbo, fired_by_akimbo)
var/turf/curloc = get_turf(user) //In case the target or we are expired.
var/turf/targloc = get_turf(target)

Expand Down Expand Up @@ -1209,7 +1213,7 @@ and you're good to go.

shots_fired++

if(dual_wield)
if(dual_wield && !fired_by_akimbo)
if(user?.client?.prefs?.toggle_prefs & TOGGLE_ALTERNATING_DUAL_WIELD)
user.swap_hand()
else
Expand Down Expand Up @@ -1352,6 +1356,10 @@ and you're good to go.
else
active_attachable.activate_attachment(src, null, TRUE)//No way.

var/fired_by_akimbo = FALSE
if(dual_wield)
fired_by_akimbo = TRUE

//Dual wielding. Do we have a gun in the other hand and is it the same category?
var/obj/item/weapon/gun/akimbo = user.get_inactive_hand()
if(!dual_wield && user)
Expand Down Expand Up @@ -1447,7 +1455,7 @@ and you're good to go.

SEND_SIGNAL(user, COMSIG_MOB_FIRED_GUN, src)

if(dual_wield)
if(dual_wield && !fired_by_akimbo)
if(user?.client?.prefs?.toggle_prefs & TOGGLE_ALTERNATING_DUAL_WIELD)
user.swap_hand()
else
Expand Down
Loading