Skip to content

Commit

Permalink
Emagging the tank compressor now releases the tank instead of on doub…
Browse files Browse the repository at this point in the history
…le-press of the button (tgstation#758)

* Makes tablets get names when not spawned on the belt (tgstation#66524)

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

Fixes tgstation#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.

Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com>
Co-authored-by: TemporalOroboros <TemporalOroboros@gmail.com>
  • Loading branch information
3 people committed Jun 6, 2022
1 parent 236242d commit 99b2766
Showing 1 changed file with 46 additions and 3 deletions.
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

0 comments on commit 99b2766

Please sign in to comment.