Adds a new verb that allows users to toggle the requiring help intent to fire weapons on or off

This commit is contained in:
Yoshax
2016-04-16 18:30:35 +01:00
parent ff6526d5a3
commit ff96d27a85
4 changed files with 99 additions and 80 deletions

View File

@@ -17,7 +17,7 @@ var/list/_client_preferences_by_type
if(ispath(preference)) if(ispath(preference))
return get_client_preference_by_type(preference) return get_client_preference_by_type(preference)
return get_client_preference_by_key(preference) return get_client_preference_by_key(preference)
/proc/get_client_preference_by_key(var/preference) /proc/get_client_preference_by_key(var/preference)
if(!_client_preferences_by_key) if(!_client_preferences_by_key)
_client_preferences_by_key = list() _client_preferences_by_key = list()
@@ -131,6 +131,12 @@ var/list/_client_preferences_by_type
key = "SHOW_PROGRESS" key = "SHOW_PROGRESS"
enabled_description = "Show" enabled_description = "Show"
disabled_description = "Hide" disabled_description = "Hide"
/datum/client_preference/safefiring
description = "Safe gun firing."
key = "SAFE_FIRING"
enabled_description = "Safe"
disabled_description = "Dangerous"
/******************** /********************
* Staff Preferences * * Staff Preferences *
********************/ ********************/
@@ -139,10 +145,10 @@ var/list/_client_preferences_by_type
/datum/client_preference/mod/may_toggle(var/mob/preference_mob) /datum/client_preference/mod/may_toggle(var/mob/preference_mob)
return check_rights(R_MOD|R_ADMIN, 0, preference_mob) return check_rights(R_MOD|R_ADMIN, 0, preference_mob)
/datum/client_preference/debug/may_toggle(var/mob/preference_mob) /datum/client_preference/debug/may_toggle(var/mob/preference_mob)
return check_rights(R_DEBUG|R_ADMIN, 0, preference_mob) return check_rights(R_DEBUG|R_ADMIN, 0, preference_mob)
/datum/client_preference/mod/show_attack_logs /datum/client_preference/mod/show_attack_logs
description = "Attack Log Messages" description = "Attack Log Messages"
key = "CHAT_ATTACKLOGS" key = "CHAT_ATTACKLOGS"
@@ -176,4 +182,4 @@ var/list/_client_preferences_by_type
description = "Radio chatter" description = "Radio chatter"
key = "CHAT_RADIO" key = "CHAT_RADIO"
enabled_description = "Show" enabled_description = "Show"
disabled_description = "Hide" disabled_description = "Hide"

View File

