From 9d84e7881c3cdfc0aeba1009066612dfe2734740 Mon Sep 17 00:00:00 2001 From: Atermonera Date: Sat, 24 Jul 2021 10:15:49 -0700 Subject: [PATCH] Fixes Indoor Rain --- code/controllers/subsystems/planets.dm | 4 ++-- code/game/objects/effects/step_triggers.dm | 2 +- code/game/turfs/simulated/floor_attackby.dm | 4 ++-- .../game/turfs/simulated/outdoors/outdoors.dm | 19 ++++++++++++------- code/game/turfs/simulated/wall_attacks.dm | 2 +- code/modules/admin/verbs/lightning_strike.dm | 4 ++-- code/modules/flufftext/look_up.dm | 2 +- code/modules/mining/fulton.dm | 4 ++-- .../mob/living/carbon/human/human_movement.dm | 2 +- code/modules/planet/sif.dm | 12 ++++++------ code/modules/planet/weather.dm | 4 ++-- 11 files changed, 32 insertions(+), 27 deletions(-) diff --git a/code/controllers/subsystems/planets.dm b/code/controllers/subsystems/planets.dm index 042d7c71d76..4dae77ccbe0 100644 --- a/code/controllers/subsystems/planets.dm +++ b/code/controllers/subsystems/planets.dm @@ -34,7 +34,7 @@ SUBSYSTEM_DEF(planets) // DO NOT CALL THIS DIRECTLY UNLESS IT'S IN INITIALIZE, // USE turf/simulated/proc/make_indoors() and -// tyrf/simulated/proc/make_outdoors() +// turf/simulated/proc/make_outdoors() /datum/controller/subsystem/planets/proc/addTurf(var/turf/T) if(z_to_planet.len >= T.z && z_to_planet[T.z]) var/datum/planet/P = z_to_planet[T.z] @@ -42,7 +42,7 @@ SUBSYSTEM_DEF(planets) return if(istype(T, /turf/unsimulated/wall/planetary)) P.planet_walls += T - else if(istype(T, /turf/simulated) && T.outdoors == OUTDOORS_YES) + else if(istype(T, /turf/simulated) && T.is_outdoors()) P.planet_floors += T P.weather_holder.apply_to_turf(T) P.sun_holder.apply_to_turf(T) diff --git a/code/game/objects/effects/step_triggers.dm b/code/game/objects/effects/step_triggers.dm index c8c8b764c40..56cc000dc9e 100644 --- a/code/game/objects/effects/step_triggers.dm +++ b/code/game/objects/effects/step_triggers.dm @@ -220,7 +220,7 @@ var/global/list/tele_landmarks = list() // Terrible, but the alternative is loop if(!istype(candidate) || istype(candidate, /turf/simulated/sky)) safety-- continue - else if(candidate && !candidate.outdoors == OUTDOORS_YES) + else if(candidate && !candidate.is_outdoors()) safety-- continue else diff --git a/code/game/turfs/simulated/floor_attackby.dm b/code/game/turfs/simulated/floor_attackby.dm index f8338039e24..4f70fc59185 100644 --- a/code/game/turfs/simulated/floor_attackby.dm +++ b/code/game/turfs/simulated/floor_attackby.dm @@ -46,10 +46,10 @@ return // Create a ceiling to shield from the weather - if(src.outdoors == OUTDOORS_YES) + if(src.is_outdoors()) for(var/dir in cardinal) var/turf/A = get_step(src, dir) - if(A && !A.outdoors == OUTDOORS_YES) + if(A && !A.is_outdoors()) if(expended_tile || R.use(1)) make_indoors() playsound(src, 'sound/weapons/Genhit.ogg', 50, 1) diff --git a/code/game/turfs/simulated/outdoors/outdoors.dm b/code/game/turfs/simulated/outdoors/outdoors.dm index f04f0dac02a..2d97bcf8027 100644 --- a/code/game/turfs/simulated/outdoors/outdoors.dm +++ b/code/game/turfs/simulated/outdoors/outdoors.dm @@ -1,6 +1,6 @@ var/list/turf_edge_cache = list() -/turf/ +/turf // If greater than 0, this turf will apply edge overlays on top of other turfs cardinally adjacent to it, if those adjacent turfs are of a different icon_state, // and if those adjacent turfs have a lower edge_blending_priority. var/edge_blending_priority = 0 @@ -26,19 +26,22 @@ var/list/turf_edge_cache = list() var/list/turf_layers = list(/turf/simulated/floor/outdoors/rocks) /turf/simulated/floor/Initialize(mapload) - if(should_be_outdoors()) + if(is_outdoors()) SSplanets.addTurf(src) . = ..() /turf/simulated/floor/Destroy() - if(should_be_outdoors()) + if(is_outdoors()) SSplanets.removeTurf(src) return ..() // Turfs can decide if they should be indoors or outdoors. // By default they choose based on their area's setting. // This helps cut down on ten billion `/outdoors` subtypes being needed. -/turf/simulated/proc/should_be_outdoors() +/turf/proc/is_outdoors() + return FALSE + +/turf/simulated/is_outdoors() switch(outdoors) if(OUTDOORS_YES) return TRUE @@ -50,14 +53,16 @@ var/list/turf_edge_cache = list() return TRUE return FALSE +/// Makes the turf explicitly outdoors. /turf/simulated/proc/make_outdoors() - if(outdoors == OUTDOORS_YES) + if(is_outdoors()) // Already outdoors. return outdoors = OUTDOORS_YES SSplanets.addTurf(src) +/// Makes the turf explicitly indoors. /turf/simulated/proc/make_indoors() - if(!outdoors == OUTDOORS_NO) + if(!is_outdoors()) // Already indoors. return outdoors = OUTDOORS_NO SSplanets.removeTurf(src) @@ -65,7 +70,7 @@ var/list/turf_edge_cache = list() /turf/simulated/post_change() ..() // If it was outdoors and still is, it will not get added twice when the planet controller gets around to putting it in. - if(outdoors == OUTDOORS_YES) + if(is_outdoors()) make_outdoors() else make_indoors() diff --git a/code/game/turfs/simulated/wall_attacks.dm b/code/game/turfs/simulated/wall_attacks.dm index 0372c3f7706..036cfd57282 100644 --- a/code/game/turfs/simulated/wall_attacks.dm +++ b/code/game/turfs/simulated/wall_attacks.dm @@ -171,7 +171,7 @@ return // Create a ceiling to shield from the weather - if(outdoors == OUTDOORS_YES) + if(is_outdoors()) if(expended_tile || R.use(1)) // Don't need to check adjacent turfs for a wall, we're building on one make_indoors() if(!expended_tile) // Would've already played a sound diff --git a/code/modules/admin/verbs/lightning_strike.dm b/code/modules/admin/verbs/lightning_strike.dm index dcd5807793d..d00fb4a1aff 100644 --- a/code/modules/admin/verbs/lightning_strike.dm +++ b/code/modules/admin/verbs/lightning_strike.dm @@ -40,13 +40,13 @@ for(var/obj/machinery/power/thing in range(LIGHTNING_REDIRECT_RANGE, T)) if(istype(thing, /obj/machinery/power/tesla_coil)) var/turf/simulated/coil_turf = get_turf(thing) - if(istype(coil_turf) && thing.anchored && coil_turf.outdoors == OUTDOORS_YES) + if(istype(coil_turf) && thing.anchored && coil_turf.is_outdoors()) coil = thing break if(istype(thing, /obj/machinery/power/grounding_rod)) var/turf/simulated/rod_turf = get_turf(thing) - if(istype(rod_turf) && thing.anchored && rod_turf.outdoors == OUTDOORS_YES) + if(istype(rod_turf) && thing.anchored && rod_turf.is_outdoors()) ground = thing if(coil) // Coil gets highest priority. diff --git a/code/modules/flufftext/look_up.dm b/code/modules/flufftext/look_up.dm index 846925c4db3..10cd25b288e 100644 --- a/code/modules/flufftext/look_up.dm +++ b/code/modules/flufftext/look_up.dm @@ -12,7 +12,7 @@ to_chat(usr, span("warning", "You appear to be in a place without any sort of concept of direction. You have bigger problems to worry about.")) return - if(T.outdoors == OUTDOORS_NO) // They're inside. + if(!T.is_outdoors()) // They're inside. to_chat(usr, "You see nothing interesting.") return diff --git a/code/modules/mining/fulton.dm b/code/modules/mining/fulton.dm index f3a96b94b93..dd4993bce23 100644 --- a/code/modules/mining/fulton.dm +++ b/code/modules/mining/fulton.dm @@ -42,7 +42,7 @@ var/global/list/total_extraction_beacons = list() return if(!can_use_indoors) var/turf/T = get_turf(A) - if(T && T.outdoors == OUTDOORS_NO) + if(T && !T.is_outdoors()) to_chat(user, "[src] can only be used on things that are outdoors!") return if(!flag) @@ -145,7 +145,7 @@ var/global/list/total_extraction_beacons = list() /obj/item/fulton_core/attack_self(mob/user) var/turf/T = get_turf(user) - var/outdoors = T.outdoors == OUTDOORS_YES + var/outdoors = T.is_outdoors() if(do_after(user,15,target = user) && !QDELETED(src) && outdoors) new /obj/structure/extraction_point(get_turf(user)) qdel(src) diff --git a/code/modules/mob/living/carbon/human/human_movement.dm b/code/modules/mob/living/carbon/human/human_movement.dm index 0aed1118900..fad2b7cf259 100644 --- a/code/modules/mob/living/carbon/human/human_movement.dm +++ b/code/modules/mob/living/carbon/human/human_movement.dm @@ -167,7 +167,7 @@ // I don't like that so I'm commenting it out :) // VOREstation Edit Start /* - if((T.outdoors == OUTDOORS_YES) && (T.z <= SSplanets.z_to_planet.len)) + if((T.is_outdoors()) && (T.z <= SSplanets.z_to_planet.len)) var/datum/planet/P = SSplanets.z_to_planet[z] if(P) var/datum/weather_holder/WH = P.weather_holder diff --git a/code/modules/planet/sif.dm b/code/modules/planet/sif.dm index 399ac93973e..e09b808a3a4 100644 --- a/code/modules/planet/sif.dm +++ b/code/modules/planet/sif.dm @@ -296,7 +296,7 @@ var/datum/planet/sif/planet_sif = null for(var/mob/living/L as anything in living_mob_list) if(L.z in holder.our_planet.expected_z_levels) var/turf/T = get_turf(L) - if(T.outdoors == OUTDOORS_NO) + if(!T.is_outdoors()) continue // They're indoors, so no need to rain on them. // If they have an open umbrella, it'll guard from rain @@ -349,7 +349,7 @@ var/datum/planet/sif/planet_sif = null for(var/mob/living/L as anything in living_mob_list) if(L.z in holder.our_planet.expected_z_levels) var/turf/T = get_turf(L) - if(T.outdoors == OUTDOORS_NO) + if(!T.is_outdoors()) continue // They're indoors, so no need to rain on them. // If they have an open umbrella, it'll guard from rain @@ -407,7 +407,7 @@ var/datum/planet/sif/planet_sif = null for(var/mob/living/carbon/H as anything in human_mob_list) if(H.z in holder.our_planet.expected_z_levels) var/turf/T = get_turf(H) - if(T.outdoors == OUTDOORS_NO) + if(!T.is_outdoors()) continue // They're indoors, so no need to pelt them with ice. // If they have an open umbrella, it'll guard from hail @@ -502,7 +502,7 @@ var/datum/planet/sif/planet_sif = null for(var/mob/living/L as anything in living_mob_list) if(L.z in holder.our_planet.expected_z_levels) var/turf/T = get_turf(L) - if(T.outdoors == OUTDOORS_NO) + if(!T.is_outdoors()) continue // They're indoors, so no need to burn them with ash. L.inflict_heat_damage(rand(1, 3)) @@ -539,7 +539,7 @@ var/datum/planet/sif/planet_sif = null if(L.z in holder.our_planet.expected_z_levels) irradiate_nearby_turf(L) var/turf/T = get_turf(L) - if(T.outdoors == OUTDOORS_NO) + if(!T.is_outdoors()) continue // They're indoors, so no need to irradiate them with fallout. L.rad_act(rand(direct_rad_low, direct_rad_high)) @@ -553,5 +553,5 @@ var/datum/planet/sif/planet_sif = null var/turf/T = pick(turfs) // We get one try per tick. if(!istype(T)) return - if(T.outdoors == OUTDOORS_YES) + if(T.is_outdoors()) SSradiation.radiate(T, rand(fallout_rad_low, fallout_rad_high)) diff --git a/code/modules/planet/weather.dm b/code/modules/planet/weather.dm index 43d7dcc4ea1..c354e8bde36 100644 --- a/code/modules/planet/weather.dm +++ b/code/modules/planet/weather.dm @@ -137,7 +137,7 @@ for(var/mob/M in player_list) // Don't need to care about clientless mobs. if(M.z in our_planet.expected_z_levels) var/turf/T = get_turf(M) - if(T.outdoors == OUTDOORS_NO) + if(!T.is_outdoors()) continue to_chat(M, message) @@ -213,7 +213,7 @@ // Otherwise they should hear some sounds, depending on if they're inside or not. var/turf/T = get_turf(M) if(istype(T)) - if(T.outdoors == OUTDOORS_YES) // Mob is currently outdoors. + if(T.is_outdoors()) // Mob is currently outdoors. hear_outdoor_sounds(M, TRUE) hear_indoor_sounds(M, FALSE)