Skip to content

Commit

Permalink
Replaces CANVERTICALATMOSPASS with a CANATMOSPASS that does both
Browse files Browse the repository at this point in the history
  • Loading branch information
covertcorvid committed Aug 11, 2024
1 parent e89242a commit faf2f34
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 22 deletions.
4 changes: 1 addition & 3 deletions code/__DEFINES/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@

#define ATMOS_ADJACENT_ANY (1<<0)
#define ATMOS_ADJACENT_FIRELOCK (1<<1)
//#define CANATMOSPASS(A, O, V) ( A.can_atmos_pass == ATMOS_PASS_PROC ? A.can_atmos_pass(O, V) : ( A.can_atmos_pass == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass ) )

#ifdef TESTING
GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
Expand All @@ -160,8 +159,7 @@ GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
//Use this to see if a turf is fully blocked or not, think windows or firelocks. Fails with 1x1 non full tile windows, but it's not worth the cost.
#define TURF_SHARES(T) (LAZYLEN(T.atmos_adjacent_turfs))

#define CANATMOSPASS(A, O) ( A.CanAtmosPass == ATMOS_PASS_PROC ? A.CanAtmosPass(O) : ( A.CanAtmosPass == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPass ) )
#define CANVERTICALATMOSPASS(A, O) ( A.CanAtmosPassVertical == ATMOS_PASS_PROC ? A.CanAtmosPass(O, TRUE) : ( A.CanAtmosPassVertical == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPassVertical ) )
#define CANATMOSPASS(A, O, V) ( A.CanAtmosPass == ATMOS_PASS_PROC ? A.CanAtmosPass(O, V) : ( A.CanAtmosPass == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPass ) )

///Used to define the temperature of a tile, arg is the temperature it should be at. Should always be put at the end of the atmos list.
///This is solely to be used after compile-time.
Expand Down
36 changes: 17 additions & 19 deletions code/modules/atmospherics/environmental/LINDA_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,30 @@

/turf/open/CanAtmosPass(turf/T, vertical = FALSE)
var/dir = vertical? get_dir_multiz(src, T) : get_dir(src, T)
var/opposite_dir = REVERSE_DIR(dir)
. = TRUE
if(vertical && !(zAirOut(dir, T) && T.zAirIn(dir, src)))
. = FALSE
if(blocks_air || T.blocks_air)
. = FALSE
//This path is a bit weird, if we're just checking with ourselves no sense asking objects on the turf
if (T == src)
return .

//Can't just return if false here, we need to set superconductivity
for(var/obj/O in contents+T.contents)
var/turf/other = (O.loc == src ? T : src)
if(!(vertical? (CANVERTICALATMOSPASS(O, other)) : (CANATMOSPASS(O, other))))
. = FALSE
if(CANATMOSPASS(O, other, vertical))
continue
. = FALSE
if(other.block_all_conductivity())
conductivity_blocked_directions |= dir
T.conductivity_blocked_directions |= opposite_dir
return FALSE
//Superconductivity is a bitfield of directions we can't conduct with
//Yes this is really weird
conductivity_blocked_directions &= ~dir
T.conductivity_blocked_directions &= ~opposite_dir

/turf/proc/update_conductivity(turf/T)
var/dir = get_dir_multiz(src, T)
Expand All @@ -55,8 +68,7 @@
return FALSE

/turf/proc/ImmediateCalculateAdjacentTurfs()
var/canpass = CANATMOSPASS(src, src)
var/canvpass = CANVERTICALATMOSPASS(src, src)
var/canpass = CANATMOSPASS(src, src, FALSE)

conductivity_blocked_directions = 0

Expand All @@ -76,7 +88,7 @@

update_conductivity(T)

if(isopenturf(T) && !(blocks_air || T.blocks_air) && ((direction & (UP|DOWN))? (canvpass && CANVERTICALATMOSPASS(T, src)) : (canpass && CANATMOSPASS(T, src))) )
if(canpass && isopenturf(T) && !(blocks_air || T.blocks_air) && (CANATMOSPASS(T, src, direction & (UP|DOWN))))
LAZYINITLIST(atmos_adjacent_turfs)
LAZYINITLIST(T.atmos_adjacent_turfs)
atmos_adjacent_turfs[T] = other_contains_firelock | src_contains_firelock
Expand Down Expand Up @@ -108,20 +120,6 @@
LAZYNULL(atmos_adjacent_turfs)
__update_auxtools_turf_adjacency_info()

//Only gets a list of adjacencies, does NOT update
/turf/proc/get_adjacent_atmos_turfs()
. = list()
var/canpass = CANATMOSPASS(src, src)
var/canvpass = CANVERTICALATMOSPASS(src, src)

for(var/direction in GLOB.cardinals_multiz)
var/turf/T = get_step_multiz(src, direction)
if(isopenturf(T) && !(blocks_air || T.blocks_air) && ((direction & (UP|DOWN))? (canvpass && CANVERTICALATMOSPASS(T, src)) : (canpass && CANATMOSPASS(T, src))) )
.[T] = 0
else
. -= T
UNSETEMPTY(.)

//returns a list of adjacent turfs that can share air with this one.
//alldir includes adjacent diagonal tiles that can share
// air with both of the related adjacent cardinal tiles
Expand Down

0 comments on commit faf2f34

Please sign in to comment.