[MIRROR] CanPass refactor (#6527)

* CanPass refactor (#59804)

* CanPass refactor

Co-authored-by: Rohesie <rohesie@gmail.com>
This commit is contained in:
SkyratBot
2021-06-25 23:33:51 +02:00
committed by GitHub
parent c06d442632
commit a14b1dadb5
63 changed files with 171 additions and 155 deletions

View File

@@ -92,7 +92,7 @@
*/
/turf/proc/ClickCross(target_dir, border_only, target_atom = null, atom/movable/mover = null)
for(var/obj/O in src)
if((mover && O.CanPass(mover,get_step(src,target_dir))) || (!mover && !O.density))
if((mover && O.CanPass(mover, target_dir)) || (!mover && !O.density))
continue
if(O == target_atom || O == mover || (O.pass_flags_self & LETPASSTHROW)) //check if there's a dense object present on the turf
continue // LETPASSTHROW is used for anything you can click through (or the firedoor special case, see above)

View File

@@ -315,19 +315,19 @@
P.set_angle(new_angle_s)
return TRUE
///Can the mover object pass this atom, while heading for the target turf
/atom/proc/CanPass(atom/movable/mover, turf/target)
/// Whether the mover object can avoid being blocked by this atom, while arriving from (or leaving through) the border_dir.
/atom/proc/CanPass(atom/movable/mover, border_dir)
SHOULD_CALL_PARENT(TRUE)
SHOULD_BE_PURE(TRUE)
if(mover.movement_type & PHASING)
return TRUE
. = CanAllowThrough(mover, target)
. = CanAllowThrough(mover, border_dir)
// This is cheaper than calling the proc every time since most things dont override CanPassThrough
if(!mover.generic_canpass)
return mover.CanPassThrough(src, target, .)
return mover.CanPassThrough(src, REVERSE_DIR(border_dir), .)
/// Returns true or false to allow the mover to move through src
/atom/proc/CanAllowThrough(atom/movable/mover, turf/target)
/atom/proc/CanAllowThrough(atom/movable/mover, border_dir)
SHOULD_CALL_PARENT(TRUE)
//SHOULD_BE_PURE(TRUE)
if(mover.pass_flags & pass_flags_self)

View File

@@ -567,7 +567,7 @@
. = TRUE
SEND_SIGNAL(src, COMSIG_MOVABLE_CROSS, AM)
SEND_SIGNAL(AM, COMSIG_MOVABLE_CROSS_OVER, src)
return CanPass(AM, AM.loc, TRUE)
return CanPass(AM, get_dir(src, AM))
///default byond proc that is deprecated for us in lieu of signals. do not call
/atom/movable/Crossed(atom/movable/AM, oldloc)
@@ -894,13 +894,13 @@
/atom/movable/proc/move_crushed(atom/movable/pusher, force = MOVE_FORCE_DEFAULT, direction)
return FALSE
/atom/movable/CanAllowThrough(atom/movable/mover, turf/target)
/atom/movable/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(mover in buckled_mobs)
return TRUE
/// Returns true or false to allow src to move through the blocker, mover has final say
/atom/movable/proc/CanPassThrough(atom/blocker, turf/target, blocker_opinion)
/atom/movable/proc/CanPassThrough(atom/blocker, movement_dir, blocker_opinion)
SHOULD_CALL_PARENT(TRUE)
SHOULD_BE_PURE(TRUE)
return blocker_opinion
@@ -925,7 +925,7 @@
return turf
else
var/atom/movable/AM = A
if(!AM.CanPass(src) || AM.density)
if(AM.density || !AM.CanPass(src, get_dir(src, AM)))
if(AM.anchored)
return AM
dense_object_backup = AM

View File

@@ -37,7 +37,7 @@
else
return ..()
/obj/structure/barricade/CanAllowThrough(atom/movable/mover, turf/target)//So bullets will fly over and stuff.
/obj/structure/barricade/CanAllowThrough(atom/movable/mover, border_dir)//So bullets will fly over and stuff.
. = ..()
if(locate(/obj/structure/barricade) in get_turf(mover))
return TRUE

View File

@@ -166,7 +166,7 @@
if(density) //Gotta be closed my friend
move_update_air(T)
/obj/machinery/door/CanAllowThrough(atom/movable/mover, turf/target)
/obj/machinery/door/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(.)
return

View File

@@ -272,9 +272,9 @@
AddElement(/datum/element/connect_loc, loc_connections)
/obj/machinery/door/firedoor/border_only/CanAllowThrough(atom/movable/mover, turf/target)
/obj/machinery/door/firedoor/border_only/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(!(get_dir(loc, target) == dir)) //Make sure looking at appropriate border
if(!(border_dir == dir)) //Make sure looking at appropriate border
return TRUE
/obj/machinery/door/firedoor/border_only/proc/on_exit(datum/source, atom/movable/leaving, direction)

View File

@@ -111,12 +111,12 @@
do_animate("deny")
return
/obj/machinery/door/window/CanAllowThrough(atom/movable/mover, turf/target)
/obj/machinery/door/window/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(.)
return
if(get_dir(loc, target) == dir)
if(border_dir == dir)
return FALSE
if(istype(mover, /obj/structure/window))

View File

@@ -99,12 +99,11 @@
icon_state = icon_name + "[is_powered]" + "[(bloody ? "bld" : "")]" // add the blood tag at the end
return ..()
/obj/machinery/recycler/CanAllowThrough(atom/movable/AM)
/obj/machinery/recycler/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(!anchored)
return
var/move_dir = get_dir(loc, AM.loc)
if(move_dir == eat_dir)
if(border_dir == eat_dir)
return TRUE
/obj/machinery/recycler/proc/on_entered(datum/source, atom/movable/AM)

View File

@@ -504,7 +504,7 @@
return SINGULARITY_TRY_MOVE_BLOCK
/obj/machinery/shieldwall/CanAllowThrough(atom/movable/mover, turf/target)
/obj/machinery/shieldwall/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(istype(mover) && (mover.pass_flags & PASSGLASS))
return prob(20)

View File

@@ -55,7 +55,7 @@
do_transform(AM)
/obj/machinery/transformer/CanAllowThrough(atom/movable/mover, turf/target)
/obj/machinery/transformer/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
// Allows items to go through,
// to stop them from blocking the conveyor belt.

View File

@@ -105,7 +105,7 @@
var/mob/living/L = M.pulledby
L.reset_pull_offsets(M, TRUE)
if (CanPass(M, loc))
if (CanPass(M, get_dir(loc, M)))
M.Move(loc)
else
if (!check_loc && M.loc != loc)

View File

@@ -32,9 +32,9 @@
icon_state = "salt_pile"
var/safepasses = 3 //how many times can this salt pile be passed before dissipating
/obj/effect/decal/cleanable/food/salt/CanAllowThrough(atom/movable/AM, turf/target)
/obj/effect/decal/cleanable/food/salt/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(is_species(AM, /datum/species/snail))
if(is_species(mover, /datum/species/snail))
return FALSE
/obj/effect/decal/cleanable/food/salt/Bumped(atom/movable/AM)

View File

@@ -52,7 +52,7 @@
icon_state = "stickyweb2"
. = ..()
/obj/structure/spider/stickyweb/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/spider/stickyweb/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(genetic)
return
@@ -75,7 +75,7 @@
allowed_mob = allowedmob
. = ..()
/obj/structure/spider/stickyweb/genetic/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/spider/stickyweb/genetic/CanAllowThrough(atom/movable/mover, border_dir)
. = ..() //this is the normal spider web return aka a spider would make this TRUE
if(mover == allowed_mob)
return TRUE

View File

@@ -119,7 +119,7 @@
if(HAS_TRAIT(user, TRAIT_SKITTISH) && divable)
. += span_notice("If you bump into [p_them()] while running, you will jump inside.")
/obj/structure/closet/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/closet/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(wall_mounted)
return TRUE

View File

@@ -27,7 +27,7 @@
AddElement(/datum/element/climbable, climb_time = crate_climb_time, climb_stun = 0)
update_appearance()
/obj/structure/closet/crate/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/closet/crate/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(!istype(mover, /obj/structure/closet))
var/obj/structure/closet/crate/locatedcrate = locate(/obj/structure/closet/crate) in get_turf(mover)

View File

@@ -292,7 +292,7 @@
qdel(src)
return TRUE
/obj/structure/girder/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/girder/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if((mover.pass_flags & PASSGRILLE) || istype(mover, /obj/projectile))
return prob(girderpasschance)

View File

@@ -161,7 +161,7 @@
if(!shock(user, 70))
take_damage(20, BRUTE, MELEE, 1)
/obj/structure/grille/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/grille/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(!. && istype(mover, /obj/projectile))
return prob(30)

View File

@@ -58,7 +58,7 @@
max_integrity = 20
var/allow_walk = TRUE //can we pass through it on walk intent
/obj/structure/holosign/barrier/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/holosign/barrier/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(.)
return
@@ -75,7 +75,7 @@
icon = 'icons/effects/effects.dmi'
icon_state = "holosign"
/obj/structure/holosign/barrier/wetsign/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/holosign/barrier/wetsign/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(iscarbon(mover))
var/mob/living/carbon/C = mover
@@ -146,7 +146,7 @@
. = ..()
. += span_notice("The biometric scanners are <b>[force_allaccess ? "off" : "on"]</b>.")
/obj/structure/holosign/barrier/medical/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/holosign/barrier/medical/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(force_allaccess)
return TRUE
@@ -175,7 +175,7 @@
return TRUE
/obj/structure/holosign/barrier/medical/attack_hand(mob/living/user, list/modifiers)
if(CanPass(user) && !user.combat_mode)
if(!user.combat_mode && CanPass(user, get_dir(src, user)))
force_allaccess = !force_allaccess
to_chat(user, span_warning("You [force_allaccess ? "deactivate" : "activate"] the biometric scanners.")) //warning spans because you can make the station sick!
else

View File

@@ -62,7 +62,7 @@
return
return TryToSwitchState(user)
/obj/structure/mineral_door/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/mineral_door/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(istype(mover, /obj/effect/beam))
return !opacity

View File

@@ -388,7 +388,7 @@ GLOBAL_LIST_EMPTY(crematoriums)
icon_state = "morguet"
pass_flags_self = PASSTABLE
/obj/structure/tray/m_tray/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/tray/m_tray/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(.)
return

View File

@@ -75,33 +75,35 @@
return CanAStarPass(ID, to_dir, caller.pulling)
return TRUE //diseases, stings, etc can pass
/obj/structure/plasticflaps/CanAllowThrough(atom/movable/A, turf/T)
/obj/structure/plasticflaps/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(A.pass_flags & PASSFLAPS) //For anything specifically engineered to cross plastic flaps.
if(mover.pass_flags & PASSFLAPS) //For anything specifically engineered to cross plastic flaps.
return TRUE
if(istype(A) && (A.pass_flags & PASSGLASS))
if(mover.pass_flags & PASSGLASS)
return prob(60)
var/obj/structure/bed/B = A
if(istype(A, /obj/structure/bed) && (B.has_buckled_mobs() || B.density))//if it's a bed/chair and is dense or someone is buckled, it will not pass
if(istype(mover, /obj/structure/bed))
var/obj/structure/bed/bed_mover = mover
if(bed_mover.density || bed_mover.has_buckled_mobs())//if it's a bed/chair and is dense or someone is buckled, it will not pass
return FALSE
if(istype(A, /obj/structure/closet/cardboard))
var/obj/structure/closet/cardboard/C = A
if(C.move_delay)
else if(istype(mover, /obj/structure/closet/cardboard))
var/obj/structure/closet/cardboard/cardboard_mover = mover
if(cardboard_mover.move_delay)
return FALSE
if(ismecha(A))
else if(ismecha(mover))
return FALSE
else if(isliving(A)) // You Shall Not Pass!
var/mob/living/M = A
if(M.buckled && istype(M.buckled, /mob/living/simple_animal/bot/mulebot)) // mulebot passenger gets a free pass.
else if(isliving(mover)) // You Shall Not Pass!
var/mob/living/living_mover = mover
if(istype(living_mover.buckled, /mob/living/simple_animal/bot/mulebot)) // mulebot passenger gets a free pass.
return TRUE
var/ventcrawler = HAS_TRAIT(M, TRAIT_VENTCRAWLER_ALWAYS) || HAS_TRAIT(M, TRAIT_VENTCRAWLER_NUDE)
if(M.body_position == STANDING_UP && !ventcrawler && M.mob_size != MOB_SIZE_TINY) //If your not laying down, or a ventcrawler or a small creature, no pass.
return FALSE
if(living_mover.body_position == STANDING_UP && living_mover.mob_size != MOB_SIZE_TINY && !(HAS_TRAIT(living_mover, TRAIT_VENTCRAWLER_ALWAYS) || HAS_TRAIT(living_mover, TRAIT_VENTCRAWLER_NUDE)))
return FALSE //If you're not laying down, or a small creature, or a ventcrawler, then no pass.
/obj/structure/plasticflaps/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))

