diff --git a/code/__DEFINES/client_prefs.dm b/code/__DEFINES/client_prefs.dm
index b1e194354555..5337f64d9e46 100644
--- a/code/__DEFINES/client_prefs.dm
+++ b/code/__DEFINES/client_prefs.dm
@@ -1,6 +1,7 @@
#define BE_ALIEN_AFTER_DEATH (1<<0)
#define BE_AGENT (1<<1)
+//toggle_prefs bits from /datum/preferences
#define TOGGLE_IGNORE_SELF (1<<0) // Determines whether you will not hurt yourself when clicking yourself
#define TOGGLE_HELP_INTENT_SAFETY (1<<1) // Determines whether help intent will be completely harmless
#define TOGGLE_MIDDLE_MOUSE_CLICK (1<<2) // This toggles whether selected ability for xeno uses middle mouse clicking or shift clicking
@@ -13,7 +14,7 @@
// and put the empty magazine in your hand
#define TOGGLE_AUTOMATIC_PUNCTUATION (1<<7) // Whether your sentences will automatically be punctuated with a period
#define TOGGLE_COMBAT_CLICKDRAG_OVERRIDE (1<<8) // Whether disarm/harm intents cause clicks to trigger immediately when the mouse button is depressed.
-#define TOGGLE_ALTERNATING_DUAL_WIELD (1<<9) // Whether dual-wielding fires both guns at once or swaps between them.
+#define TOGGLE_ALTERNATING_DUAL_WIELD (1<<9) // Whether dual-wielding fires both guns at once or swaps between them, OUTDATED, used to update savefiles, now dual_wield_pref
#define TOGGLE_FULLSCREEN (1<<10) // See /client/proc/toggle_fullscreen in client_procs.dm
#define TOGGLE_MEMBER_PUBLIC (1<<11) //determines if you get a byond logo by your name in ooc if you're a member or not
#define TOGGLE_OOC_FLAG (1<<12) // determines if your country flag appears by your name in ooc chat
@@ -32,3 +33,11 @@
#define AGE_MIN 19 //youngest a character can be
#define AGE_MAX 90 //oldest a character can be //no. you are not allowed to be 160.
#define MAX_GEAR_COST 7 //Used in chargen for loadout limit.
+
+///dual_wield_pref from /datum/preferences
+///Fire both weapons when dual wielding
+#define DUAL_WIELD_FIRE 0
+///Swap to the other weapon when dual wielding
+#define DUAL_WIELD_SWAP 1
+///Do nothing when dual wielding
+#define DUAL_WIELD_NONE 2
diff --git a/code/modules/client/preferences.dm b/code/modules/client/preferences.dm
index de50af8dd808..27eeed30b927 100644
--- a/code/modules/client/preferences.dm
+++ b/code/modules/client/preferences.dm
@@ -77,6 +77,7 @@ var/const/MAX_SAVE_SLOTS = 10
)
var/ghost_vision_pref = GHOST_VISION_LEVEL_MID_NVG
var/ghost_orbit = GHOST_ORBIT_CIRCLE
+ var/dual_wield_pref = DUAL_WIELD_FIRE
//Synthetic specific preferences
var/synthetic_name = "Undefined"
@@ -616,13 +617,12 @@ var/const/MAX_SAVE_SLOTS = 10
[toggle_prefs & TOGGLE_AUTOMATIC_PUNCTUATION ? "On" : "Off"]
"
dat += "Toggle Combat Click-Drag Override: \
[toggle_prefs & TOGGLE_COMBAT_CLICKDRAG_OVERRIDE ? "On" : "Off"]
"
- dat += "Toggle Alternate-Fire Dual Wielding: \
- [toggle_prefs & TOGGLE_ALTERNATING_DUAL_WIELD ? "On" : "Off"]
"
dat += "Toggle Middle-Click Swap Hands: \
[toggle_prefs & TOGGLE_MIDDLE_MOUSE_SWAP_HANDS ? "On" : "Off"]
"
dat += "Toggle Vendors Vending to Hands: \
[toggle_prefs & TOGGLE_VEND_ITEM_TO_HAND ? "On" : "Off"]
"
dat += "Toggle Item Animations Detail Level
"
+ dat += "Toggle Dual Wield Functionality
"
if(MENU_SPECIAL) //wart
dat += "
"
dat += "
ERT Settings:
"
diff --git a/code/modules/client/preferences_savefile.dm b/code/modules/client/preferences_savefile.dm
index 89cd10af75b8..145e0bc16c6d 100644
--- a/code/modules/client/preferences_savefile.dm
+++ b/code/modules/client/preferences_savefile.dm
@@ -1,5 +1,5 @@
#define SAVEFILE_VERSION_MIN 8
-#define SAVEFILE_VERSION_MAX 20
+#define SAVEFILE_VERSION_MAX 21
//handles converting savefiles to new formats
//MAKE SURE YOU KEEP THIS UP TO DATE!
@@ -80,6 +80,15 @@
sound_toggles |= (SOUND_ADMIN_MEME|SOUND_ADMIN_ATMOSPHERIC)
S["toggles_sound"] << sound_toggles
+ if(savefile_version < 21)
+ var/pref_toggles
+ S["toggle_prefs"] >> pref_toggles
+ if(pref_toggles & TOGGLE_ALTERNATING_DUAL_WIELD)
+ dual_wield_pref = DUAL_WIELD_SWAP
+ else
+ dual_wield_pref = DUAL_WIELD_FIRE
+ S["dual_wield_pref"] << dual_wield_pref
+
savefile_version = SAVEFILE_VERSION_MAX
return 1
@@ -125,6 +134,7 @@
S["toggles_langchat"] >> toggles_langchat
S["toggles_sound"] >> toggles_sound
S["toggle_prefs"] >> toggle_prefs
+ S["dual_wield_pref"] >> dual_wield_pref
S["toggles_flashing"] >> toggles_flashing
S["toggles_ert"] >> toggles_ert
S["toggles_admin"] >> toggles_admin
@@ -209,6 +219,7 @@
toggles_langchat = sanitize_integer(toggles_langchat, 0, SHORT_REAL_LIMIT, initial(toggles_langchat))
toggles_sound = sanitize_integer(toggles_sound, 0, SHORT_REAL_LIMIT, initial(toggles_sound))
toggle_prefs = sanitize_integer(toggle_prefs, 0, SHORT_REAL_LIMIT, initial(toggle_prefs))
+ dual_wield_pref = sanitize_integer(dual_wield_pref, 0, 2, initial(dual_wield_pref))
toggles_flashing= sanitize_integer(toggles_flashing, 0, SHORT_REAL_LIMIT, initial(toggles_flashing))
toggles_ert = sanitize_integer(toggles_ert, 0, SHORT_REAL_LIMIT, initial(toggles_ert))
toggles_admin = sanitize_integer(toggles_admin, 0, SHORT_REAL_LIMIT, initial(toggles_admin))
@@ -315,6 +326,7 @@
S["toggles_langchat"] << toggles_langchat
S["toggles_sound"] << toggles_sound
S["toggle_prefs"] << toggle_prefs
+ S["dual_wield_pref"] << dual_wield_pref
S["toggles_flashing"] << toggles_flashing
S["toggles_ert"] << toggles_ert
S["toggles_admin"] << toggles_admin
diff --git a/code/modules/client/preferences_toggles.dm b/code/modules/client/preferences_toggles.dm
index b600b39a0018..6f9026a437dd 100644
--- a/code/modules/client/preferences_toggles.dm
+++ b/code/modules/client/preferences_toggles.dm
@@ -372,12 +372,21 @@
to_chat(src,SPAN_BOLDNOTICE( "Click-dragging now blocks clicks from going through."))
prefs.save_preferences()
-/client/proc/toggle_dualwield() //Toggle whether dual-wielding fires both guns at once or swaps between them.
- prefs.toggle_prefs ^= TOGGLE_ALTERNATING_DUAL_WIELD
- if(prefs.toggle_prefs & TOGGLE_ALTERNATING_DUAL_WIELD)
- to_chat(src, SPAN_BOLDNOTICE("Dual-wielding now switches between guns, as long as the other gun is loaded."))
+///Toggle whether dual-wielding fires both guns at once or swaps between them.
+/client/proc/toggle_dualwield()
+ if(prefs.dual_wield_pref < DUAL_WIELD_NONE)
+ prefs.dual_wield_pref++
else
- to_chat(src, SPAN_BOLDNOTICE("Dual-wielding now fires both guns simultaneously."))
+ prefs.dual_wield_pref = DUAL_WIELD_FIRE
+
+ switch(prefs.dual_wield_pref)
+ if(DUAL_WIELD_FIRE)
+ to_chat(src, SPAN_BOLDNOTICE("Dual-wielding now fires both guns simultaneously."))
+ if(DUAL_WIELD_SWAP)
+ to_chat(src, SPAN_BOLDNOTICE("Dual-wielding now switches between guns, as long as the other gun is loaded."))
+ if(DUAL_WIELD_NONE)
+ to_chat(src, SPAN_BOLDNOTICE("Dual-wielding now has no effect on how you fire."))
+
prefs.save_preferences()
/client/proc/toggle_middle_mouse_swap_hands() //Toggle whether middle click swaps your hands
diff --git a/code/modules/projectiles/gun.dm b/code/modules/projectiles/gun.dm
index 88f6e3fb2f5d..e9ab9aecc3c2 100644
--- a/code/modules/projectiles/gun.dm
+++ b/code/modules/projectiles/gun.dm
@@ -1214,10 +1214,11 @@ and you're good to go.
shots_fired++
if(dual_wield && !fired_by_akimbo)
- if(user?.client?.prefs?.toggle_prefs & TOGGLE_ALTERNATING_DUAL_WIELD)
- user.swap_hand()
- else
- INVOKE_ASYNC(akimbo, PROC_REF(Fire), target, user, params, 0, TRUE)
+ switch(user?.client?.prefs?.dual_wield_pref)
+ if(DUAL_WIELD_FIRE)
+ INVOKE_ASYNC(akimbo, PROC_REF(Fire), target, user, params, 0, TRUE)
+ if(DUAL_WIELD_SWAP)
+ user.swap_hand()
else
return TRUE
@@ -1456,10 +1457,11 @@ and you're good to go.
SEND_SIGNAL(user, COMSIG_MOB_FIRED_GUN, src)
if(dual_wield && !fired_by_akimbo)
- if(user?.client?.prefs?.toggle_prefs & TOGGLE_ALTERNATING_DUAL_WIELD)
- user.swap_hand()
- else
- INVOKE_ASYNC(akimbo, PROC_REF(attack), attacked_mob, user, TRUE)
+ switch(user?.client?.prefs?.dual_wield_pref)
+ if(DUAL_WIELD_FIRE)
+ INVOKE_ASYNC(akimbo, PROC_REF(attack), attacked_mob, user, TRUE)
+ if(DUAL_WIELD_SWAP)
+ user.swap_hand()
if(EXECUTION_CHECK) //Continue execution if on the correct intent. Accounts for change via the earlier do_after
user.visible_message(SPAN_DANGER("[user] has executed [attacked_mob] with [src]!"), SPAN_DANGER("You have executed [attacked_mob] with [src]!"), message_flags = CHAT_TYPE_WEAPON_USE)