Add null checks to client prefs checks

client.prefs. -> client?.prefs?.
This commit is contained in:
psq95
2023-05-13 23:53:47 +01:00
parent dfeb85bfa4
commit 5840c8ab99
93 changed files with 310 additions and 310 deletions
@@ -313,7 +313,7 @@ GLOBAL_LIST_EMPTY(roundstart_races)
C.canbearoused = FALSE
else
if(C.client)
C.canbearoused = C.client.prefs.arousable
C.canbearoused = C.client?.prefs?.arousable
if(ishuman(C))
var/mob/living/carbon/human/H = C
if(NOGENITALS in H.dna.species.species_traits)
@@ -21,7 +21,7 @@
if(ishuman(C))
var/mob/living/carbon/human/H = C
if(!H.dna.features["moth_wings"])
H.dna.features["moth_wings"] = "[(H.client && H.client.prefs && LAZYLEN(H.client.prefs.features) && H.client.prefs.features["moth_wings"]) ? H.client.prefs.features["moth_wings"] : "Plain"]"
H.dna.features["moth_wings"] = "[(H.client && H.client.prefs && LAZYLEN(H.client?.prefs?.features) && H.client?.prefs?.features["moth_wings"]) ? H.client?.prefs?.features["moth_wings"] : "Plain"]"
handle_mutant_bodyparts(H)
/datum/species/moth/random_name(gender,unique,lastname)
@@ -25,7 +25,7 @@
log_whisper("[src.name]/[src.key] : [message]")
if (src.client)
if (src.client.prefs.muted & MUTE_IC)
if (src.client?.prefs?.muted & MUTE_IC)
to_chat(src, "<span class='danger'>You cannot whisper (muted).</span>")
return
@@ -54,7 +54,7 @@
var/list/listening_dead = list()
for(var/mob/M in GLOB.player_list)
if(M.stat == DEAD && M.client && ((M.client.prefs.chat_toggles & CHAT_GHOSTWHISPER) || (get_dist(M, src) <= 7)))
if(M.stat == DEAD && M.client && ((M.client?.prefs?.chat_toggles & CHAT_GHOSTWHISPER) || (get_dist(M, src) <= 7)))
listening_dead |= M
var/list/listening = get_hearers_in_view(1, src)
+1 -1
View File
@@ -410,7 +410,7 @@
return FALSE
else if(QDELETED(user))
return FALSE
else if(user.client && user.client.prefs.muted & MUTE_IC)
else if(user.client && user.client?.prefs?.muted & MUTE_IC)
to_chat(user, "You cannot send IC messages (muted).")
return FALSE
else if(!params)
+1 -1
View File
@@ -1105,7 +1105,7 @@
if(client)
client.move_delay = world.time + movement_delay()
lying_prev = lying
if(canmove && !intentionalresting && iscarbon(src) && client && client.prefs && client.prefs.autostand)//CIT CHANGE - adds autostanding as a preference
if(canmove && !intentionalresting && iscarbon(src) && client && client.prefs && client?.prefs?.autostand)//CIT CHANGE - adds autostanding as a preference
addtimer(CALLBACK(src, .proc/resist_a_rest, TRUE), 0) //CIT CHANGE - ditto
return canmove
+5 -5
View File
@@ -249,7 +249,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
deaf_message = "<span class='notice'>You can't hear yourself!</span>"
deaf_type = 2 // Since you should be able to hear yourself without looking
// Create map text prior to modifying message for goonchat
if (client?.prefs.chat_on_map && stat != UNCONSCIOUS && (client.prefs.see_chat_non_mob || ismob(speaker)) && can_hear())
if (client?.prefs.chat_on_map && stat != UNCONSCIOUS && (client?.prefs?.see_chat_non_mob || ismob(speaker)) && can_hear())
create_chat_message(speaker, message_language, raw_message, spans, message_mode)
if (client?.prefs.radiosounds && stat != UNCONSCIOUS && can_hear() && radio_freq)
playsound_local(src,'sound/voice/radio.ogg', 30, 0)
@@ -281,9 +281,9 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
if(!M.client || !client) //client is so that ghosts don't have to listen to mice
continue
if(get_dist(M, source) > 7 || M.z != z) //they're out of range of normal hearing
if(eavesdropping_modes[message_mode] && !(M.client.prefs.chat_toggles & CHAT_GHOSTWHISPER)) //they're whispering and we have hearing whispers at any range off
if(eavesdropping_modes[message_mode] && !(M.client?.prefs?.chat_toggles & CHAT_GHOSTWHISPER)) //they're whispering and we have hearing whispers at any range off
continue
if(!(M.client.prefs.chat_toggles & CHAT_GHOSTEARS)) //they're talking normally and we have hearing at any range off
if(!(M.client?.prefs?.chat_toggles & CHAT_GHOSTEARS)) //they're talking normally and we have hearing at any range off
continue
listening |= M
the_dead[M] = TRUE
@@ -306,7 +306,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
//speech bubble
var/list/speech_bubble_recipients = list()
for(var/mob/M in listening)
if(M.client && !M.client.prefs.chat_on_map)
if(M.client && !M.client?.prefs?.chat_on_map)
speech_bubble_recipients.Add(M.client)
var/image/I = image('icons/mob/talk.dmi', src, "[bubble_type][say_test(message)]", FLY_LAYER)
I.appearance_flags = APPEARANCE_UI_IGNORE_ALPHA
@@ -321,7 +321,7 @@ GLOBAL_LIST_INIT(department_radio_keys, list(
/mob/living/proc/can_speak_basic(message, ignore_spam = FALSE) //Check BEFORE handling of xeno and ling channels
if(client)
if(client.prefs.muted & MUTE_IC)
if(client?.prefs?.muted & MUTE_IC)
to_chat(src, "<span class='danger'>You cannot speak in IC (muted).</span>")
return 0
if(!ignore_spam && client.handle_spam_prevention(message,MUTE_IC))
+1 -1
View File
@@ -830,7 +830,7 @@
jobpart = "Unknown"
var/rendered = "<i><span class='game say'>[start]<span class='name'>[hrefpart][namepart] ([jobpart])</a> </span><span class='message'>[treated_message]</span></span></i>"
if (client?.prefs.chat_on_map && (client.prefs.see_chat_non_mob || ismob(speaker)))
if (client?.prefs.chat_on_map && (client?.prefs?.see_chat_non_mob || ismob(speaker)))
create_chat_message(speaker, message_language, raw_message, spans, message_mode)
show_message(rendered, MSG_AUDIBLE)
+1 -1
View File
@@ -151,7 +151,7 @@
if(!only_listener)
// Play voice for all mobs in the z level
for(var/mob/M in GLOB.player_list)
if(M.client && M.can_hear() && (M.client.prefs.toggles & SOUND_ANNOUNCEMENTS))
if(M.client && M.can_hear() && (M.client?.prefs?.toggles & SOUND_ANNOUNCEMENTS))
var/turf/T = get_turf(M)
if(T.z == z_level)
SEND_SOUND(M, voice)