@@ -3,182 +3,195 @@
set name = "Show/Hide Ghost Ears" set name = "Show/Hide Ghost Ears"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles between seeing all mob speech and nearby mob speech." set desc = "Toggles between seeing all mob speech and nearby mob speech."
var/pref_path = /datum/client_preference/ghost_ears var/pref_path = /datum/client_preference/ghost_ears
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : " no longer"] hear all mob speech as a ghost." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : " no longer"] hear all mob speech as a ghost."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TGEars") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TGEars") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_ghost_vision() /client/verb/toggle_ghost_vision()
set name = "Show/Hide Ghost Vision" set name = "Show/Hide Ghost Vision"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles between seeing all mob emotes and nearby mob emotes." set desc = "Toggles between seeing all mob emotes and nearby mob emotes."
var/pref_path = /datum/client_preference/ghost_sight var/pref_path = /datum/client_preference/ghost_sight
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : " no longer"] see all emotes as a ghost." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : " no longer"] see all emotes as a ghost."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TGVision") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TGVision") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_ghost_radio() /client/verb/toggle_ghost_radio()
set name = "Show/Hide Radio Chatter" set name = "Show/Hide Radio Chatter"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles between seeing all radio chat and nearby radio chatter." set desc = "Toggles between seeing all radio chat and nearby radio chatter."
var/pref_path = /datum/client_preference/ghost_radio var/pref_path = /datum/client_preference/ghost_radio
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear all radios as a ghost." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear all radios as a ghost."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TGRadio") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TGRadio") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_deadchat() /client/verb/toggle_deadchat()
set name = "Show/Hide Deadchat" set name = "Show/Hide Deadchat"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles the dead chat channel." set desc = "Toggles the dead chat channel."
var/pref_path = /datum/client_preference/show_dsay var/pref_path = /datum/client_preference/show_dsay
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear dead chat as a ghost." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear dead chat as a ghost."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TDeadChat") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TDeadChat") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_ooc() /client/verb/toggle_ooc()
set name = "Show/Hide OOC" set name = "Show/Hide OOC"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles global out of character chat." set desc = "Toggles global out of character chat."
var/pref_path = /datum/client_preference/show_ooc var/pref_path = /datum/client_preference/show_ooc
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(/datum/client_preference/show_ooc)) ? "now" : "no longer"] hear global out of character chat." src << "You will [ (is_preference_enabled(/datum/client_preference/show_ooc)) ? "now" : "no longer"] hear global out of character chat."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_looc() /client/verb/toggle_looc()
set name = "Show/Hide LOOC" set name = "Show/Hide LOOC"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles local out of character chat." set desc = "Toggles local out of character chat."
var/pref_path = /datum/client_preference/show_looc var/pref_path = /datum/client_preference/show_looc
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear local out of character chat." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear local out of character chat."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TLOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TLOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_typing() /client/verb/toggle_typing()
set name = "Show/Hide Typing Indicator" set name = "Show/Hide Typing Indicator"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles the speech bubble typing indicator." set desc = "Toggles the speech bubble typing indicator."
var/pref_path = /datum/client_preference/show_typing_indicator var/pref_path = /datum/client_preference/show_typing_indicator
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] see the speech indicator." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] see the speech indicator."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TLOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TLOOC") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_ahelp_sound() /client/verb/toggle_ahelp_sound()
set name = "Toggle Admin Help Sound" set name = "Toggle Admin Help Sound"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles the ability to hear a noise broadcasted when you get an admin message." set desc = "Toggles the ability to hear a noise broadcasted when you get an admin message."
var/pref_path = /datum/client_preference/holder/play_adminhelp_ping var/pref_path = /datum/client_preference/holder/play_adminhelp_ping
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] receive noise from admin messages." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] receive noise from admin messages."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TAHelp") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TAHelp") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_lobby_music() /client/verb/toggle_lobby_music()
set name = "Toggle Lobby Music" set name = "Toggle Lobby Music"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles the music in the lobby." set desc = "Toggles the music in the lobby."
var/pref_path = /datum/client_preference/play_lobby_music var/pref_path = /datum/client_preference/play_lobby_music
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear music in the lobby." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] hear music in the lobby."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TLobMusic") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TLobMusic") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_admin_midis() /client/verb/toggle_admin_midis()
set name = "Toggle Admin MIDIs" set name = "Toggle Admin MIDIs"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles the music in the lobby." set desc = "Toggles the music in the lobby."
var/pref_path = /datum/client_preference/play_admin_midis var/pref_path = /datum/client_preference/play_admin_midis
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : " no longer"] hear MIDIs from admins." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : " no longer"] hear MIDIs from admins."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TAMidis") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TAMidis") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_ambience() /client/verb/toggle_ambience()
set name = "Toggle Ambience" set name = "Toggle Ambience"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles the playing of ambience." set desc = "Toggles the playing of ambience."
var/pref_path = /datum/client_preference/play_ambiance var/pref_path = /datum/client_preference/play_ambiance
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : " no longer"] hear ambient noise." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : " no longer"] hear ambient noise."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_be_special(role in be_special_flags) /client/verb/toggle_be_special(role in be_special_flags)
set name = "Toggle SpecialRole Candidacy" set name = "Toggle SpecialRole Candidacy"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles which special roles you would like to be a candidate for, during events." set desc = "Toggles which special roles you would like to be a candidate for, during events."
var/role_flag = be_special_flags[role] var/role_flag = be_special_flags[role]
if(!role_flag) return if(!role_flag) return
prefs.be_special ^= role_flag prefs.be_special ^= role_flag
prefs.save_preferences() prefs.save_preferences()
src << "You will [(prefs.be_special & role_flag) ? "now" : "no longer"] be considered for [role] events (where possible)." src << "You will [(prefs.be_special & role_flag) ? "now" : "no longer"] be considered for [role] events (where possible)."
feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/verb/toggle_safe_firing()
set name = "Toggle Safe Firearms Firing"
set category = "Preferences"
set desc = "Toggles between safe and dangerous firing. Safe requires a non-help intent to fire, dangerous can be fired on help intent."
var/pref_path = /datum/client_preference/safefiring
toggle_preference(pref_path)
prefs.save_preferences()
src << "You will now use [(is_preference_enabled(/datum/client_preference/safefiring)) ? "safe" : "dangerous"] firearms firing."
feedback_add_details("admin_verb","TFiringMode") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
//Toggles for Staff //Toggles for Staff
//Developers //Developers
@@ -186,27 +199,27 @@
set name = "Toggle Debug Logs" set name = "Toggle Debug Logs"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles debug logs." set desc = "Toggles debug logs."
var/pref_path = /datum/client_preference/debug/show_debug_logs var/pref_path = /datum/client_preference/debug/show_debug_logs
if(check_rights(R_ADMIN|R_DEBUG)) if(check_rights(R_ADMIN|R_DEBUG))
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] receive debug logs." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] receive debug logs."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
//Mods //Mods
/client/proc/toggle_attack_logs() /client/proc/toggle_attack_logs()
set name = "Toggle Attack Logs" set name = "Toggle Attack Logs"
set category = "Preferences" set category = "Preferences"
set desc = "Toggles attack logs." set desc = "Toggles attack logs."
var/pref_path = /datum/client_preference/mod/show_attack_logs var/pref_path = /datum/client_preference/mod/show_attack_logs
if(check_rights(R_ADMIN|R_MOD)) if(check_rights(R_ADMIN|R_MOD))
toggle_preference(pref_path) toggle_preference(pref_path)
src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] receive attack logs." src << "You will [ (is_preference_enabled(pref_path)) ? "now" : "no longer"] receive attack logs."
prefs.save_preferences() prefs.save_preferences()
feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","TBeSpecial") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!