View File

@@ -66,11 +66,10 @@
to_chat(user, span_notice("You [anchored ? "fasten the railing to":"unfasten the railing from"] the floor."))
return TRUE
/obj/structure/railing/CanPass(atom/movable/mover, turf/target)
/obj/structure/railing/CanPass(atom/movable/mover, border_dir)
. = ..()
if(get_dir(loc, target) & dir)
var/checking = FLYING | FLOATING
return . || mover.throwing || mover.movement_type & checking
if(border_dir & dir)
return . || mover.throwing || mover.movement_type & (FLYING | FLOATING)
return TRUE
/obj/structure/railing/corner/CanPass()

View File

@@ -100,7 +100,7 @@
return
/obj/structure/table/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/table/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(.)
return
@@ -638,7 +638,7 @@
. = ..()
. += span_notice("It's held together by a couple of <b>bolts</b>.")
/obj/structure/rack/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/rack/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(.)
return

View File

@@ -28,7 +28,7 @@
QDEL_NULL(tank)
return ..()
/obj/structure/tank_holder/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/tank_holder/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(istype(mover) && mover.throwing)
return TRUE

View File

@@ -55,10 +55,10 @@
icon_state = "[facing]_[secure ? "secure_" : ""]windoor_assembly[state]"
return ..()
/obj/structure/windoor_assembly/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/windoor_assembly/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(get_dir(loc, target) == dir)
if(border_dir == dir)
return
if(istype(mover, /obj/structure/window))

