[MIRROR] Adds an achievement for saving a cascading SM from the final countdown. [MDB IGNORE] (#23358)

* Adds an achievement for saving a cascading SM from the final countdown. (#77900)

## About The Pull Request

Adds the "All Within Theoretical Limits" achievement. You get the
achievement for standing inside the engine room at the time where the SM
crystal heals from 0% health (when the crystal says "Crystalline
hyperstructure returning to safe operating parameters. Harmonic
frequency restored within emergency bounds. Anti-resonance filter
initiated"), and waiting until the SM heals to at least 25% health.

## Why It's Good For The Game

This rewards engineers who stay behind and try to save the engine even
in the most dire circumstances.

## Changelog
🆑 distributivgesetz
add: Add an achievement for saving a cascading engine from the final
countdown.
/🆑

* Adds an achievement for saving a cascading SM from the final countdown.

---------

Co-authored-by: distributivgesetz <distributivgesetz93@gmail.com>
This commit is contained in:
SkyratBot
2023-08-27 10:37:07 -07:00
committed by GitHub
co-authored by distributivgesetz
parent 91e98c032e
commit c8bbdbed80
4 changed files with 31 additions and 0 deletions
@@ -169,6 +169,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
/// Only values greater or equal to the current one can change the strat.
var/delam_priority = SM_DELAM_PRIO_NONE
/// Lazy list of the crazy engineers who managed to turn a cascading engine around.
var/list/datum/weakref/saviors = null
/obj/machinery/power/supermatter_crystal/Initialize(mapload)
. = ..()
gas_percentage = list()
@@ -312,6 +315,16 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
processing_sound()
handle_high_power()
psychological_examination()
// handle the engineers that saved the engine from cascading, if there were any
if(get_status() < SUPERMATTER_EMERGENCY && !isnull(saviors))
for(var/datum/weakref/savior_ref as anything in saviors)
var/mob/living/savior = savior_ref.resolve()
if(!istype(savior)) // didn't live to tell the tale, sadly.
continue
savior.client?.give_award(/datum/award/achievement/misc/theoretical_limits, savior)
LAZYNULL(saviors)
if(prob(15))
supermatter_pull(loc, min(internal_energy/850, 3))//850, 1700, 2550
update_appearance()
@@ -515,6 +528,17 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
if(healed)
final_countdown = FALSE
if(!istype(delamination_strategy, /datum/sm_delam/cascade))
return
for(var/mob/living/lucky_engi as anything in mobs_in_area_type(list(/area/station/engineering/supermatter)))
if(isnull(lucky_engi.client))
continue
if(isanimal_or_basicmob(lucky_engi))
continue
LAZYADD(saviors, WEAKREF(lucky_engi))
return // delam averted
sleep(1 SECONDS)