mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Miscellaneous ZAS Fixes and Optimizations (#8396)
This commit is contained in:
@@ -113,7 +113,7 @@ If it gains pressure too slowly, it may leak or just rupture instead of explodin
|
||||
icon = 'icons/effects/fire.dmi'
|
||||
icon_state = "1"
|
||||
light_color = "#ED9200"
|
||||
layer = TURF_LAYER
|
||||
layer = GASFIRE_LAYER // CHOMPEdit
|
||||
|
||||
var/firelevel = 1 //Calculated by gas_mixture.calculate_firelevel()
|
||||
|
||||
|
||||
@@ -1,3 +1,21 @@
|
||||
// CHOMPAdd
|
||||
#define GET_ZONE_NEIGHBOURS(T, ret) \
|
||||
ret = 0; \
|
||||
if (T.zone) { \
|
||||
for (var/_gzn_dir in GLOB.gzn_check) { \
|
||||
var/turf/simulated/other = get_step(T, _gzn_dir); \
|
||||
if (istype(other) && other.zone == T.zone) { \
|
||||
var/block; \
|
||||
ATMOS_CANPASS_TURF(block, other, T); \
|
||||
if (!(block & AIR_BLOCKED)) { \
|
||||
ret |= _gzn_dir; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
// CHOMPEnd
|
||||
|
||||
/turf/simulated/var/zone/zone
|
||||
/turf/simulated/var/open_directions
|
||||
|
||||
@@ -52,8 +70,8 @@
|
||||
*/
|
||||
|
||||
/turf/simulated/proc/can_safely_remove_from_zone()
|
||||
|
||||
|
||||
// CHOMPEdit Start
|
||||
/*
|
||||
if(!zone) return 1
|
||||
|
||||
var/check_dirs = get_zone_neighbours(src)
|
||||
@@ -64,15 +82,36 @@
|
||||
#else
|
||||
var/to_check = cornerdirs
|
||||
#endif
|
||||
*/
|
||||
|
||||
for(var/dir in to_check)
|
||||
if(!zone)
|
||||
return TRUE
|
||||
|
||||
var/check_dirs
|
||||
GET_ZONE_NEIGHBOURS(src, check_dirs)
|
||||
|
||||
if (!(. & (. - 1)))
|
||||
return TRUE
|
||||
|
||||
for(var/dir in GLOB.csrfz_check) // CHOMPEdit
|
||||
//for each pair of "adjacent" cardinals (e.g. NORTH and WEST, but not NORTH and SOUTH)
|
||||
if((dir & check_dirs) == dir)
|
||||
/*
|
||||
//check that they are connected by the corner turf
|
||||
var/connected_dirs = get_zone_neighbours(get_step(src, dir))
|
||||
if(connected_dirs && (dir & reverse_dir[connected_dirs]) == dir)
|
||||
unconnected_dirs &= ~dir //they are, so unflag the cardinals in question
|
||||
*/
|
||||
var/turf/simulated/T = get_step(src, dir)
|
||||
if (!istype(T))
|
||||
. &= ~dir
|
||||
continue
|
||||
|
||||
var/connected_dirs
|
||||
GET_ZONE_NEIGHBOURS(T, connected_dirs)
|
||||
if(connected_dirs && (dir & GLOB.reverse_dir[connected_dirs]) == dir)
|
||||
. &= ~dir //they are, so unflag the cardinals in question
|
||||
/*
|
||||
//it is safe to remove src from the zone if all cardinals are connected by corner turfs
|
||||
return !unconnected_dirs
|
||||
|
||||
@@ -89,6 +128,9 @@
|
||||
var/turf/simulated/other = get_step(T, dir)
|
||||
if(istype(other) && other.zone == T.zone && !(other.c_airblock(T) & AIR_BLOCKED) && get_dist(src, other) <= 1)
|
||||
. |= dir
|
||||
*/
|
||||
return !.
|
||||
// CHOMPEdit End
|
||||
|
||||
/turf/simulated/update_air_properties()
|
||||
|
||||
@@ -96,7 +138,8 @@
|
||||
c_copy_air()
|
||||
zone = null //Easier than iterating through the list at the zone.
|
||||
|
||||
var/s_block = c_airblock(src)
|
||||
var/s_block // CHOMPEdit
|
||||
ATMOS_CANPASS_TURF(s_block, src, src)
|
||||
if(s_block & AIR_BLOCKED)
|
||||
#ifdef ZASDBG
|
||||
if(verbose) to_world("Self-blocked.")
|
||||
@@ -106,6 +149,7 @@
|
||||
var/zone/z = zone
|
||||
|
||||
if(can_safely_remove_from_zone()) //Helps normal airlocks avoid rebuilding zones all the time
|
||||
c_copy_air() // CHOMPAdd
|
||||
z.remove(src)
|
||||
else
|
||||
z.rebuild()
|
||||
|
||||
Reference in New Issue
Block a user