View File

@@ -145,7 +145,7 @@
PreFire(A,user,params) //They're using the new gun system, locate what they're aiming at. PreFire(A,user,params) //They're using the new gun system, locate what they're aiming at.
return return
if(user && user.a_intent == I_HELP) //regardless of what happens, refuse to shoot if help intent is on if(user && user.a_intent == I_HELP && user.is_preference_enabled(/datum/client_preference/safefiring)) //regardless of what happens, refuse to shoot if help intent is on
user << "<span class='warning'>You refrain from firing your [src] as your intent is set to help.</span>" user << "<span class='warning'>You refrain from firing your [src] as your intent is set to help.</span>"
else else
Fire(A,user,params) //Otherwise, fire normally. Fire(A,user,params) //Otherwise, fire normally.

View File

@@ -20,7 +20,7 @@
if(!owner.canClick()) if(!owner.canClick())
return return
owner.setClickCooldown(5) // Spam prevention, essentially. owner.setClickCooldown(5) // Spam prevention, essentially.
if(owner.a_intent == I_HELP) if(owner.a_intent == I_HELP && owner.is_preference_enabled(/datum/client_preference/safefiring))
owner << "<span class='warning'>You refrain from firing \the [aiming_with] as your intent is set to help.</span>" owner << "<span class='warning'>You refrain from firing \the [aiming_with] as your intent is set to help.</span>"
return return
owner.visible_message("<span class='danger'>\The [owner] pulls the trigger reflexively!</span>") owner.visible_message("<span class='danger'>\The [owner] pulls the trigger reflexively!</span>")