From 2d36cbb9f7c3973b669e02dda9db260b29b51e72 Mon Sep 17 00:00:00 2001 From: RandomGamer123 <31096837+RandomGamer123@users.noreply.github.com> Date: Mon, 15 Nov 2021 02:16:09 -0500 Subject: [PATCH] Stops HFRs (and other INDESTRUCTIBLE machinery) from being able to be blown up if an explosion's epicenter is on the tile (#62164) * Stops HFRs from being able to be blown up if an explosion's epicenter is on the tile * Stops stationloving objects from being able to be teleported to HFR core * Automatically add PREVENT_CONTENTS_EXPLOSION_1 to all INDESTRUCTIBLE machinery * Document reason for PREVENT_CONTENTS_EXPLOSION_1 flag being needed --- code/game/machinery/_machinery.dm | 6 +++++- .../atmospherics/machinery/components/fusion/hfr_core.dm | 9 +++++++++ .../machinery/components/fusion/hfr_parts.dm | 2 ++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 021249bde61..2cdaae24724 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -159,7 +159,11 @@ if(occupant_typecache) occupant_typecache = typecacheof(occupant_typecache) - + + if((resistance_flags & INDESTRUCTIBLE) && component_parts){ // This is needed to prevent indestructible machinery still blowing up. If an explosion occurs on the same tile as the indestructible machinery without the PREVENT_CONTENTS_EXPLOSION_1 flag, /datum/controller/subsystem/explosions/proc/propagate_blastwave will call ex_act on all movable atoms inside the machine, including the circuit board and component parts. However, if those parts get deleted, the entire machine gets deleted, allowing for INDESTRUCTIBLE machines to be destroyed. (See #62164 for more info) + flags_1 |= PREVENT_CONTENTS_EXPLOSION_1 + } + return INITIALIZE_HINT_LATELOAD /obj/machinery/LateInitialize() diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm index 92b2bbe2378..2412e05baa8 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_core.dm @@ -171,6 +171,15 @@ radio.listening = 0 radio.recalculateChannels() investigate_log("has been created.", INVESTIGATE_HYPERTORUS) + + RegisterSignal(src.loc, COMSIG_ATOM_ENTERED, .proc/on_entered) + + for(var/atom/movable/movable_object in src.loc) + SEND_SIGNAL(movable_object, COMSIG_MOVABLE_SECLUDED_LOCATION) + +/obj/machinery/atmospherics/components/unary/hypertorus/core/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs) + SIGNAL_HANDLER + SEND_SIGNAL(arrived, COMSIG_MOVABLE_SECLUDED_LOCATION) // to prevent stationloving items (eg. nuke disk) being teleported onto core /obj/machinery/atmospherics/components/unary/hypertorus/core/Destroy() unregister_signals(TRUE) diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm index f5fa99efc6f..6d95c1b396c 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm @@ -11,6 +11,7 @@ anchored = TRUE density = TRUE resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF + flags_1 = PREVENT_CONTENTS_EXPLOSION_1 layer = OBJ_LAYER pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY circuit = /obj/item/circuitboard/machine/thermomachine @@ -128,6 +129,7 @@ anchored = TRUE density = TRUE resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF + flags_1 = PREVENT_CONTENTS_EXPLOSION_1 power_channel = AREA_USAGE_ENVIRON var/active = FALSE var/icon_state_open