Fixes Indoor Rain

This commit is contained in:
Neerti
2021-07-12 14:19:59 -04:00
parent 9932e13f6d
commit 6b4ee972dd
11 changed files with 32 additions and 27 deletions

View File

@@ -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
T.vis_contents |= P.weather_holder.visuals
T.vis_contents |= P.weather_holder.special_visuals

View File

@@ -215,7 +215,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

View File

@@ -45,10 +45,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)

View File

@@ -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()

View File

@@ -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

View File

@@ -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.

View File

@@ -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

View File

@@ -43,7 +43,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)
@@ -146,7 +146,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)

View File

@@ -146,7 +146,7 @@
. += turf_move_cost
// Wind makes it easier or harder to move, depending on if you're with or against the wind.
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

View File

@@ -299,7 +299,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
@@ -352,7 +352,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
@@ -410,7 +410,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
@@ -506,7 +506,7 @@ var/datum/planet/sif/planet_sif = null
var/mob/living/L = thing
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))
@@ -544,7 +544,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))
@@ -558,5 +558,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))

View File

@@ -123,7 +123,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)
@@ -200,7 +200,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)