mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-21 12:56:10 +01:00
Adds a preference to have an intent check for guns (#3653)
what title says
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
--
|
||||
-- Implemented in PR #3653.
|
||||
-- Renames parallax toggles to a more generic name.
|
||||
--
|
||||
|
||||
ALTER TABLE `ss13_player_preferences`
|
||||
CHANGE `parallax_toggles` `toggles_secondary` INT(11) NULL DEFAULT NULL;
|
||||
@@ -68,6 +68,9 @@ Will print: "/mob/living/carbon/human/death" (you can optionally embed it in a s
|
||||
#define PARALLAX_DUST 0x2
|
||||
#define PROGRESS_BARS 0x4
|
||||
#define PARALLAX_IS_STATIC 0x8
|
||||
//Gun safety check.
|
||||
#define SAFETY_CHECK 0x10
|
||||
|
||||
|
||||
#define TOGGLES_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|CHAT_OOC|CHAT_DEAD|CHAT_GHOSTEARS|CHAT_GHOSTSIGHT|CHAT_PRAYER|CHAT_RADIO|CHAT_ATTACKLOGS|CHAT_LOOC)
|
||||
|
||||
|
||||
@@ -655,7 +655,7 @@ proc/GaussRandRound(var/sigma,var/roundto)
|
||||
var/holding = user.get_active_hand()
|
||||
|
||||
var/datum/progressbar/progbar
|
||||
if (display_progress && user.client && (user.client.prefs.parallax_togs & PROGRESS_BARS))
|
||||
if (display_progress && user.client && (user.client.prefs.toggles_secondary & PROGRESS_BARS))
|
||||
progbar = new(user, delay, target)
|
||||
|
||||
var/endtime = world.time + delay
|
||||
@@ -695,7 +695,7 @@ proc/GaussRandRound(var/sigma,var/roundto)
|
||||
var/holding = user.get_active_hand()
|
||||
|
||||
var/datum/progressbar/progbar
|
||||
if (display_progress && user.client && (user.client.prefs.parallax_togs & PROGRESS_BARS))
|
||||
if (display_progress && user.client && (user.client.prefs.toggles_secondary & PROGRESS_BARS))
|
||||
progbar = new(user, delay, act_target)
|
||||
|
||||
var/endtime = world.time + delay
|
||||
|
||||
@@ -87,12 +87,12 @@
|
||||
|
||||
/datum/hud/proc/update_parallax()
|
||||
var/client/C = mymob.client
|
||||
if(C.prefs.parallax_togs & PARALLAX_SPACE)
|
||||
if(C.prefs.toggles_secondary & PARALLAX_SPACE)
|
||||
for(var/obj/screen/parallax/bgobj in C.parallax)
|
||||
C.screen |= bgobj
|
||||
C.screen |= C.parallax_master
|
||||
C.screen |= C.parallax_spacemaster
|
||||
if(C.prefs.parallax_togs & PARALLAX_DUST)
|
||||
if(C.prefs.toggles_secondary & PARALLAX_DUST)
|
||||
C.parallax_dustmaster.color = list(
|
||||
1,0,0,0,
|
||||
0,1,0,0,
|
||||
@@ -111,8 +111,8 @@
|
||||
var/client/C = mymob.client
|
||||
if(!SSparallax.parallax_initialized)
|
||||
return
|
||||
|
||||
if (C.prefs.parallax_togs & PARALLAX_IS_STATIC)
|
||||
|
||||
if (C.prefs.toggles_secondary & PARALLAX_IS_STATIC)
|
||||
return
|
||||
|
||||
//ACTUALLY MOVING THE PARALLAX
|
||||
|
||||
@@ -405,7 +405,7 @@
|
||||
var/time = 6 * breakout_time * 2
|
||||
|
||||
var/datum/progressbar/bar
|
||||
if (escapee.client && escapee.client.prefs.parallax_togs & PROGRESS_BARS)
|
||||
if (escapee.client && escapee.client.prefs.toggles_secondary & PROGRESS_BARS)
|
||||
bar = new(escapee, time, src)
|
||||
|
||||
breakout = 1
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
S["motd_hash"] >> pref.motd_hash
|
||||
S["memo_hash"] >> pref.memo_hash
|
||||
S["parallax_speed"] >> pref.parallax_speed
|
||||
S["parallax_toggles"] >> pref.parallax_togs
|
||||
S["toggles_secondary"] >> pref.toggles_secondary
|
||||
|
||||
/datum/category_item/player_setup_item/player_global/settings/save_preferences(var/savefile/S)
|
||||
S["lastchangelog"] << pref.lastchangelog
|
||||
@@ -20,7 +20,7 @@
|
||||
S["motd_hash"] << pref.motd_hash
|
||||
S["memo_hash"] << pref.memo_hash
|
||||
S["parallax_speed"] << pref.parallax_speed
|
||||
S["parallax_toggles"] << pref.parallax_togs
|
||||
S["toggles_secondary"] << pref.toggles_secondary
|
||||
|
||||
/datum/category_item/player_setup_item/player_global/settings/gather_load_query()
|
||||
return list(
|
||||
@@ -32,9 +32,9 @@
|
||||
"asfx_togs",
|
||||
"lastmotd" = "motd_hash",
|
||||
"lastmemo" = "memo_hash",
|
||||
"parallax_toggles" = "parallax_togs",
|
||||
"toggles_secondary" = "toggles_secondary",
|
||||
"parallax_speed"
|
||||
),
|
||||
),
|
||||
"args" = list("ckey")
|
||||
)
|
||||
)
|
||||
@@ -66,7 +66,7 @@
|
||||
"asfx_togs" = pref.asfx_togs,
|
||||
"lastmotd" = pref.motd_hash,
|
||||
"lastmemo" = pref.memo_hash,
|
||||
"parallax_toggles" = pref.parallax_togs,
|
||||
"toggles_secondary" = pref.toggles_secondary,
|
||||
"parallax_speed" = pref.parallax_speed
|
||||
)
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
pref.motd_hash = sanitize_text(pref.motd_hash, initial(pref.motd_hash))
|
||||
pref.memo_hash = sanitize_text(pref.memo_hash, initial(pref.memo_hash))
|
||||
pref.parallax_speed = sanitize_integer(text2num(pref.parallax_speed), 1, 10, initial(pref.parallax_speed))
|
||||
pref.parallax_togs = sanitize_integer(text2num(pref.parallax_togs), 0, 65535, initial(pref.parallax_togs))
|
||||
pref.toggles_secondary = sanitize_integer(text2num(pref.toggles_secondary), 0, 65535, initial(pref.toggles_secondary))
|
||||
|
||||
/datum/category_item/player_setup_item/player_global/settings/content(mob/user)
|
||||
var/list/dat = list(
|
||||
@@ -90,10 +90,10 @@
|
||||
"<b>Ghost ears:</b> <a href='?src=\ref[src];toggle=[CHAT_GHOSTEARS]'><b>[(pref.toggles & CHAT_GHOSTEARS) ? "All Speech" : "Nearest Creatures"]</b></a><br>",
|
||||
"<b>Ghost sight:</b> <a href='?src=\ref[src];toggle=[CHAT_GHOSTSIGHT]'><b>[(pref.toggles & CHAT_GHOSTSIGHT) ? "All Emotes" : "Nearest Creatures"]</b></a><br>",
|
||||
"<b>Ghost radio:</b> <a href='?src=\ref[src];toggle=[CHAT_GHOSTRADIO]'><b>[(pref.toggles & CHAT_GHOSTRADIO) ? "All Chatter" : "Nearest Speakers"]</b></a><br>",
|
||||
"<b>Space Parallax:</b> <a href='?src=\ref[src];paratoggle=[PARALLAX_SPACE]'><b>[(pref.parallax_togs & PARALLAX_SPACE) ? "Yes" : "No"]</b></a><br>",
|
||||
"<b>Space Dust:</b> <a href='?src=\ref[src];paratoggle=[PARALLAX_DUST]'><b>[(pref.parallax_togs & PARALLAX_DUST) ? "Yes" : "No"]</b></a><br>",
|
||||
"<b>Progress Bars:</b> <a href='?src=\ref[src];paratoggle=[PROGRESS_BARS]'><b>[(pref.parallax_togs & PROGRESS_BARS) ? "Yes" : "No"]</b></a><br>",
|
||||
"<b>Static Space:</b> <a href='?src=\ref[src];paratoggle=[PARALLAX_IS_STATIC]'><b>[(pref.parallax_togs & PARALLAX_IS_STATIC) ? "Yes" : "No"]</b></a><br>"
|
||||
"<b>Space Parallax:</b> <a href='?src=\ref[src];paratoggle=[PARALLAX_SPACE]'><b>[(pref.toggles_secondary & PARALLAX_SPACE) ? "Yes" : "No"]</b></a><br>",
|
||||
"<b>Space Dust:</b> <a href='?src=\ref[src];paratoggle=[PARALLAX_DUST]'><b>[(pref.toggles_secondary & PARALLAX_DUST) ? "Yes" : "No"]</b></a><br>",
|
||||
"<b>Progress Bars:</b> <a href='?src=\ref[src];paratoggle=[PROGRESS_BARS]'><b>[(pref.toggles_secondary & PROGRESS_BARS) ? "Yes" : "No"]</b></a><br>",
|
||||
"<b>Static Space:</b> <a href='?src=\ref[src];paratoggle=[PARALLAX_IS_STATIC]'><b>[(pref.toggles_secondary & PARALLAX_IS_STATIC) ? "Yes" : "No"]</b></a><br>"
|
||||
)
|
||||
|
||||
. = dat.Join()
|
||||
@@ -111,7 +111,7 @@
|
||||
|
||||
if(href_list["paratoggle"])
|
||||
var/flag = text2num(href_list["paratoggle"])
|
||||
pref.parallax_togs ^= flag
|
||||
pref.toggles_secondary ^= flag
|
||||
return TOPIC_REFRESH
|
||||
|
||||
return ..()
|
||||
|
||||
@@ -126,7 +126,7 @@ datum/preferences
|
||||
|
||||
// SPAAAACE
|
||||
var/parallax_speed = 2
|
||||
var/parallax_togs = PARALLAX_SPACE | PARALLAX_DUST | PROGRESS_BARS
|
||||
var/toggles_secondary = PARALLAX_SPACE | PARALLAX_DUST | PROGRESS_BARS
|
||||
|
||||
var/list/pai = list() // A list for holding pAI related data.
|
||||
|
||||
@@ -142,6 +142,8 @@ datum/preferences
|
||||
|
||||
var/dress_mob = TRUE
|
||||
|
||||
|
||||
|
||||
/datum/preferences/New(client/C)
|
||||
new_setup()
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
//toggles
|
||||
|
||||
/client/verb/toggle_ghost_ears()
|
||||
set name = "Show/Hide GhostEars"
|
||||
set category = "Preferences"
|
||||
@@ -150,13 +151,13 @@
|
||||
set name = "Show/Hide Space Parallax"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles space parallax effects."
|
||||
prefs.parallax_togs ^= PARALLAX_SPACE
|
||||
prefs.toggles_secondary ^= PARALLAX_SPACE
|
||||
prefs.save_preferences()
|
||||
if (prefs.parallax_togs & PARALLAX_SPACE)
|
||||
if (prefs.toggles_secondary & PARALLAX_SPACE)
|
||||
src << "You will now see space parallax effects."
|
||||
else
|
||||
src << "You will no longer see space parallax effects."
|
||||
|
||||
|
||||
if (mob.hud_used)
|
||||
mob.hud_used.update_parallax()
|
||||
|
||||
@@ -165,13 +166,13 @@
|
||||
set name = "Show/Hide Space Dust"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles space parallax dust."
|
||||
prefs.parallax_togs ^= PARALLAX_DUST
|
||||
prefs.toggles_secondary ^= PARALLAX_DUST
|
||||
prefs.save_preferences()
|
||||
if (prefs.parallax_togs & PARALLAX_DUST)
|
||||
if (prefs.toggles_secondary & PARALLAX_DUST)
|
||||
src << "You will now see space parallax dust effects."
|
||||
else
|
||||
src << "You will no longer see space parallax dust effects."
|
||||
|
||||
|
||||
if (mob.hud_used)
|
||||
mob.hud_used.update_parallax()
|
||||
|
||||
@@ -195,9 +196,9 @@
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles progress bars on slow actions."
|
||||
|
||||
prefs.parallax_togs ^= PROGRESS_BARS
|
||||
prefs.toggles_secondary ^= PROGRESS_BARS
|
||||
prefs.save_preferences()
|
||||
if (prefs.parallax_togs & PROGRESS_BARS)
|
||||
if (prefs.toggles_secondary & PROGRESS_BARS)
|
||||
src << "You will now see progress bars on delayed actions."
|
||||
else
|
||||
src << "You will no longer see progress bars on delayed actions."
|
||||
@@ -207,10 +208,20 @@
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles movement of parallax space."
|
||||
|
||||
prefs.parallax_togs ^= PARALLAX_IS_STATIC
|
||||
prefs.toggles_secondary ^= PARALLAX_IS_STATIC
|
||||
prefs.save_preferences()
|
||||
|
||||
if (prefs.parallax_togs & PARALLAX_IS_STATIC)
|
||||
if (prefs.toggles_secondary & PARALLAX_IS_STATIC)
|
||||
src << "Space will no longer move."
|
||||
else
|
||||
src << "Space will now move."
|
||||
|
||||
/client/verb/toggle_safety_check()
|
||||
|
||||
set name = "Toggle Gun Safety Check"
|
||||
set category = "Preferences"
|
||||
set desc = "Toggles firing guns on intents other than help."
|
||||
|
||||
prefs.toggles_secondary ^= SAFETY_CHECK //Held in Parallax because we don't want to deal with an SQL migration right now.
|
||||
prefs.save_preferences()
|
||||
src << "You will [(prefs.toggles_secondary & SAFETY_CHECK) ? "no longer" : "now"] fire your weapon on intents other than harm."
|
||||
@@ -148,9 +148,14 @@
|
||||
return ..() //Pistolwhippin'
|
||||
|
||||
/obj/item/weapon/gun/proc/Fire(atom/target, mob/living/user, clickparams, pointblank=0, reflex=0)
|
||||
|
||||
|
||||
if(!user || !target) return
|
||||
|
||||
add_fingerprint(user)
|
||||
if(user.client && (user.client.prefs.toggles_secondary & SAFETY_CHECK) && user.a_intent != I_HURT) //Check this first to save time.
|
||||
user << "You refrain from firing, as you aren't on harm intent."
|
||||
return
|
||||
|
||||
if(!special_check(user))
|
||||
return
|
||||
|
||||
@@ -9,6 +9,10 @@
|
||||
AO.update_aiming_deferred()
|
||||
|
||||
/obj/aiming_overlay/proc/trigger(var/perm)
|
||||
|
||||
if((user.client.prefs.toggles_secondary & SAFETY_CHECK) && user.a_intent != I_HURT) //Check this first to save time.
|
||||
user << "You refrain from firing, as you aren't on harm intent."
|
||||
return
|
||||
if(!owner || !aiming_with || !aiming_at || !locked)
|
||||
return
|
||||
if(perm && (target_permissions & perm))
|
||||
@@ -25,7 +29,7 @@
|
||||
toggle_active()
|
||||
if (owner.client)
|
||||
owner.client.remove_gun_icons()
|
||||
|
||||
|
||||
/mob/living/ClickOn(var/atom/A, var/params)
|
||||
. = ..()
|
||||
trigger_aiming(TARGET_CAN_CLICK)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
################################
|
||||
# Example Changelog File
|
||||
#
|
||||
# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
|
||||
#
|
||||
# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
|
||||
# When it is, any changes listed below will disappear.
|
||||
#
|
||||
# Valid Prefixes:
|
||||
# bugfix
|
||||
# wip (For works in progress)
|
||||
# tweak
|
||||
# soundadd
|
||||
# sounddel
|
||||
# rscadd (general adding of nice things)
|
||||
# rscdel (general deleting of nice things)
|
||||
# imageadd
|
||||
# imagedel
|
||||
# maptweak
|
||||
# spellcheck (typo fixes)
|
||||
# experiment
|
||||
# balance
|
||||
#################################
|
||||
|
||||
# Your name.
|
||||
author: Chaoko99
|
||||
|
||||
# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
|
||||
delete-after: True
|
||||
|
||||
# Any changes you've made. See valid prefix list above.
|
||||
# INDENT WITH TWO SPACES. NOT TABS. SPACES.
|
||||
# SCREW THIS UP AND IT WON'T WORK.
|
||||
# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
|
||||
# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
|
||||
changes:
|
||||
- rscadd: "Added a preference to check if the player is on harm intent before firing; defaults off."
|
||||
Reference in New Issue
Block a user