From 2090bf4df3998d67f031bbe81485de9d98e8fcdf Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 5 Apr 2023 20:32:12 +0200 Subject: [PATCH] [MIRROR] timestop the SM [MDB IGNORE] (#20352) * timestop the SM (#74302) ## About The Pull Request Allows the timestop effects to freeze the Supermatter processing so that engineers might be able to save it this time ## Why It's Good For The Game Both wizards and science nerds are able to stop the SM seconds from meltdown so that engies can figure out what's the right pipe to place to prevent a destruction of property. ## Changelog :cl: add: Timestop blocks the SM from processing (can't be healed, doesn't output gases but can still take damage) /:cl: * timestop the SM --------- Co-authored-by: Ghilker <42839747+Ghilker@users.noreply.github.com> --- .../signals/signals_atom/signals_atom_main.dm | 4 +++ code/__DEFINES/supermatter.dm | 7 ++++++ .../proximity_monitor/fields/timestop.dm | 7 ++++-- code/modules/power/supermatter/supermatter.dm | 25 ++++++++++++++++--- .../power/supermatter/supermatter_variants.dm | 4 +-- 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/code/__DEFINES/dcs/signals/signals_atom/signals_atom_main.dm b/code/__DEFINES/dcs/signals/signals_atom/signals_atom_main.dm index 431a0827421..d80e3084e52 100644 --- a/code/__DEFINES/dcs/signals/signals_atom/signals_atom_main.dm +++ b/code/__DEFINES/dcs/signals/signals_atom/signals_atom_main.dm @@ -95,3 +95,7 @@ #define COMSIG_ATOM_PROPAGATE_RAD_PULSE "atom_propagate_radiation_pulse" /// from cosmetic items to restyle certain mobs, objects or organs: (atom/source, mob/living/trimmer, atom/movable/original_target, body_zone, restyle_type, style_speed) #define COMSIG_ATOM_RESTYLE "atom_restyle" +/// when a timestop ability is used on the atom: (datum/proximity_monitor/advanced/timestop) +#define COMSIG_ATOM_TIMESTOP_FREEZE "atom_timestop_freeze" +/// when the timestop ability effect ends on the atom: (datum/proximity_monitor/advanced/timestop) +#define COMSIG_ATOM_TIMESTOP_UNFREEZE "atom_timestop_unfreeze" diff --git a/code/__DEFINES/supermatter.dm b/code/__DEFINES/supermatter.dm index aedc4c9ab6a..f7e4a1bb51e 100644 --- a/code/__DEFINES/supermatter.dm +++ b/code/__DEFINES/supermatter.dm @@ -71,6 +71,13 @@ /// Purge the current forced delam and make it zero again (back to normal). /// Needs to be higher priority than current forced_delam though. #define SM_DELAM_STRATEGY_PURGE null +///Totally disable the processing of the SM, used on the hugbox +#define SM_PROCESS_DISABLED -1 +///Totally disable the processing of the SM, set when the timestop effect hit the SM +#define SM_PROCESS_TIMESTOP 0 +///Enable the SM to process atmos and internal procs +#define SM_PROCESS_ENABLED 1 + // These are used by supermatter and supermatter monitor program, mostly for UI updating purposes. Higher should always be worse! // [/obj/machinery/power/supermatter_crystal/proc/get_status] diff --git a/code/datums/proximity_monitor/fields/timestop.dm b/code/datums/proximity_monitor/fields/timestop.dm index f66fe0e3012..7fad290fc74 100644 --- a/code/datums/proximity_monitor/fields/timestop.dm +++ b/code/datums/proximity_monitor/fields/timestop.dm @@ -132,6 +132,8 @@ RegisterSignal(A, COMSIG_MOVABLE_PRE_MOVE, PROC_REF(unfreeze_atom)) RegisterSignal(A, COMSIG_ITEM_PICKUP, PROC_REF(unfreeze_atom)) + SEND_SIGNAL(A, COMSIG_ATOM_TIMESTOP_FREEZE, src) + return TRUE /datum/proximity_monitor/advanced/timestop/proc/unfreeze_all() @@ -142,7 +144,6 @@ /datum/proximity_monitor/advanced/timestop/proc/unfreeze_atom(atom/movable/A) SIGNAL_HANDLER - if(A.throwing) unfreeze_throwing(A) if(isliving(A)) @@ -154,6 +155,9 @@ UnregisterSignal(A, COMSIG_MOVABLE_PRE_MOVE) UnregisterSignal(A, COMSIG_ITEM_PICKUP) + + SEND_SIGNAL(A, COMSIG_ATOM_TIMESTOP_UNFREEZE, src) + escape_the_negative_zone(A) A.move_resist = frozen_things[A] frozen_things -= A @@ -166,7 +170,6 @@ /datum/proximity_monitor/advanced/timestop/proc/unfreeze_mecha(obj/vehicle/sealed/mecha/M) M.completely_disabled = FALSE - /datum/proximity_monitor/advanced/timestop/proc/freeze_throwing(atom/movable/AM) var/datum/thrownthing/T = AM.throwing T.paused = TRUE diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index c754554fd28..dd8a3ab5b77 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -144,9 +144,10 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) var/disable_gas = FALSE /// Disables power changes. var/disable_power_change = FALSE - /// Disables the SM's proccessing totally. - /// Make sure absorbed_gasmix and gas_percentage isnt null if this is on. - var/disable_process = FALSE + /// Disables the SM's proccessing totally when set to SM_PROCESS_DISABLED. + /// Temporary disables the processing when it's set to SM_PROCESS_TIMESTOP. + /// Make sure absorbed_gasmix and gas_percentage isnt null if this is on SM_PROCESS_DISABLED. + var/disable_process = SM_PROCESS_ENABLED ///Stores the time of when the last zap occurred var/last_power_zap = 0 @@ -188,6 +189,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) AddElement(/datum/element/bsa_blocker) RegisterSignal(src, COMSIG_ATOM_BSA_BEAM, PROC_REF(force_delam)) + RegisterSignal(src, COMSIG_ATOM_TIMESTOP_FREEZE, PROC_REF(time_frozen)) + RegisterSignal(src, COMSIG_ATOM_TIMESTOP_UNFREEZE, PROC_REF(time_unfrozen)) var/static/list/loc_connections = list( COMSIG_TURF_INDUSTRIAL_LIFT_ENTER = PROC_REF(tram_contents_consume), @@ -235,7 +238,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) /obj/machinery/power/supermatter_crystal/process_atmos() // PART 1: PRELIMINARIES - if(disable_process) + if(disable_process != SM_PROCESS_ENABLED) return var/turf/local_turf = loc @@ -441,6 +444,20 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) else icon_state = base_icon_state +/obj/machinery/power/supermatter_crystal/proc/time_frozen() + SIGNAL_HANDLER + if(disable_process != SM_PROCESS_ENABLED) + return + + disable_process = SM_PROCESS_TIMESTOP + +/obj/machinery/power/supermatter_crystal/proc/time_unfrozen() + SIGNAL_HANDLER + if(disable_process != SM_PROCESS_TIMESTOP) + return + + disable_process = SM_PROCESS_ENABLED + /obj/machinery/power/supermatter_crystal/proc/force_delam() SIGNAL_HANDLER investigate_log("was forcefully delaminated", INVESTIGATE_ENGINE) diff --git a/code/modules/power/supermatter/supermatter_variants.dm b/code/modules/power/supermatter/supermatter_variants.dm index bcdf5ea802c..2390ab3d0b7 100644 --- a/code/modules/power/supermatter/supermatter_variants.dm +++ b/code/modules/power/supermatter/supermatter_variants.dm @@ -3,7 +3,7 @@ disable_damage = TRUE disable_gas = TRUE disable_power_change = TRUE - disable_process = TRUE + disable_process = SM_PROCESS_DISABLED /// Normal SM designated as main engine. /obj/machinery/power/supermatter_crystal/engine @@ -28,7 +28,7 @@ disable_damage = TRUE disable_gas = TRUE disable_power_change = TRUE - disable_process = TRUE + disable_process = SM_PROCESS_DISABLED moveable = FALSE anchored = TRUE