From 8ed384b38c8bdcdee12b5fe556d5536890edf915 Mon Sep 17 00:00:00 2001 From: Anewbe Date: Sun, 10 Feb 2019 17:32:39 -0600 Subject: [PATCH] Rewrites Atmospherics --- code/ZAS/Atom.dm | 57 ++- code/__defines/atmos.dm | 8 +- code/game/gamemodes/meteor/meteors.dm | 2 +- code/game/machinery/OpTable.dm | 9 +- code/game/machinery/deployable.dm | 18 +- code/game/machinery/doors/airlock.dm | 2 +- code/game/machinery/doors/blast_door.dm | 12 +- code/game/machinery/doors/door.dm | 8 +- code/game/machinery/doors/firedoor.dm | 3 +- code/game/machinery/doors/windowdoor.dm | 19 +- code/game/machinery/iv_drip.dm | 6 +- code/game/mecha/mech_sensor.dm | 12 +- code/game/objects/effects/alien/aliens.dm | 4 +- code/game/objects/effects/chem/foam.dm | 6 +- code/game/objects/effects/spiders.dm | 12 +- code/game/objects/effects/zone_divider.dm | 7 +- code/game/objects/items/weapons/policetape.dm | 11 +- code/game/objects/structures/cliff.dm | 475 +++++++++--------- code/game/objects/structures/coathanger.dm | 2 +- .../structures/crates_lockers/closets.dm | 2 +- .../crates_lockers/closets/coffin.dm | 2 +- code/game/objects/structures/fence.dm | 356 ++++++------- code/game/objects/structures/gravemarker.dm | 9 +- code/game/objects/structures/grille.dm | 23 +- code/game/objects/structures/inflatable.dm | 8 +- code/game/objects/structures/plasticflaps.dm | 13 +- code/game/objects/structures/railing.dm | 11 +- code/game/objects/structures/simple_doors.dm | 4 +- .../structures/stool_bed_chair_nest/bed.dm | 7 +- .../objects/structures/windoor_assembly.dm | 8 +- code/game/objects/structures/window.dm | 17 + .../game/objects/structures/window_spawner.dm | 3 +- code/game/shuttle_engines.dm | 8 +- code/modules/blob/blob.dm | 8 +- code/modules/blob2/blobs/base_blob.dm | 14 +- code/modules/blob2/blobs/shield.dm | 1 + code/modules/holodeck/HolodeckObjects.dm | 15 +- code/modules/hydroponics/trays/tray.dm | 9 +- code/modules/mob/dead/observer/observer.dm | 4 +- code/modules/mob/living/living_movement.dm | 8 +- code/modules/power/antimatter/shielding.dm | 5 +- .../power/fusion/fusion_particle_catcher.dm | 4 +- code/modules/power/turbine.dm | 6 +- code/modules/recycling/disposal.dm | 4 +- code/modules/shieldgen/directional_shield.dm | 8 +- code/modules/shieldgen/emergency_shield.dm | 5 +- code/modules/shieldgen/energy_field.dm | 10 +- code/modules/shieldgen/sheldwallgen.dm | 12 +- code/modules/tables/interactions.dm | 16 +- 49 files changed, 633 insertions(+), 640 deletions(-) diff --git a/code/ZAS/Atom.dm b/code/ZAS/Atom.dm index 63ed9cf090..0457dce1a5 100644 --- a/code/ZAS/Atom.dm +++ b/code/ZAS/Atom.dm @@ -1,34 +1,46 @@ /atom/var/pressure_resistance = ONE_ATMOSPHERE +/atom/var/can_atmos_pass = ATMOS_PASS_YES -/atom/proc/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0) - //Purpose: Determines if the object (or airflow) can pass this atom. - //Called by: Movement, airflow. - //Inputs: The moving atom (optional), target turf, "height" and air group - //Outputs: Boolean if can pass. +// Purpose: Determines if the object can pass this atom. +// Called by: Movement. +// Inputs: The moving atom, target turf. +// Outputs: Boolean if can pass. +// Airflow and ZAS zones now uses CanZASPass() instead of this proc. +/atom/proc/CanPass(atom/movable/mover, turf/target) + return !density - return (!density || !height || air_group) +// Purpose: Determines if airflow is allowed between T and loc. +// Called by: Airflow. +// Inputs: The turf the airflow is from, which may not be the same as loc. is_zone is for conditionally disallowing merging. +// Outputs: Boolean if airflow can pass. +/atom/proc/CanZASPass(turf/T, is_zone) + switch(can_atmos_pass) + if(ATMOS_PASS_DENSITY) + return !density + else + return can_atmos_pass -/turf/CanPass(atom/movable/mover, turf/target, height=1.5,air_group=0) - if(!target) return 0 +/turf/can_atmos_pass = ATMOS_PASS_NO + +/turf/CanPass(atom/movable/mover, turf/target) + if(!target) return FALSE if(istype(mover)) // turf/Enter(...) will perform more advanced checks return !density - else // Now, doing more detailed checks for air movement and air group formation - if(target.blocks_air||blocks_air) - return 0 - - for(var/obj/obstacle in src) - if(!obstacle.CanPass(mover, target, height, air_group)) - return 0 - if(target != src) - for(var/obj/obstacle in target) - if(!obstacle.CanPass(mover, src, height, air_group)) - return 0 - - return 1 +/turf/CanZASPass(turf/T, is_zone) + if(T.blocks_air || src.blocks_air) + return FALSE + for(var/obj/obstacle in src) + if(!obstacle.CanZASPass(T, is_zone)) + return FALSE + if(T != src) + for(var/obj/obstacle in T) + if(!obstacle.CanZASPass(src, is_zone)) + return FALSE + return TRUE //Convenience function for atoms to update turfs they occupy /atom/movable/proc/update_nearby_tiles(need_rebuild) @@ -50,8 +62,7 @@ atom/proc/c_airblock(turf/other) #ifdef ZASDBG ASSERT(isturf(other)) #endif - return (AIR_BLOCKED*!CanPass(null, other, 0, 0))|(ZONE_BLOCKED*!CanPass(null, other, 1.5, 1)) - + return (AIR_BLOCKED*!CanZASPass(other, FALSE))|(ZONE_BLOCKED*!CanZASPass(other, TRUE)) turf/c_airblock(turf/other) #ifdef ZASDBG diff --git a/code/__defines/atmos.dm b/code/__defines/atmos.dm index 13964a6f80..66348344f2 100644 --- a/code/__defines/atmos.dm +++ b/code/__defines/atmos.dm @@ -92,4 +92,10 @@ #define ATMOSTANK_OXYGEN 40000 // O2 is also important for airmix, but not as much as N2 as it's only 21% of it. #define ATMOSTANK_CO2 25000 // CO2 and PH are not critically important for station, only for toxins and alternative coolants, no need to store a lot of those. #define ATMOSTANK_PHORON 25000 -#define ATMOSTANK_NITROUSOXIDE 10000 // N2O doesn't have a real useful use, i guess it's on station just to allow refilling of sec's riot control canisters? \ No newline at end of file +#define ATMOSTANK_NITROUSOXIDE 10000 // N2O doesn't have a real useful use, i guess it's on station just to allow refilling of sec's riot control canisters? + +// Used for quickly making certain things allow airflow or not. +// More complicated, conditional airflow should override CanZASPass(). +#define ATMOS_PASS_YES 1 +#define ATMOS_PASS_NO 0 +#define ATMOS_PASS_DENSITY -1 // Just checks density. \ No newline at end of file diff --git a/code/game/gamemodes/meteor/meteors.dm b/code/game/gamemodes/meteor/meteors.dm index 84cbb4d904..4380331b50 100644 --- a/code/game/gamemodes/meteor/meteors.dm +++ b/code/game/gamemodes/meteor/meteors.dm @@ -148,7 +148,7 @@ else die(0) -/obj/effect/meteor/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) +/obj/effect/meteor/CanPass(atom/movable/mover, turf/target) return istype(mover, /obj/effect/meteor) ? 1 : ..() /obj/effect/meteor/proc/ram_turf(var/turf/T) diff --git a/code/game/machinery/OpTable.dm b/code/game/machinery/OpTable.dm index ccf3f69529..f7a454a7de 100644 --- a/code/game/machinery/OpTable.dm +++ b/code/game/machinery/OpTable.dm @@ -48,13 +48,10 @@ qdel(src) return -/obj/machinery/optable/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group || (height==0)) return 1 - +/obj/machinery/optable/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSTABLE)) - return 1 - else - return 0 + return TRUE + return FALSE /obj/machinery/optable/MouseDrop_T(obj/O as obj, mob/user as mob) diff --git a/code/game/machinery/deployable.dm b/code/game/machinery/deployable.dm index c50503f3c5..765ced8a39 100644 --- a/code/game/machinery/deployable.dm +++ b/code/game/machinery/deployable.dm @@ -128,13 +128,10 @@ for reference: dismantle() return -/obj/structure/barricade/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)//So bullets will fly over and stuff. - if(air_group || (height==0)) - return 1 +/obj/structure/barricade/CanPass(atom/movable/mover, turf/target)//So bullets will fly over and stuff. if(istype(mover) && mover.checkpass(PASSTABLE)) - return 1 - else - return 0 + return TRUE + return FALSE //Actual Deployable machinery stuff /obj/machinery/deployable @@ -223,13 +220,10 @@ for reference: anchored = !anchored icon_state = "barrier[locked]" -/obj/machinery/deployable/barrier/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)//So bullets will fly over and stuff. - if(air_group || (height==0)) - return 1 +/obj/machinery/deployable/barrier/CanPass(atom/movable/mover, turf/target)//So bullets will fly over and stuff. if(istype(mover) && mover.checkpass(PASSTABLE)) - return 1 - else - return 0 + return TRUE + return FALSE /obj/machinery/deployable/barrier/proc/explode() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 9c1a9a75b0..ed7808ec93 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -782,7 +782,7 @@ About the new airlock wires panel: if (user) src.attack_ai(user) -/obj/machinery/door/airlock/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) +/obj/machinery/door/airlock/CanPass(atom/movable/mover, turf/target) if (src.isElectrified()) if (istype(mover, /obj/item)) var/obj/item/i = mover diff --git a/code/game/machinery/doors/blast_door.dm b/code/game/machinery/doors/blast_door.dm index 13cc48c4c5..fb2ea6c799 100644 --- a/code/game/machinery/doors/blast_door.dm +++ b/code/game/machinery/doors/blast_door.dm @@ -259,12 +259,14 @@ if(stat & BROKEN) stat &= ~BROKEN - -/obj/machinery/door/blast/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group) return 1 +/* +// This replicates the old functionality coded into CanPass() for this object, however it appeared to have made blast doors not airtight. +// If for some reason this is actually needed for something important, uncomment this. +/obj/machinery/door/blast/CanZASPass(turf/T, is_zone) + if(is_zone) + return ATMOS_PASS_YES return ..() - - +*/ // SUBTYPE: Regular // Your classical blast door, found almost everywhere. diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index b0dde10ee4..abcf6b41eb 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -9,6 +9,7 @@ anchored = 1 opacity = 1 density = 1 + can_atmos_pass = ATMOS_PASS_DENSITY layer = DOOR_OPEN_LAYER var/open_layer = DOOR_OPEN_LAYER var/closed_layer = DOOR_CLOSED_LAYER @@ -135,12 +136,15 @@ else do_animate("deny") -/obj/machinery/door/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group) return !block_air_zones +/obj/machinery/door/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSGLASS)) return !opacity return !density +/obj/machinery/door/CanZASPass(turf/T, is_zone) + if(is_zone) + return block_air_zones ? ATMOS_PASS_NO : ATMOS_PASS_YES + return ..() /obj/machinery/door/proc/bumpopen(mob/user as mob) if(operating) return diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index ac5246d2da..d5043af6ef 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -471,11 +471,10 @@ heat_proof = 1 air_properties_vary_with_direction = 1 - CanPass(atom/movable/mover, turf/target, height=0, air_group=0) + CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSGLASS)) return 1 if(get_dir(loc, target) == dir) //Make sure looking at appropriate border - if(air_group) return 0 return !density else return 1 diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 1724b49192..162df0d582 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -84,14 +84,27 @@ open() addtimer(CALLBACK(src, .proc/close), check_access(null)? 50 : 20) -/obj/machinery/door/window/CanPass(atom/movable/mover, turf/target, height, air_group) +<<<<<<< HEAD +/obj/machinery/door/window/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(istype(mover) && mover.checkpass(PASSGLASS)) return 1 if(get_dir(mover, loc) == turn(dir, 180)) //Make sure looking at appropriate border if(air_group) return 0 +======= +/obj/machinery/door/window/CanPass(atom/movable/mover, turf/target) + if(istype(mover) && mover.checkpass(PASSGLASS)) + return TRUE + if(get_dir(mover, loc) == turn(dir, 180)) //Make sure looking at appropriate border +>>>>>>> 4122c65... Merge pull request #5947 from Neerti/bump_fixes return !density - else - return 1 + return TRUE + +/obj/machinery/door/window/CanZASPass(turf/T, is_zone) + if(get_dir(T, loc) == turn(dir, 180)) + if(is_zone) // No merging allowed. + return ATMOS_PASS_NO + return ..() // Air can flow if open (density == FALSE). + return ATMOS_PASS_YES // Windoors don't block if not facing the right way. /obj/machinery/door/window/CheckExit(atom/movable/mover as mob|obj, turf/target as turf) if(istype(mover) && mover.checkpass(PASSGLASS)) diff --git a/code/game/machinery/iv_drip.dm b/code/game/machinery/iv_drip.dm index 36ec27f4ac..cc20f2cb4e 100644 --- a/code/game/machinery/iv_drip.dm +++ b/code/game/machinery/iv_drip.dm @@ -180,7 +180,7 @@ to_chat(user, "[attached ? attached : "No one"] is attached.") -/obj/machinery/iv_drip/CanPass(atom/movable/mover, turf/target, height = 0, air_group = 0) - if(height && istype(mover) && mover.checkpass(PASSTABLE)) //allow bullets, beams, thrown objects, mice, drones, and the like through. - return 1 +/obj/machinery/iv_drip/CanPass(atom/movable/mover, turf/target) + if(istype(mover) && mover.checkpass(PASSTABLE)) //allow bullets, beams, thrown objects, mice, drones, and the like through. + return TRUE return ..() diff --git a/code/game/mecha/mech_sensor.dm b/code/game/mecha/mech_sensor.dm index 3ac0361e48..aa598d1b0d 100644 --- a/code/game/mecha/mech_sensor.dm +++ b/code/game/mecha/mech_sensor.dm @@ -15,14 +15,14 @@ var/frequency = 1379 var/datum/radio_frequency/radio_connection -/obj/machinery/mech_sensor/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(!src.enabled()) return 1 - if(air_group || (height==0)) return 1 +/obj/machinery/mech_sensor/CanPass(atom/movable/mover, turf/target) + if(!enabled()) + return TRUE - if ((get_dir(loc, target) & dir) && src.is_blocked(mover)) + if((get_dir(loc, target) & dir) && src.is_blocked(mover)) src.give_feedback(mover) - return 0 - return 1 + return FALSE + return TRUE /obj/machinery/mech_sensor/proc/is_blocked(O as obj) if(istype(O, /obj/mecha/medical/odysseus)) diff --git a/code/game/objects/effects/alien/aliens.dm b/code/game/objects/effects/alien/aliens.dm index 7a79c21e1e..44963c31d2 100644 --- a/code/game/objects/effects/alien/aliens.dm +++ b/code/game/objects/effects/alien/aliens.dm @@ -26,6 +26,7 @@ density = 1 opacity = 1 anchored = 1 + can_atmos_pass = ATMOS_PASS_NO var/health = 200 //var/mob/living/affecting = null @@ -128,8 +129,7 @@ ..() return -/obj/effect/alien/resin/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group) return 0 +/obj/effect/alien/resin/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSGLASS)) return !opacity return !density diff --git a/code/game/objects/effects/chem/foam.dm b/code/game/objects/effects/chem/foam.dm index 4455f049ca..f32a75dcce 100644 --- a/code/game/objects/effects/chem/foam.dm +++ b/code/game/objects/effects/chem/foam.dm @@ -130,6 +130,7 @@ anchored = 1 name = "foamed metal" desc = "A lightweight foamed metal wall." + can_atmos_pass = ATMOS_PASS_NO var/metal = 1 // 1 = aluminum, 2 = iron /obj/structure/foamedmetal/New() @@ -178,8 +179,3 @@ qdel(src) else user << "You hit the metal foam to no effect." - -/obj/structure/foamedmetal/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0) - if(air_group) - return 0 - return !density \ No newline at end of file diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index e0581b50f2..bc8490b0f0 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -62,17 +62,23 @@ icon_state = "stickyweb2" return ..() +<<<<<<< HEAD /obj/effect/spider/stickyweb/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(air_group || (height==0)) return 1 if(istype(mover, /mob/living/simple_mob/animal/giant_spider)) return 1 +======= +/obj/effect/spider/stickyweb/CanPass(atom/movable/mover, turf/target) + if(istype(mover, /mob/living/simple_mob/animal/giant_spider)) + return TRUE +>>>>>>> 4122c65... Merge pull request #5947 from Neerti/bump_fixes else if(istype(mover, /mob/living)) if(prob(50)) - mover << "You get stuck in \the [src] for a moment." - return 0 + to_chat(mover, span("warning", "You get stuck in \the [src] for a moment.")) + return FALSE else if(istype(mover, /obj/item/projectile)) return prob(30) - return 1 + return TRUE /obj/effect/spider/eggcluster name = "egg cluster" diff --git a/code/game/objects/effects/zone_divider.dm b/code/game/objects/effects/zone_divider.dm index 5adabf318c..01e6834f16 100644 --- a/code/game/objects/effects/zone_divider.dm +++ b/code/game/objects/effects/zone_divider.dm @@ -8,13 +8,12 @@ density = 0 opacity = 0 -/obj/effect/zone_divider/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) +/obj/effect/zone_divider/CanZASPass(turf/T, is_zone) // Special case to prevent us from being part of a zone during the first air master tick. // We must merge ourselves into a zone on next tick. This will cause a bit of lag on // startup, but it can't really be helped you know? if(air_master && air_master.current_cycle == 0) spawn(1) air_master.mark_for_update(get_turf(src)) - return 0 - return !air_group // Anything except zones can pass - + return ATMOS_PASS_NO + return is_zone ? ATMOS_PASS_NO : ATMOS_PASS_YES // Anything except zones can pass diff --git a/code/game/objects/items/weapons/policetape.dm b/code/game/objects/items/weapons/policetape.dm index fcb2920aa0..bce9b190f6 100644 --- a/code/game/objects/items/weapons/policetape.dm +++ b/code/game/objects/items/weapons/policetape.dm @@ -286,16 +286,23 @@ var/list/tape_roll_applications = list() update_icon() name = "crumpled [name]" -/obj/item/tape/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) +/obj/item/tape/CanPass(atom/movable/mover, turf/target) if(!lifted && ismob(mover)) var/mob/M = mover add_fingerprint(M) +<<<<<<< HEAD if (!allowed(M)) //only select few learn art of not crumpling the tape M << "You are not supposed to go past [src]..." if(M.a_intent == I_HELP && !(istype(M, /mob/living/simple_mob))) return 0 +======= + if(!allowed(M)) //only select few learn art of not crumpling the tape + to_chat(M, span("warning", "You are not supposed to go past \the [src]...")) + if(M.a_intent == I_HELP && !(istype(M, /mob/living/simple_mob))) + return FALSE +>>>>>>> 4122c65... Merge pull request #5947 from Neerti/bump_fixes crumple() - return ..(mover) + return ..() /obj/item/tape/attackby(obj/item/weapon/W as obj, mob/user as mob) breaktape(user) diff --git a/code/game/objects/structures/cliff.dm b/code/game/objects/structures/cliff.dm index 0d197b2a22..c4caf4b7ab 100644 --- a/code/game/objects/structures/cliff.dm +++ b/code/game/objects/structures/cliff.dm @@ -1,239 +1,236 @@ -GLOBAL_LIST_EMPTY(cliff_icon_cache) - -/* -Cliffs give a visual illusion of depth by seperating two places while presenting a 'top' and 'bottom' side. - -Mobs moving into a cliff from the bottom side will simply bump into it and be denied moving into the tile, -where as mobs moving into a cliff from the top side will 'fall' off the cliff, forcing them to the bottom, causing significant damage and stunning them. - -Mobs can climb this while wearing climbing equipment by clickdragging themselves onto a cliff, as if it were a table. - -Flying mobs can pass over all cliffs with no risk of falling. - -Projectiles and thrown objects can pass, however if moving upwards, there is a chance for it to be stopped by the cliff. -This makes fighting something that is on top of a cliff more challenging. - -As a note, dir points upwards, e.g. pointing WEST means the left side is 'up', and the right side is 'down'. - -When mapping these in, be sure to give at least a one tile clearance, as NORTH facing cliffs expand to -two tiles on initialization, and which way a cliff is facing may change during maploading. -*/ - -/obj/structure/cliff - name = "cliff" - desc = "A steep rock ledge. You might be able to climb it if you feel bold enough." - description_info = "Walking off the edge of a cliff while on top will cause you to fall off, causing severe injury.
\ - You can climb this cliff if wearing special climbing equipment, by click-dragging yourself onto the cliff.
\ - Projectiles traveling up a cliff may hit the cliff instead, making it more difficult to fight something \ - on top." - icon = 'icons/obj/flora/rocks.dmi' - - anchored = TRUE - density = TRUE - opacity = FALSE - climbable = TRUE - climb_delay = 10 SECONDS - block_turf_edges = TRUE // Don't want turf edges popping up from the cliff edge. - register_as_dangerous_object = TRUE - - var/icon_variant = null // Used to make cliffs less repeative by having a selection of sprites to display. - var/corner = FALSE // Used for icon things. - var/ramp = FALSE // Ditto. - var/bottom = FALSE // Used for 'bottom' typed cliffs, to avoid infinite cliffs, and for icons. - - var/is_double_cliff = FALSE // Set to true when making the two-tile cliffs, used for projectile checks. - var/uphill_penalty = 30 // Odds of a projectile not making it up the cliff. - -// These arrange their sprites at runtime, as opposed to being statically placed in the map file. -/obj/structure/cliff/automatic - icon_state = "cliffbuilder" - dir = NORTH - -/obj/structure/cliff/automatic/corner - icon_state = "cliffbuilder-corner" - dir = NORTHEAST - corner = TRUE - -// Tiny part that doesn't block, used for making 'ramps'. -/obj/structure/cliff/automatic/ramp - icon_state = "cliffbuilder-ramp" - dir = NORTHEAST - density = FALSE - ramp = TRUE - -// Made automatically as needed by automatic cliffs. -/obj/structure/cliff/bottom - bottom = TRUE - -/obj/structure/cliff/automatic/Initialize() - ..() - return INITIALIZE_HINT_LATELOAD - -// Paranoid about the maploader, direction is very important to cliffs, since they may get bigger if initialized while facing NORTH. -/obj/structure/cliff/automatic/LateInitialize() - if(dir in GLOB.cardinal) - icon_variant = pick("a", "b", "c") - - if(dir & NORTH && !bottom) // North-facing cliffs require more cliffs to be made. - make_bottom() - - update_icon() - -/obj/structure/cliff/proc/make_bottom() - // First, make sure there's room to put the bottom side. - var/turf/T = locate(x, y - 1, z) - if(!istype(T)) - return FALSE - - // Now make the bottom cliff have mostly the same variables. - var/obj/structure/cliff/bottom/bottom = new(T) - is_double_cliff = TRUE - climb_delay /= 2 // Since there are two cliffs to climb when going north, both take half the time. - - bottom.dir = dir - bottom.is_double_cliff = TRUE - bottom.climb_delay = climb_delay - bottom.icon_variant = icon_variant - bottom.corner = corner - bottom.ramp = ramp - bottom.layer = layer - 0.1 - bottom.density = density - bottom.update_icon() - -/obj/structure/cliff/set_dir(new_dir) - ..() - update_icon() - -/obj/structure/cliff/update_icon() - icon_state = "cliff-[dir][icon_variant][bottom ? "-bottom" : ""][corner ? "-corner" : ""][ramp ? "-ramp" : ""]" - - // Now for making the top-side look like a different turf. - var/turf/T = get_step(src, dir) - if(!istype(T)) - return - - var/subtraction_icon_state = "[icon_state]-subtract" - var/cache_string = "[icon_state]_[T.icon]_[T.icon_state]" - if(T && subtraction_icon_state in icon_states(icon)) - cut_overlays() - // If we've made the same icon before, just recycle it. - if(cache_string in GLOB.cliff_icon_cache) - add_overlay(GLOB.cliff_icon_cache[cache_string]) - - else // Otherwise make a new one, but only once. - var/icon/underlying_ground = icon(T.icon, T.icon_state, T.dir) - var/icon/subtract = icon(icon, subtraction_icon_state) - underlying_ground.Blend(subtract, ICON_SUBTRACT) - var/image/final = image(underlying_ground) - final.layer = src.layer - 0.2 - GLOB.cliff_icon_cache[cache_string] = final - add_overlay(final) - - -// Movement-related code. - -/obj/structure/cliff/CanPass(atom/movable/mover, turf/target, height = 0, air_group = 0) - if(air_group || height == 0) - return TRUE // Airflow can always pass. - - else if(isliving(mover)) - var/mob/living/L = mover - if(L.hovering) // Flying mobs can always pass. - return TRUE - return ..() - - // Projectiles and objects flying 'upward' have a chance to hit the cliff instead, wasting the shot. - else if(istype(mover, /obj)) - var/obj/O = mover - if(check_shield_arc(src, dir, O)) // This is actually for mobs but it will work for our purposes as well. - if(prob(uphill_penalty / (1 + is_double_cliff) )) // Firing upwards facing NORTH means it will likely have to pass through two cliffs, so the chance is halved. - return FALSE - return TRUE - -/obj/structure/cliff/Bumped(atom/A) - if(isliving(A)) - var/mob/living/L = A - if(should_fall(L)) - fall_off_cliff(L) - return - ..() - -/obj/structure/cliff/proc/should_fall(mob/living/L) - if(L.hovering) - return FALSE - - var/turf/T = get_turf(L) - if(T && get_dir(T, loc) & reverse_dir[dir]) // dir points 'up' the cliff, e.g. cliff pointing NORTH will cause someone to fall if moving SOUTH into it. - return TRUE - return FALSE - -/obj/structure/cliff/proc/fall_off_cliff(mob/living/L) - if(!istype(L)) - return FALSE - var/turf/T = get_step(src, reverse_dir[dir]) - var/displaced = FALSE - - if(dir in list(EAST, WEST)) // Apply an offset if flying sideways, to help maintain the illusion of depth. - for(var/i = 1 to 2) - var/turf/new_T = locate(T.x, T.y - i, T.z) - if(!new_T || locate(/obj/structure/cliff) in new_T) - break - T = new_T - displaced = TRUE - - if(istype(T)) - visible_message(span("danger", "\The [L] falls off \the [src]!")) - L.forceMove(T) - - // Do the actual hurting. Double cliffs do halved damage due to them most likely hitting twice. - var/harm = !is_double_cliff ? 1 : 0.5 - if(istype(L.buckled, /obj/vehicle)) // People falling off in vehicles will take less damage, but will damage the vehicle severely. - var/obj/vehicle/vehicle = L.buckled - vehicle.adjust_health(40 * harm) - to_chat(L, span("warning", "\The [vehicle] absorbs some of the impact, damaging it.")) - harm /= 2 - - playsound(L, 'sound/effects/break_stone.ogg', 70, 1) - L.Weaken(5 * harm) - var/fall_time = 3 - if(displaced) // Make the fall look more natural when falling sideways. - L.pixel_z = 32 * 2 - animate(L, pixel_z = 0, time = fall_time) - sleep(fall_time) // A brief delay inbetween the two sounds helps sell the 'ouch' effect. - playsound(L, "punch", 70, 1) - shake_camera(L, 1, 1) - visible_message(span("danger", "\The [L] hits the ground!")) - - // The bigger they are, the harder they fall. - // They will take at least 20 damage at the minimum, and tries to scale up to 40% of their max health. - // This scaling is capped at 100 total damage, which occurs if the thing that fell has more than 250 health. - var/damage = between(20, L.getMaxHealth() * 0.4, 100) - var/target_zone = ran_zone() - var/blocked = L.run_armor_check(target_zone, "melee") * harm - var/soaked = L.get_armor_soak(target_zone, "melee") * harm - - L.apply_damage(damage * harm, BRUTE, target_zone, blocked, soaked, used_weapon=src) - - // Now fall off more cliffs below this one if they exist. - var/obj/structure/cliff/bottom_cliff = locate() in T - if(bottom_cliff) - visible_message(span("danger", "\The [L] rolls down towards \the [bottom_cliff]!")) - sleep(5) - bottom_cliff.fall_off_cliff(L) - -/obj/structure/cliff/can_climb(mob/living/user, post_climb_check = FALSE) - // Cliff climbing requires climbing gear. - if(ishuman(user)) - var/mob/living/carbon/human/H = user - var/obj/item/clothing/shoes/shoes = H.shoes - if(shoes && shoes.rock_climbing) - return ..() // Do the other checks too. - - to_chat(user, span("warning", "\The [src] is too steep to climb unassisted.")) - return FALSE - -// This tells AI mobs to not be dumb and step off cliffs willingly. -/obj/structure/cliff/is_safe_to_step(mob/living/L) - if(should_fall(L)) - return FALSE - return ..() +GLOBAL_LIST_EMPTY(cliff_icon_cache) + +/* +Cliffs give a visual illusion of depth by seperating two places while presenting a 'top' and 'bottom' side. + +Mobs moving into a cliff from the bottom side will simply bump into it and be denied moving into the tile, +where as mobs moving into a cliff from the top side will 'fall' off the cliff, forcing them to the bottom, causing significant damage and stunning them. + +Mobs can climb this while wearing climbing equipment by clickdragging themselves onto a cliff, as if it were a table. + +Flying mobs can pass over all cliffs with no risk of falling. + +Projectiles and thrown objects can pass, however if moving upwards, there is a chance for it to be stopped by the cliff. +This makes fighting something that is on top of a cliff more challenging. + +As a note, dir points upwards, e.g. pointing WEST means the left side is 'up', and the right side is 'down'. + +When mapping these in, be sure to give at least a one tile clearance, as NORTH facing cliffs expand to +two tiles on initialization, and which way a cliff is facing may change during maploading. +*/ + +/obj/structure/cliff + name = "cliff" + desc = "A steep rock ledge. You might be able to climb it if you feel bold enough." + description_info = "Walking off the edge of a cliff while on top will cause you to fall off, causing severe injury.
\ + You can climb this cliff if wearing special climbing equipment, by click-dragging yourself onto the cliff.
\ + Projectiles traveling up a cliff may hit the cliff instead, making it more difficult to fight something \ + on top." + icon = 'icons/obj/flora/rocks.dmi' + + anchored = TRUE + density = TRUE + opacity = FALSE + climbable = TRUE + climb_delay = 10 SECONDS + block_turf_edges = TRUE // Don't want turf edges popping up from the cliff edge. + register_as_dangerous_object = TRUE + + var/icon_variant = null // Used to make cliffs less repeative by having a selection of sprites to display. + var/corner = FALSE // Used for icon things. + var/ramp = FALSE // Ditto. + var/bottom = FALSE // Used for 'bottom' typed cliffs, to avoid infinite cliffs, and for icons. + + var/is_double_cliff = FALSE // Set to true when making the two-tile cliffs, used for projectile checks. + var/uphill_penalty = 30 // Odds of a projectile not making it up the cliff. + +// These arrange their sprites at runtime, as opposed to being statically placed in the map file. +/obj/structure/cliff/automatic + icon_state = "cliffbuilder" + dir = NORTH + +/obj/structure/cliff/automatic/corner + icon_state = "cliffbuilder-corner" + dir = NORTHEAST + corner = TRUE + +// Tiny part that doesn't block, used for making 'ramps'. +/obj/structure/cliff/automatic/ramp + icon_state = "cliffbuilder-ramp" + dir = NORTHEAST + density = FALSE + ramp = TRUE + +// Made automatically as needed by automatic cliffs. +/obj/structure/cliff/bottom + bottom = TRUE + +/obj/structure/cliff/automatic/Initialize() + ..() + return INITIALIZE_HINT_LATELOAD + +// Paranoid about the maploader, direction is very important to cliffs, since they may get bigger if initialized while facing NORTH. +/obj/structure/cliff/automatic/LateInitialize() + if(dir in GLOB.cardinal) + icon_variant = pick("a", "b", "c") + + if(dir & NORTH && !bottom) // North-facing cliffs require more cliffs to be made. + make_bottom() + + update_icon() + +/obj/structure/cliff/proc/make_bottom() + // First, make sure there's room to put the bottom side. + var/turf/T = locate(x, y - 1, z) + if(!istype(T)) + return FALSE + + // Now make the bottom cliff have mostly the same variables. + var/obj/structure/cliff/bottom/bottom = new(T) + is_double_cliff = TRUE + climb_delay /= 2 // Since there are two cliffs to climb when going north, both take half the time. + + bottom.dir = dir + bottom.is_double_cliff = TRUE + bottom.climb_delay = climb_delay + bottom.icon_variant = icon_variant + bottom.corner = corner + bottom.ramp = ramp + bottom.layer = layer - 0.1 + bottom.density = density + bottom.update_icon() + +/obj/structure/cliff/set_dir(new_dir) + ..() + update_icon() + +/obj/structure/cliff/update_icon() + icon_state = "cliff-[dir][icon_variant][bottom ? "-bottom" : ""][corner ? "-corner" : ""][ramp ? "-ramp" : ""]" + + // Now for making the top-side look like a different turf. + var/turf/T = get_step(src, dir) + if(!istype(T)) + return + + var/subtraction_icon_state = "[icon_state]-subtract" + var/cache_string = "[icon_state]_[T.icon]_[T.icon_state]" + if(T && subtraction_icon_state in icon_states(icon)) + cut_overlays() + // If we've made the same icon before, just recycle it. + if(cache_string in GLOB.cliff_icon_cache) + add_overlay(GLOB.cliff_icon_cache[cache_string]) + + else // Otherwise make a new one, but only once. + var/icon/underlying_ground = icon(T.icon, T.icon_state, T.dir) + var/icon/subtract = icon(icon, subtraction_icon_state) + underlying_ground.Blend(subtract, ICON_SUBTRACT) + var/image/final = image(underlying_ground) + final.layer = src.layer - 0.2 + GLOB.cliff_icon_cache[cache_string] = final + add_overlay(final) + + +// Movement-related code. + +/obj/structure/cliff/CanPass(atom/movable/mover, turf/target) + if(isliving(mover)) + var/mob/living/L = mover + if(L.hovering) // Flying mobs can always pass. + return TRUE + return ..() + + // Projectiles and objects flying 'upward' have a chance to hit the cliff instead, wasting the shot. + else if(istype(mover, /obj)) + var/obj/O = mover + if(check_shield_arc(src, dir, O)) // This is actually for mobs but it will work for our purposes as well. + if(prob(uphill_penalty / (1 + is_double_cliff) )) // Firing upwards facing NORTH means it will likely have to pass through two cliffs, so the chance is halved. + return FALSE + return TRUE + +/obj/structure/cliff/Bumped(atom/A) + if(isliving(A)) + var/mob/living/L = A + if(should_fall(L)) + fall_off_cliff(L) + return + ..() + +/obj/structure/cliff/proc/should_fall(mob/living/L) + if(L.hovering) + return FALSE + + var/turf/T = get_turf(L) + if(T && get_dir(T, loc) & reverse_dir[dir]) // dir points 'up' the cliff, e.g. cliff pointing NORTH will cause someone to fall if moving SOUTH into it. + return TRUE + return FALSE + +/obj/structure/cliff/proc/fall_off_cliff(mob/living/L) + if(!istype(L)) + return FALSE + var/turf/T = get_step(src, reverse_dir[dir]) + var/displaced = FALSE + + if(dir in list(EAST, WEST)) // Apply an offset if flying sideways, to help maintain the illusion of depth. + for(var/i = 1 to 2) + var/turf/new_T = locate(T.x, T.y - i, T.z) + if(!new_T || locate(/obj/structure/cliff) in new_T) + break + T = new_T + displaced = TRUE + + if(istype(T)) + visible_message(span("danger", "\The [L] falls off \the [src]!")) + L.forceMove(T) + + // Do the actual hurting. Double cliffs do halved damage due to them most likely hitting twice. + var/harm = !is_double_cliff ? 1 : 0.5 + if(istype(L.buckled, /obj/vehicle)) // People falling off in vehicles will take less damage, but will damage the vehicle severely. + var/obj/vehicle/vehicle = L.buckled + vehicle.adjust_health(40 * harm) + to_chat(L, span("warning", "\The [vehicle] absorbs some of the impact, damaging it.")) + harm /= 2 + + playsound(L, 'sound/effects/break_stone.ogg', 70, 1) + L.Weaken(5 * harm) + var/fall_time = 3 + if(displaced) // Make the fall look more natural when falling sideways. + L.pixel_z = 32 * 2 + animate(L, pixel_z = 0, time = fall_time) + sleep(fall_time) // A brief delay inbetween the two sounds helps sell the 'ouch' effect. + playsound(L, "punch", 70, 1) + shake_camera(L, 1, 1) + visible_message(span("danger", "\The [L] hits the ground!")) + + // The bigger they are, the harder they fall. + // They will take at least 20 damage at the minimum, and tries to scale up to 40% of their max health. + // This scaling is capped at 100 total damage, which occurs if the thing that fell has more than 250 health. + var/damage = between(20, L.getMaxHealth() * 0.4, 100) + var/target_zone = ran_zone() + var/blocked = L.run_armor_check(target_zone, "melee") * harm + var/soaked = L.get_armor_soak(target_zone, "melee") * harm + + L.apply_damage(damage * harm, BRUTE, target_zone, blocked, soaked, used_weapon=src) + + // Now fall off more cliffs below this one if they exist. + var/obj/structure/cliff/bottom_cliff = locate() in T + if(bottom_cliff) + visible_message(span("danger", "\The [L] rolls down towards \the [bottom_cliff]!")) + sleep(5) + bottom_cliff.fall_off_cliff(L) + +/obj/structure/cliff/can_climb(mob/living/user, post_climb_check = FALSE) + // Cliff climbing requires climbing gear. + if(ishuman(user)) + var/mob/living/carbon/human/H = user + var/obj/item/clothing/shoes/shoes = H.shoes + if(shoes && shoes.rock_climbing) + return ..() // Do the other checks too. + + to_chat(user, span("warning", "\The [src] is too steep to climb unassisted.")) + return FALSE + +// This tells AI mobs to not be dumb and step off cliffs willingly. +/obj/structure/cliff/is_safe_to_step(mob/living/L) + if(should_fall(L)) + return FALSE + return ..() diff --git a/code/game/objects/structures/coathanger.dm b/code/game/objects/structures/coathanger.dm index 625af060db..c457c35f67 100644 --- a/code/game/objects/structures/coathanger.dm +++ b/code/game/objects/structures/coathanger.dm @@ -27,7 +27,7 @@ user << "You cannot hang [W] on [src]" return ..() -/obj/structure/coatrack/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) +/obj/structure/coatrack/CanPass(atom/movable/mover, turf/target) var/can_hang = 0 for (var/T in allowed) if(istype(mover,T)) diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 97f9329b88..5f91ad7091 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -69,7 +69,7 @@ else to_chat(user, "It is full.") -/obj/structure/closet/CanPass(atom/movable/mover, turf/target, height, air_group) +/obj/structure/closet/CanPass(atom/movable/mover, turf/target) if(wall_mounted) return TRUE return ..() diff --git a/code/game/objects/structures/crates_lockers/closets/coffin.dm b/code/game/objects/structures/crates_lockers/closets/coffin.dm index 6d5df80ed8..9257c2d3a3 100644 --- a/code/game/objects/structures/crates_lockers/closets/coffin.dm +++ b/code/game/objects/structures/crates_lockers/closets/coffin.dm @@ -39,7 +39,7 @@ "You stop climbing into \the [src.name].") return -/obj/structure/closet/grave/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) +/obj/structure/closet/grave/CanPass(atom/movable/mover, turf/target) if(opened && ismob(mover)) var/mob/M = mover add_fingerprint(M) diff --git a/code/game/objects/structures/fence.dm b/code/game/objects/structures/fence.dm index 04f58390a6..bb99d37d3a 100644 --- a/code/game/objects/structures/fence.dm +++ b/code/game/objects/structures/fence.dm @@ -1,179 +1,179 @@ -//Chain link fences -//Sprites ported from /VG/ - -#define CUT_TIME 10 SECONDS -#define CLIMB_TIME 5 SECONDS - -#define NO_HOLE 0 //section is intact -#define MEDIUM_HOLE 1 //medium hole in the section - can climb through -#define LARGE_HOLE 2 //large hole in the section - can walk through -#define MAX_HOLE_SIZE LARGE_HOLE - -/obj/structure/fence - name = "fence" - desc = "A chain link fence. Not as effective as a wall, but generally it keeps people out." - description_info = "Projectiles can freely pass fences." - density = TRUE - anchored = TRUE - - icon = 'icons/obj/fence.dmi' - icon_state = "straight" - - var/cuttable = TRUE - var/hole_size= NO_HOLE - var/invulnerable = FALSE - -/obj/structure/fence/Initialize() - update_cut_status() - return ..() - -/obj/structure/fence/examine(mob/user) - . = ..() - - switch(hole_size) - if(MEDIUM_HOLE) - user.show_message("There is a large hole in \the [src].") - if(LARGE_HOLE) - user.show_message("\The [src] has been completely cut through.") - -/obj/structure/fence/get_description_interaction() - var/list/results = list() - if(cuttable && !invulnerable && hole_size < MAX_HOLE_SIZE) - results += "[desc_panel_image("wirecutters")]to [hole_size > NO_HOLE ? "expand the":"cut a"] hole into the fence, allowing passage." - return results - -/obj/structure/fence/end - icon_state = "end" - cuttable = FALSE - -/obj/structure/fence/corner - icon_state = "corner" - cuttable = FALSE - -/obj/structure/fence/post - icon_state = "post" - cuttable = FALSE - -/obj/structure/fence/cut/medium - icon_state = "straight_cut2" - hole_size = MEDIUM_HOLE - -/obj/structure/fence/cut/large - icon_state = "straight_cut3" - hole_size = LARGE_HOLE - -// Projectiles can pass through fences. -/obj/structure/fence/CanPass(atom/movable/mover, turf/target, height = 0, air_group = 0) - if(istype(mover, /obj/item/projectile)) - return TRUE - return ..() - -/obj/structure/fence/attackby(obj/item/W, mob/user) - if(W.is_wirecutter()) - if(!cuttable) - to_chat(user, span("warning", "This section of the fence can't be cut.")) - return - if(invulnerable) - to_chat(user, span("warning", "This fence is too strong to cut through.")) - return - var/current_stage = hole_size - if(current_stage >= MAX_HOLE_SIZE) - to_chat(user, span("notice", "This fence has too much cut out of it already.")) - return - - user.visible_message(span("danger", "\The [user] starts cutting through \the [src] with \the [W]."),\ - span("danger", "You start cutting through \the [src] with \the [W].")) - playsound(src, W.usesound, 50, 1) - - if(do_after(user, CUT_TIME * W.toolspeed, target = src)) - if(current_stage == hole_size) - switch(++hole_size) - if(MEDIUM_HOLE) - visible_message(span("notice", "\The [user] cuts into \the [src] some more.")) - to_chat(user, span("notice", "You could probably fit yourself through that hole now. Although climbing through would be much faster if you made it even bigger.")) - climbable = TRUE - if(LARGE_HOLE) - visible_message(span("notice", "\The [user] completely cuts through \the [src].")) - to_chat(user, span("notice", "The hole in \the [src] is now big enough to walk through.")) - climbable = FALSE - update_cut_status() - return TRUE - -/obj/structure/fence/proc/update_cut_status() - if(!cuttable) - return - density = TRUE - - switch(hole_size) - if(NO_HOLE) - icon_state = initial(icon_state) - if(MEDIUM_HOLE) - icon_state = "straight_cut2" - if(LARGE_HOLE) - icon_state = "straight_cut3" - density = FALSE - -//FENCE DOORS - -/obj/structure/fence/door - name = "fence door" - desc = "Not very useful without a real lock." - icon_state = "door_closed" - cuttable = FALSE - var/open = FALSE - var/locked = FALSE - -/obj/structure/fence/door/Initialize() - update_door_status() - return ..() - -/obj/structure/fence/door/opened - icon_state = "door_opened" - open = TRUE - density = TRUE - -/obj/structure/fence/door/locked - desc = "It looks like it has a strong padlock attached." - locked = TRUE - -/obj/structure/fence/door/attack_hand(mob/user) - if(can_open(user)) - toggle(user) - else - to_chat(user, span("warning", "\The [src] is [!open ? "locked" : "stuck open"].")) - - return TRUE - -/obj/structure/fence/door/proc/toggle(mob/user) - switch(open) - if(FALSE) - visible_message(span("notice", "\The [user] opens \the [src].")) - open = TRUE - if(TRUE) - visible_message(span("notice", "\The [user] closes \the [src].")) - open = FALSE - - update_door_status() - playsound(src, 'sound/machines/click.ogg', 100, 1) - -/obj/structure/fence/door/proc/update_door_status() - switch(open) - if(FALSE) - density = TRUE - icon_state = "door_closed" - if(TRUE) - density = FALSE - icon_state = "door_opened" - -/obj/structure/fence/door/proc/can_open(mob/user) - if(locked) - return FALSE - return TRUE - -#undef CUT_TIME -#undef CLIMB_TIME - -#undef NO_HOLE -#undef MEDIUM_HOLE -#undef LARGE_HOLE +//Chain link fences +//Sprites ported from /VG/ + +#define CUT_TIME 10 SECONDS +#define CLIMB_TIME 5 SECONDS + +#define NO_HOLE 0 //section is intact +#define MEDIUM_HOLE 1 //medium hole in the section - can climb through +#define LARGE_HOLE 2 //large hole in the section - can walk through +#define MAX_HOLE_SIZE LARGE_HOLE + +/obj/structure/fence + name = "fence" + desc = "A chain link fence. Not as effective as a wall, but generally it keeps people out." + description_info = "Projectiles can freely pass fences." + density = TRUE + anchored = TRUE + + icon = 'icons/obj/fence.dmi' + icon_state = "straight" + + var/cuttable = TRUE + var/hole_size= NO_HOLE + var/invulnerable = FALSE + +/obj/structure/fence/Initialize() + update_cut_status() + return ..() + +/obj/structure/fence/examine(mob/user) + . = ..() + + switch(hole_size) + if(MEDIUM_HOLE) + user.show_message("There is a large hole in \the [src].") + if(LARGE_HOLE) + user.show_message("\The [src] has been completely cut through.") + +/obj/structure/fence/get_description_interaction() + var/list/results = list() + if(cuttable && !invulnerable && hole_size < MAX_HOLE_SIZE) + results += "[desc_panel_image("wirecutters")]to [hole_size > NO_HOLE ? "expand the":"cut a"] hole into the fence, allowing passage." + return results + +/obj/structure/fence/end + icon_state = "end" + cuttable = FALSE + +/obj/structure/fence/corner + icon_state = "corner" + cuttable = FALSE + +/obj/structure/fence/post + icon_state = "post" + cuttable = FALSE + +/obj/structure/fence/cut/medium + icon_state = "straight_cut2" + hole_size = MEDIUM_HOLE + +/obj/structure/fence/cut/large + icon_state = "straight_cut3" + hole_size = LARGE_HOLE + +// Projectiles can pass through fences. +/obj/structure/fence/CanPass(atom/movable/mover, turf/target) + if(istype(mover, /obj/item/projectile)) + return TRUE + return ..() + +/obj/structure/fence/attackby(obj/item/W, mob/user) + if(W.is_wirecutter()) + if(!cuttable) + to_chat(user, span("warning", "This section of the fence can't be cut.")) + return + if(invulnerable) + to_chat(user, span("warning", "This fence is too strong to cut through.")) + return + var/current_stage = hole_size + if(current_stage >= MAX_HOLE_SIZE) + to_chat(user, span("notice", "This fence has too much cut out of it already.")) + return + + user.visible_message(span("danger", "\The [user] starts cutting through \the [src] with \the [W]."),\ + span("danger", "You start cutting through \the [src] with \the [W].")) + playsound(src, W.usesound, 50, 1) + + if(do_after(user, CUT_TIME * W.toolspeed, target = src)) + if(current_stage == hole_size) + switch(++hole_size) + if(MEDIUM_HOLE) + visible_message(span("notice", "\The [user] cuts into \the [src] some more.")) + to_chat(user, span("notice", "You could probably fit yourself through that hole now. Although climbing through would be much faster if you made it even bigger.")) + climbable = TRUE + if(LARGE_HOLE) + visible_message(span("notice", "\The [user] completely cuts through \the [src].")) + to_chat(user, span("notice", "The hole in \the [src] is now big enough to walk through.")) + climbable = FALSE + update_cut_status() + return TRUE + +/obj/structure/fence/proc/update_cut_status() + if(!cuttable) + return + density = TRUE + + switch(hole_size) + if(NO_HOLE) + icon_state = initial(icon_state) + if(MEDIUM_HOLE) + icon_state = "straight_cut2" + if(LARGE_HOLE) + icon_state = "straight_cut3" + density = FALSE + +//FENCE DOORS + +/obj/structure/fence/door + name = "fence door" + desc = "Not very useful without a real lock." + icon_state = "door_closed" + cuttable = FALSE + var/open = FALSE + var/locked = FALSE + +/obj/structure/fence/door/Initialize() + update_door_status() + return ..() + +/obj/structure/fence/door/opened + icon_state = "door_opened" + open = TRUE + density = TRUE + +/obj/structure/fence/door/locked + desc = "It looks like it has a strong padlock attached." + locked = TRUE + +/obj/structure/fence/door/attack_hand(mob/user) + if(can_open(user)) + toggle(user) + else + to_chat(user, span("warning", "\The [src] is [!open ? "locked" : "stuck open"].")) + + return TRUE + +/obj/structure/fence/door/proc/toggle(mob/user) + switch(open) + if(FALSE) + visible_message(span("notice", "\The [user] opens \the [src].")) + open = TRUE + if(TRUE) + visible_message(span("notice", "\The [user] closes \the [src].")) + open = FALSE + + update_door_status() + playsound(src, 'sound/machines/click.ogg', 100, 1) + +/obj/structure/fence/door/proc/update_door_status() + switch(open) + if(FALSE) + density = TRUE + icon_state = "door_closed" + if(TRUE) + density = FALSE + icon_state = "door_opened" + +/obj/structure/fence/door/proc/can_open(mob/user) + if(locked) + return FALSE + return TRUE + +#undef CUT_TIME +#undef CLIMB_TIME + +#undef NO_HOLE +#undef MEDIUM_HOLE +#undef LARGE_HOLE #undef MAX_HOLE_SIZE \ No newline at end of file diff --git a/code/game/objects/structures/gravemarker.dm b/code/game/objects/structures/gravemarker.dm index 715c051c58..1df13a6eb4 100644 --- a/code/game/objects/structures/gravemarker.dm +++ b/code/game/objects/structures/gravemarker.dm @@ -38,15 +38,12 @@ if(epitaph) to_chat(user, epitaph) -/obj/structure/gravemarker/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(!mover) - return 1 +/obj/structure/gravemarker/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSTABLE)) - return 1 + return TRUE if(get_dir(loc, target) & dir) return !density - else - return 1 + return TRUE /obj/structure/gravemarker/CheckExit(atom/movable/O as mob|obj, target as turf) if(istype(O) && O.checkpass(PASSTABLE)) diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm index 50fa3e8c6e..801615c764 100644 --- a/code/game/objects/structures/grille.dm +++ b/code/game/objects/structures/grille.dm @@ -49,15 +49,12 @@ attack_generic(user,damage_dealt,attack_message) -/obj/structure/grille/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group || (height==0)) return 1 +/obj/structure/grille/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSGRILLE)) - return 1 - else - if(istype(mover, /obj/item/projectile)) - return prob(30) - else - return !density + return TRUE + if(istype(mover, /obj/item/projectile)) + return prob(30) + return !density /obj/structure/grille/bullet_act(var/obj/item/projectile/Proj) if(!Proj) return @@ -235,14 +232,10 @@ /obj/structure/grille/cult name = "cult grille" - desc = "A matrice built out of an unknown material, with some sort of force field blocking air around it" + desc = "A matrice built out of an unknown material, with some sort of force field blocking air around it." icon_state = "grillecult" - health = 40 //Make it strong enough to avoid people breaking in too easily - -/obj/structure/grille/cult/CanPass(atom/movable/mover, turf/target, height = 1.5, air_group = 0) - if(air_group) - return 0 //Make sure air doesn't drain - ..() + health = 40 // Make it strong enough to avoid people breaking in too easily. + can_atmos_pass = ATMOS_PASS_NO // Make sure air doesn't drain. /obj/structure/grille/broken/cult icon_state = "grillecult-b" diff --git a/code/game/objects/structures/inflatable.dm b/code/game/objects/structures/inflatable.dm index 51e824c6b0..2192b5690c 100644 --- a/code/game/objects/structures/inflatable.dm +++ b/code/game/objects/structures/inflatable.dm @@ -25,6 +25,7 @@ density = 1 anchored = 1 opacity = 0 + can_atmos_pass = ATMOS_PASS_DENSITY icon = 'icons/obj/inflatable.dmi' icon_state = "wall" @@ -40,9 +41,6 @@ update_nearby_tiles() return ..() -/obj/structure/inflatable/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - return 0 - /obj/structure/inflatable/bullet_act(var/obj/item/projectile/Proj) var/proj_damage = Proj.get_structure_damage() if(!proj_damage) return @@ -168,9 +166,7 @@ /obj/structure/inflatable/door/attack_hand(mob/user as mob) return TryToSwitchState(user) -/obj/structure/inflatable/door/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group) - return state +/obj/structure/inflatable/door/CanPass(atom/movable/mover, turf/target) if(istype(mover, /obj/effect/beam)) return !opacity return !density diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm index f328eb54fa..8f21f72781 100644 --- a/code/game/objects/structures/plasticflaps.dm +++ b/code/game/objects/structures/plasticflaps.dm @@ -64,15 +64,4 @@ /obj/structure/plasticflaps/mining //A specific type for mining that doesn't allow airflow because of them damn crates name = "airtight plastic flaps" desc = "Heavy duty, airtight, plastic flaps." - -/obj/structure/plasticflaps/mining/New() //set the turf below the flaps to block air - var/turf/T = get_turf(loc) - if(T) - T.blocks_air = 1 - ..() - -/obj/structure/plasticflaps/mining/Destroy() //lazy hack to set the turf to allow air to pass if it's a simulated floor - var/turf/T = get_turf(loc) - if(T && istype(T, /turf/simulated/floor)) - T.blocks_air = 0 - ..() \ No newline at end of file + can_atmos_pass = ATMOS_PASS_NO diff --git a/code/game/objects/structures/railing.dm b/code/game/objects/structures/railing.dm index 6c1a8f485b..9d96f0cc25 100644 --- a/code/game/objects/structures/railing.dm +++ b/code/game/objects/structures/railing.dm @@ -34,15 +34,12 @@ for(var/obj/structure/railing/R in orange(location, 1)) R.update_icon() -/obj/structure/railing/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(!mover) - return 1 +/obj/structure/railing/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSTABLE)) - return 1 - if(get_dir(loc, target) == dir) + return TRUE + if(get_dir(mover, target) == turn(dir, 180)) return !density - else - return 1 + return TRUE /obj/structure/railing/examine(mob/user) . = ..() diff --git a/code/game/objects/structures/simple_doors.dm b/code/game/objects/structures/simple_doors.dm index f9d5b2250a..4b741ed648 100644 --- a/code/game/objects/structures/simple_doors.dm +++ b/code/game/objects/structures/simple_doors.dm @@ -2,6 +2,7 @@ name = "door" density = 1 anchored = 1 + can_atmos_pass = ATMOS_PASS_DENSITY icon = 'icons/obj/doors/material_doors.dmi' icon_state = "metal" @@ -63,8 +64,7 @@ /obj/structure/simple_door/attack_hand(mob/user as mob) return TryToSwitchState(user) -/obj/structure/simple_door/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group) return 0 +/obj/structure/simple_door/CanPass(atom/movable/mover, turf/target) if(istype(mover, /obj/effect/beam)) return !opacity return !density diff --git a/code/game/objects/structures/stool_bed_chair_nest/bed.dm b/code/game/objects/structures/stool_bed_chair_nest/bed.dm index c2f29d8afd..9c53116965 100644 --- a/code/game/objects/structures/stool_bed_chair_nest/bed.dm +++ b/code/game/objects/structures/stool_bed_chair_nest/bed.dm @@ -69,11 +69,10 @@ name = "[material.display_name] [initial(name)]" desc += " It's made of [material.use_name]." -/obj/structure/bed/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) +/obj/structure/bed/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSTABLE)) - return 1 - else - return ..() + return TRUE + return ..() /obj/structure/bed/ex_act(severity) switch(severity) diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index 25a97b642c..c4facdaa20 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -54,14 +54,12 @@ obj/structure/windoor_assembly/Destroy() /obj/structure/windoor_assembly/update_icon() icon_state = "[facing]_[secure]windoor_assembly[state]" -/obj/structure/windoor_assembly/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) +/obj/structure/windoor_assembly/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSGLASS)) - return 1 + return TRUE if(get_dir(loc, target) == dir) //Make sure looking at appropriate border - if(air_group) return 0 return !density - else - return 1 + return TRUE /obj/structure/windoor_assembly/CheckExit(atom/movable/mover as mob|obj, turf/target as turf) if(istype(mover) && mover.checkpass(PASSGLASS)) diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 1532f499a5..1cf6c39e8a 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -3,6 +3,7 @@ desc = "A window." icon = 'icons/obj/structures_vr.dmi' // VOREStation Edit - New icons density = 1 + can_atmos_pass = ATMOS_PASS_DENSITY w_class = ITEMSIZE_NORMAL layer = WINDOW_LAYER @@ -129,7 +130,17 @@ /obj/structure/window/blob_act() take_damage(50) +<<<<<<< HEAD +//TODO: Make full windows a separate type of window. +//Once a full window, it will always be a full window, so there's no point +//having the same type for both. +/obj/structure/window/proc/is_full_window() + return (dir == SOUTHWEST || dir == SOUTHEAST || dir == NORTHWEST || dir == NORTHEAST) + /obj/structure/window/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) +======= +/obj/structure/window/CanPass(atom/movable/mover, turf/target) +>>>>>>> 4122c65... Merge pull request #5947 from Neerti/bump_fixes if(istype(mover) && mover.checkpass(PASSGLASS)) return TRUE if(is_fulltile()) @@ -139,6 +150,12 @@ else return TRUE + +/obj/structure/window/CanZASPass(turf/T, is_zone) + if(is_fulltile() || get_dir(T, loc) == turn(dir, 180)) // Make sure we're handling the border correctly. + return anchored ? ATMOS_PASS_NO : ATMOS_PASS_YES // If it's anchored, it'll block air. + return ATMOS_PASS_YES // Don't stop airflow from the other sides. + /obj/structure/window/CheckExit(atom/movable/O as mob|obj, target as turf) if(istype(O) && O.checkpass(PASSGLASS)) return 1 diff --git a/code/game/objects/structures/window_spawner.dm b/code/game/objects/structures/window_spawner.dm index 52a8458077..bb8b5cff6b 100644 --- a/code/game/objects/structures/window_spawner.dm +++ b/code/game/objects/structures/window_spawner.dm @@ -10,6 +10,7 @@ density = 1 anchored = 1.0 pressure_resistance = 4*ONE_ATMOSPHERE + can_atmos_pass = ATMOS_PASS_NO var/win_path = /obj/structure/window/basic var/activated @@ -22,7 +23,7 @@ /obj/effect/wingrille_spawn/attack_generic() activate() -/obj/effect/wingrille_spawn/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0) +/obj/effect/wingrille_spawn/CanPass(atom/movable/mover, turf/target) return FALSE /obj/effect/wingrille_spawn/Initialize() diff --git a/code/game/shuttle_engines.dm b/code/game/shuttle_engines.dm index 03e8c25e6d..579b6f6aea 100644 --- a/code/game/shuttle_engines.dm +++ b/code/game/shuttle_engines.dm @@ -9,13 +9,15 @@ density = 1 opacity = 0 anchored = 1 + can_atmos_pass = ATMOS_PASS_NO var/window_flags = 0 // Bitflags to indicate connected windows var/wall_flags = 0 // Bitflags to indicate connected walls -/obj/structure/shuttle/window/CanPass(atom/movable/mover, turf/target, height, air_group) - if(!height || air_group) return 0 - else return ..() +/obj/structure/shuttle/window/CanPass(atom/movable/mover, turf/target) + if(istype(mover) && mover.checkpass(PASSGLASS)) + return TRUE + return ..() /obj/structure/shuttle/window/Initialize() . = ..() diff --git a/code/modules/blob/blob.dm b/code/modules/blob/blob.dm index e859bdd237..c9ab387753 100644 --- a/code/modules/blob/blob.dm +++ b/code/modules/blob/blob.dm @@ -22,10 +22,8 @@ update_icon() return ..(loc) -/obj/effect/blob/CanPass(var/atom/movable/mover, vra/turf/target, var/height = 0, var/air_group = 0) - if(air_group || height == 0) - return 1 - return 0 +/obj/effect/blob/CanPass(var/atom/movable/mover, vra/turf/target) + return FALSE /obj/effect/blob/ex_act(var/severity) switch(severity) @@ -207,5 +205,5 @@ else icon_state = "blob_damaged" -/obj/effect/blob/shield/CanPass(var/atom/movable/mover, var/turf/target, var/height = 0, var/air_group = 0) +/obj/effect/blob/shield/CanPass(var/atom/movable/mover, var/turf/target) return !density diff --git a/code/modules/blob2/blobs/base_blob.dm b/code/modules/blob2/blobs/base_blob.dm index e70587c5a3..767cf4c783 100644 --- a/code/modules/blob2/blobs/base_blob.dm +++ b/code/modules/blob2/blobs/base_blob.dm @@ -46,9 +46,8 @@ var/list/blobs = list() color = null set_light(0) -/obj/structure/blob/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group || (height==0)) - return TRUE +// Blob tiles are not actually dense so we need Special Code(tm). +/obj/structure/blob/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSBLOB)) return TRUE else if(istype(mover, /mob/living)) @@ -57,12 +56,9 @@ var/list/blobs = list() return TRUE else if(istype(mover, /obj/item/projectile)) var/obj/item/projectile/P = mover - if(P.firer && P.firer.faction == "blob") + if(istype(P.firer) && P.firer.faction == "blob") return TRUE - return FALSE - else - return FALSE -// return ..() + return FALSE /obj/structure/blob/examine(mob/user) ..() @@ -257,7 +253,7 @@ var/list/blobs = list() if(!P) return - if(P.firer && P.firer.faction == "blob") + if(istype(P.firer) && P.firer.faction == "blob") return var/damage = P.get_structure_damage() // So tasers don't hurt the blob. diff --git a/code/modules/blob2/blobs/shield.dm b/code/modules/blob2/blobs/shield.dm index a519d982a4..4cd607859d 100644 --- a/code/modules/blob2/blobs/shield.dm +++ b/code/modules/blob2/blobs/shield.dm @@ -6,6 +6,7 @@ desc = "A solid wall of slightly twitching tendrils." max_integrity = 100 point_return = 4 + can_atmos_pass = ATMOS_PASS_NO /obj/structure/blob/shield/core point_return = 0 diff --git a/code/modules/holodeck/HolodeckObjects.dm b/code/modules/holodeck/HolodeckObjects.dm index 9ffeb100d7..22b4b2e6c6 100644 --- a/code/modules/holodeck/HolodeckObjects.dm +++ b/code/modules/holodeck/HolodeckObjects.dm @@ -325,19 +325,18 @@ visible_message("[user] dunks [W] into the [src]!", 3) return -/obj/structure/holohoop/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) +/obj/structure/holohoop/CanPass(atom/movable/mover, turf/target) if (istype(mover,/obj/item) && mover.throwing) var/obj/item/I = mover if(istype(I, /obj/item/projectile)) - return + return TRUE if(prob(50)) - I.loc = src.loc - visible_message("Swish! \the [I] lands in \the [src].", 3) + I.forceMove(loc) + visible_message(span("notice", "Swish! \the [I] lands in \the [src]."), 3) else - visible_message("\The [I] bounces off of \the [src]'s rim!", 3) - return 0 - else - return ..(mover, target, height, air_group) + visible_message(span("warning", "\The [I] bounces off of \the [src]'s rim!"), 3) + return FALSE + return ..() /obj/machinery/readybutton diff --git a/code/modules/hydroponics/trays/tray.dm b/code/modules/hydroponics/trays/tray.dm index 5dad0b9c21..5551cc95ad 100644 --- a/code/modules/hydroponics/trays/tray.dm +++ b/code/modules/hydroponics/trays/tray.dm @@ -217,13 +217,10 @@ ..() -/obj/machinery/portable_atmospherics/hydroponics/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group || (height==0)) return 1 - +/obj/machinery/portable_atmospherics/hydroponics/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSTABLE)) - return 1 - else - return 0 + return TRUE + return FALSE /obj/machinery/portable_atmospherics/hydroponics/proc/check_health() if(seed && !dead && health <= 0) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index fa021509fb..a3bf0d5465 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -143,8 +143,8 @@ var/mob/observer/dead/M = src M.manifest(user) -/mob/observer/dead/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - return 1 +/mob/observer/dead/CanPass(atom/movable/mover, turf/target) + return TRUE /* Transfer_mind is there to check if mob is being deleted/not going to have a body. Works together with spawning an observer, noted above. diff --git a/code/modules/mob/living/living_movement.dm b/code/modules/mob/living/living_movement.dm index e9a4b8f6dc..3f6c8411d1 100644 --- a/code/modules/mob/living/living_movement.dm +++ b/code/modules/mob/living/living_movement.dm @@ -1,7 +1,4 @@ -/mob/CanPass(atom/movable/mover, turf/target, height, air_group) - if(air_group || (height == 0)) - return TRUE - +/mob/CanPass(atom/movable/mover, turf/target) if(ismob(mover)) var/mob/moving_mob = mover if ((other_mobs && moving_mob.other_mobs)) @@ -10,3 +7,6 @@ var/obj/item/projectile/P = mover return !P.can_hit_target(src, P.permutated, src == P.original, TRUE) return (!mover.density || !density || lying) + +/mob/CanZASPass(turf/T, is_zone) + return ATMOS_PASS_YES \ No newline at end of file diff --git a/code/modules/power/antimatter/shielding.dm b/code/modules/power/antimatter/shielding.dm index 6a2dc58056..9bccd86d67 100644 --- a/code/modules/power/antimatter/shielding.dm +++ b/code/modules/power/antimatter/shielding.dm @@ -74,9 +74,8 @@ proc/cardinalrange(var/center) return -/obj/machinery/am_shielding/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group || (height==0)) return 1 - return 0 +/obj/machinery/am_shielding/CanPass(atom/movable/mover, turf/target) + return FALSE /obj/machinery/am_shielding/process() diff --git a/code/modules/power/fusion/fusion_particle_catcher.dm b/code/modules/power/fusion/fusion_particle_catcher.dm index 3651285485..78e4b8b950 100644 --- a/code/modules/power/fusion/fusion_particle_catcher.dm +++ b/code/modules/power/fusion/fusion_particle_catcher.dm @@ -37,7 +37,7 @@ update_icon() return 0 -/obj/effect/fusion_particle_catcher/CanPass(var/atom/movable/mover, var/turf/target, var/height=0, var/air_group=0) +/obj/effect/fusion_particle_catcher/CanPass(atom/movable/mover, turf/target) if(istype(mover, /obj/effect/accelerated_particle) || istype(mover, /obj/item/projectile/beam)) return !density - return 1 + return TRUE diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index dbc90a634d..29a1db0e16 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -95,10 +95,8 @@ stat |= BROKEN // When anchored, don't let air past us. -/obj/machinery/compressor/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0) - if(!height || air_group) - return !anchored - return !density +/obj/machinery/compressor/CanZASPass(turf/T, is_zone) + return anchored ? ATMOS_PASS_NO : ATMOS_PASS_YES /obj/machinery/compressor/proc/locate_machinery() if(turbine) diff --git a/code/modules/recycling/disposal.dm b/code/modules/recycling/disposal.dm index 7dcca19a7b..98d3500c6e 100644 --- a/code/modules/recycling/disposal.dm +++ b/code/modules/recycling/disposal.dm @@ -467,7 +467,7 @@ H.vent_gas(loc) qdel(H) -/obj/machinery/disposal/CanPass(atom/movable/mover, turf/target, height, air_group) +/obj/machinery/disposal/CanPass(atom/movable/mover, turf/target) if(istype(mover, /obj/item/projectile)) return 1 if (istype(mover,/obj/item) && mover.throwing) @@ -483,7 +483,7 @@ M.show_message("\The [I] bounces off of \the [src]'s rim!", 3) return 0 else - return ..(mover, target, height, air_group) + return ..(mover, target) // virtual disposal object // travels through pipes in lieu of actual items diff --git a/code/modules/shieldgen/directional_shield.dm b/code/modules/shieldgen/directional_shield.dm index 279580ce89..9cc0454620 100644 --- a/code/modules/shieldgen/directional_shield.dm +++ b/code/modules/shieldgen/directional_shield.dm @@ -53,10 +53,8 @@ projector = null return ..() -/obj/effect/directional_shield/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group || (height==0)) - return TRUE - else if(istype(mover, /obj/item/projectile)) +/obj/effect/directional_shield/CanPass(atom/movable/mover, turf/target) + if(istype(mover, /obj/item/projectile)) var/obj/item/projectile/P = mover if(istype(P, /obj/item/projectile/test)) // Turrets need to try to kill the shield and so their test bullet needs to penetrate. return TRUE @@ -64,8 +62,6 @@ var/bad_arc = reverse_direction(dir) // Arc of directions from which we cannot block. if(check_shield_arc(src, bad_arc, P)) // This is actually for mobs but it will work for our purposes as well. return FALSE - else - return TRUE return TRUE /obj/effect/directional_shield/bullet_act(var/obj/item/projectile/P) diff --git a/code/modules/shieldgen/emergency_shield.dm b/code/modules/shieldgen/emergency_shield.dm index 1798ebd67f..e764e0b516 100644 --- a/code/modules/shieldgen/emergency_shield.dm +++ b/code/modules/shieldgen/emergency_shield.dm @@ -7,6 +7,7 @@ opacity = 0 anchored = 1 unacidable = 1 + can_atmos_pass = ATMOS_PASS_NO var/const/max_health = 200 var/health = max_health //The shield can only take so much beating (prevents perma-prisons) var/shield_generate_power = 7500 //how much power we use when regenerating @@ -38,10 +39,6 @@ update_nearby_tiles() ..() -/obj/machinery/shield/CanPass(atom/movable/mover, turf/target, height, air_group) - if(!height || air_group) return 0 - else return ..() - /obj/machinery/shield/attackby(obj/item/weapon/W as obj, mob/user as mob) if(!istype(W)) return diff --git a/code/modules/shieldgen/energy_field.dm b/code/modules/shieldgen/energy_field.dm index 1c5b8d2965..65eb6dc363 100644 --- a/code/modules/shieldgen/energy_field.dm +++ b/code/modules/shieldgen/energy_field.dm @@ -18,6 +18,7 @@ plane = MOB_PLANE layer = ABOVE_MOB_LAYER density = 0 + can_atmos_pass = ATMOS_PASS_DENSITY var/obj/machinery/shield_gen/my_gen = null var/strength = 0 // in Renwicks var/ticks_recovering = 10 @@ -103,15 +104,6 @@ update_icon() update_nearby_tiles() -/obj/effect/energy_field/CanPass(atom/movable/mover, turf/target, height=1.5, air_group = 0) - //Purpose: Determines if the object (or airflow) can pass this atom. - //Called by: Movement, airflow. - //Inputs: The moving atom (optional), target turf, "height" and air group - //Outputs: Boolean if can pass. - - //return (!density || !height || air_group) - return !density - /obj/effect/energy_field/update_icon(var/update_neightbors = 0) overlays.Cut() var/list/adjacent_shields_dir = list() diff --git a/code/modules/shieldgen/sheldwallgen.dm b/code/modules/shieldgen/sheldwallgen.dm index 37c55e5911..812a0738a1 100644 --- a/code/modules/shieldgen/sheldwallgen.dm +++ b/code/modules/shieldgen/sheldwallgen.dm @@ -317,13 +317,9 @@ return -/obj/machinery/shieldwall/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) - if(air_group || (height==0)) return 1 - +/obj/machinery/shieldwall/CanPass(atom/movable/mover, turf/target) if(istype(mover) && mover.checkpass(PASSGLASS)) return prob(20) - else - if (istype(mover, /obj/item/projectile)) - return prob(10) - else - return !src.density + if(istype(mover, /obj/item/projectile)) + return prob(10) + return !density diff --git a/code/modules/tables/interactions.dm b/code/modules/tables/interactions.dm index f3b953ac25..ab90115f5e 100644 --- a/code/modules/tables/interactions.dm +++ b/code/modules/tables/interactions.dm @@ -1,21 +1,25 @@ -/obj/structure/table/CanPass(atom/movable/mover, turf/target, height, air_group) +<<<<<<< HEAD +/obj/structure/table/CanPass(atom/movable/mover, turf/target, height=0, air_group=0) if(air_group || (height==0)) return 1 +======= +/obj/structure/table/CanPass(atom/movable/mover, turf/target) +>>>>>>> 4122c65... Merge pull request #5947 from Neerti/bump_fixes if(istype(mover,/obj/item/projectile)) return (check_cover(mover,target)) if (flipped == 1) if (get_dir(loc, target) == dir) return !density else - return 1 + return TRUE if(istype(mover) && mover.checkpass(PASSTABLE)) - return 1 + return TRUE if(locate(/obj/structure/table/bench) in get_turf(mover)) - return 0 + return FALSE var/obj/structure/table/table = locate(/obj/structure/table) in get_turf(mover) if(table && !table.flipped) - return 1 - return 0 + return TRUE + return FALSE //checks if projectile 'P' from turf 'from' can hit whatever is behind the table. Returns 1 if it can, 0 if bullet stops. /obj/structure/table/proc/check_cover(obj/item/projectile/P, turf/from)