From 1077b47b7e762862eb001d886fcf55923e336f7b Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 25 Nov 2023 19:17:29 +0100 Subject: [PATCH] [MIRROR] Fixes a footsteps runtime [MDB IGNORE] (#25240) * Fixes a footsteps runtime (#79903) ## About The Pull Request Tin. Fixes the following runtime: ![image](https://github.com/tgstation/tgstation/assets/13398309/e4cd087f-3c6e-49f7-aaa4-2a91ca1b9a79) Which happened because `barefoot_type` can potentially be null if `turf.barefootstep` is null. ![Code_KnExLVOSD4](https://github.com/tgstation/tgstation/assets/13398309/1b3c97d5-500b-4d3d-a104-8dac7071fae0) This results in trying to access `GLOB.barefootstep[null]`, which results in a runtime, which prevents the `play_fov_effect()` from executing. ## Why It's Good For The Game Less CI failures, and fixes a bug. ## Changelog :cl: fix: fixes a runtime in footstep code that would prevent the fov effect from playing to nearby mobs /:cl: * Fixes a footsteps runtime --------- Co-authored-by: Bloop <13398309+vinylspiders@users.noreply.github.com> --- code/datums/elements/footstep.dm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/code/datums/elements/footstep.dm b/code/datums/elements/footstep.dm index d2f129c09f4..dd4656e3f31 100644 --- a/code/datums/elements/footstep.dm +++ b/code/datums/elements/footstep.dm @@ -155,11 +155,11 @@ heard_clients = playsound(source.loc, pick(source.dna.species.special_step_sounds), 50, TRUE, falloff_distance = 1, vary = sound_vary) else var/static/list/bare_footstep_sounds = GLOB.barefootstep - - heard_clients = playsound(source.loc, pick(bare_footstep_sounds[barefoot_type][1]), - bare_footstep_sounds[barefoot_type][2] * volume * volume_multiplier, - TRUE, - bare_footstep_sounds[barefoot_type][3] + e_range + range_adjustment, falloff_distance = 1, vary = sound_vary) + if(!isnull(barefoot_type) && bare_footstep_sounds[barefoot_type]) // barefoot_type can be null + heard_clients = playsound(source.loc, pick(bare_footstep_sounds[barefoot_type][1]), + bare_footstep_sounds[barefoot_type][2] * volume * volume_multiplier, + TRUE, + bare_footstep_sounds[barefoot_type][3] + e_range + range_adjustment, falloff_distance = 1, vary = sound_vary) if(heard_clients) play_fov_effect(source, 5, "footstep", direction, ignore_self = TRUE, override_list = heard_clients)