View File

@@ -104,7 +104,7 @@
if(current_size >= STAGE_FIVE)
deconstruct(FALSE)
/obj/structure/window/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/window/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(.)
return
@@ -112,7 +112,7 @@
if(fulltile)
return FALSE
if(get_dir(loc, target) == dir)
if(border_dir == dir)
return FALSE
if(istype(mover, /obj/structure/window))
@@ -236,14 +236,20 @@
/obj/structure/window/proc/check_state_and_anchored(checked_state, checked_anchored)
return check_state(checked_state) && check_anchored(checked_anchored)
/obj/structure/window/proc/can_be_reached(mob/user)
if(!fulltile)
if(get_dir(user,src) & dir)
for(var/obj/O in loc)
if(!O.CanPass(user, user.loc, 1))
if(fulltile)
return TRUE
var/checking_dir = get_dir(user, src)
if(!(checking_dir & dir))
return TRUE // Only windows on the other side may be blocked by other things.
checking_dir = REVERSE_DIR(checking_dir)
for(var/obj/blocker in loc)
if(!blocker.CanPass(user, checking_dir))
return FALSE
return TRUE
/obj/structure/window/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1)
. = ..()
if(.) //received damage

View File

@@ -17,7 +17,7 @@
AddComponent(/datum/component/chasm, SSmapping.get_turf_below(src))
/// Lets people walk into chasms.
/turf/open/chasm/CanAllowThrough(atom/movable/AM, turf/target)
/turf/open/chasm/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
return TRUE

