[MIRROR] Adds optional area-based definition for outdoors-ness

This commit is contained in:
Chompstation Bot
2021-08-01 15:41:46 +00:00
parent 1a38674550
commit 21b6022a3a
26 changed files with 3346 additions and 58 deletions

View File

@@ -22,3 +22,9 @@
#define IS_OPAQUE_TURF(turf) (turf.directional_opacity == ALL_CARDINALS)
#define IS_OPAQUE_TURF_DIR(turf, dir) (turf.directional_opacity & dir)
#define FOOTSTEP_SPRITE_AMT 2
// Used to designate if a turf (or its area) should initialize as outdoors or not.
#define OUTDOORS_YES 1 // This being 1 helps with backwards compatibility.
#define OUTDOORS_NO 0 // Ditto.
#define OUTDOORS_AREA -1 // If a turf has this, it will defer to the area's settings on init.
// Note that after init, it will be either YES or NO.

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

View File

@@ -18,7 +18,7 @@
/obj/item/mecha_parts/mecha_equipment/weapon/ballistic/mortar/action_checks(atom/target)
var/turf/MT = get_turf(chassis)
var/turf/TT = get_turf(target)
if(!MT.outdoors || !TT.outdoors)
if(!MT.outdoors || !TT.is_outdoors())
to_chat(chassis.occupant, "<span class='notice'>\The [src]'s control system prevents you from firing due to a blocked firing arc.</span>")
return 0
return ..()

View File

@@ -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)
else if(candidate && !candidate.is_outdoors())
safety--
continue
else

View File

@@ -46,10 +46,10 @@
return
// Create a ceiling to shield from the weather
if(src.outdoors)
if(src.is_outdoors())
for(var/dir in cardinal)
var/turf/A = get_step(src, dir)
if(A && !A.outdoors)
if(A && !A.is_outdoors())
if(expended_tile || R.use(1))
make_indoors()
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)

View File

@@ -87,7 +87,7 @@ var/image/no_ceiling_image = null
// Show 'ceilingless' overlay.
var/turf/above = GetAbove(src)
if(above && isopenspace(above) && !istype(src, /turf/simulated/floor/outdoors)) // This won't apply to outdoor turfs since its assumed they don't have a ceiling anyways.
if(!is_outdoors() && above && isopenspace(above)) // This won't apply to outdoor turfs since its assumed they don't have a ceiling anyways.
add_overlay(no_ceiling_image)
// Update our 'them-to-us' edges, aka edges from external turfs we feel should spill onto us

View File

@@ -17,11 +17,11 @@
initial_flooring = /decl/flooring/lava // Defining this in case someone DOES step on lava and survive. Somehow.
/turf/simulated/floor/lava/outdoors
outdoors = TRUE
outdoors = OUTDOORS_YES
// For maximum pedantry.
/turf/simulated/floor/lava/Initialize()
if(!outdoors)
if(!is_outdoors())
name = "magma"
update_icon()
update_light()

View File

@@ -1,11 +1,16 @@
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
// Outdoors var determines if the game should consider the turf to be 'outdoors', which controls certain things such as weather effects.
var/outdoors = FALSE
var/outdoors = OUTDOORS_AREA
/area
// If a turf's `outdoors` variable is set to `OUTDOORS_AREA`,
// it will decide if it's outdoors or not when being initialized based on this var.
var/outdoors = OUTDOORS_NO
/turf/simulated/floor/outdoors
name = "generic ground"
@@ -13,7 +18,7 @@ var/list/turf_edge_cache = list()
icon = 'icons/turf/outdoors.dmi'
icon_state = null
edge_blending_priority = 1
outdoors = TRUE // This variable is used for weather effects.
outdoors = OUTDOORS_YES // This variable is used for weather effects.
can_dirty = FALSE // Looks hideous with dirt on it.
can_build_into_floor = TRUE
@@ -21,31 +26,51 @@ var/list/turf_edge_cache = list()
var/list/turf_layers = list(/turf/simulated/floor/outdoors/rocks)
/turf/simulated/floor/Initialize(mapload)
if(outdoors)
if(is_outdoors())
SSplanets.addTurf(src)
. = ..()
/turf/simulated/floor/Destroy()
if(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/proc/is_outdoors()
return FALSE
/turf/simulated/is_outdoors()
switch(outdoors)
if(OUTDOORS_YES)
return TRUE
if(OUTDOORS_NO)
return FALSE
if(OUTDOORS_AREA)
var/area/A = loc
if(A.outdoors == OUTDOORS_YES)
return TRUE
return FALSE
/// Makes the turf explicitly outdoors.
/turf/simulated/proc/make_outdoors()
if(outdoors)
if(is_outdoors()) // Already outdoors.
return
outdoors = TRUE
outdoors = OUTDOORS_YES
SSplanets.addTurf(src)
/// Makes the turf explicitly indoors.
/turf/simulated/proc/make_indoors()
if(!outdoors)
if(!is_outdoors()) // Already indoors.
return
outdoors = FALSE
outdoors = OUTDOORS_NO
SSplanets.removeTurf(src)
/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)
if(is_outdoors())
make_outdoors()
else
make_indoors()

