Starts work on unbreaking CanPass()

This commit is contained in:
Neerti
2019-02-09 20:45:49 -05:00
parent 33efaed83c
commit d880379bbf
10 changed files with 91 additions and 29 deletions

View File

@@ -1,6 +1,28 @@
/atom/var/pressure_resistance = ONE_ATMOSPHERE
/atom/var/can_atmos_pass = ATMOS_PASS_YES
// Used to determine if airflow/zones can pass this atom.
/atom/proc/CanZASPass(turf/T, is_zone)
switch(can_atmos_pass)
if(ATMOS_PASS_PROC)
return ATMOS_PASS_YES
if(ATMOS_PASS_DENSITY)
return !density
else
return can_atmos_pass
// return (!density || is_zone)
/*
/atom/proc/CanAtmosPass(turf/T)
switch (CanAtmosPass)
if (ATMOS_PASS_PROC)
return ATMOS_PASS_YES
if (ATMOS_PASS_DENSITY)
return !density
else
return CanAtmosPass
/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.
@@ -9,13 +31,21 @@
//Outputs: Boolean if can pass.
return (!density || !height || air_group)
*/
// Used to see if objects can freely move past this atom.
// Airflow and ZAS zones now uses CanZASPass() instead.
/atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0)
return !density
/turf/can_atmos_pass = ATMOS_PASS_NO
/turf/CanPass(atom/movable/mover, turf/target, height=1.5,air_group=0)
if(!target) return 0
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
@@ -29,6 +59,19 @@
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)
@@ -46,12 +89,18 @@
// AIR_BLOCKED - Blocked
// ZONE_BLOCKED - Not blocked, but zone boundaries will not cross.
// BLOCKED - Blocked, zone boundaries will not cross even if opened.
/*
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))
*/
atom/proc/c_airblock(turf/other)
#ifdef ZASDBG
ASSERT(isturf(other))
#endif
return (AIR_BLOCKED*!CanZASPass(other, FALSE))|(ZONE_BLOCKED*!CanZASPass(other, TRUE))
turf/c_airblock(turf/other)
#ifdef ZASDBG

View File

@@ -93,3 +93,10 @@
#define ATMOSTANK_CO2 25000 // CO2 and PH are not critically important for station, only for toxins and alternative coolants, no need to store a lot of those.
#define ATMOSTANK_PHORON 25000
#define ATMOSTANK_NITROUSOXIDE 10000 // N2O doesn't have a real useful use, i guess it's on station just to allow refilling of sec's riot control canisters?
// Used for quickly making certain things allow airflow or not.
// More complicated, conditional abilities for airflow should use ATMOS_PASS_PROC and override CanZASPass().
#define ATMOS_PASS_YES 1
#define ATMOS_PASS_NO 0
#define ATMOS_PASS_PROC -1 // Asks CanZASPass()
#define ATMOS_PASS_DENSITY -2 // Just checks density.

View File

@@ -48,13 +48,10 @@
qdel(src)
return
/obj/machinery/optable/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group || (height==0)) return 1
/obj/machinery/optable/CanPass(atom/movable/mover, turf/target)
if(istype(mover) && mover.checkpass(PASSTABLE))
return 1
else
return 0
return TRUE
return FALSE
/obj/machinery/optable/MouseDrop_T(obj/O as obj, mob/user as mob)

View File

@@ -750,7 +750,7 @@ About the new airlock wires panel:
if (user)
src.attack_ai(user)
/obj/machinery/door/airlock/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
/obj/machinery/door/airlock/CanPass(atom/movable/mover, turf/target)
if (src.isElectrified())
if (istype(mover, /obj/item))
var/obj/item/i = mover

View File

@@ -259,12 +259,14 @@
if(stat & BROKEN)
stat &= ~BROKEN
/obj/machinery/door/blast/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group) return 1
/*
// This replicates the old functionality coded into CanPass() for this object, however it appeared to have made blast doors not airtight.
// If for some reason this is actually needed for something important, uncomment this.
/obj/machinery/door/blast/CanZASPass(turf/T, is_zone)
if(is_zone)
return TRUE
return ..()
*/
// SUBTYPE: Regular
// Your classical blast door, found almost everywhere.

