From 35b7446a32c02ccd471710d16f0af152c91eeed6 Mon Sep 17 00:00:00 2001 From: Leshana Date: Mon, 20 Apr 2020 13:06:20 -0400 Subject: [PATCH] Fix return values of CanZASPass - CanZASPass is supposed to return boolean. Nobody noticed this bug because ATMOS_PASS_YES and ATMOS_PASS_NO happen to be defined as 1 and 0. But thats not a good assumption to make, so lets fix it! --- code/game/machinery/doors/blast_door.dm | 2 +- code/game/machinery/doors/door.dm | 2 +- code/game/machinery/doors/windowdoor.dm | 4 ++-- code/game/objects/effects/zone_divider.dm | 4 ++-- code/game/objects/structures/window.dm | 4 ++-- code/modules/mob/living/living_movement.dm | 5 +++-- code/modules/power/turbine.dm | 2 +- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/code/game/machinery/doors/blast_door.dm b/code/game/machinery/doors/blast_door.dm index 36faf82b00..5ff587a7d9 100644 --- a/code/game/machinery/doors/blast_door.dm +++ b/code/game/machinery/doors/blast_door.dm @@ -269,7 +269,7 @@ // 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 TRUE return ..() */ diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index b866504b33..eaeb601a0a 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -143,7 +143,7 @@ /obj/machinery/door/CanZASPass(turf/T, is_zone) if(is_zone) - return block_air_zones ? ATMOS_PASS_NO : ATMOS_PASS_YES + return !block_air_zones return ..() /obj/machinery/door/proc/bumpopen(mob/user as mob) diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 1396b5f554..2414ac525b 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -94,9 +94,9 @@ /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 FALSE return ..() // Air can flow if open (density == FALSE). - return ATMOS_PASS_YES // Windoors don't block if not facing the right way. + return TRUE // 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/objects/effects/zone_divider.dm b/code/game/objects/effects/zone_divider.dm index 01e6834f16..90f9b0b6ff 100644 --- a/code/game/objects/effects/zone_divider.dm +++ b/code/game/objects/effects/zone_divider.dm @@ -15,5 +15,5 @@ if(air_master && air_master.current_cycle == 0) spawn(1) air_master.mark_for_update(get_turf(src)) - return ATMOS_PASS_NO - return is_zone ? ATMOS_PASS_NO : ATMOS_PASS_YES // Anything except zones can pass + return FALSE + return is_zone ? FALSE : TRUE // Anything except zones can pass diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 3d06325a00..4ccecdf920 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -143,8 +143,8 @@ /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. + return !anchored // If it's anchored, it'll block air. + return TRUE // 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)) diff --git a/code/modules/mob/living/living_movement.dm b/code/modules/mob/living/living_movement.dm index f730077d70..923d9e55dd 100644 --- a/code/modules/mob/living/living_movement.dm +++ b/code/modules/mob/living/living_movement.dm @@ -8,8 +8,9 @@ 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 +// There is no need to override this if you're just going to unconditionally return TRUE. Set can_atmos_pass instead. +///mob/CanZASPass(turf/T, is_zone) +// return TRUE /mob/living/SelfMove(turf/n, direct) // If on walk intent, don't willingly step into hazardous tiles. diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index 29a1db0e16..5629782161 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -96,7 +96,7 @@ // When anchored, don't let air past us. /obj/machinery/compressor/CanZASPass(turf/T, is_zone) - return anchored ? ATMOS_PASS_NO : ATMOS_PASS_YES + return !anchored /obj/machinery/compressor/proc/locate_machinery() if(turbine)