View File

@@ -200,15 +200,14 @@ GLOBAL_LIST_EMPTY(station_turfs)
if(density)
return TRUE
for(var/content in contents)
for(var/atom/movable/movable_content as anything in contents)
// We don't want to block ourselves or consider any ignored atoms.
if((content == source_atom) || (content in ignore_atoms))
if((movable_content == source_atom) || (movable_content in ignore_atoms))
continue
var/atom/atom_content = content
// If the thing is dense AND we're including mobs or the thing isn't a mob AND if there's a source atom and
// it cannot pass through the thing on the turf, we consider the turf blocked.
if(atom_content.density && (!exclude_mobs || !ismob(atom_content)))
if(source_atom && atom_content.CanPass(source_atom, src))
if(movable_content.density && (!exclude_mobs || !ismob(movable_content)))
if(source_atom && movable_content.CanPass(source_atom, get_dir(src, source_atom)))
continue
return TRUE
return FALSE
@@ -303,7 +302,7 @@ GLOBAL_LIST_EMPTY(station_turfs)
// By default byond will call Bump() on the first dense object in contents
// Here's hoping it doesn't stay like this for years before we finish conversion to step_
var/atom/firstbump
var/canPassSelf = CanPass(mover, src)
var/canPassSelf = CanPass(mover, get_dir(src, mover))
if(canPassSelf || (mover.movement_type & PHASING))
for(var/i in contents)
if(QDELETED(mover))

View File

@@ -62,7 +62,7 @@
else
adjustFireLoss(5)
/mob/living/simple_animal/hostile/blob/CanAllowThrough(atom/movable/mover, turf/target)
/mob/living/simple_animal/hostile/blob/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(istype(mover, /obj/structure/blob))
return TRUE

View File

@@ -145,11 +145,11 @@
playsound(src.loc, 'sound/effects/splat.ogg', 50, TRUE) //Let's give some feedback that we DID try to spawn in space, since players are used to it
ConsumeTile() //hit the tile we're in, making sure there are no border objects blocking us
if(!T.CanPass(src, T)) //is the target turf impassable
if(!T.CanPass(src, get_dir(T, src))) //is the target turf impassable
make_blob = FALSE
T.blob_act(src) //hit the turf if it is
for(var/atom/A in T)
if(!A.CanPass(src, T)) //is anything in the turf impassable
if(!A.CanPass(src, get_dir(T, src))) //is anything in the turf impassable
make_blob = FALSE
if(isliving(A) && overmind && !controller) // Make sure to inject strain-reagents with automatic attacks when needed.
overmind.blobstrain.attack_living(A)

View File

@@ -297,7 +297,7 @@
to_chat(src, span_revenwarning("You cannot use abilities from inside of a wall."))
return FALSE
for(var/obj/O in T)
if(O.density && !O.CanPass(src, T))
if(O.density && !O.CanPass(src, get_dir(T, src)))
to_chat(src, span_revenwarning("You cannot use abilities inside of a dense object."))
return FALSE
if(inhibited)

