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
+2 -2
View File
@@ -787,8 +787,8 @@ GLOBAL_VAR_INIT(rpg_loot_items, FALSE)
openToolTip(user,src,params,title = name,content = "[desc]<br><b>Force:</b> [force_string]",theme = "")
/obj/item/MouseEntered(location, control, params)
if((item_flags & IN_INVENTORY) && usr.client.prefs.enable_tips && !QDELETED(src))
var/timedelay = usr.client.prefs.tip_delay/100
if((item_flags & IN_INVENTORY) && usr.client?.prefs?.enable_tips && !QDELETED(src))
var/timedelay = usr.client?.prefs?.tip_delay/100
var/user = usr
tip_timer = addtimer(CALLBACK(src, .proc/openTip, location, control, params, user), timedelay, TIMER_STOPPABLE)//timer takes delay in deciseconds, but the pref is in milliseconds. dividing by 100 converts it.
+4 -4
View File
@@ -164,8 +164,8 @@ GLOBAL_LIST_EMPTY(PDAs)
if(equipped)
return
if(user.client)
background_color = user.client.prefs.pda_color
switch(user.client.prefs.pda_style)
background_color = user.client?.prefs?.pda_color
switch(user.client?.prefs?.pda_style)
if(MONO)
font_index = MODE_MONO
font_mode = FONT_MONO
@@ -181,7 +181,7 @@ GLOBAL_LIST_EMPTY(PDAs)
else
font_index = MODE_MONO
font_mode = FONT_MONO
var/pref_skin = GLOB.pda_reskins[user.client.prefs.pda_skin]
var/pref_skin = GLOB.pda_reskins[user.client?.prefs?.pda_skin]
if(icon != pref_skin)
icon = pref_skin
update_icon(FALSE, TRUE)
@@ -778,7 +778,7 @@ GLOBAL_LIST_EMPTY(PDAs)
// Show it to ghosts
var/ghost_message = "<span class='name'>[owner] </span><span class='game say'>PDA Message</span> --> <span class='name'>[target_text]</span>: <span class='message'>[signal.format_message(TRUE)]</span>"
for(var/mob/M in GLOB.player_list)
if(isobserver(M) && M.client && (M.client.prefs.chat_toggles & CHAT_GHOSTPDA))
if(isobserver(M) && M.client && (M.client?.prefs?.chat_toggles & CHAT_GHOSTPDA))
to_chat(M, "[FOLLOW_LINK(M, user)] [ghost_message]")
// Log in the talk log
user.log_talk(message, LOG_PDA, tag="PDA: [initial(name)] to [target_text]")
@@ -78,7 +78,7 @@
if(!iscarbon(target))
return
var/voracious = TRUE
if(!target.client || !(target.client.prefs.cit_toggles & MEDIHOUND_SLEEPER) || !hound.client || !(hound.client.prefs.cit_toggles & MEDIHOUND_SLEEPER))
if(!target.client || !(target.client?.prefs?.cit_toggles & MEDIHOUND_SLEEPER) || !hound.client || !(hound.client?.prefs?.cit_toggles & MEDIHOUND_SLEEPER))
voracious = FALSE
if(target.buckled)
to_chat(user, "<span class='warning'>The user is buckled and can not be put into your [src].</span>")
@@ -121,7 +121,7 @@
if(user.a_intent == INTENT_HELP)
return
var/voracious = TRUE
if(!user.client || !(user.client.prefs.cit_toggles & MEDIHOUND_SLEEPER) || !hound.client || !(hound.client.prefs.cit_toggles & MEDIHOUND_SLEEPER))
if(!user.client || !(user.client?.prefs?.cit_toggles & MEDIHOUND_SLEEPER) || !hound.client || !(hound.client?.prefs?.cit_toggles & MEDIHOUND_SLEEPER))
voracious = FALSE
user.visible_message("<span class='notice'>You see [voracious ? "[user] struggling against the expanded material of [hound]'s gut!" : "and hear [user] pounding against something inside of [hound]'s [src.name]!"]</span>", \
"<span class='notice'>[voracious ? "You start struggling inside of [src]'s tight, flexible confines," : "You start pounding against the metallic walls of [src],"] trying to trigger the release... (this will take about [DisplayTimeText(breakout_time)].)</span>", \
@@ -136,11 +136,11 @@
var/list/targets = target && hound ? list(target) : contents
if(hound)
//hound.setClickCooldown(50) Not needed?
if(!hound.client || !(hound.client.prefs.cit_toggles & MEDIHOUND_SLEEPER))
if(!hound.client || !(hound.client?.prefs?.cit_toggles & MEDIHOUND_SLEEPER))
voracious = FALSE
else
for(var/mob/M in targets)
if(!M.client || !(M.client.prefs.cit_toggles & MEDIHOUND_SLEEPER))
if(!M.client || !(M.client?.prefs?.cit_toggles & MEDIHOUND_SLEEPER))
voracious = FALSE
if(length(targets))
if(hound)
@@ -263,7 +263,7 @@
patient_laststat = patient.stat
prociconupdate = TRUE
if(!patient.client || !(patient.client.prefs.cit_toggles & MEDIHOUND_SLEEPER) || !hound.client || !(hound.client.prefs.cit_toggles & MEDIHOUND_SLEEPER))
if(!patient.client || !(patient.client?.prefs?.cit_toggles & MEDIHOUND_SLEEPER) || !hound.client || !(hound.client?.prefs?.cit_toggles & MEDIHOUND_SLEEPER))
hound.sleeper_nv = TRUE
else
hound.sleeper_nv = FALSE
@@ -288,7 +288,7 @@
hound.sleeper_g = 1
patient_laststat = patient.stat
if(!patient.client || !(patient.client.prefs.cit_toggles & MEDIHOUND_SLEEPER) || !hound.client || !(hound.client.prefs.cit_toggles & MEDIHOUND_SLEEPER))
if(!patient.client || !(patient.client?.prefs?.cit_toggles & MEDIHOUND_SLEEPER) || !hound.client || !(hound.client?.prefs?.cit_toggles & MEDIHOUND_SLEEPER))
hound.sleeper_nv = TRUE
else
hound.sleeper_nv = FALSE
@@ -345,7 +345,7 @@
var/turf/source = get_turf(hound)
LAZYCLEARLIST(hearing_mobs)
for(var/mob/H in get_hearers_in_view(3, source))
if(!H.client || !(H.client.prefs.cit_toggles & DIGESTION_NOISES))
if(!H.client || !(H.client?.prefs?.cit_toggles & DIGESTION_NOISES))
continue
LAZYADD(hearing_mobs, H)
last_hearcheck = world.time
@@ -389,7 +389,7 @@
var/turf/source = get_turf(hound)
LAZYCLEARLIST(hearing_mobs)
for(var/mob/H in get_hearers_in_view(3, source))
if(!H.client || !(H.client.prefs.cit_toggles & DIGESTION_NOISES))
if(!H.client || !(H.client?.prefs?.cit_toggles & DIGESTION_NOISES))
continue
LAZYADD(hearing_mobs, H)
last_hearcheck = world.time
+1 -1
View File
@@ -81,7 +81,7 @@
body = new mob_type(T)
var/mob/ghostie = mind.get_ghost(TRUE)
if(ghostie.client && ghostie.client.prefs)
ghostie.client.prefs.copy_to(body)
ghostie.client?.prefs?.copy_to(body)
mind.transfer_to(body)
else
body.forceMove(T)
+1 -1
View File
@@ -67,7 +67,7 @@
if((world.time - MUSICIAN_HEARCHECK_MINDELAY) > last_hearcheck)
LAZYCLEARLIST(hearing_mobs)
for(var/mob/M in get_hearers_in_view(15, source))
if(!M.client || !(M.client.prefs.toggles & SOUND_INSTRUMENTS))
if(!M.client || !(M.client?.prefs?.toggles & SOUND_INSTRUMENTS))
continue
LAZYADD(hearing_mobs, M)
last_hearcheck = world.time