From f15a971193fcdae581d81e3a925e4bfe9cf47c5d Mon Sep 17 00:00:00 2001 From: Penelope Haze Date: Tue, 6 Jun 2023 18:34:03 -0500 Subject: [PATCH] Fixes cases where doors do not bolt correctly (#75882) ## About The Pull Request Some things, like door control buttons, set locked directly instead of calling lock() or unlock(). This fixes that, which should make sound effects play. Also annotates some code where we *don't* want that to happen with an explanation of why we just set locked directly. ## Why It's Good For The Game Fixes Skyrat-SS13/Skyrat-tg/issues/21510, which also applies to upstream. --- code/modules/assembly/doorcontrol.dm | 5 ++++- code/modules/mapping/mapping_helpers.dm | 2 ++ code/modules/projectiles/projectile/magic.dm | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/code/modules/assembly/doorcontrol.dm b/code/modules/assembly/doorcontrol.dm index 6123629f4a9..ad264876286 100644 --- a/code/modules/assembly/doorcontrol.dm +++ b/code/modules/assembly/doorcontrol.dm @@ -85,7 +85,10 @@ D.aiDisabledIdScanner = !D.aiDisabledIdScanner if(specialfunctions & BOLTS) if(!D.wires.is_cut(WIRE_BOLTS) && D.hasPower()) - D.locked = !D.locked + if(D.locked) + D.unlock() + else + D.lock() D.update_appearance() if(specialfunctions & SHOCK) if(D.secondsElectrified) diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm index 2833bfb23c0..2c6c507d872 100644 --- a/code/modules/mapping/mapping_helpers.dm +++ b/code/modules/mapping/mapping_helpers.dm @@ -153,6 +153,7 @@ return if(9 to 11) airlock.lights = FALSE + // These do not use airlock.bolt() because we want to pretend it was always locked. That means no sound effects. airlock.locked = TRUE if(12 to 15) airlock.locked = TRUE @@ -201,6 +202,7 @@ if(airlock.locked) log_mapping("[src] at [AREACOORD(src)] tried to bolt [airlock] but it's already locked!") else + // Used instead of bolt so that we can pretend it was always locked, i.e. no sound effects on init. airlock.locked = TRUE /obj/effect/mapping_helpers/airlock/unres diff --git a/code/modules/projectiles/projectile/magic.dm b/code/modules/projectiles/projectile/magic.dm index f3e45dd8f44..a56f4439fb7 100644 --- a/code/modules/projectiles/projectile/magic.dm +++ b/code/modules/projectiles/projectile/magic.dm @@ -141,7 +141,7 @@ /obj/projectile/magic/door/proc/OpenDoor(obj/machinery/door/D) if(istype(D, /obj/machinery/door/airlock)) var/obj/machinery/door/airlock/A = D - A.locked = FALSE + A.unlock() D.open() /obj/projectile/magic/change