From 7907e1dc384f90f148a0f7dcd6c2f6736cedb50f Mon Sep 17 00:00:00 2001 From: Qwertytoforty <52090703+Qwertytoforty@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:43:05 -0400 Subject: [PATCH] Only malf AI can hack doors with cut ai wires, flash emps cameras (#21610) * Only malf AI can hack doors with cut ai wires, flash emp * weaker emp = less time * Apply suggestions from code review Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com> * FLASH. AH AH --------- Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com> Co-authored-by: JimKil3 <47290811+JimKil3@users.noreply.github.com> --- code/game/machinery/camera/camera.dm | 2 +- code/game/machinery/doors/airlock.dm | 16 ++++++++-------- code/game/objects/items/devices/flash.dm | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/code/game/machinery/camera/camera.dm b/code/game/machinery/camera/camera.dm index 141144dc750..9e574403f6f 100644 --- a/code/game/machinery/camera/camera.dm +++ b/code/game/machinery/camera/camera.dm @@ -98,7 +98,7 @@ network = list() stat |= EMPED turn_off(null, FALSE, TRUE) - addtimer(CALLBACK(src, PROC_REF(reactivate_after_emp)), 90 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE) + addtimer(CALLBACK(src, PROC_REF(reactivate_after_emp)), (90 / severity) SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE) ..() /obj/machinery/camera/proc/reactivate_after_emp() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 3e4c50ae4d2..b4da8047b4d 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -212,8 +212,8 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays) /obj/machinery/door/airlock/proc/canAIControl() return ((aiControlDisabled != AICONTROLDISABLED_ON) && (!isAllPowerLoss())) -/obj/machinery/door/airlock/proc/canAIHack() - return ((aiControlDisabled == AICONTROLDISABLED_ON) && (!hackProof) && (!isAllPowerLoss())) +/obj/machinery/door/airlock/proc/canAIHack(mob/living/user) + return ((aiControlDisabled == AICONTROLDISABLED_ON) && (!hackProof) && (!isAllPowerLoss()) && user.mind?.special_role) /obj/machinery/door/airlock/proc/arePowerSystemsOn() if(stat & (NOPOWER|BROKEN)) @@ -716,7 +716,7 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays) if(!aiHacking) aiHacking = TRUE to_chat(user, "Airlock AI control has been blocked. Beginning fault-detection.") - sleep(50) + sleep(3 SECONDS) if(canAIControl()) to_chat(user, "Alert cancelled. Airlock control has been restored without our assistance.") aiHacking = FALSE @@ -726,9 +726,9 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays) aiHacking = FALSE return to_chat(user, "Fault confirmed: airlock control wire disabled or cut.") - sleep(20) + sleep(2 SECONDS) to_chat(user, "Attempting to hack into airlock. This may take some time.") - sleep(200) + sleep(15 SECONDS) if(canAIControl()) to_chat(user, "Alert cancelled. Airlock control has been restored without our assistance.") aiHacking = FALSE @@ -738,7 +738,7 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays) aiHacking = FALSE return to_chat(user, "Upload access confirmed. Loading control program into airlock software.") - sleep(170) + sleep(5 SECONDS) if(canAIControl()) to_chat(user, "Alert cancelled. Airlock control has been restored without our assistance.") aiHacking = FALSE @@ -748,11 +748,11 @@ GLOBAL_LIST_EMPTY(airlock_emissive_underlays) aiHacking = FALSE return to_chat(user, "Transfer complete. Forcing airlock to execute program.") - sleep(50) + sleep(5 SECONDS) //disable blocked control aiControlDisabled = AICONTROLDISABLED_BYPASS to_chat(user, "Receiving control information from airlock.") - sleep(10) + sleep(1 SECONDS) //bring up airlock dialog aiHacking = FALSE if(user) diff --git a/code/game/objects/items/devices/flash.dm b/code/game/objects/items/devices/flash.dm index 7257e7a0e19..68f25ec321b 100644 --- a/code/game/objects/items/devices/flash.dm +++ b/code/game/objects/items/devices/flash.dm @@ -137,6 +137,20 @@ return 1 user.visible_message("[user] fails to blind [M] with [src]!", "You fail to blind [M] with [src]!") +/obj/item/flash/afterattack(atom/target, mob/living/user, proximity, params) + if(!proximity) + return + if(!istype(target, /obj/machinery/camera)) + return + if(!try_use_flash(user)) + return + var/obj/machinery/camera/C = target + C.emp_act(EMP_HEAVY) + to_chat(user,"You hit the lens of [C] with [src], temporarily disabling the camera!") + log_admin("[key_name(user)] EMPd a camera with a flash") + user.create_attack_log("[key_name(user)] EMPd a camera with a flash") + add_attack_logs(user, C, "EMPd with [src]", ATKLOG_ALL) + /obj/item/flash/attack_self(mob/living/carbon/user, flag = 0, emp = 0) if(!try_use_flash(user)) @@ -144,6 +158,11 @@ user.visible_message("[user]'s [name] emits a blinding light!", "Your [name] emits a blinding light!") for(var/mob/living/carbon/M in oviewers(3, null)) flash_carbon(M, user, 6 SECONDS, 0) + for(var/obj/machinery/camera/C in view(3, user)) + C.emp_act(EMP_LIGHT) + log_admin("[key_name(user)] EMPd a camera with a flash") + user.create_attack_log("[key_name(user)] EMPd a camera with a flash") + add_attack_logs(user, C, "EMPd with [src]", ATKLOG_ALL) /obj/item/flash/emp_act(severity)