View File

@@ -6,11 +6,9 @@
invisibility = INVISIBILITY_MAXIMUM
anchored = TRUE
/obj/effect/oneway/CanAllowThrough(atom/movable/mover, turf/target)
/obj/effect/oneway/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
var/turf/T = get_turf(src)
var/turf/MT = get_turf(mover)
return . && (T == MT || get_dir(MT,T) == dir)
return . && border_dir == dir
/obj/effect/wind
@@ -45,7 +43,7 @@
if(blocked_types.len)
blocked_types = typecacheof(blocked_types)
/obj/effect/path_blocker/CanAllowThrough(atom/movable/mover, turf/target)
/obj/effect/path_blocker/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(blocked_types.len)
var/list/mover_contents = mover.GetAllContents()

View File

@@ -584,7 +584,7 @@
return
qdel(src)
/obj/structure/spacevine/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/spacevine/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(isvineimmune(mover))
return TRUE

View File

@@ -126,7 +126,7 @@
setup_edge_turf(T)
CHECK_TICK
/datum/proximity_monitor/advanced/proc/field_turf_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_turf/F, turf/entering)
/datum/proximity_monitor/advanced/proc/field_turf_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_turf/F, border_dir)
return TRUE
/datum/proximity_monitor/advanced/proc/field_turf_crossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_turf/F)
@@ -135,7 +135,7 @@
/datum/proximity_monitor/advanced/proc/field_turf_uncrossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_turf/F)
return TRUE
/datum/proximity_monitor/advanced/proc/field_edge_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F, turf/entering)
/datum/proximity_monitor/advanced/proc/field_edge_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F, border_dir)
return TRUE
/datum/proximity_monitor/advanced/proc/field_edge_crossed(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F)

View File

@@ -106,7 +106,7 @@
staging -= AM
return ..()
/datum/proximity_monitor/advanced/peaceborg_dampener/field_edge_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F, turf/entering)
/datum/proximity_monitor/advanced/peaceborg_dampener/field_edge_canpass(atom/movable/AM, obj/effect/abstract/proximity_checker/advanced/field_edge/F, border_dir)
if(istype(AM, /obj/projectile))
staging[AM] = get_turf(AM)
. = ..()

View File

@@ -23,10 +23,10 @@
name = "energy field"
desc = "Get off my turf!"
/obj/effect/abstract/proximity_checker/advanced/field_turf/CanAllowThrough(atom/movable/AM, turf/target)
/obj/effect/abstract/proximity_checker/advanced/field_turf/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(parent)
return parent.field_turf_canpass(AM, src, target)
return parent.field_turf_canpass(mover, src, border_dir)
/obj/effect/abstract/proximity_checker/advanced/field_turf/on_entered(datum/source, atom/movable/AM)
. = ..()
@@ -44,10 +44,10 @@
name = "energy field edge"
desc = "Edgy description here."
/obj/effect/abstract/proximity_checker/advanced/field_edge/CanAllowThrough(atom/movable/AM, turf/target)
/obj/effect/abstract/proximity_checker/advanced/field_edge/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(parent)
return parent.field_edge_canpass(AM, src, target)
return parent.field_edge_canpass(mover, src, border_dir)
/obj/effect/abstract/proximity_checker/advanced/field_edge/on_entered(datum/source, atom/movable/AM)
. = ..()

View File

