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

Added preference to disallow de-activation of your current ability #3904

Merged
merged 3 commits into from
Jul 18, 2023
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
1 change: 1 addition & 0 deletions code/__DEFINES/client_prefs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define TOGGLE_VEND_ITEM_TO_HAND (1<<15) // This toggles whether items from vendors will be automatically put into your hand.
#define TOGGLE_START_JOIN_CURRENT_SLOT (1<<16) // Whether joining at roundstart ignores assigned character slot for the job and uses currently selected slot.
#define TOGGLE_LATE_JOIN_CURRENT_SLOT (1<<17) //Whether joining during the round ignores assigned character slot for the job and uses currently selected slot.
#define TOGGLE_ABILITY_DEACTIVATION_OFF (1<<18) // This toggles whether selecting the same ability again can toggle it off

#define JOB_SLOT_RANDOMISED_SLOT -1
#define JOB_SLOT_CURRENT_SLOT 0
Expand Down
1 change: 1 addition & 0 deletions code/modules/client/client_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ GLOBAL_LIST_INIT(whitelisted_client_procs, list(
/client/proc/toggle_eject_to_hand,
/client/proc/toggle_automatic_punctuation,
/client/proc/toggle_middle_mouse_click,
/client/proc/toggle_ability_deactivation,
/client/proc/toggle_clickdrag_override,
/client/proc/toggle_dualwield,
/client/proc/toggle_middle_mouse_swap_hands,
Expand Down
4 changes: 3 additions & 1 deletion code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,8 @@ var/const/MAX_SAVE_SLOTS = 10
</b> <a href='?_src_=prefs;preference=toggle_prefs;flag=[TOGGLE_HELP_INTENT_SAFETY]'><b>[toggle_prefs & TOGGLE_HELP_INTENT_SAFETY ? "On" : "Off"]</b></a><br>"
dat += "<b>Toggle Middle Mouse Ability Activation: \
</b> <a href='?_src_=prefs;preference=toggle_prefs;flag=[TOGGLE_MIDDLE_MOUSE_CLICK]'><b>[toggle_prefs & TOGGLE_MIDDLE_MOUSE_CLICK ? "On" : "Off"]</b></a><br>"
dat += "<b>Toggle Ability Deactivation: \
</b> <a href='?_src_=prefs;preference=toggle_prefs;flag=[TOGGLE_ABILITY_DEACTIVATION_OFF]'><b>[toggle_prefs & TOGGLE_ABILITY_DEACTIVATION_OFF ? "Off" : "On"]</b></a><br>"
dat += "<b>Toggle Directional Assist: \
</b> <a href='?_src_=prefs;preference=toggle_prefs;flag=[TOGGLE_DIRECTIONAL_ATTACK]'><b>[toggle_prefs & TOGGLE_DIRECTIONAL_ATTACK ? "On" : "Off"]</b></a><br>"
dat += "<b>Toggle Magazine Auto-Ejection: \
Expand Down Expand Up @@ -1229,7 +1231,7 @@ var/const/MAX_SAVE_SLOTS = 10
predator_gender = predator_gender == MALE ? FEMALE : MALE
if("pred_age")
var/new_predator_age = tgui_input_number(user, "Choose your Predator's age(175 to 3000):", "Character Preference", 1234, 3000, 175)
if(new_predator_age)
if(new_predator_age)
predator_age = max(min( round(text2num(new_predator_age)), 3000),175)
if("pred_trans_type")
var/new_translator_type = tgui_input_list(user, "Choose your translator type.", "Translator Type", PRED_TRANSLATORS)
Expand Down
13 changes: 11 additions & 2 deletions code/modules/client/preferences_toggles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
set name = "Toggle SpecialRole Candidacy"
set category = "Preferences"
set desc = "Toggles which special roles you would like to be a candidate for, during events."

var/list/be_special_flags = list(
"Xenomorph after unrevivable death" = BE_ALIEN_AFTER_DEATH,
"Agent" = BE_AGENT,
Expand Down Expand Up @@ -274,6 +274,7 @@
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/toggle_eject_to_hand'>Toggle 'Unload Weapon' Ejecting Magazines to Your Hands</a><br>",
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/toggle_automatic_punctuation'>Toggle Automatic Punctuation</a><br>",
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/toggle_middle_mouse_click'>Toggle Middle Mouse Ability Activation</a><br>",
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/toggle_ability_deactivation'>Toggle Ability Deactivation</a><br>",
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/toggle_clickdrag_override'>Toggle Combat Click-Drag Override</a><br>",
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/toggle_dualwield'>Toggle Alternate-Fire Dual Wielding</a><br>",
"<a href='?src=\ref[src];action=proccall;procpath=/client/proc/toggle_middle_mouse_swap_hands'>Toggle Middle Mouse Swapping Hands</a><br>",
Expand All @@ -287,7 +288,7 @@
for (var/pref_button in pref_buttons)
dat += "[pref_button]\n"

var/height = 50+22*length(pref_buttons)
var/height = 50+24*length(pref_buttons)

show_browser(src, dat, "Toggle Preferences", "togglepreferences", "size=475x[height]")

Expand Down Expand Up @@ -355,6 +356,14 @@
to_chat(src, SPAN_NOTICE("Your selected ability will now be activated with shift clicking."))
prefs.save_preferences()

/client/proc/toggle_ability_deactivation() // Toggle whether the current ability can be deactivated when re-selected
prefs.toggle_prefs ^= TOGGLE_ABILITY_DEACTIVATION_OFF
if (prefs.toggle_prefs & TOGGLE_ABILITY_DEACTIVATION_OFF)
to_chat(src, SPAN_NOTICE("Your current ability can no longer be toggled off when re-selected."))
else
to_chat(src, SPAN_NOTICE("Your current ability can be toggled off when re-selected."))
prefs.save_preferences()

/client/proc/toggle_clickdrag_override() //Toggle whether mousedown clicks immediately when on disarm or harm intent to prevent click-dragging from 'eating' attacks.
prefs.toggle_prefs ^= TOGGLE_COMBAT_CLICKDRAG_OVERRIDE
if(prefs.toggle_prefs & TOGGLE_COMBAT_CLICKDRAG_OVERRIDE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@
if(xeno.selected_ability == src)
if(xeno.deselect_timer > world.time)
return // We clicked the same ability in a very short time
if(xeno.client && xeno.client.prefs && xeno.client.prefs.toggle_prefs & TOGGLE_ABILITY_DEACTIVATION_OFF)
return
to_chat(xeno, "You will no longer use [ability_name] with \
[xeno.client && xeno.client.prefs && xeno.client.prefs.toggle_prefs & TOGGLE_MIDDLE_MOUSE_CLICK ? "middle-click" : "shift-click"].")
button.icon_state = "template"
Expand Down
15 changes: 15 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/xeno_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,21 @@
else
to_chat(src, SPAN_NOTICE("The selected xeno ability will now be activated with shift clicking."))

/mob/living/carbon/xenomorph/verb/ability_deactivation_toggle()
set name = "Toggle Ability Deactivation"
set desc = "Toggles whether you can deactivate your currently active ability when re-selecting it."
set category = "Alien"

if (!client || !client.prefs)
return

client.prefs.toggle_prefs ^= TOGGLE_ABILITY_DEACTIVATION_OFF
client.prefs.save_preferences()
if (client.prefs.toggle_prefs & TOGGLE_ABILITY_DEACTIVATION_OFF)
to_chat(src, SPAN_NOTICE("Your current ability can no longer be toggled off when re-selected."))
else
to_chat(src, SPAN_NOTICE("Your current ability can be toggled off when re-selected."))

/mob/living/carbon/xenomorph/verb/directional_attack_toggle()
set name = "Toggle Directional Attacks"
set desc = "Toggles the use of directional assist attacks."
Expand Down
Loading