View File

@@ -4,7 +4,7 @@
desc = "Hope you don't have a fear of heights."
icon = 'icons/turf/floors.dmi'
icon_state = "sky_slow"
outdoors = TRUE
outdoors = OUTDOORS_YES
// Assume there's a vacuum for the purposes of avoiding active edges at initialization, as well as ZAS fun if a window breaks.
oxygen = 0

View File

@@ -171,7 +171,7 @@
return
// Create a ceiling to shield from the weather
if(outdoors)
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

@@ -8,7 +8,7 @@
var/under_state = "rock"
edge_blending_priority = -1
movement_cost = 4
outdoors = TRUE
outdoors = OUTDOORS_YES
layer = WATER_FLOOR_LAYER
@@ -106,12 +106,12 @@
name = "pool"
desc = "Don't worry, it's not closed."
under_state = "pool"
outdoors = FALSE
outdoors = OUTDOORS_NO
/turf/simulated/floor/water/deep/pool
name = "deep pool"
desc = "Don't worry, it's not closed."
outdoors = FALSE
outdoors = OUTDOORS_NO
/mob/living/proc/can_breathe_water()
return FALSE

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)
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)
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) // They're inside.
if(!T.is_outdoors()) // They're inside.
to_chat(usr, "You see nothing interesting.")
return

View File

@@ -100,7 +100,7 @@
var/list/all_turfs = block(locate(1, 1, min), locate(world.maxx, world.maxy, max))
var/list/turfs_to_use = list()
for(var/turf/T as anything in all_turfs)
if(T.outdoors)
if(T.is_outdoors())
turfs_to_use += T
if(!turfs_to_use.len)

View File

@@ -86,7 +86,7 @@
var/num = 0
for(var/mob/living/L in player_list)
var/turf/T = get_turf(L)
if(istype(T) && !istype(T, /turf/space) && T.outdoors)
if(istype(T) && !istype(T, /turf/space) && T.is_outdoors())
. += assess_player_activity(L)
num++
if(num)

View File

@@ -6,7 +6,7 @@
var/num = 0
for(var/mob/living/L in player_list)
var/turf/T = get_turf(L)
if(istype(T) && !istype(T, /turf/space) && T.outdoors)
if(istype(T) && !istype(T, /turf/space) && T.is_outdoors())
if(assess_player_activity(L) >= cutoff)
num++
return num

View File

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

@@ -167,7 +167,7 @@
// I don't like that so I'm commenting it out :)
// VOREstation Edit Start
/*
if(T.outdoors && (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

@@ -136,7 +136,8 @@
if(stat != DEAD && cell)
// TODO generalize solar occlusion to charge from the actual sun.
var/new_recharge_state = istype(loc, /turf/simulated/floor/outdoors) || /*, /turf/exterior) */ istype(loc, /turf/space)
var/turf/T = get_turf(src)
var/new_recharge_state = T?.is_outdoors() || isspace(T)
if(new_recharge_state != last_recharge_state)
last_recharge_state = new_recharge_state
if(last_recharge_state)

View File

@@ -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)
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)
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)
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)
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)
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)
if(T.is_outdoors())
SSradiation.radiate(T, rand(fallout_rad_low, fallout_rad_high))

