From 63a78950cda1a75c8d276500203bccb40ad8eb86 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Wed, 11 Nov 2020 03:47:11 +0100 Subject: [PATCH] [MIRROR] Borgs synced to an AI using Doomsday will have their lights force-set to red and enabled to at least level 1 (#1659) * Borgs synced to an AI using Doomsday will have their lights force-set to red and enabled to at least level 1 (#54677) * Borgs synced to an AI using Doomsday will have their lights force-set to red and enabled to at least level 1 Co-authored-by: zxaber <37497534+zxaber@users.noreply.github.com> --- .../traitor/equipment/Malf_Modules.dm | 27 ++++++++++++++----- code/modules/mob/living/silicon/ai/death.dm | 7 ----- .../modules/mob/living/silicon/robot/robot.dm | 16 ++++++++--- 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm index fcde36aa9c6..f709bf365da 100644 --- a/code/modules/antagonists/traitor/equipment/Malf_Modules.dm +++ b/code/modules/antagonists/traitor/equipment/Malf_Modules.dm @@ -264,20 +264,32 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) var/obj/effect/countdown/doomsday/countdown var/detonation_timer var/next_announce + var/mob/living/silicon/ai/owner /obj/machinery/doomsday_device/Initialize() . = ..() + owner = loc + if(!istype(owner)) + stack_trace("Doomsday created outside an AI somehow, shit's fucking broke. Anyway, we're just gonna qdel now. Go make a github issue report.") + qdel(src) countdown = new(src) /obj/machinery/doomsday_device/Destroy() + timing = FALSE QDEL_NULL(countdown) STOP_PROCESSING(SSfastprocess, src) SSshuttle.clearHostileEnvironment(src) SSmapping.remove_nuke_threat(src) - for(var/A in GLOB.ai_list) - var/mob/living/silicon/ai/AI = A - if(AI.doomsday_device == src) - AI.doomsday_device = null + set_security_level("red") + for(var/mob/living/silicon/robot/borg in owner.connected_robots) + borg.lamp_doom = FALSE + borg.toggle_headlamp(FALSE, TRUE) //forces borg lamp to update + owner?.doomsday_device = null + owner?.nuking = null + owner = null + for(var/obj/item/pinpointer/nuke/P in GLOB.pinpointer_list) + P.switch_mode_to(TRACK_NUKE_DISK) //Party's over, back to work, everyone + P.alert = FALSE return ..() /obj/machinery/doomsday_device/proc/start() @@ -288,6 +300,10 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) START_PROCESSING(SSfastprocess, src) SSshuttle.registerHostileEnvironment(src) SSmapping.add_nuke_threat(src) //This causes all blue "circuit" tiles on the map to change to animated red icon state. + for(var/mob/living/silicon/robot/borg in owner.connected_robots) + borg.lamp_doom = TRUE + borg.toggle_headlamp(FALSE, TRUE) //forces borg lamp to update + /obj/machinery/doomsday_device/proc/seconds_remaining() . = max(0, (round((detonation_timer - world.time) / 10))) @@ -296,8 +312,7 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module)) var/turf/T = get_turf(src) if(!T || !is_station_level(T.z)) minor_announce("DOOMSDAY DEVICE OUT OF STATION RANGE, ABORTING", "ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4", TRUE) - SSshuttle.clearHostileEnvironment(src) - qdel(src) + owner.ShutOffDoomsdayDevice() return if(!timing) STOP_PROCESSING(SSfastprocess, src) diff --git a/code/modules/mob/living/silicon/ai/death.dm b/code/modules/mob/living/silicon/ai/death.dm index b42f6cfa30f..72262dcd133 100644 --- a/code/modules/mob/living/silicon/ai/death.dm +++ b/code/modules/mob/living/silicon/ai/death.dm @@ -45,13 +45,6 @@ /mob/living/silicon/ai/proc/ShutOffDoomsdayDevice() if(nuking) - set_security_level("red") nuking = FALSE - for(var/obj/item/pinpointer/nuke/P in GLOB.pinpointer_list) - P.switch_mode_to(TRACK_NUKE_DISK) //Party's over, back to work, everyone - P.alert = FALSE - if(doomsday_device) - doomsday_device.timing = FALSE - SSshuttle.clearHostileEnvironment(doomsday_device) qdel(doomsday_device) diff --git a/code/modules/mob/living/silicon/robot/robot.dm b/code/modules/mob/living/silicon/robot/robot.dm index f3d714d1a77..e4000930fbc 100644 --- a/code/modules/mob/living/silicon/robot/robot.dm +++ b/code/modules/mob/living/silicon/robot/robot.dm @@ -84,6 +84,8 @@ var/lamp_enabled = FALSE ///Set lamp color var/lamp_color = COLOR_WHITE + ///Set to true if a doomsday event is locking our lamp to on and RED + var/lamp_doom = FALSE ///Lamp brightness. Starts at 3, but can be 1 - 5. var/lamp_intensity = 3 ///Lamp button reference @@ -431,9 +433,9 @@ if(stat != DEAD && !(HAS_TRAIT(src, TRAIT_KNOCKEDOUT) || IsStun() || IsParalyzed() || low_power_mode)) //Not dead, not stunned. if(!eye_lights) eye_lights = new() - if(lamp_enabled) + if(lamp_enabled || lamp_doom) eye_lights.icon_state = "[module.special_light_key ? "[module.special_light_key]":"[module.cyborg_base_icon]"]_l" - eye_lights.color = lamp_color + eye_lights.color = lamp_doom? COLOR_RED : lamp_color eye_lights.plane = 19 //glowy eyes else eye_lights.icon_state = "[module.special_light_key ? "[module.special_light_key]":"[module.cyborg_base_icon]"]_e" @@ -553,13 +555,15 @@ /mob/living/silicon/robot/proc/toggle_headlamp(turn_off = FALSE, update_color = FALSE) //if both lamp is enabled AND the update_color flag is on, keep the lamp on. Otherwise, if anything listed is true, disable the lamp. if(!(update_color && lamp_enabled) && (turn_off || lamp_enabled || update_color || !lamp_functional || stat || low_power_mode)) - set_light_on(FALSE) + set_light_on(lamp_functional && stat != DEAD && lamp_doom) //If the lamp isn't broken and borg isn't dead, doomsday borgs cannot disable their light fully. + set_light_color(COLOR_RED) //This should only matter for doomsday borgs, as any other time the lamp will be off and the color not seen + set_light_range(1) //Again, like above, this only takes effect when the light is forced on by doomsday mode. lamp_enabled = FALSE lampButton.update_icon() update_icons() return set_light_range(lamp_intensity) - set_light_color(lamp_color) + set_light_color(lamp_doom? COLOR_RED : lamp_color) //Red for doomsday killborgs, borg's choice otherwise set_light_on(TRUE) lamp_enabled = TRUE lampButton.update_icon() @@ -824,6 +828,7 @@ locked = TRUE notify_ai(NEW_BORG) . = TRUE + toggle_headlamp(FALSE, TRUE) //This will reenable borg headlamps if doomsday is currently going on still. /mob/living/silicon/robot/fully_replace_character_name(oldname, newname) ..() @@ -1094,8 +1099,11 @@ if(.) var/mob/living/silicon/ai/old_ai = . old_ai.connected_robots -= src + lamp_doom = FALSE if(connected_ai) connected_ai.connected_robots |= src + lamp_doom = connected_ai.doomsday_device ? TRUE : FALSE + toggle_headlamp(FALSE, TRUE) /** * Records an IC event log entry in the cyborg's internal tablet.