@@ -802,7 +802,7 @@ GLOBAL_LIST_INIT(hallucination_list, list(
target.playsound_local(get_turf(airlock), 'sound/machines/boltsup.ogg',30,0,3)
qdel(src)
/obj/effect/hallucination/fake_door_lock/CanAllowThrough(atom/movable/mover, turf/_target)
/obj/effect/hallucination/fake_door_lock/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(mover == target && airlock.density)
return FALSE

View File

@@ -135,14 +135,14 @@
to_chat(user, span_info("[src] has been set to attack hostile wildlife."))
return
/mob/living/simple_animal/hostile/mining_drone/CanAllowThrough(atom/movable/object)
/mob/living/simple_animal/hostile/mining_drone/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(istype(object, /obj/projectile/kinetic))
var/obj/projectile/kinetic/projectile = object
if(istype(mover, /obj/projectile/kinetic))
var/obj/projectile/kinetic/projectile = mover
if(projectile.kinetic_gun)
if (locate(/obj/item/borg/upgrade/modkit/minebot_passthrough) in projectile.kinetic_gun.modkits)
return TRUE
if(istype(object, /obj/projectile/destabilizer))
else if(istype(mover, /obj/projectile/destabilizer))
return TRUE
/mob/living/simple_animal/hostile/mining_drone/proc/SetCollectBehavior()

View File

@@ -82,7 +82,7 @@
Paralyze(40, ignore_canstun = TRUE)
toggle_leap(0)
else if(hit_atom.density && !hit_atom.CanPass(src))
else if(hit_atom.density && !hit_atom.CanPass(src, get_dir(hit_atom, src)))
visible_message(span_danger("[src] smashes into [hit_atom]!"), span_alertalien("[src] smashes into [hit_atom]!"))
Paralyze(40, ignore_canstun = TRUE)

View File

@@ -3,7 +3,7 @@
update_turf_movespeed(loc)
/mob/living/CanAllowThrough(atom/movable/mover, turf/target)
/mob/living/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(.)
return

View File

@@ -650,7 +650,7 @@
else
Stun((knockdown_time * 2), ignore_canstun = TRUE)
charge_end()
else if(hit_atom.density && !hit_atom.CanPass(src))
else if(hit_atom.density && !hit_atom.CanPass(src, get_dir(hit_atom, src)))
visible_message(span_danger("[src] smashes into [hit_atom]!"))
Stun((knockdown_time * 2), ignore_canstun = TRUE)

View File

@@ -36,11 +36,11 @@
footstep_type = FOOTSTEP_MOB_BAREFOOT
/mob/living/simple_animal/hostile/jungle/mook/CanAllowThrough(atom/movable/O)
/mob/living/simple_animal/hostile/jungle/mook/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(istype(O, /mob/living/simple_animal/hostile/jungle/mook))
var/mob/living/simple_animal/hostile/jungle/mook/M = O
if(M.attack_state == MOOK_ATTACK_ACTIVE && M.throwing)
if(istype(mover, /mob/living/simple_animal/hostile/jungle/mook))
var/mob/living/simple_animal/hostile/jungle/mook/mook_moover = mover
if(mook_moover.attack_state == MOOK_ATTACK_ACTIVE && mook_moover.throwing)
return TRUE
/mob/living/simple_animal/hostile/jungle/mook/death()

View File

@@ -444,7 +444,7 @@ Difficulty: Hard
severity = EXPLODE_LIGHT // puny mortals
return ..()
/mob/living/simple_animal/hostile/megafauna/bubblegum/CanAllowThrough(atom/movable/mover, turf/target)
/mob/living/simple_animal/hostile/megafauna/bubblegum/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(istype(mover, /mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination))
return TRUE
@@ -546,7 +546,7 @@ Difficulty: Hard
new /obj/effect/decal/cleanable/blood(get_turf(src))
. = ..()
/mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination/CanAllowThrough(atom/movable/mover, turf/target)
/mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(istype(mover, /mob/living/simple_animal/hostile/megafauna/bubblegum)) // hallucinations should not be stopping bubblegum or eachother
return TRUE

View File

@@ -535,7 +535,7 @@ Difficulty: Hard
QUEUE_SMOOTH_NEIGHBORS(src)
return ..()
/obj/effect/temp_visual/hierophant/wall/CanAllowThrough(atom/movable/mover, turf/target)
/obj/effect/temp_visual/hierophant/wall/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(QDELETED(caster))
return FALSE

View File

@@ -317,7 +317,7 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca
AM.forceMove(C)
return ..()
/mob/living/simple_animal/hostile/mimic/xenobio/CanAllowThrough(atom/movable/mover, turf/target)
/mob/living/simple_animal/hostile/mimic/xenobio/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(istype(mover, /obj/structure/closet))
return FALSE

View File

@@ -72,7 +72,7 @@
return
//if it's not our target, we ignore it
/mob/living/simple_animal/hostile/asteroid/curseblob/CanAllowThrough(atom/movable/mover, turf/target)
/mob/living/simple_animal/hostile/asteroid/curseblob/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(mover == set_target)
return FALSE

View File

@@ -352,7 +352,7 @@ While using this makes the system rely on OnFire, it still gives options for tim
ourelite = null
return ..()
/obj/effect/temp_visual/elite_tumor_wall/CanAllowThrough(atom/movable/mover, turf/target)
/obj/effect/temp_visual/elite_tumor_wall/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(mover == ourelite || mover == activator)
return FALSE

View File

@@ -317,7 +317,7 @@
var/mob/M = AM
if(M.buckled)
continue
if(!AM.CanPass(src) || AM.density)
if(AM.density || !AM.CanPass(src, get_dir(AM, src)))
if(AM.anchored)
return AM
if(pulling == AM)

View File

@@ -28,12 +28,11 @@
. = ..()
eat_dir = newdir
/obj/machinery/plumbing/fermenter/CanAllowThrough(atom/movable/AM)
/obj/machinery/plumbing/fermenter/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(!anchored)
return
var/move_dir = get_dir(loc, AM.loc)
if(move_dir == eat_dir)
if(border_dir == eat_dir)
return TRUE
/obj/machinery/plumbing/fermenter/proc/on_entered(datum/source, atom/movable/AM)

View File

@@ -27,12 +27,11 @@
. = ..()
eat_dir = newdir
/obj/machinery/plumbing/grinder_chemical/CanAllowThrough(atom/movable/AM)
/obj/machinery/plumbing/grinder_chemical/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(!anchored)
return
var/move_dir = get_dir(loc, AM.loc)
if(move_dir == eat_dir)
if(border_dir == eat_dir)
return TRUE
/obj/machinery/plumbing/grinder_chemical/proc/on_entered(datum/source, atom/movable/AM)

View File

@@ -117,7 +117,7 @@
return
/obj/machinery/field/CanAllowThrough(atom/movable/mover, turf/target)
/obj/machinery/field/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(hasShocked || isliving(mover) || ismachinery(mover) || isstructure(mover) || ismecha(mover))
return FALSE

View File

@@ -101,21 +101,33 @@
return FALSE
var/obj/dummy = new(user_turf)
dummy.pass_flags |= PASSTABLE|PASSGLASS|PASSGRILLE //Grille/Glass so it can be used through common windows
for(var/turf/turf in getline(user_turf,target))
if(mounted && turf == user_turf)
var/turf/previous_step = user_turf
var/first_step = TRUE
for(var/turf/next_step as anything in (getline(user_turf, target) - user_turf))
if(first_step)
for(var/obj/blocker in user_turf)
if(!blocker.density || !(blocker.flags_1 & ON_BORDER_1))
continue
if(blocker.CanPass(dummy, get_dir(user_turf, next_step)))
continue
return FALSE // Could not leave the first turf.
first_step = FALSE
if(mounted && next_step == user_turf)
continue //Mechs are dense and thus fail the check
if(turf.density)
if(next_step.density)
qdel(dummy)
return FALSE
for(var/atom/movable/AM in turf)
if(!AM.CanPass(dummy,turf,1))
for(var/atom/movable/movable as anything in next_step)
if(!movable.CanPass(dummy, get_dir(next_step, previous_step)))
qdel(dummy)
return FALSE
for(var/obj/effect/ebeam/medical/B in turf)// Don't cross the str-beams!
for(var/obj/effect/ebeam/medical/B in next_step)// Don't cross the str-beams!
if(B.owner.origin != current_beam.origin)
explosion(B.loc, heavy_impact_range = 3, light_impact_range = 5, flash_range = 8)
qdel(dummy)
return FALSE
previous_step = next_step
qdel(dummy)
return TRUE

View File

@@ -560,8 +560,8 @@
* Projectile can pass through
* Used to not even attempt to Bump() or fail to Cross() anything we already hit.
*/
/obj/projectile/CanPassThrough(atom/blocker, turf/target, blocker_opinion)
return impacted[blocker]? TRUE : ..()
/obj/projectile/CanPassThrough(atom/blocker, movement_dir, blocker_opinion)
return impacted[blocker] ? TRUE : ..()
/**
* Projectile moved:

View File

@@ -212,7 +212,7 @@
/obj/item/reagent_containers/proc/bartender_check(atom/target)
. = FALSE
var/mob/thrown_by = thrownby?.resolve()
if(target.CanPass(src, get_turf(src)) && thrown_by && HAS_TRAIT(thrown_by, TRAIT_BOOZE_SLIDER))
if(target.CanPass(src, get_dir(target, src)) && thrown_by && HAS_TRAIT(thrown_by, TRAIT_BOOZE_SLIDER))
. = TRUE
/obj/item/reagent_containers/proc/SplashReagents(atom/target, thrown = FALSE, override_spillable = FALSE)

View File

@@ -62,9 +62,9 @@
/obj/structure/necropolis_gate/singularity_pull()
return 0
/obj/structure/necropolis_gate/CanAllowThrough(atom/movable/mover, turf/target)
/obj/structure/necropolis_gate/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(!(get_dir(loc, target) == dir))
if(border_dir != dir)
return TRUE
/obj/structure/necropolis_gate/proc/on_exit(datum/source, atom/movable/leaving, direction)

View File

@@ -94,7 +94,7 @@
icon = 'icons/mob/blob.dmi'
color = rgb(145, 150, 0)
/obj/effect/gluttony/CanAllowThrough(atom/movable/mover, turf/target)//So bullets will fly over and stuff.
/obj/effect/gluttony/CanAllowThrough(atom/movable/mover, border_dir)//So bullets will fly over and stuff.
. = ..()
if(ishuman(mover))
var/mob/living/carbon/human/H = mover

View File

@@ -236,7 +236,7 @@
var/static/list/check_times = list()
var/list/payees = list()
/obj/machinery/scanner_gate/luxury_shuttle/CanAllowThrough(atom/movable/mover, turf/target)
/obj/machinery/scanner_gate/luxury_shuttle/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(mover in approved_passengers)

View File

@@ -521,11 +521,22 @@ GLOBAL_LIST_INIT(spells, typesof(/obj/effect/proc_holder/spell)) //needed for th
//Checks for obstacles from A to B
var/obj/dummy = new(A.loc)
dummy.pass_flags |= PASSTABLE
for(var/turf/turf in getline(A,B))
for(var/atom/movable/AM in turf)
if(!AM.CanPass(dummy,turf,1))
var/turf/previous_step = get_turf(A)
var/first_step = TRUE
for(var/turf/next_step as anything in (getline(A, B) - previous_step))
if(first_step)
for(var/obj/blocker in previous_step)
if(!blocker.density || !(blocker.flags_1 & ON_BORDER_1))
continue
if(blocker.CanPass(dummy, get_dir(previous_step, next_step)))
continue
return FALSE // Could not leave the first turf.
first_step = FALSE
for(var/atom/movable/movable as anything in next_step)
if(!movable.CanPass(dummy, get_dir(next_step, previous_step)))
qdel(dummy)
return FALSE
previous_step = next_step
qdel(dummy)
return TRUE

View File

@@ -30,11 +30,11 @@
. = ..()
wizard = summoner
/obj/effect/forcefield/wizard/CanAllowThrough(atom/movable/mover, turf/target)
/obj/effect/forcefield/wizard/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(mover == wizard)
return TRUE
if(ismob(mover))
if(isliving(mover))
var/mob/M = mover
if(M.anti_magic_check(chargecost = 0))
return TRUE

View File

@@ -114,11 +114,11 @@
else
death()
/mob/living/simple_animal/hostile/swarmer/CanAllowThrough(atom/movable/O)
/mob/living/simple_animal/hostile/swarmer/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(istype(O, /obj/projectile/beam/disabler))//Allows for swarmers to fight as a group without wasting their shots hitting each other
if(istype(mover, /obj/projectile/beam/disabler))//Allows for swarmers to fight as a group without wasting their shots hitting each other
return TRUE
if(isswarmer(O))
else if(isswarmer(mover))
return TRUE
////CTRL CLICK FOR SWARMERS AND SWARMER_ACT()'S////

View File

@@ -156,9 +156,9 @@
max_integrity = 50
density = TRUE
/obj/structure/swarmer/blockade/CanAllowThrough(atom/movable/O)
/obj/structure/swarmer/blockade/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
if(isswarmer(O) || istype(O, /obj/projectile/beam/disabler))
if(isswarmer(mover) || istype(mover, /obj/projectile/beam/disabler))
return TRUE
/obj/effect/temp_visual/swarmer //temporary swarmer visual feedback objects

View File

@@ -267,12 +267,12 @@
return base_icon_state
return "[base_icon_state]-open"
/obj/vehicle/sealed/mecha/CanPassThrough(atom/blocker, turf/target, blocker_opinion)
/obj/vehicle/sealed/mecha/CanPassThrough(atom/blocker, movement_dir, blocker_opinion)
if(!phasing || get_charge() <= phasing_energy_drain || throwing)
return ..()
if(phase_state)
flick(phase_state, src)
var/area/destination_area = target.loc
var/area/destination_area = get_step(loc, movement_dir).loc
if(destination_area.area_flags & NOTELEPORT)
return FALSE
return TRUE
@@ -722,7 +722,7 @@
if(COOLDOWN_FINISHED(src, mecha_bump_smash))
obstacle.mech_melee_attack(src)
COOLDOWN_START(src, mecha_bump_smash, smashcooldown)
if(!obstacle || obstacle.CanPass(src,get_step(src,dir)))
if(!obstacle || obstacle.CanPass(src, get_dir(obstacle, src) || dir)) // The else is in case the obstacle is in the same turf.
step(src,dir)
if(isobj(obstacle))
var/obj/obj_obstacle = obstacle

View File

@@ -442,15 +442,7 @@
if(LAZYLEN(syringes) >= max_syringes)
to_chat(user, "[icon2html(src, user)][span_warning("[src]'s syringe chamber is full!")]")
return FALSE
if(get_dist(src,S) >= 2)
to_chat(user, "[icon2html(src, user)][span_warning("The syringe is too far away!")]")
return FALSE
for(var/obj/structure/D in S.loc)//Basic level check for structures in the way (Like grilles and windows)
if(!(D.CanPass(S,src.loc)))
to_chat(user, "[icon2html(src, user)][span_warning("Unable to load syringe!")]")
return FALSE
for(var/obj/machinery/door/D in S.loc)//Checks for doors
if(!(D.CanPass(S,src.loc)))
if(!chassis.Adjacent(S))
to_chat(user, "[icon2html(src, user)][span_warning("Unable to load syringe!")]")
return FALSE
S.reagents.trans_to(src, S.reagents.total_volume, transfered_by = user)