View File

@@ -9,6 +9,7 @@
anchored = 1
opacity = 1
density = 1
can_atmos_pass = ATMOS_PASS_DENSITY
layer = DOOR_OPEN_LAYER
var/open_layer = DOOR_OPEN_LAYER
var/closed_layer = DOOR_CLOSED_LAYER
@@ -135,13 +136,16 @@
else
do_animate("deny")
/obj/machinery/door/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group) return !block_air_zones
/obj/machinery/door/CanPass(atom/movable/mover, turf/target)
if(istype(mover) && mover.checkpass(PASSGLASS))
return !opacity
return !density
/*
/obj/machinery/door/CanZASPass(turf/T, is_zone)
if(is_zone)
return !block_air_zones
return ..()
*/
/obj/machinery/door/proc/bumpopen(mob/user as mob)
if(operating) return
if(user.last_airflow > world.time - vsc.airflow_delay) //Fakkit

View File

@@ -25,6 +25,7 @@
density = 1
anchored = 1
opacity = 0
can_atmos_pass = ATMOS_PASS_DENSITY
icon = 'icons/obj/inflatable.dmi'
icon_state = "wall"
@@ -40,9 +41,6 @@
update_nearby_tiles()
return ..()
/obj/structure/inflatable/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
return 0
/obj/structure/inflatable/bullet_act(var/obj/item/projectile/Proj)
var/proj_damage = Proj.get_structure_damage()
if(!proj_damage) return
@@ -168,9 +166,7 @@
/obj/structure/inflatable/door/attack_hand(mob/user as mob)
return TryToSwitchState(user)
/obj/structure/inflatable/door/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
if(air_group)
return state
/obj/structure/inflatable/door/CanPass(atom/movable/mover, turf/target)
if(istype(mover, /obj/effect/beam))
return !opacity
return !density

View File

@@ -47,20 +47,27 @@ var/list/blobs = list()
set_light(0)
/obj/structure/blob/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
world << "/obj/structure/blob/CanPass(mover=[mover], target=[target], height=[height], air_group=[air_group]) called on [src]."
if(air_group || (height==0))
world << "Returned true due to being air group or having height=0"
return TRUE
if(istype(mover) && mover.checkpass(PASSBLOB))
world << "Returned true due to having PASSBLOB."
return TRUE
else if(istype(mover, /mob/living))
var/mob/living/L = mover
if(L.faction == "blob")
world << "Returned true due to being in blob faction."
return TRUE
else if(istype(mover, /obj/item/projectile))
var/obj/item/projectile/P = mover
if(P.firer && P.firer.faction == "blob")
world << "Returned true due to being a projectile fired by someone in blob faction."
return TRUE
world << "Returned false due to being a projectile, with firer not in faction."
return FALSE
else
world << "Returned false."
return FALSE
// return ..()

View File

@@ -1,7 +1,4 @@
/mob/CanPass(atom/movable/mover, turf/target, height, air_group)
if(air_group || (height == 0))
return TRUE
if(ismob(mover))
var/mob/moving_mob = mover
if ((other_mobs && moving_mob.other_mobs))
@@ -10,3 +7,6 @@
var/obj/item/projectile/P = mover
return !P.can_hit_target(src, P.permutated, src == P.original, TRUE)
return (!mover.density || !density || lying)
/mob/CanZASPass(turf/T, is_zone)
return TRUE

View File

@@ -2629,7 +2629,7 @@
#include "code\ZAS\Zone.dm"
#include "interface\interface.dm"
#include "interface\skin.dmf"
#include "maps\southern_cross\southern_cross.dm"
#include "maps\example\example.dm"
#include "maps\submaps\space_submaps\space.dm"
#include "maps\submaps\surface_submaps\mountains\mountains.dm"
#include "maps\submaps\surface_submaps\mountains\mountains_areas.dm"