diff --git a/code/_onclick/adjacent.dm b/code/_onclick/adjacent.dm index 1939ec7517d..829f78b052c 100644 --- a/code/_onclick/adjacent.dm +++ b/code/_onclick/adjacent.dm @@ -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) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index 82b90ca4359..7f012507dc6 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -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) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 200412d01f5..8fb6169e60a 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -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 diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index f3f48a7365e..574a52a465e 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -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 diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index aa40873bd8b..9948f744e23 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -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 diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 41c04a84ad6..8243933a3ee 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -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) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index be894d04691..5fe187cfdad 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -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)) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index 11f76527718..bf68865745e 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -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) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 558c366fa39..f577df0cb72 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -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) diff --git a/code/game/machinery/transformer.dm b/code/game/machinery/transformer.dm index 8f49c9758f5..8d449ef1c98 100644 --- a/code/game/machinery/transformer.dm +++ b/code/game/machinery/transformer.dm @@ -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. diff --git a/code/game/objects/buckling.dm b/code/game/objects/buckling.dm index e28db18d352..e05df979f92 100644 --- a/code/game/objects/buckling.dm +++ b/code/game/objects/buckling.dm @@ -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) diff --git a/code/game/objects/effects/decals/cleanable/food.dm b/code/game/objects/effects/decals/cleanable/food.dm index 83c0304a1e4..876c557a715 100644 --- a/code/game/objects/effects/decals/cleanable/food.dm +++ b/code/game/objects/effects/decals/cleanable/food.dm @@ -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) diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 2bd8a0db402..d6d76e8e943 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -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 diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 2e3c0c99cca..09f4ba22b50 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -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 diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index 98be77facf3..69c2f0b8663 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -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) diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index 4d4b7a3eddc..53e93b17dc3 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -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) diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 0edd0311f0d..cce13a7c683 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -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) diff --git a/code/game/objects/structures/holosign.dm b/code/game/objects/structures/holosign.dm index ab0b8d4afc0..8a4e1dacba5 100644 --- a/code/game/objects/structures/holosign.dm +++ b/code/game/objects/structures/holosign.dm @@ -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 [force_allaccess ? "off" : "on"].") -/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 diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 283343871dd..02b586ca8e3 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -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 diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index a46374dc4ed..e4aedffd11e 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -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 diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm index 8fa09fe04de..a7d9b3561bc 100644 --- a/code/game/objects/structures/plasticflaps.dm +++ b/code/game/objects/structures/plasticflaps.dm @@ -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 - return FALSE - - if(istype(A, /obj/structure/closet/cardboard)) - var/obj/structure/closet/cardboard/C = A - if(C.move_delay) + 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(ismecha(A)) + else if(istype(mover, /obj/structure/closet/cardboard)) + var/obj/structure/closet/cardboard/cardboard_mover = mover + if(cardboard_mover.move_delay) + return FALSE + + 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)) diff --git a/code/game/objects/structures/railings.dm b/code/game/objects/structures/railings.dm index 770b97783cc..057f0957138 100644 --- a/code/game/objects/structures/railings.dm +++ b/code/game/objects/structures/railings.dm @@ -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() diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 44eb68dd4de..0262b0c3ec5 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -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 @@ -632,7 +632,7 @@ . = ..() . += span_notice("It's held together by a couple of bolts.") -/obj/structure/rack/CanAllowThrough(atom/movable/mover, turf/target) +/obj/structure/rack/CanAllowThrough(atom/movable/mover, border_dir) . = ..() if(.) return diff --git a/code/game/objects/structures/tank_holder.dm b/code/game/objects/structures/tank_holder.dm index 4f7519e3d5c..dce25119f04 100644 --- a/code/game/objects/structures/tank_holder.dm +++ b/code/game/objects/structures/tank_holder.dm @@ -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 diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index 7399cf7e6b4..eca723ff146 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -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)) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 23507d70bb5..15d8ee243fe 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -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)) - return FALSE + 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 diff --git a/code/game/turfs/open/chasm.dm b/code/game/turfs/open/chasm.dm index 31b94fbab45..81a04a1c11f 100644 --- a/code/game/turfs/open/chasm.dm +++ b/code/game/turfs/open/chasm.dm @@ -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 diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index 66d014faf52..7c045fbfa86 100755 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -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)) diff --git a/code/modules/antagonists/blob/blob_mobs.dm b/code/modules/antagonists/blob/blob_mobs.dm index b6b2daf0267..911dd59a618 100644 --- a/code/modules/antagonists/blob/blob_mobs.dm +++ b/code/modules/antagonists/blob/blob_mobs.dm @@ -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 diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm index f3b9b871a3b..eb6551d8f95 100644 --- a/code/modules/antagonists/blob/structures/_blob.dm +++ b/code/modules/antagonists/blob/structures/_blob.dm @@ -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) diff --git a/code/modules/antagonists/revenant/revenant.dm b/code/modules/antagonists/revenant/revenant.dm index 93ab32a892c..c7fe25e7940 100644 --- a/code/modules/antagonists/revenant/revenant.dm +++ b/code/modules/antagonists/revenant/revenant.dm @@ -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) diff --git a/code/modules/awaymissions/away_props.dm b/code/modules/awaymissions/away_props.dm index 953ca2cc128..fa5c18c1f33 100644 --- a/code/modules/awaymissions/away_props.dm +++ b/code/modules/awaymissions/away_props.dm @@ -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() diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index 990c6ca94d4..de154020a83 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -583,7 +583,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 diff --git a/code/modules/fields/fields.dm b/code/modules/fields/fields.dm index 311a25d4452..66386e8defd 100644 --- a/code/modules/fields/fields.dm +++ b/code/modules/fields/fields.dm @@ -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) diff --git a/code/modules/fields/peaceborg_dampener.dm b/code/modules/fields/peaceborg_dampener.dm index e6ffc3ec9ce..2f5565327da 100644 --- a/code/modules/fields/peaceborg_dampener.dm +++ b/code/modules/fields/peaceborg_dampener.dm @@ -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) . = ..() diff --git a/code/modules/fields/turf_objects.dm b/code/modules/fields/turf_objects.dm index 17700ca23a2..3ecea11eeb1 100644 --- a/code/modules/fields/turf_objects.dm +++ b/code/modules/fields/turf_objects.dm @@ -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) . = ..() diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index a819012284d..acd22f4ee52 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -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 diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index fa518b4b62b..6385036508d 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -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() diff --git a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm index 7d5781c27d9..2cf4a2ba4b1 100644 --- a/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm +++ b/code/modules/mob/living/carbon/alien/humanoid/caste/hunter.dm @@ -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) diff --git a/code/modules/mob/living/living_movement.dm b/code/modules/mob/living/living_movement.dm index 3a464554434..94a610a0d48 100644 --- a/code/modules/mob/living/living_movement.dm +++ b/code/modules/mob/living/living_movement.dm @@ -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 diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm index e3bc4ad96ef..d08362907e4 100644 --- a/code/modules/mob/living/simple_animal/hostile/hostile.dm +++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm @@ -651,7 +651,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) diff --git a/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm b/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm index 9e92a5ed416..ed2994cec0c 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm @@ -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() diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm index 5b2034bec31..e79182c1414 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm @@ -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 diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm index cb0ad0c30f9..5cc8ef82fa6 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -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 diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index 0f7f3907477..31b94e8df6c 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -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 diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm index bb96a8c4676..6a7b5f0fb74 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/curse_blob.dm @@ -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 diff --git a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm index 80c03dc99cc..6a596963fa1 100644 --- a/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm +++ b/code/modules/mob/living/simple_animal/hostile/mining_mobs/elites/elite.dm @@ -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 diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 0f7ce89f443..1c89ebeb951 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -310,7 +310,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) diff --git a/code/modules/plumbing/plumbers/fermenter.dm b/code/modules/plumbing/plumbers/fermenter.dm index c7469e5ad8a..5eb67234af9 100644 --- a/code/modules/plumbing/plumbers/fermenter.dm +++ b/code/modules/plumbing/plumbers/fermenter.dm @@ -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) diff --git a/code/modules/plumbing/plumbers/grinder_chemical.dm b/code/modules/plumbing/plumbers/grinder_chemical.dm index 0e35002355e..fbf23480ab1 100644 --- a/code/modules/plumbing/plumbers/grinder_chemical.dm +++ b/code/modules/plumbing/plumbers/grinder_chemical.dm @@ -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) diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index 8c391db6f5e..9f537b11834 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -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 diff --git a/code/modules/projectiles/guns/misc/medbeam.dm b/code/modules/projectiles/guns/misc/medbeam.dm index 9211dea31e4..4e6f3194032 100644 --- a/code/modules/projectiles/guns/misc/medbeam.dm +++ b/code/modules/projectiles/guns/misc/medbeam.dm @@ -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 diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm index 49b6acd794c..c3a6d12e823 100644 --- a/code/modules/projectiles/projectile.dm +++ b/code/modules/projectiles/projectile.dm @@ -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: diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm index 100e3d29dbb..e7dfeba2226 100644 --- a/code/modules/reagents/reagent_containers.dm +++ b/code/modules/reagents/reagent_containers.dm @@ -170,7 +170,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) diff --git a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm index b26a7256deb..cb59f114b25 100644 --- a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm +++ b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm @@ -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) diff --git a/code/modules/ruins/objects_and_mobs/sin_ruins.dm b/code/modules/ruins/objects_and_mobs/sin_ruins.dm index a79a9f2bcea..b517b18aba6 100644 --- a/code/modules/ruins/objects_and_mobs/sin_ruins.dm +++ b/code/modules/ruins/objects_and_mobs/sin_ruins.dm @@ -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 diff --git a/code/modules/shuttle/special.dm b/code/modules/shuttle/special.dm index e5e9b999b13..c049371edea 100644 --- a/code/modules/shuttle/special.dm +++ b/code/modules/shuttle/special.dm @@ -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) diff --git a/code/modules/spells/spell.dm b/code/modules/spells/spell.dm index a4ebda1cab2..f80a486b473 100644 --- a/code/modules/spells/spell.dm +++ b/code/modules/spells/spell.dm @@ -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 diff --git a/code/modules/spells/spell_types/forcewall.dm b/code/modules/spells/spell_types/forcewall.dm index 272c9e99ac8..38dee151efa 100644 --- a/code/modules/spells/spell_types/forcewall.dm +++ b/code/modules/spells/spell_types/forcewall.dm @@ -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 diff --git a/code/modules/swarmers/swarmer.dm b/code/modules/swarmers/swarmer.dm index 5ca9439f86e..e10e4a58956 100644 --- a/code/modules/swarmers/swarmer.dm +++ b/code/modules/swarmers/swarmer.dm @@ -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//// diff --git a/code/modules/swarmers/swarmer_objs.dm b/code/modules/swarmers/swarmer_objs.dm index 63f92d85d5c..c815402fde1 100644 --- a/code/modules/swarmers/swarmer_objs.dm +++ b/code/modules/swarmers/swarmer_objs.dm @@ -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 diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm index b2bf49f4ca9..0ac9c640ce7 100644 --- a/code/modules/vehicles/mecha/_mecha.dm +++ b/code/modules/vehicles/mecha/_mecha.dm @@ -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 diff --git a/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm b/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm index c0954b75f9e..d0ab4d7ae02 100644 --- a/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm +++ b/code/modules/vehicles/mecha/equipment/tools/medical_tools.dm @@ -442,17 +442,9 @@ 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!")]") + if(!chassis.Adjacent(S)) + to_chat(user, "[icon2html(src, user)][span_warning("Unable to load syringe!")]") 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))) - 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) S.forceMove(src) LAZYADD(syringes,S)