From 74492471594271b580d1dd1e2eae1eba98235d87 Mon Sep 17 00:00:00 2001 From: Greniza <61635418+Greniza@users.noreply.github.com> Date: Wed, 7 Jul 2021 14:29:23 -0600 Subject: [PATCH] Weather runtime & EPB fix (#60043) Fixes the major runtime issue encountered in #60034 Fixes Environmental Protection Bags not protecting from ash storms as they should --- code/datums/weather/weather.dm | 19 +++++++++---------- .../datums/weather/weather_types/ash_storm.dm | 7 ++++++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/code/datums/weather/weather.dm b/code/datums/weather/weather.dm index cccac59fdfc..4562ef12b43 100644 --- a/code/datums/weather/weather.dm +++ b/code/datums/weather/weather.dm @@ -192,18 +192,17 @@ /datum/weather/proc/can_weather_act(mob/living/mob_to_check) var/turf/mob_turf = get_turf(mob_to_check) + if(!mob_turf) + return + if(!(mob_turf.z in impacted_z_levels)) - if(mob_turf) - return + return - if(!(mob_to_check.loc.z in impacted_z_levels)) // in this case, get_turf(mob_to_check) =/= mob_to_check.loc, so we have to proceed with checking the location's type - return - - if(istype(mob_to_check.loc, /obj/structure/closet)) - var/obj/structure/closet/current_locker = mob_to_check.loc - if(current_locker.weather_protection) - if((immunity_type in current_locker.weather_protection) || (WEATHER_ALL in current_locker.weather_protection)) - return + if(istype(mob_to_check.loc, /obj/structure/closet)) + var/obj/structure/closet/current_locker = mob_to_check.loc + if(current_locker.weather_protection) + if((immunity_type in current_locker.weather_protection) || (WEATHER_ALL in current_locker.weather_protection)) + return if((immunity_type in mob_to_check.weather_immunities) || (WEATHER_ALL in mob_to_check.weather_immunities)) return diff --git a/code/datums/weather/weather_types/ash_storm.dm b/code/datums/weather/weather_types/ash_storm.dm index 90565d4138e..cc70b0ed6c3 100644 --- a/code/datums/weather/weather_types/ash_storm.dm +++ b/code/datums/weather/weather_types/ash_storm.dm @@ -72,8 +72,13 @@ return TRUE if(isliving(L))// if we're a non immune mob inside an immune mob we have to reconsider if that mob is immune to protect ourselves var/mob/living/the_mob = L - if(WEATHER_ASH in the_mob.weather_immunities) + if((WEATHER_ASH in the_mob.weather_immunities) || (WEATHER_ALL in the_mob.weather_immunities)) return TRUE + if(istype(L, /obj/structure/closet)) + var/obj/structure/closet/the_locker = L + if(the_locker.weather_protection) + if((WEATHER_ASH in the_locker.weather_protection) || (WEATHER_ALL in the_locker.weather_protection)) + return TRUE L = L.loc //Check parent items immunities (recurses up to the turf) return FALSE //RIP you