diff --git a/code/__DEFINES/apc_defines.dm b/code/__DEFINES/apc_defines.dm index 4768c637332..4cc5e31cb10 100644 --- a/code/__DEFINES/apc_defines.dm +++ b/code/__DEFINES/apc_defines.dm @@ -80,10 +80,8 @@ #define UPSTATE_BROKE (1<<3) /// The APC is undergoing maintenance. #define UPSTATE_MAINT (1<<4) -/// The APC is emagged or malfed. -#define UPSTATE_BLUESCREEN (1<<5) /// The APCs wires are exposed. -#define UPSTATE_WIREEXP (1<<6) +#define UPSTATE_WIREEXP (1<<5) // update_overlay // Bitflags: diff --git a/code/__DEFINES/atom_hud.dm b/code/__DEFINES/atom_hud.dm index a38e1b793ab..7a1ca9705ac 100644 --- a/code/__DEFINES/atom_hud.dm +++ b/code/__DEFINES/atom_hud.dm @@ -45,6 +45,8 @@ #define FAN_HUD "21" /// Mech camera HUD #define DIAG_CAMERA_HUD "22" +/// Steady Hacked APC effect, visible only to Malf AIs +#define MALF_APC_HUD "23" // SKYRAT EDIT ADDITION BEGIN - gun permits and DNR /// ammo of guns @@ -72,8 +74,9 @@ #define DATA_HUD_SENTIENT_DISEASE 8 #define DATA_HUD_AI_DETECT 9 #define DATA_HUD_FAN 10 -#define DATA_HUD_PERMIT 11 //SKYRAT EDIT -#define DATA_HUD_DNR 12 // SKYRAT EDIT +#define DATA_HUD_MALF_APC 11 +#define DATA_HUD_PERMIT 12 //SKYRAT EDIT +#define DATA_HUD_DNR 13 // SKYRAT EDIT /// cooldown for being shown the images for any particular data hud #define ADD_HUD_TO_COOLDOWN 20 diff --git a/code/datums/hud.dm b/code/datums/hud.dm index 604dea3ff71..b69b9f40015 100644 --- a/code/datums/hud.dm +++ b/code/datums/hud.dm @@ -18,6 +18,7 @@ GLOBAL_LIST_INIT(huds, list( DATA_HUD_SENTIENT_DISEASE = new/datum/atom_hud/sentient_disease(), DATA_HUD_AI_DETECT = new/datum/atom_hud/ai_detector(), DATA_HUD_FAN = new/datum/atom_hud/data/human/fan_hud(), + DATA_HUD_MALF_APC = new/datum/atom_hud/data/malf_apc(), DATA_HUD_PERMIT = new/datum/atom_hud/data/human/permit(), // SKYRAT EDIT ADDITION DATA_HUD_DNR = new/datum/atom_hud/data/human/dnr(), // SKYRAT EDIT ADDITION )) diff --git a/code/game/data_huds.dm b/code/game/data_huds.dm index 0a77222e109..0412aab33e9 100644 --- a/code/game/data_huds.dm +++ b/code/game/data_huds.dm @@ -81,6 +81,9 @@ for(var/mob/camera/ai_eye/eye as anything in GLOB.aiEyes) eye.update_ai_detect_hud() +/datum/atom_hud/data/malf_apc + hud_icons = list(MALF_APC_HUD) + /* MED/SEC/DIAG HUD HOOKS */ /* @@ -572,3 +575,10 @@ Diagnostic HUDs! var/image/holder = hud_list[DIAG_AIRLOCK_HUD] holder.icon_state = "electrified" set_hud_image_active(DIAG_AIRLOCK_HUD) + +/// Applies hacked overlay for malf AIs +/obj/machinery/power/apc/proc/set_hacked_hud() + var/image/holder = hud_list[MALF_APC_HUD] + holder.loc = get_turf(src) + SET_PLANE(holder,ABOVE_LIGHTING_PLANE,src) + set_hud_image_active(MALF_APC_HUD) diff --git a/code/modules/antagonists/malf_ai/malf_ai.dm b/code/modules/antagonists/malf_ai/malf_ai.dm index 7415d09b9dc..778df3c7311 100644 --- a/code/modules/antagonists/malf_ai/malf_ai.dm +++ b/code/modules/antagonists/malf_ai/malf_ai.dm @@ -50,6 +50,9 @@ owner.current.playsound_local(get_turf(owner.current), 'sound/ambience/antag/malf.ogg', 100, FALSE, pressure_affected = FALSE, use_reverb = FALSE) owner.current.grant_language(/datum/language/codespeak, source = LANGUAGE_MALF) + var/datum/atom_hud/data/hackyhud = GLOB.huds[DATA_HUD_MALF_APC] + hackyhud.show_to(owner.current) + return ..() /datum/antagonist/malf_ai/on_removal() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index f2f815df0e2..5665fd0608b 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -1044,10 +1044,10 @@ apc.malfhack = TRUE apc.locked = TRUE apc.coverlocked = TRUE - + apc.flicker_hacked_icon() + apc.set_hacked_hud() playsound(get_turf(src), 'sound/machines/ding.ogg', 50, TRUE, ignore_walls = FALSE) to_chat(src, "Hack complete. [apc] is now under your exclusive control.") - apc.update_appearance() /mob/living/silicon/ai/verb/deploy_to_shell(mob/living/silicon/robot/target) set category = "AI Commands" diff --git a/code/modules/power/apc/apc_appearance.dm b/code/modules/power/apc/apc_appearance.dm index 06e0452efad..41547288a0b 100644 --- a/code/modules/power/apc/apc_appearance.dm +++ b/code/modules/power/apc/apc_appearance.dm @@ -18,11 +18,6 @@ set_light(light_on_range) return - if(update_state & UPSTATE_BLUESCREEN) - set_light_color(LIGHT_COLOR_BLUE) - set_light(light_on_range) - return - set_light(0) /obj/machinery/power/apc/update_icon_state() @@ -39,9 +34,6 @@ if(update_state & UPSTATE_BROKE) icon_state = "apc-b" return ..() - if(update_state & UPSTATE_BLUESCREEN) - icon_state = "apcemag" - return ..() if(update_state & UPSTATE_WIREEXP) icon_state = "apcewires" return ..() @@ -85,8 +77,6 @@ if(cell) new_update_state |= UPSTATE_CELL_IN - else if((obj_flags & EMAGGED) || malfai) - new_update_state |= UPSTATE_BLUESCREEN else if(panel_open) new_update_state |= UPSTATE_WIREEXP @@ -116,3 +106,16 @@ // Used in process so it doesn't update the icon too much /obj/machinery/power/apc/proc/queue_icon_update() icon_update_needed = TRUE + +// Shows a dark-blue interface for a moment. Shouldn't appear on cameras. +/obj/machinery/power/apc/proc/flicker_hacked_icon() + var/image/hacker_image = image(icon = 'icons/obj/machines/wallmounts.dmi', loc = src, icon_state = "apcemag", layer = FLOAT_LAYER) + var/list/mobs_to_show = list() + // Collecting mobs the APC can see for this animation, rather than mobs that can see the APC. Important distinction, intended such that mobs on camera / with XRAY cannot see the flicker. + for(var/mob/viewer in view(src)) + if(viewer.client) + mobs_to_show += viewer.client + if(malfai?.client) + mobs_to_show |= malfai.client + flick_overlay_global(hacker_image, mobs_to_show, 1 SECONDS) + hacked_flicker_counter = rand(3, 5) //The counter is decrimented in the process() proc, which runs every two seconds. diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm index 8c7e9adeac7..b822ce2003f 100644 --- a/code/modules/power/apc/apc_main.dm +++ b/code/modules/power/apc/apc_main.dm @@ -71,6 +71,8 @@ var/malfhack = FALSE //New var for my changes to AI malf. --NeoFite ///Reference to our ai hacker var/mob/living/silicon/ai/malfai = null //See above --NeoFite + ///Counter for displaying the hacked overlay to mobs within view + var/hacked_flicker_counter = 0 ///State of the electronics inside (missing, installed, secured) var/has_electronics = APC_ELECTRONICS_MISSING ///used for the Blackout malf module @@ -154,6 +156,10 @@ offset_old = pixel_x pixel_x = -APC_PIXEL_OFFSET + hud_list = list( + MALF_APC_HUD = image(icon = 'icons/mob/huds/hud.dmi', icon_state = "apc_hacked", pixel_x = src.pixel_x, pixel_y = src.pixel_y) + ) + //Assign it to its area. If mappers already assigned an area string fast load the area from it else get the current area var/area/our_area = get_area(loc) if(areastring) @@ -227,7 +233,6 @@ QDEL_NULL(cell) if(terminal) disconnect_terminal() - return ..() /obj/machinery/power/apc/proc/assign_to_area(area/target_area = get_area(src)) @@ -482,6 +487,11 @@ force_update = TRUE return + if(obj_flags & EMAGGED || malfai) + hacked_flicker_counter = hacked_flicker_counter - 1 + if(hacked_flicker_counter <= 0) + flicker_hacked_icon() + //dont use any power from that channel if we shut that power channel off lastused_light = APC_CHANNEL_IS_ON(lighting) ? area.power_usage[AREA_USAGE_LIGHT] + area.power_usage[AREA_USAGE_STATIC_LIGHT] : 0 lastused_equip = APC_CHANNEL_IS_ON(equipment) ? area.power_usage[AREA_USAGE_EQUIP] + area.power_usage[AREA_USAGE_STATIC_EQUIP] : 0 diff --git a/code/modules/power/apc/apc_tool_act.dm b/code/modules/power/apc/apc_tool_act.dm index 25b218a8969..b35f4de3fba 100644 --- a/code/modules/power/apc/apc_tool_act.dm +++ b/code/modules/power/apc/apc_tool_act.dm @@ -220,6 +220,7 @@ locked = FALSE balloon_alert(user, "interface damaged") update_appearance() + flicker_hacked_icon() return TRUE // damage and destruction acts diff --git a/icons/mob/huds/hud.dmi b/icons/mob/huds/hud.dmi index 18527378473..1ade65044e6 100644 Binary files a/icons/mob/huds/hud.dmi and b/icons/mob/huds/hud.dmi differ diff --git a/icons/obj/machines/wallmounts.dmi b/icons/obj/machines/wallmounts.dmi index 65ce74e9891..12a9c8e418f 100644 Binary files a/icons/obj/machines/wallmounts.dmi and b/icons/obj/machines/wallmounts.dmi differ diff --git a/modular_skyrat/modules/aesthetics/apc/code/apc.dm b/modular_skyrat/modules/aesthetics/apc/code/apc.dm index 78c3f2cfb72..0bddd02c7b4 100644 --- a/modular_skyrat/modules/aesthetics/apc/code/apc.dm +++ b/modular_skyrat/modules/aesthetics/apc/code/apc.dm @@ -22,9 +22,4 @@ set_light(light_on_range) return TRUE - if(update_state & UPSTATE_BLUESCREEN) - set_light_color(LIGHT_COLOR_BLUE) - set_light(light_on_range) - return TRUE - set_light(0)