Rewrites Atmospherics

This commit is contained in:
Anewbe
2019-02-10 17:32:39 -06:00
committed by Novacat
parent 6d4ea26332
commit 8ed384b38c
49 changed files with 633 additions and 640 deletions

View File

@@ -1,34 +1,46 @@
/atom/var/pressure_resistance = ONE_ATMOSPHERE
/atom/var/can_atmos_pass = ATMOS_PASS_YES
/atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0)
//Purpose: Determines if the object (or airflow) can pass this atom.
//Called by: Movement, airflow.
//Inputs: The moving atom (optional), target turf, "height" and air group
//Outputs: Boolean if can pass.
// Purpose: Determines if the object can pass this atom.
// Called by: Movement.
// Inputs: The moving atom, target turf.
// Outputs: Boolean if can pass.
// Airflow and ZAS zones now uses CanZASPass() instead of this proc.
/atom/proc/CanPass(atom/movable/mover, turf/target)
return !density
return (!density || !height || air_group)
// Purpose: Determines if airflow is allowed between T and loc.
// Called by: Airflow.
// Inputs: The turf the airflow is from, which may not be the same as loc. is_zone is for conditionally disallowing merging.
// Outputs: Boolean if airflow can pass.
/atom/proc/CanZASPass(turf/T, is_zone)
switch(can_atmos_pass)
if(ATMOS_PASS_DENSITY)
return !density
else
return can_atmos_pass
/turf/CanPass(atom/movable/mover, turf/target, height=1.5,air_group=0)
if(!target) return 0
/turf/can_atmos_pass = ATMOS_PASS_NO
/turf/CanPass(atom/movable/mover, turf/target)
if(!target) return FALSE
if(istype(mover)) // turf/Enter(...) will perform more advanced checks
return !density
else // Now, doing more detailed checks for air movement and air group formation
if(target.blocks_air||blocks_air)
return 0
for(var/obj/obstacle in src)
if(!obstacle.CanPass(mover, target, height, air_group))
return 0
if(target != src)
for(var/obj/obstacle in target)
if(!obstacle.CanPass(mover, src, height, air_group))
return 0
return 1
/turf/CanZASPass(turf/T, is_zone)
if(T.blocks_air || src.blocks_air)
return FALSE
for(var/obj/obstacle in src)
if(!obstacle.CanZASPass(T, is_zone))
return FALSE
if(T != src)
for(var/obj/obstacle in T)
if(!obstacle.CanZASPass(src, is_zone))
return FALSE
return TRUE
//Convenience function for atoms to update turfs they occupy
/atom/movable/proc/update_nearby_tiles(need_rebuild)
@@ -50,8 +62,7 @@ atom/proc/c_airblock(turf/other)
#ifdef ZASDBG
ASSERT(isturf(other))
#endif
return (AIR_BLOCKED*!CanPass(null, other, 0, 0))|(ZONE_BLOCKED*!CanPass(null, other, 1.5, 1))
return (AIR_BLOCKED*!CanZASPass(other, FALSE))|(ZONE_BLOCKED*!CanZASPass(other, TRUE))
turf/c_airblock(turf/other)
#ifdef ZASDBG