From 53024590decf7325d779d55b79b37424d730ea68 Mon Sep 17 00:00:00 2001 From: Emmett Gaines Date: Wed, 8 Jan 2020 15:31:49 -0500 Subject: [PATCH] Can pass refactor (#48659) * Makes all CanPass procs call parent * Makes CanPass more extendable and gives the mover a say in the matter * Replace CanPass with CanAllowThrough to use the new system Regex replace `(? `/CanAllowThrough(` * Simple optimization pass --- code/game/atoms.dm | 11 +++++ code/game/atoms_movable.dm | 15 +++++-- code/game/machinery/deployable.dm | 15 ++++--- code/game/machinery/doors/door.dm | 4 +- code/game/machinery/doors/firedoor.dm | 7 ++-- code/game/machinery/doors/windowdoor.dm | 9 ++-- code/game/machinery/recycler.dm | 2 +- code/game/machinery/shieldgen.dm | 5 +-- code/game/machinery/transformer.dm | 10 ++--- .../objects/effects/decals/cleanable/food.dm | 10 +++-- .../effects/effect_system/effects_foam.dm | 7 +--- .../effects/effect_system/effects_smoke.dm | 10 ++--- code/game/objects/effects/spiders.dm | 4 +- .../items/devices/forcefieldprojector.dm | 6 +-- code/game/objects/structures/aliens.dm | 5 --- .../structures/crates_lockers/closets.dm | 4 +- .../structures/crates_lockers/crates.dm | 8 ++-- code/game/objects/structures/girders.dm | 10 ++--- code/game/objects/structures/grille.dm | 13 +++--- code/game/objects/structures/holosign.dm | 42 +++++++++++-------- code/game/objects/structures/mineral_doors.dm | 4 +- code/game/objects/structures/morgue.dm | 9 ++-- code/game/objects/structures/plasticflaps.dm | 5 ++- code/game/objects/structures/tables_racks.dm | 23 +++++----- .../structures/transit_tubes/transit_tube.dm | 4 +- .../objects/structures/windoor_assembly.dm | 8 ++-- code/game/objects/structures/window.dm | 11 +++-- code/game/turfs/closed/_closed.dm | 4 +- code/game/turfs/open/chasm.dm | 3 -- code/game/turfs/turf.dm | 10 ----- code/modules/antagonists/blob/blob_mobs.dm | 6 +-- .../antagonists/blob/structures/_blob.dm | 6 +-- code/modules/antagonists/swarmer/swarmer.dm | 7 ++-- code/modules/awaymissions/away_props.dm | 8 ++-- code/modules/events/spacevine.dm | 7 ++-- code/modules/fields/turf_objects.dm | 8 ++-- code/modules/flufftext/Hallucination.dm | 4 +- code/modules/holiday/halloween.dm | 4 -- code/modules/hydroponics/grown/towercap.dm | 4 +- code/modules/mining/minebot.dm | 4 +- code/modules/mob/dead/observer/observer.dm | 3 -- code/modules/mob/living/living_movement.dm | 10 ++--- .../simple_animal/hostile/jungle/mook.dm | 4 +- .../hostile/megafauna/bubblegum.dm | 8 ++-- .../hostile/megafauna/hierophant.dm | 4 +- .../mob/living/simple_animal/hostile/mimic.dm | 25 ++++++----- .../hostile/mining_mobs/curse_blob.dm | 4 +- .../hostile/mining_mobs/elites/elite.dm | 5 +-- code/modules/mob/mob_movement.dm | 20 ++++----- .../plumbing/plumbers/grinder_chemical.dm | 2 +- .../power/singularity/containment_field.dm | 4 +- .../ruins/objects_and_mobs/necropolis_gate.dm | 8 ++-- .../ruins/objects_and_mobs/sin_ruins.dm | 5 +-- code/modules/shuttle/special.dm | 6 +-- code/modules/spells/spell_types/forcewall.dm | 4 +- 55 files changed, 217 insertions(+), 231 deletions(-) diff --git a/code/game/atoms.dm b/code/game/atoms.dm index c355e700326..0e1331d4d46 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -222,6 +222,17 @@ ///Can the mover object pass this atom, while heading for the target turf /atom/proc/CanPass(atom/movable/mover, turf/target) + SHOULD_CALL_PARENT(TRUE) + if(mover.movement_type & UNSTOPPABLE) + return TRUE + . = CanAllowThrough(mover, target) + // This is cheaper than calling the proc every time since most things dont override CanPassThrough + if(!mover.generic_canpass) + return mover.CanPassThrough(src, target, .) + +/// Returns true or false to allow the mover to move through src +/atom/proc/CanAllowThrough(atom/movable/mover, turf/target) + SHOULD_CALL_PARENT(TRUE) return !density /** diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index 9e166242106..c54b73e383c 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -23,7 +23,9 @@ var/inertia_moving = 0 var/inertia_next_move = 0 var/inertia_move_delay = 5 - var/pass_flags = 0 + var/pass_flags = NONE + /// If false makes CanPass call CanPassThrough on this type instead of using default behaviour + var/generic_canpass = TRUE var/moving_diagonally = 0 //0: not doing a diagonal move. 1 and 2: doing the first/second step of the diagonal move var/atom/movable/moving_from_pull //attempt to resume grab after moving instead of before. var/list/client_mobs_in_contents // This contains all the client mobs within this container @@ -648,10 +650,15 @@ /atom/movable/proc/move_crushed(atom/movable/pusher, force = MOVE_FORCE_DEFAULT, direction) return FALSE -/atom/movable/CanPass(atom/movable/mover, turf/target) +/atom/movable/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(mover in buckled_mobs) - return 1 - return ..() + 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) + SHOULD_CALL_PARENT(TRUE) + return blocker_opinion // called when this atom is removed from a storage item, which is passed on as S. The loc variable is already set to the new destination before this is called. /atom/movable/proc/on_exit_storage(datum/component/storage/concrete/S) diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index 2cca61824ce..356cd54c990 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -37,20 +37,19 @@ else return ..() -/obj/structure/barricade/CanPass(atom/movable/mover, turf/target)//So bullets will fly over and stuff. +/obj/structure/barricade/CanAllowThrough(atom/movable/mover, turf/target)//So bullets will fly over and stuff. + . = ..() if(locate(/obj/structure/barricade) in get_turf(mover)) - return 1 + return TRUE else if(istype(mover, /obj/projectile)) if(!anchored) - return 1 + return TRUE var/obj/projectile/proj = mover if(proj.firer && Adjacent(proj.firer)) - return 1 + return TRUE if(prob(proj_pass_rate)) - return 1 - return 0 - else - return !density + return TRUE + return FALSE diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 0a80da4abdc..ee674490fda 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -143,10 +143,10 @@ . = ..() move_update_air(T) -/obj/machinery/door/CanPass(atom/movable/mover, turf/target) +/obj/machinery/door/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSGLASS)) return !opacity - return !density /obj/machinery/door/proc/bumpopen(mob/user) if(operating) diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 958caa573c2..6419b436eb1 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -225,12 +225,11 @@ opacity = TRUE density = TRUE -/obj/machinery/door/firedoor/border_only/CanPass(atom/movable/mover, turf/target) +/obj/machinery/door/firedoor/border_only/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSGLASS)) return TRUE - if(get_dir(loc, target) == dir) //Make sure looking at appropriate border - return !density - else + if(!(get_dir(loc, target) == dir)) //Make sure looking at appropriate border return TRUE /obj/machinery/door/firedoor/border_only/CheckExit(atom/movable/mover as mob|obj, turf/target) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 4318960baac..3f419f6a2e8 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -97,11 +97,12 @@ do_animate("deny") return -/obj/machinery/door/window/CanPass(atom/movable/mover, turf/target) +/obj/machinery/door/window/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSGLASS)) - return 1 + return TRUE if(get_dir(loc, target) == dir) //Make sure looking at appropriate border - return !density + return if(istype(mover, /obj/structure/window)) var/obj/structure/window/W = mover if(!valid_window_location(loc, W.ini_dir)) @@ -113,7 +114,7 @@ else if(istype(mover, /obj/machinery/door/window) && !valid_window_location(loc, mover.dir)) return FALSE else - return 1 + return TRUE /obj/machinery/door/window/CanAtmosPass(turf/T) if(get_dir(loc, T) == dir) diff --git a/code/game/machinery/recycler.dm b/code/game/machinery/recycler.dm index c9e528eb69f..0926fb87078 100644 --- a/code/game/machinery/recycler.dm +++ b/code/game/machinery/recycler.dm @@ -78,7 +78,7 @@ is_powered = FALSE icon_state = icon_name + "[is_powered]" + "[(blood ? "bld" : "")]" // add the blood tag at the end -/obj/machinery/recycler/CanPass(atom/movable/AM) +/obj/machinery/recycler/CanAllowThrough(atom/movable/AM) . = ..() if(!anchored) return diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index db771053851..8b4d3a65fd7 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -451,11 +451,10 @@ if(gen_secondary) //using power may cause us to be destroyed gen_secondary.add_load(drain_amount * 0.5) -/obj/machinery/shieldwall/CanPass(atom/movable/mover, turf/target) +/obj/machinery/shieldwall/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSGLASS)) return prob(20) else if(istype(mover, /obj/projectile)) return prob(10) - else - return !density diff --git a/code/game/machinery/transformer.dm b/code/game/machinery/transformer.dm index 8ec8d7d0361..1256543e8f8 100644 --- a/code/game/machinery/transformer.dm +++ b/code/game/machinery/transformer.dm @@ -53,14 +53,14 @@ AM.forceMove(drop_location()) do_transform(AM) -/obj/machinery/transformer/CanPass(atom/movable/mover, turf/target) +/obj/machinery/transformer/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() // Allows items to go through, // to stop them from blocking the conveyor belt. if(!ishuman(mover)) - var/dir = get_dir(src, mover) - if(dir == EAST) - return ..() - return 0 + if(get_dir(src, mover) == EAST) + return + return FALSE /obj/machinery/transformer/process() if(cooldown && (cooldown_timer <= world.time)) diff --git a/code/game/objects/effects/decals/cleanable/food.dm b/code/game/objects/effects/decals/cleanable/food.dm index dfb5a1d552e..7a702bf354f 100644 --- a/code/game/objects/effects/decals/cleanable/food.dm +++ b/code/game/objects/effects/decals/cleanable/food.dm @@ -31,11 +31,15 @@ desc = "A sizable pile of table salt. Someone must be upset." icon_state = "salt_pile" -/obj/effect/decal/cleanable/food/salt/CanPass(atom/movable/AM, turf/target) +/obj/effect/decal/cleanable/food/salt/CanAllowThrough(atom/movable/AM, turf/target) + . = ..() + if(is_species(AM, /datum/species/snail)) + return FALSE + +/obj/effect/decal/cleanable/food/salt/Bumped(atom/movable/AM) + . = ..() if(is_species(AM, /datum/species/snail)) to_chat(AM, "Your path is obstructed by salt.") - return FALSE - return TRUE /obj/effect/decal/cleanable/food/flour name = "flour" diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm index dee23a53431..2aeabfbad58 100644 --- a/code/game/objects/effects/effect_system/effects_foam.dm +++ b/code/game/objects/effects/effect_system/effects_foam.dm @@ -290,9 +290,6 @@ to_chat(user, "You hit [src] but bounce off it!") playsound(src.loc, 'sound/weapons/tap.ogg', 100, TRUE) -/obj/structure/foamedmetal/CanPass(atom/movable/mover, turf/target) - return !density - /obj/structure/foamedmetal/iron max_integrity = 50 icon_state = "ironfoam" @@ -333,10 +330,10 @@ for(var/obj/item/Item in O) Item.extinguish() -/obj/structure/foamedmetal/resin/CanPass(atom/movable/mover, turf/target) +/obj/structure/foamedmetal/resin/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSGLASS)) return TRUE - . = ..() #undef ALUMINUM_FOAM #undef IRON_FOAM diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm index a50a4e55ea7..0493a176827 100644 --- a/code/game/objects/effects/effect_system/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/effects_smoke.dm @@ -132,13 +132,11 @@ M.emote("cough") return 1 -/obj/effect/particle_effect/smoke/bad/CanPass(atom/movable/mover, turf/target) - if(istype(mover, /obj/projectile/beam)) - var/obj/projectile/beam/B = mover +/obj/effect/particle_effect/smoke/bad/Crossed(atom/movable/AM, oldloc) + . = ..() + if(istype(AM, /obj/projectile/beam)) + var/obj/projectile/beam/B = AM B.damage = (B.damage/2) - return 1 - - /datum/effect_system/smoke_spread/bad effect_type = /obj/effect/particle_effect/smoke/bad diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index 828f252f103..4d02d3d5799 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -35,7 +35,8 @@ icon_state = "stickyweb2" . = ..() -/obj/structure/spider/stickyweb/CanPass(atom/movable/mover, turf/target) +/obj/structure/spider/stickyweb/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover, /mob/living/simple_animal/hostile/poison/giant_spider)) return TRUE else if(isliving(mover)) @@ -46,7 +47,6 @@ return FALSE else if(istype(mover, /obj/projectile)) return prob(30) - return TRUE /obj/structure/spider/eggcluster name = "egg cluster" diff --git a/code/game/objects/items/devices/forcefieldprojector.dm b/code/game/objects/items/devices/forcefieldprojector.dm index 25a98c3dd7f..3126977722e 100644 --- a/code/game/objects/items/devices/forcefieldprojector.dm +++ b/code/game/objects/items/devices/forcefieldprojector.dm @@ -98,10 +98,10 @@ generator = null return ..() -/obj/structure/projected_forcefield/CanPass(atom/movable/mover, turf/target) +/obj/structure/projected_forcefield/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSGLASS)) - return 1 - return !density + return TRUE /obj/structure/projected_forcefield/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0) playsound(loc, 'sound/weapons/egloves.ogg', 80, TRUE) diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm index c413575128f..0b746d34bfa 100644 --- a/code/game/objects/structures/aliens.dm +++ b/code/game/objects/structures/aliens.dm @@ -97,11 +97,6 @@ /obj/structure/alien/resin/attack_paw(mob/user) return attack_hand(user) - -/obj/structure/alien/resin/CanPass(atom/movable/mover, turf/target) - return !density - - /* * Weeds */ diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 5428c2a50cb..6f90c16577a 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -92,10 +92,10 @@ if(HAS_TRAIT(L, TRAIT_SKITTISH)) . += "Ctrl-Shift-click [src] to jump inside." -/obj/structure/closet/CanPass(atom/movable/mover, turf/target) +/obj/structure/closet/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(wall_mounted) return TRUE - return !density /obj/structure/closet/proc/can_open(mob/living/user) if(welded || locked) diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm index 06f87afa996..f6fd2c5e171 100644 --- a/code/game/objects/structures/crates_lockers/crates.dm +++ b/code/game/objects/structures/crates_lockers/crates.dm @@ -26,15 +26,15 @@ opened = TRUE update_icon() -/obj/structure/closet/crate/CanPass(atom/movable/mover, turf/target) +/obj/structure/closet/crate/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(!istype(mover, /obj/structure/closet)) var/obj/structure/closet/crate/locatedcrate = locate(/obj/structure/closet/crate) in get_turf(mover) if(locatedcrate) //you can walk on it like tables, if you're not in an open crate trying to move to a closed crate if(opened) //if we're open, allow entering regardless of located crate openness - return 1 + return TRUE if(!locatedcrate.opened) //otherwise, if the located crate is closed, allow entering - return 1 - return !density + return TRUE /obj/structure/closet/crate/update_icon() icon_state = "[initial(icon_state)][opened ? "open" : ""]" diff --git a/code/game/objects/structures/girders.dm b/code/game/objects/structures/girders.dm index 9b273aa148c..fefde61a586 100644 --- a/code/game/objects/structures/girders.dm +++ b/code/game/objects/structures/girders.dm @@ -271,14 +271,10 @@ qdel(src) return TRUE -/obj/structure/girder/CanPass(atom/movable/mover, turf/target) - if(istype(mover) && (mover.pass_flags & PASSGRILLE)) +/obj/structure/girder/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() + if((mover.pass_flags & PASSGRILLE) || istype(mover, /obj/projectile)) return prob(girderpasschance) - else - if(istype(mover, /obj/projectile)) - return prob(girderpasschance) - else - return 0 /obj/structure/girder/CanAStarPass(ID, dir, caller) . = !density diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 4d445d083bf..5c3b3359dd5 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -114,15 +114,12 @@ if(!shock(user, 70)) take_damage(20, BRUTE, "melee", 1) - -/obj/structure/grille/CanPass(atom/movable/mover, turf/target) - if(istype(mover) && (mover.pass_flags & PASSGRILLE)) +/obj/structure/grille/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() + if(mover.pass_flags & PASSGRILLE) return TRUE - else - if(istype(mover, /obj/projectile) && density) - return prob(30) - else - return !density + else if(!. && istype(mover, /obj/projectile)) + return prob(30) /obj/structure/grille/CanAStarPass(ID, dir, caller) . = !density diff --git a/code/game/objects/structures/holosign.dm b/code/game/objects/structures/holosign.dm index 114ac534a93..cbf114337db 100644 --- a/code/game/objects/structures/holosign.dm +++ b/code/game/objects/structures/holosign.dm @@ -56,13 +56,14 @@ max_integrity = 20 var/allow_walk = TRUE //can we pass through it on walk intent -/obj/structure/holosign/barrier/CanPass(atom/movable/mover, turf/target) - if(!density) - return TRUE +/obj/structure/holosign/barrier/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() + if(.) + return if(mover.pass_flags & (PASSGLASS|PASSTABLE|PASSGRILLE)) return TRUE if(iscarbon(mover)) - var/mob/living/carbon/C = mover + var/mob/living/carbon/C = mover if(C.stat) // Lets not prevent dragging unconscious/dead people. return TRUE if(allow_walk && C.m_intent == MOVE_INTENT_WALK) @@ -74,14 +75,14 @@ icon = 'icons/effects/effects.dmi' icon_state = "holosign" -/obj/structure/holosign/barrier/wetsign/CanPass(atom/movable/mover, turf/target) +/obj/structure/holosign/barrier/wetsign/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(iscarbon(mover)) var/mob/living/carbon/C = mover if(C.stat) // Lets not prevent dragging unconscious/dead people. return TRUE if(allow_walk && C.m_intent != MOVE_INTENT_WALK) return FALSE - return TRUE /obj/structure/holosign/barrier/engineering icon_state = "holosign_engi" @@ -130,21 +131,26 @@ . = ..() . += "The biometric scanners are [force_allaccess ? "off" : "on"]." -/obj/structure/holosign/barrier/medical/CanPass(atom/movable/mover, turf/target) - icon_state = "holo_medical" +/obj/structure/holosign/barrier/medical/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(force_allaccess) return TRUE if(ishuman(mover)) - var/mob/living/carbon/human/sickboi = mover - var/threat = sickboi.check_virus() - if(get_disease_severity_value(threat) > get_disease_severity_value(DISEASE_SEVERITY_MINOR)) - if(buzzcd < world.time) - playsound(get_turf(src),'sound/machines/buzz-sigh.ogg',65,TRUE,4) - buzzcd = (world.time + 60) - icon_state = "holo_medical-deny" - return FALSE - else - return TRUE //nice or benign diseases! + return CheckHuman(mover) + +/obj/structure/holosign/barrier/medical/Bumped(atom/movable/AM) + . = ..() + icon_state = "holo_medical" + if(ishuman(AM) && !CheckHuman(AM)) + if(buzzcd < world.time) + playsound(get_turf(src),'sound/machines/buzz-sigh.ogg',65,TRUE,4) + buzzcd = (world.time + 60) + icon_state = "holo_medical-deny" + +/obj/structure/holosign/barrier/medical/proc/CheckHuman(mob/living/carbon/human/sickboi) + var/threat = sickboi.check_virus() + if(get_disease_severity_value(threat) > get_disease_severity_value(DISEASE_SEVERITY_MINOR)) + return FALSE return TRUE /obj/structure/holosign/barrier/medical/attack_hand(mob/living/user) diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 667ab2a6091..d66b557694a 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -57,10 +57,10 @@ return return TryToSwitchState(user) -/obj/structure/mineral_door/CanPass(atom/movable/mover, turf/target) +/obj/structure/mineral_door/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover, /obj/effect/beam)) return !opacity - return !density /obj/structure/mineral_door/proc/TryToSwitchState(atom/user) if(isSwitchingStates || !anchored) diff --git a/code/game/objects/structures/morgue.dm b/code/game/objects/structures/morgue.dm index 162b35b6a2e..ce6706d5717 100644 --- a/code/game/objects/structures/morgue.dm +++ b/code/game/objects/structures/morgue.dm @@ -378,13 +378,12 @@ GLOBAL_LIST_EMPTY(crematoriums) desc = "Apply corpse before closing." icon_state = "morguet" -/obj/structure/tray/m_tray/CanPass(atom/movable/mover, turf/target) +/obj/structure/tray/m_tray/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSTABLE)) - return 1 + return TRUE if(locate(/obj/structure/table) in get_turf(mover)) - return 1 - else - return 0 + return TRUE /obj/structure/tray/m_tray/CanAStarPass(ID, dir, caller) . = !density diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm index 9d85f773377..7e9746423e4 100644 --- a/code/game/objects/structures/plasticflaps.dm +++ b/code/game/objects/structures/plasticflaps.dm @@ -69,7 +69,9 @@ return CanAStarPass(ID, to_dir, M.pulling) return TRUE //diseases, stings, etc can pass -/obj/structure/plasticflaps/CanPass(atom/movable/A, turf/T) +/obj/structure/plasticflaps/CanAllowThrough(atom/movable/A, turf/T) + . = ..() + if(istype(A) && (A.pass_flags & PASSGLASS)) return prob(60) @@ -93,7 +95,6 @@ return TRUE if((M.mobility_flags & MOBILITY_STAND) && !M.ventcrawler && M.mob_size != MOB_SIZE_TINY) //If your not laying down, or a ventcrawler or a small creature, no pass. return FALSE - return ..() /obj/structure/plasticflaps/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1)) diff --git a/code/game/objects/structures/tables_racks.dm b/code/game/objects/structures/tables_racks.dm index 6224460b686..f83851406df 100644 --- a/code/game/objects/structures/tables_racks.dm +++ b/code/game/objects/structures/tables_racks.dm @@ -89,15 +89,15 @@ /obj/structure/table/attack_tk() return FALSE -/obj/structure/table/CanPass(atom/movable/mover, turf/target) +/obj/structure/table/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() + if(istype(mover) && (mover.pass_flags & PASSTABLE)) - return 1 + return TRUE if(mover.throwing) - return 1 + return TRUE if(locate(/obj/structure/table) in get_turf(mover)) - return 1 - else - return !density + return TRUE /obj/structure/table/CanAStarPass(ID, dir, caller) . = !density @@ -502,13 +502,12 @@ . = ..() . += "It's held together by a couple of bolts." -/obj/structure/rack/CanPass(atom/movable/mover, turf/target) - if(src.density == 0) //Because broken racks -Agouri |TODO: SPRITE!| - return 1 +/obj/structure/rack/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() + if(.) + return if(istype(mover) && (mover.pass_flags & PASSTABLE)) - return 1 - else - return 0 + return TRUE /obj/structure/rack/CanAStarPass(ID, dir, caller) . = !density diff --git a/code/game/objects/structures/transit_tubes/transit_tube.dm b/code/game/objects/structures/transit_tubes/transit_tube.dm index 1d17361e7e9..f68f8acf25a 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube.dm @@ -14,10 +14,10 @@ var/enter_delay = 0 var/const/time_to_unwrench = 2 SECONDS -/obj/structure/transit_tube/CanPass(atom/movable/mover, turf/target) +/obj/structure/transit_tube/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSGLASS)) return TRUE - return !density /obj/structure/transit_tube/New(loc, newdirection) ..(loc) diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index 30f0e642ef0..a8a4e10f930 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -50,11 +50,12 @@ /obj/structure/windoor_assembly/update_icon() icon_state = "[facing]_[secure ? "secure_" : ""]windoor_assembly[state]" -/obj/structure/windoor_assembly/CanPass(atom/movable/mover, turf/target) +/obj/structure/windoor_assembly/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSGLASS)) - return 1 + return TRUE if(get_dir(loc, target) == dir) //Make sure looking at appropriate border - return !density + return if(istype(mover, /obj/structure/window)) var/obj/structure/window/W = mover if(!valid_window_location(loc, W.ini_dir)) @@ -65,7 +66,6 @@ return FALSE else if(istype(mover, /obj/machinery/door/window) && !valid_window_location(loc, mover.dir)) return FALSE - return 1 /obj/structure/windoor_assembly/CanAtmosPass(turf/T) if(get_dir(loc, T) == dir) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index c91e7908b94..1dedf1effe8 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -95,13 +95,15 @@ else ..(FULLTILE_WINDOW_DIR) -/obj/structure/window/CanPass(atom/movable/mover, turf/target) +/obj/structure/window/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSGLASS)) return 1 if(dir == FULLTILE_WINDOW_DIR) return 0 //full tile window, you can't move into it! - if(get_dir(loc, target) == dir) - return !density + var/attempted_dir = get_dir(loc, target) + if(attempted_dir == dir) + return if(istype(mover, /obj/structure/window)) var/obj/structure/window/W = mover if(!valid_window_location(loc, W.ini_dir)) @@ -112,7 +114,8 @@ return FALSE else if(istype(mover, /obj/machinery/door/window) && !valid_window_location(loc, mover.dir)) return FALSE - return 1 + else if(attempted_dir != dir) + return TRUE /obj/structure/window/CheckExit(atom/movable/O, turf/target) if(istype(O) && (O.pass_flags & PASSGLASS)) diff --git a/code/game/turfs/closed/_closed.dm b/code/game/turfs/closed/_closed.dm index c0a00ed35ef..6b45a164adf 100644 --- a/code/game/turfs/closed/_closed.dm +++ b/code/game/turfs/closed/_closed.dm @@ -13,10 +13,10 @@ /turf/closed/get_smooth_underlay_icon(mutable_appearance/underlay_appearance, turf/asking_turf, adjacency_dir) return FALSE -/turf/closed/CanPass(atom/movable/mover, turf/target) +/turf/closed/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSCLOSEDTURF)) return TRUE - return ..() /turf/closed/indestructible name = "wall" diff --git a/code/game/turfs/open/chasm.dm b/code/game/turfs/open/chasm.dm index ff7b8141af9..2dcfcb20e15 100644 --- a/code/game/turfs/open/chasm.dm +++ b/code/game/turfs/open/chasm.dm @@ -76,9 +76,6 @@ else to_chat(user, "The plating is going to need some support! Place metal rods first.") -/turf/open/chasm/CanPass(atom/movable/mover, turf/target) - return 1 - // Chasms for Lavaland, with planetary atmos and lava glow /turf/open/chasm/lavaland initial_gas_mix = LAVALAND_DEFAULT_ATMOS diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm index e82bf066d50..d037bc0bb6b 100755 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -206,16 +206,6 @@ return FALSE -/turf/CanPass(atom/movable/mover, turf/target) - if(!target) - return FALSE - - if(istype(mover)) // turf/Enter(...) will perform more advanced checks - return !density - - stack_trace("Non movable passed to turf CanPass : [mover]") - return FALSE - //There's a lot of QDELETED() calls here if someone can figure out how to optimize this but not runtime when something gets deleted by a Bump/CanPass/Cross call, lemme know or go ahead and fix this mess - kevinz000 /turf/Enter(atom/movable/mover, atom/oldloc) // Do not call ..() diff --git a/code/modules/antagonists/blob/blob_mobs.dm b/code/modules/antagonists/blob/blob_mobs.dm index df57f3d9ad7..462a73f07ea 100644 --- a/code/modules/antagonists/blob/blob_mobs.dm +++ b/code/modules/antagonists/blob/blob_mobs.dm @@ -46,10 +46,10 @@ else adjustFireLoss(5) -/mob/living/simple_animal/hostile/blob/CanPass(atom/movable/mover, turf/target) +/mob/living/simple_animal/hostile/blob/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover, /obj/structure/blob)) - return 1 - return ..() + return TRUE /mob/living/simple_animal/hostile/blob/Process_Spacemove(movement_dir = 0) for(var/obj/structure/blob/B in range(1, src)) diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm index b1bcebce372..25523e8ede9 100644 --- a/code/modules/antagonists/blob/structures/_blob.dm +++ b/code/modules/antagonists/blob/structures/_blob.dm @@ -67,10 +67,10 @@ /obj/structure/blob/BlockSuperconductivity() return atmosblock -/obj/structure/blob/CanPass(atom/movable/mover, turf/target) +/obj/structure/blob/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSBLOB)) - return 1 - return 0 + return TRUE /obj/structure/blob/CanAtmosPass(turf/T) return !atmosblock diff --git a/code/modules/antagonists/swarmer/swarmer.dm b/code/modules/antagonists/swarmer/swarmer.dm index 569a6d45af7..ef315af4726 100644 --- a/code/modules/antagonists/swarmer/swarmer.dm +++ b/code/modules/antagonists/swarmer/swarmer.dm @@ -138,12 +138,12 @@ else death() -/mob/living/simple_animal/hostile/swarmer/CanPass(atom/movable/O) +/mob/living/simple_animal/hostile/swarmer/CanAllowThrough(atom/movable/O) + . = ..() if(istype(O, /obj/projectile/beam/disabler))//Allows for swarmers to fight as a group without wasting their shots hitting each other return TRUE if(isswarmer(O)) return TRUE - ..() ////CTRL CLICK FOR SWARMERS AND SWARMER_ACT()'S//// /mob/living/simple_animal/hostile/swarmer/AttackingTarget() @@ -613,7 +613,8 @@ light_range = MINIMUM_USEFUL_LIGHT_RANGE max_integrity = 50 -/obj/structure/swarmer/blockade/CanPass(atom/movable/O) +/obj/structure/swarmer/blockade/CanAllowThrough(atom/movable/O) + . = ..() if(isswarmer(O)) return TRUE if(istype(O, /obj/projectile/beam/disabler)) diff --git a/code/modules/awaymissions/away_props.dm b/code/modules/awaymissions/away_props.dm index 55eb7d011a5..fecc17c711a 100644 --- a/code/modules/awaymissions/away_props.dm +++ b/code/modules/awaymissions/away_props.dm @@ -6,10 +6,11 @@ invisibility = INVISIBILITY_MAXIMUM anchored = TRUE -/obj/effect/oneway/CanPass(atom/movable/mover, turf/target) +/obj/effect/oneway/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() var/turf/T = get_turf(src) var/turf/MT = get_turf(mover) - return ..() && (T == MT || get_dir(MT,T) == dir) + return . && (T == MT || get_dir(MT,T) == dir) /obj/effect/wind @@ -44,7 +45,8 @@ if(blocked_types.len) blocked_types = typecacheof(blocked_types) -/obj/effect/path_blocker/CanPass(atom/movable/mover, turf/target) +/obj/effect/path_blocker/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(blocked_types.len) var/list/mover_contents = mover.GetAllContents() for(var/atom/movable/thing in mover_contents) diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index 68225e968c5..993f18bd838 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -533,11 +533,10 @@ if(!override) qdel(src) -/obj/structure/spacevine/CanPass(atom/movable/mover, turf/target) +/obj/structure/spacevine/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(isvineimmune(mover)) - . = TRUE - else - . = ..() + return TRUE /proc/isvineimmune(atom/A) . = FALSE diff --git a/code/modules/fields/turf_objects.dm b/code/modules/fields/turf_objects.dm index d37036d83c7..4d3a4cf4b70 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/CanPass(atom/movable/AM, turf/target) +/obj/effect/abstract/proximity_checker/advanced/field_turf/CanAllowThrough(atom/movable/AM, turf/target) + . = ..() if(parent) return parent.field_turf_canpass(AM, src, target) - return TRUE /obj/effect/abstract/proximity_checker/advanced/field_turf/Crossed(atom/movable/AM) if(parent) @@ -47,10 +47,10 @@ name = "energy field edge" desc = "Edgy description here." -/obj/effect/abstract/proximity_checker/advanced/field_edge/CanPass(atom/movable/AM, turf/target) +/obj/effect/abstract/proximity_checker/advanced/field_edge/CanAllowThrough(atom/movable/AM, turf/target) + . = ..() if(parent) return parent.field_edge_canpass(AM, src, target) - return TRUE /obj/effect/abstract/proximity_checker/advanced/field_edge/Crossed(atom/movable/AM) if(parent) diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm index 4b981d59f79..bbfcdc96b1a 100644 --- a/code/modules/flufftext/Hallucination.dm +++ b/code/modules/flufftext/Hallucination.dm @@ -643,10 +643,10 @@ 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/CanPass(atom/movable/mover, turf/_target) +/obj/effect/hallucination/fake_door_lock/CanAllowThrough(atom/movable/mover, turf/_target) + . = ..() if(mover == target && airlock.density) return FALSE - return TRUE /datum/hallucination/chat diff --git a/code/modules/holiday/halloween.dm b/code/modules/holiday/halloween.dm index 92a0b699de7..d4763a7a720 100644 --- a/code/modules/holiday/halloween.dm +++ b/code/modules/holiday/halloween.dm @@ -171,10 +171,6 @@ /mob/living/simple_animal/shade/howling_ghost/adjustHealth(amount, updating_health = TRUE, forced = FALSE) . = 0 -/mob/living/simple_animal/shade/howling_ghost/CanPass(atom/movable/mover, turf/target) - return 1 - - /////////////////////////// //Spookoween Insane Clown// /////////////////////////// diff --git a/code/modules/hydroponics/grown/towercap.dm b/code/modules/hydroponics/grown/towercap.dm index 1ef4393de02..cc40eb59aa4 100644 --- a/code/modules/hydroponics/grown/towercap.dm +++ b/code/modules/hydroponics/grown/towercap.dm @@ -164,12 +164,12 @@ . = ..() StartBurning() -/obj/structure/bonfire/CanPass(atom/movable/mover, turf/target) +/obj/structure/bonfire/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover) && (mover.pass_flags & PASSTABLE)) return TRUE if(mover.throwing) return TRUE - return ..() /obj/structure/bonfire/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/stack/rods) && !can_buckle && !grill) diff --git a/code/modules/mining/minebot.dm b/code/modules/mining/minebot.dm index 3b5b96f1bdb..7f64bbbf9e2 100644 --- a/code/modules/mining/minebot.dm +++ b/code/modules/mining/minebot.dm @@ -132,7 +132,8 @@ to_chat(M, "[src] has been set to attack hostile wildlife.") return -/mob/living/simple_animal/hostile/mining_drone/CanPass(atom/movable/O) +/mob/living/simple_animal/hostile/mining_drone/CanAllowThrough(atom/movable/O) + . = ..() if(istype(O, /obj/projectile/kinetic)) var/obj/projectile/kinetic/K = O if(K.kinetic_gun) @@ -142,7 +143,6 @@ return TRUE if(istype(O, /obj/projectile/destabilizer)) return TRUE - return ..() /mob/living/simple_animal/hostile/mining_drone/proc/SetCollectBehavior() mode = MINEDRONE_COLLECT diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index ee724d4179f..e26e5a3cf6e 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -164,9 +164,6 @@ GLOBAL_VAR_INIT(observer_default_invisibility, INVISIBILITY_OBSERVER) QDEL_NULL(spawners_menu) return ..() -/mob/dead/CanPass(atom/movable/mover, turf/target) - return 1 - /* * This proc will update the icon of the ghost itself, with hair overlays, as well as the ghost image. * Please call update_icon(icon_state) from now on when you want to update the icon_state of the ghost, diff --git a/code/modules/mob/living/living_movement.dm b/code/modules/mob/living/living_movement.dm index 89ce99f58ec..4e5bbdef2e1 100644 --- a/code/modules/mob/living/living_movement.dm +++ b/code/modules/mob/living/living_movement.dm @@ -2,7 +2,8 @@ . = ..() update_turf_movespeed(loc) -/mob/living/CanPass(atom/movable/mover, turf/target) +/mob/living/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if((mover.pass_flags & PASSMOB)) return TRUE if(istype(mover, /obj/projectile)) @@ -12,10 +13,9 @@ return (!density || !(mobility_flags & MOBILITY_STAND) || (mover.throwing.thrower == src && !ismob(mover))) if(buckled == mover) return TRUE - if(ismob(mover)) - if(mover in buckled_mobs) - return TRUE - return (!mover.density || !density || !(mobility_flags & MOBILITY_STAND)) + if(ismob(mover) && (mover in buckled_mobs)) + return TRUE + return (!mover.density || . || !(mobility_flags & MOBILITY_STAND)) /mob/living/toggle_move_intent() . = ..() 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 4bf12c8b059..6995c066efa 100644 --- a/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm +++ b/code/modules/mob/living/simple_animal/hostile/jungle/mook.dm @@ -33,12 +33,12 @@ footstep_type = FOOTSTEP_MOB_BAREFOOT -/mob/living/simple_animal/hostile/jungle/mook/CanPass(atom/movable/O) +/mob/living/simple_animal/hostile/jungle/mook/CanAllowThrough(atom/movable/O) + . = ..() 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) return TRUE - return ..() /mob/living/simple_animal/hostile/jungle/mook/death() desc = "A deceased primitive. Upon closer inspection, it was suffering from severe cellular degeneration and its garments are machine made..."//Can you guess the twist 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 aa262c8803a..369204f9765 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/bubblegum.dm @@ -427,10 +427,10 @@ Difficulty: Hard severity = EXPLODE_LIGHT // puny mortals return ..() -/mob/living/simple_animal/hostile/megafauna/bubblegum/CanPass(atom/movable/mover, turf/target) +/mob/living/simple_animal/hostile/megafauna/bubblegum/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover, /mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination)) return TRUE - return ..() /mob/living/simple_animal/hostile/megafauna/bubblegum/Goto(target, delay, minimum_distance) if(!charging) @@ -526,10 +526,10 @@ Difficulty: Hard new /obj/effect/decal/cleanable/blood(get_turf(src)) . = ..() -/mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination/CanPass(atom/movable/mover, turf/target) +/mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover, /mob/living/simple_animal/hostile/megafauna/bubblegum)) // hallucinations should not be stopping bubblegum or eachother return TRUE - return ..() /mob/living/simple_animal/hostile/megafauna/bubblegum/hallucination/Life() return 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 bec6ae87ceb..acfd0ed3db4 100644 --- a/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm +++ b/code/modules/mob/living/simple_animal/hostile/megafauna/hierophant.dm @@ -528,7 +528,8 @@ Difficulty: Hard queue_smooth_neighbors(src) return ..() -/obj/effect/temp_visual/hierophant/wall/CanPass(atom/movable/mover, turf/target) +/obj/effect/temp_visual/hierophant/wall/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(QDELETED(caster)) return FALSE if(mover == caster.pulledby) @@ -539,7 +540,6 @@ Difficulty: Hard return TRUE if(mover == caster) return TRUE - return FALSE /obj/effect/temp_visual/hierophant/chaser //a hierophant's chaser. follows target around, moving and producing a blast every speed deciseconds. duration = 98 diff --git a/code/modules/mob/living/simple_animal/hostile/mimic.dm b/code/modules/mob/living/simple_animal/hostile/mimic.dm index b2cf49582f7..26219f8e7de 100644 --- a/code/modules/mob/living/simple_animal/hostile/mimic.dm +++ b/code/modules/mob/living/simple_animal/hostile/mimic.dm @@ -283,37 +283,36 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca var/max_mob_size = MOB_SIZE_HUMAN var/locked = FALSE var/datum/action/innate/mimic/lock/lock - + /mob/living/simple_animal/hostile/mimic/xenobio/Initialize() . = ..() lock = new lock.Grant(src) - + /mob/living/simple_animal/hostile/mimic/xenobio/AttackingTarget() if(src == target) toggle_open() return return ..() - + /mob/living/simple_animal/hostile/mimic/xenobio/attack_hand(mob/living/carbon/human/M) . = ..() if(M.a_intent != "help") return toggle_open() - + /mob/living/simple_animal/hostile/mimic/xenobio/death() var/obj/structure/closet/crate/C = new(get_turf(src)) // Put loot in crate for(var/atom/movable/AM in src) AM.forceMove(C) return ..() - -/mob/living/simple_animal/hostile/mimic/xenobio/CanPass(atom/movable/mover, turf/target) + +/mob/living/simple_animal/hostile/mimic/xenobio/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(istype(mover, /obj/structure/closet)) return FALSE - else - return !density - + /mob/living/simple_animal/hostile/mimic/xenobio/proc/toggle_open() if(locked) return @@ -332,7 +331,7 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca for(var/atom/movable/AM in get_turf(src)) if(insertion_allowed(AM)) AM.forceMove(src) - + /mob/living/simple_animal/hostile/mimic/xenobio/proc/insertion_allowed(atom/movable/AM) if(ismob(AM)) if(!isliving(AM)) //Don't let ghosts and such get trapped in the beast. @@ -355,14 +354,14 @@ GLOBAL_LIST_INIT(protected_objects, list(/obj/structure/table, /obj/structure/ca else return FALSE return TRUE - + /datum/action/innate/mimic background_icon_state = "bg_default" - + /datum/action/innate/mimic/lock name = "Lock/Unlock" desc = "Toggle preventing yourself from being opened or closed." - + /datum/action/innate/mimic/lock/Activate() var/mob/living/simple_animal/hostile/mimic/xenobio/M = owner M.locked = !M.locked 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 f6701bb44b2..b24f055d3bb 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 @@ -71,14 +71,14 @@ return //if it's not our target, we ignore it -/mob/living/simple_animal/hostile/asteroid/curseblob/CanPass(atom/movable/mover, turf/target) +/mob/living/simple_animal/hostile/asteroid/curseblob/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(mover == set_target) return FALSE if(istype(mover, /obj/projectile)) var/obj/projectile/P = mover if(P.firer == set_target) return FALSE - return TRUE #define IGNORE_PROC_IF_NOT_TARGET(X) /mob/living/simple_animal/hostile/asteroid/curseblob/##X(AM) { if (AM == set_target) return ..(); } 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 695639cc5ee..8cb629c9025 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 @@ -354,8 +354,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/CanPass(atom/movable/mover, turf/target) +/obj/effect/temp_visual/elite_tumor_wall/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(mover == ourelite || mover == activator) return FALSE - else - return TRUE diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 98a59b851cd..740a0884138 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -1,7 +1,3 @@ -///Can the atom pass this mob (always true for /mob) -/mob/CanPass(atom/movable/mover, turf/target) - return TRUE //There's almost no cases where non /living mobs should be used in game as actual mobs, other than ghosts. - /** * If your mob is concious, drop the item in the active hand * @@ -38,17 +34,17 @@ * Move a client in a direction * * Huge proc, has a lot of functionality - * + * * Mostly it will despatch to the mob that you are the owner of to actually move * in the physical realm - * + * * Things that stop you moving as a mob: * * world time being less than your next move_delay * * not being in a mob, or that mob not having a loc * * missing the n and direction parameters * * being in remote control of an object (calls Moveobject instead) * * being dead (it ghosts you instead) - * + * * Things that stop you moving as a mob living (why even have OO if you're just shoving it all * in the parent proc with istype checks right?): * * having incorporeal_move set (calls Process_Incorpmove() instead) @@ -68,7 +64,7 @@ * * Finally if you're pulling an object and it's dense, you are turned 180 after the move * (if you ask me, this should be at the top of the move so you don't dance around) - * + * */ /client/Move(n, direct) if(world.time < move_delay) //do not move anything ahead of this check please @@ -175,7 +171,7 @@ * Allows mobs to ignore density and phase through objects * * Called by client/Move() - * + * * The behaviour depends on the incorporeal_move value of the mob * * * INCORPOREAL_MOVE_BASIC - forceMoved to the next tile with no stop @@ -263,9 +259,9 @@ * Handles mob/living movement in space (or no gravity) * * Called by /client/Move() - * + * * return TRUE for movement or FALSE for none - * + * * You can move in space if you have a spacewalk ability */ /mob/Process_Spacemove(movement_dir = 0) @@ -443,7 +439,7 @@ /** * Toggle the move intent of the mob - * + * * triggers an update the move intent hud as well */ /mob/proc/toggle_move_intent(mob/user) diff --git a/code/modules/plumbing/plumbers/grinder_chemical.dm b/code/modules/plumbing/plumbers/grinder_chemical.dm index 9ef1d192b24..9f10ff3ac44 100644 --- a/code/modules/plumbing/plumbers/grinder_chemical.dm +++ b/code/modules/plumbing/plumbers/grinder_chemical.dm @@ -31,7 +31,7 @@ eat_dir = WEST return TRUE -/obj/machinery/plumbing/grinder_chemical/CanPass(atom/movable/AM) +/obj/machinery/plumbing/grinder_chemical/CanAllowThrough(atom/movable/AM) . = ..() if(!anchored) return diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm index 6a01138840d..a732edb3af2 100644 --- a/code/modules/power/singularity/containment_field.dm +++ b/code/modules/power/singularity/containment_field.dm @@ -106,10 +106,10 @@ return -/obj/machinery/field/CanPass(atom/movable/mover, turf/target) +/obj/machinery/field/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(hasShocked || isliving(mover) || ismachinery(mover) || isstructure(mover) || ismecha(mover)) return FALSE - return ..() /obj/machinery/field/proc/shock(mob/living/user) var/shock_damage = min(rand(30,40),rand(30,40)) diff --git a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm index d996ac8d0b7..ef8a53ea4c5 100644 --- a/code/modules/ruins/objects_and_mobs/necropolis_gate.dm +++ b/code/modules/ruins/objects_and_mobs/necropolis_gate.dm @@ -56,10 +56,10 @@ /obj/structure/necropolis_gate/singularity_pull() return 0 -/obj/structure/necropolis_gate/CanPass(atom/movable/mover, turf/target) - if(get_dir(loc, target) == dir) - return !density - return 1 +/obj/structure/necropolis_gate/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() + if(!(get_dir(loc, target) == dir)) + return TRUE /obj/structure/necropolis_gate/CheckExit(atom/movable/O, target) if(get_dir(O.loc, target) == dir) diff --git a/code/modules/ruins/objects_and_mobs/sin_ruins.dm b/code/modules/ruins/objects_and_mobs/sin_ruins.dm index 7467f2bff62..a5b4d2e1043 100644 --- a/code/modules/ruins/objects_and_mobs/sin_ruins.dm +++ b/code/modules/ruins/objects_and_mobs/sin_ruins.dm @@ -80,7 +80,8 @@ icon = 'icons/mob/blob.dmi' color = rgb(145, 150, 0) -/obj/effect/gluttony/CanPass(atom/movable/mover, turf/target)//So bullets will fly over and stuff. +/obj/effect/gluttony/CanAllowThrough(atom/movable/mover, turf/target)//So bullets will fly over and stuff. + . = ..() if(ishuman(mover)) var/mob/living/carbon/human/H = mover if(H.nutrition >= NUTRITION_LEVEL_FAT) @@ -90,8 +91,6 @@ to_chat(H, "You're repulsed by even looking at [src]. Only a pig could force themselves to go through it.") if(istype(mover, /mob/living/simple_animal/hostile/morph)) return TRUE - else - return FALSE /obj/structure/mirror/magic/pride //Pride's mirror: Used in the Pride ruin. name = "pride's mirror" diff --git a/code/modules/shuttle/special.dm b/code/modules/shuttle/special.dm index fe5d6d31678..80862fdc928 100644 --- a/code/modules/shuttle/special.dm +++ b/code/modules/shuttle/special.dm @@ -223,7 +223,9 @@ var/static/list/check_times = list() var/list/payees = list() -/obj/machinery/scanner_gate/luxury_shuttle/CanPass(atom/movable/mover, turf/target) +/obj/machinery/scanner_gate/luxury_shuttle/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() + if(mover in approved_passengers) set_scanline("scanning", 10) return TRUE @@ -231,8 +233,6 @@ if(!isliving(mover)) //No stowaways return FALSE - return FALSE - /obj/machinery/scanner_gate/luxury_shuttle/Crossed(atom/movable/AM) return diff --git a/code/modules/spells/spell_types/forcewall.dm b/code/modules/spells/spell_types/forcewall.dm index a8b61969a69..3c3fcc320a2 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/CanPass(atom/movable/mover, turf/target) +/obj/effect/forcefield/wizard/CanAllowThrough(atom/movable/mover, turf/target) + . = ..() if(mover == wizard) return TRUE if(ismob(mover)) var/mob/M = mover if(M.anti_magic_check(chargecost = 0)) return TRUE - return FALSE