View File

@@ -276,7 +276,7 @@ var/datum/planet/virgo3b/planet_virgo3b = 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)
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
@@ -327,7 +327,7 @@ var/datum/planet/virgo3b/planet_virgo3b = 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)
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
@@ -383,7 +383,7 @@ var/datum/planet/virgo3b/planet_virgo3b = 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)
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
@@ -474,7 +474,7 @@ var/datum/planet/virgo3b/planet_virgo3b = 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)
if(!T.is_outdoors())
continue // They're indoors, so no need to burn them with ash.
L.inflict_heat_damage(rand(1, 3))
@@ -511,7 +511,7 @@ var/datum/planet/virgo3b/planet_virgo3b = null
if(L.z in holder.our_planet.expected_z_levels)
irradiate_nearby_turf(L)
var/turf/T = get_turf(L)
if(!T.outdoors)
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))
@@ -525,6 +525,6 @@ var/datum/planet/virgo3b/planet_virgo3b = null
var/turf/T = pick(turfs) // We get one try per tick.
if(!istype(T))
return
if(T.outdoors)
if(T.is_outdoors())
SSradiation.radiate(T, rand(fallout_rad_low, fallout_rad_high))

View File

@@ -255,7 +255,7 @@ var/datum/planet/virgo4/planet_virgo4 = 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)
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
@@ -301,7 +301,7 @@ var/datum/planet/virgo4/planet_virgo4 = 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)
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
@@ -354,7 +354,7 @@ var/datum/planet/virgo4/planet_virgo4 = 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)
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
@@ -447,7 +447,7 @@ var/datum/planet/virgo4/planet_virgo4 = 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)
if(!T.is_outdoors())
continue // They're indoors, so no need to burn them with ash.
L.inflict_heat_damage(rand(1, 3))
@@ -484,7 +484,7 @@ var/datum/planet/virgo4/planet_virgo4 = null
if(L.z in holder.our_planet.expected_z_levels)
irradiate_nearby_turf(L)
var/turf/T = get_turf(L)
if(!T.outdoors)
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))
@@ -498,7 +498,7 @@ var/datum/planet/virgo4/planet_virgo4 = null
var/turf/T = pick(turfs) // We get one try per tick.
if(!istype(T))
return
if(T.outdoors)
if(T.is_outdoors())
SSradiation.radiate(T, rand(fallout_rad_low, fallout_rad_high))
/turf/unsimulated/wall/planetary/normal/virgo4

View File

@@ -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)
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) // Mob is currently outdoors.
if(T.is_outdoors()) // Mob is currently outdoors.
hear_outdoor_sounds(M, TRUE)
hear_indoor_sounds(M, FALSE)

View File

@@ -24,7 +24,9 @@
// continue // Not on the right z-level.
if(L.stat)
continue // Don't want dead people.
if(istype(get_turf(L), /turf/simulated/floor/outdoors) && istype(get_area(L),/area/surface/outside/wilderness))
var/turf/T = get_turf(L)
var/area/A = get_area(L)
if(T?.is_outdoors() && istype(A, /area/tether/outpost/exploration_plains)) // VOREStation Edit
potential_victims += L
if(potential_victims.len)

File diff suppressed because it is too large Load Diff

View File

@@ -24,19 +24,19 @@
oxygen = MOLES_O2SIF
nitrogen = MOLES_N2SIF
temperature = TEMPERATURE_SIF
outdoors = TRUE
outdoors = OUTDOORS_YES
/turf/simulated/floor/tiled/steel/sif/planetuse
oxygen = MOLES_O2SIF
nitrogen = MOLES_N2SIF
temperature = TEMPERATURE_SIF
outdoors = TRUE
outdoors = OUTDOORS_YES
/turf/simulated/floor/plating/sif/planetuse
oxygen = MOLES_O2SIF
nitrogen = MOLES_N2SIF
temperature = TEMPERATURE_SIF
outdoors = TRUE
outdoors = OUTDOORS_YES
/turf/simulated/floor/outdoors/snow/sif/planetuse
oxygen = MOLES_O2SIF