From 0fc53de09ccadf7476bfbe37d70375a31b9c1682 Mon Sep 17 00:00:00 2001 From: Kyep Date: Wed, 8 Aug 2018 14:55:52 -0700 Subject: [PATCH] fixes reactor sometimes not overloading, also an armory bypass --- code/game/area/depot-areas.dm | 4 +++- code/game/objects/structures/depot.dm | 18 ++++++++++++++---- .../living/simple_animal/hostile/syndicate.dm | 7 +++++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/code/game/area/depot-areas.dm b/code/game/area/depot-areas.dm index 9de680da82e..4505b94375f 100644 --- a/code/game/area/depot-areas.dm +++ b/code/game/area/depot-areas.dm @@ -257,8 +257,10 @@ else log_game("Depot self destruct activated.") if(reactor) - reactor.overload(containment_failure) + if(!reactor.has_overloaded) + reactor.overload(containment_failure) else + log_debug("Depot: [src] called activate_self_destruct with no reactor."); message_admins("Syndicate Depot lacks reactor to initiate self-destruct. Must be destroyed manually.") updateicon() diff --git a/code/game/objects/structures/depot.dm b/code/game/objects/structures/depot.dm index 9dfe256ce38..0d048467c3a 100644 --- a/code/game/objects/structures/depot.dm +++ b/code/game/objects/structures/depot.dm @@ -7,6 +7,7 @@ anchored = 1 max_integrity = 50 var/area/syndicate_depot/core/depotarea + var/has_overloaded = FALSE /obj/structure/fusionreactor/Initialize() . = ..() @@ -15,7 +16,9 @@ depotarea.reactor = src /obj/structure/fusionreactor/Destroy() - if(depotarea) + if(istype(depotarea)) + if(!has_overloaded) + overload(TRUE, TRUE) depotarea.reactor = null ..() @@ -30,7 +33,7 @@ healthcheck() /obj/structure/fusionreactor/proc/healthcheck() - if(obj_integrity <= 0) + if(obj_integrity <= 0 && istype(depotarea)) overload(TRUE) /obj/structure/fusionreactor/attackby(obj/item/I, mob/user, params) @@ -47,13 +50,20 @@ else return ..() -/obj/structure/fusionreactor/proc/overload(containment_failure) +/obj/structure/fusionreactor/proc/overload(containment_failure = FALSE, skip_qdel = FALSE) + if(has_overloaded) + return + has_overloaded = TRUE + if(istype(depotarea) && !depotarea.used_self_destruct) + depotarea.activate_self_destruct("Fusion reactor cracked open. Core loose!", TRUE) var/obj/effect/overload/O = new /obj/effect/overload(get_turf(src)) if(containment_failure) playsound(loc, 'sound/machines/Alarm.ogg', 100, 0, 0) O.deliberate = TRUE O.max_cycles = 6 - qdel(src) + if(!skip_qdel) + qdel(src) + /obj/effect/overload icon = 'icons/obj/tesla_engine/energy_ball.dmi' diff --git a/code/modules/mob/living/simple_animal/hostile/syndicate.dm b/code/modules/mob/living/simple_animal/hostile/syndicate.dm index 9d728977556..4f55094c3f6 100644 --- a/code/modules/mob/living/simple_animal/hostile/syndicate.dm +++ b/code/modules/mob/living/simple_animal/hostile/syndicate.dm @@ -205,8 +205,11 @@ alert_on_shield_breach = TRUE /mob/living/simple_animal/hostile/syndicate/melee/autogib/depot/armory/death() - if(depotarea) - depotarea.declare_finished() + if(istype(depotarea)) + if(depotarea.shield_list.len) + depotarea.activate_self_destruct("[src] has died while the armory shield is up.", FALSE) + else + depotarea.declare_finished() return ..()