From f3629f7d57c16c16f814529c03b42869cfbf3c0a Mon Sep 17 00:00:00 2001 From: TemporalOroboros Date: Sat, 7 May 2022 20:05:07 -0700 Subject: [PATCH] Emagging the anomaly compressor will eject the bomb the next time someone tries to use it. (#66647) Fixes #66635 and moves the behavior behind emagging. It's funny, but probably shouldn't be something you can do by accident simply by spamming the start compression button. --- .../research/anomaly/anomaly_refinery.dm | 49 +++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/code/modules/research/anomaly/anomaly_refinery.dm b/code/modules/research/anomaly/anomaly_refinery.dm index de35b946604ede..5d70b73af315fa 100644 --- a/code/modules/research/anomaly/anomaly_refinery.dm +++ b/code/modules/research/anomaly/anomaly_refinery.dm @@ -42,6 +42,12 @@ . = ..() RegisterSignal(src, COMSIG_ATOM_INTERNAL_EXPLOSION, .proc/check_test) +/obj/machinery/research/anomaly_refinery/examine_more(mob/user) + . = ..() + if (obj_flags & EMAGGED) + . += span_notice("A small panel on [p_their()] side is dislaying a notice. Something about firmware?") + + /obj/machinery/research/anomaly_refinery/assume_air(datum/gas_mixture/giver) return null // Required to make the TTV not vent directly into the air. @@ -116,10 +122,25 @@ return FALSE return TRUE +/obj/machinery/research/anomaly_refinery/emag_act(mob/user, obj/item/card/emag/emag_card) + . = ..() + if (obj_flags & EMAGGED) + balloon_alert(user, span_warning("already hacked!")) + return + + obj_flags |= EMAGGED + playsound(src, 'sound/machines/buzz-sigh.ogg', 50, vary = FALSE) + say("ERROR: Unauthorized firmware access.") + return TRUE + /** * Starts a compression test. */ /obj/machinery/research/anomaly_refinery/proc/start_test() + if (active) + say("ERROR: Already running a compression test.") + return + if(!istype(inserted_core) || !istype(inserted_bomb)) end_test("ERROR: Missing equpment. Items ejected.") return @@ -131,11 +152,31 @@ say("Beginning compression test. Opening transfer valve.") active = TRUE test_status = null + + if (obj_flags & EMAGGED) + say("ERROR: An firmware issue was detected while starting a process. Running autopatcher.") + playsound(src, 'sound/machines/ding.ogg', 50, vary = TRUE) + addtimer(CALLBACK(src, .proc/error_test), 2 SECONDS, TIMER_STOPPABLE | TIMER_UNIQUE | TIMER_NO_HASH_WAIT) // Synced with the sound. + return + inserted_bomb.toggle_valve(tank_to_target) - tank_to_target = null timeout_timer = addtimer(CALLBACK(src, .proc/timeout_test), COMPRESSION_TEST_TIME, TIMER_STOPPABLE | TIMER_UNIQUE | TIMER_NO_HASH_WAIT) return +/** + * Ejects a live TTV. + * Triggered by attempting to operate an emagged anomaly refinery. + */ +/obj/machinery/research/anomaly_refinery/proc/error_test() + message_admins("[src] was emagged and ejected a TTV") + investigate_log("was emagged and ejected a TTV", INVESTIGATE_RESEARCH) + obj_flags &= ~EMAGGED + + say("Issue resolved. Have a nice day!") + inserted_bomb.toggle_valve(tank_to_target) + eject_bomb(force = TRUE) + timeout_timer = addtimer(CALLBACK(src, .proc/timeout_test), COMPRESSION_TEST_TIME, TIMER_STOPPABLE | TIMER_UNIQUE | TIMER_NO_HASH_WAIT) // Actually start the test so they can't just put the bomb back in. + /** * Ends a compression test. * @@ -144,6 +185,8 @@ */ /obj/machinery/research/anomaly_refinery/proc/end_test(message) active = FALSE + tank_to_target = null + test_status = null if(inserted_core) eject_core() if(inserted_bomb) @@ -216,8 +259,8 @@ reaction_increment += 1 /// We dont allow incomplete valves to go in but do code in checks for incomplete valves. Just in case. -/obj/machinery/research/anomaly_refinery/proc/eject_bomb(mob/user) - if(!inserted_bomb || active) +/obj/machinery/research/anomaly_refinery/proc/eject_bomb(mob/user, force = FALSE) + if(!inserted_bomb || (active && !force)) return if(user) user.put_in_hands(inserted_bomb)