Files
Aurora.3/code/__defines/ZAS.dm
Lohikar 0d08d096f0 Fix MultiZAS (#2614)
changes:

MultiZAS now actually works.
The ZAS connection diagnostic verb is now aware of MultiZ.
Potential performance improvement for ZAS connections.
Probably should not be merged until shuttles have roofs unless people want to take their chances at outrunning ZAS getting off the shuttle.
2017-06-10 22:38:41 +03:00

97 lines
2.0 KiB
Plaintext

//#define ZASDBG
//#define MULTIZAS
#define AIR_BLOCKED 1
#define ZONE_BLOCKED 2
#define BLOCKED 3
#define ZONE_MIN_SIZE 14 //zones with less than this many turfs will always merge, even if the connection is not direct
#define CANPASS_ALWAYS 1
#define CANPASS_DENSITY 2
#define CANPASS_PROC 3
#define CANPASS_NEVER 4
#ifdef MULTIZAS
#define ATMOS_CANPASS_TURF(ret,A,B) \
if (A.blocks_air & AIR_BLOCKED || B.blocks_air & AIR_BLOCKED) { \
ret = BLOCKED; \
} \
else if (B.z != A.z) { \
if (B.z < A.z) { \
if (!istype(A, /turf/simulated/open)) { \
ret = BLOCKED; \
} \
} \
else { \
if (!istype(B, /turf/simulated/open)) { \
ret = BLOCKED; \
} \
} \
} \
else if (A.blocks_air & ZONE_BLOCKED || B.blocks_air & ZONE_BLOCKED) { \
ret = (A.z == B.z) ? ZONE_BLOCKED : AIR_BLOCKED; \
} \
else if (A.contents.len) { \
ret = 0;\
for (var/thing in A) { \
var/atom/movable/AM = thing; \
switch (AM.atmos_canpass) { \
if (CANPASS_ALWAYS) { \
continue; \
} \
if (CANPASS_DENSITY) { \
if (AM.density) { \
ret |= AIR_BLOCKED; \
} \
} \
if (CANPASS_PROC) { \
ret |= AM.c_airblock(B); \
} \
if (CANPASS_NEVER) { \
ret = BLOCKED; \
} \
} \
if (ret == BLOCKED) { \
break;\
}\
}\
}
#else
#define ATMOS_CANPASS_TURF(ret,A,B) \
if (A.blocks_air & AIR_BLOCKED || B.blocks_air & AIR_BLOCKED) { \
ret = BLOCKED; \
} \
else if (A.blocks_air & ZONE_BLOCKED || B.blocks_air & ZONE_BLOCKED) { \
ret = ZONE_BLOCKED; \
} \
else if (A.contents.len) { \
ret = 0;\
for (var/thing in A) { \
var/atom/movable/AM = thing; \
switch (AM.atmos_canpass) { \
if (CANPASS_ALWAYS) { \
continue; \
} \
if (CANPASS_DENSITY) { \
if (AM.density) { \
ret |= AIR_BLOCKED; \
} \
} \
if (CANPASS_PROC) { \
ret |= AM.c_airblock(B); \
} \
if (CANPASS_NEVER) { \
ret = BLOCKED; \
} \
} \
if (ret == BLOCKED) { \
break;\
}\
}\
}
#endif