Skip to content

Commit

Permalink
Makes atmos treat atmos_adjacent_turfs as a list
Browse files Browse the repository at this point in the history
  • Loading branch information
MrStonedOne committed Feb 14, 2016
1 parent 8893042 commit 15e080b
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions code/modules/atmospherics/environmental/LINDA_system.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,47 +67,38 @@
var/turf/T = get_step(src, direction)
if(!istype(T))
continue
var/counterdir = get_dir(T, src)
if(CanAtmosPass(T))
atmos_adjacent_turfs_amount += 1
atmos_adjacent_turfs |= direction
if(!(T.atmos_adjacent_turfs & counterdir))
atmos_adjacent_turfs |= T
if(!(src in T.atmos_adjacent_turfs))
T.atmos_adjacent_turfs_amount += 1
T.atmos_adjacent_turfs |= counterdir
T.atmos_adjacent_turfs |= src
else
atmos_adjacent_turfs &= ~direction
if(T.atmos_adjacent_turfs & counterdir)
atmos_adjacent_turfs -= T
if(src in T.atmos_adjacent_turfs)
T.atmos_adjacent_turfs_amount -= 1
T.atmos_adjacent_turfs &= ~counterdir
T.atmos_adjacent_turfs -= src

//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
/turf/proc/GetAtmosAdjacentTurfs(alldir = 0)
if (!istype(src, /turf/simulated))
return list()

var/adjacent_turfs = list()

var/turf/simulated/curloc = src
for (var/direction in cardinal)
if(!(curloc.atmos_adjacent_turfs & direction))
continue

var/turf/simulated/S = get_step(curloc, direction)
if (istype(S))
adjacent_turfs += S

var/adjacent_turfs = atmos_adjacent_turfs.Copy()
if (!alldir)
return adjacent_turfs
return adjacent_turfs()
var/turf/simulated/curloc = src

for (var/direction in diagonals)
var/matchingDirections = 0
var/turf/simulated/S = get_step(curloc, direction)

for (var/checkDirection in cardinal)
if(!(S.atmos_adjacent_turfs & checkDirection))
continue
var/turf/simulated/checkTurf = get_step(S, checkDirection)
if(!(checkTurf in S.atmos_adjacent_turfs))
continue

if (checkTurf in adjacent_turfs)
matchingDirections++
Expand Down Expand Up @@ -190,4 +181,4 @@ var/const/SPAWN_AIR = 256
new_gases["n2"][MOLES] += MOLES_N2STANDARD * amount

air.merge(G)
SSair.add_to_active(src, 0)
SSair.add_to_active(src, 0)

0 comments on commit 15e080b

Please sign in to comment.