Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emagging the anomaly compressor will eject the bomb the next time someone tries to use it. #66647

Merged
merged 4 commits into from May 8, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
49 changes: 46 additions & 3 deletions code/modules/research/anomaly/anomaly_refinery.dm
Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand All @@ -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.
*
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down