diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index ec4d155e8d0..b25eb450dd1 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -53,6 +53,80 @@ turret.shot_delay = 20 src << "Turrets upgraded." +/datum/AI_Module/large/lockdown + module_name = "Hostile Station Lockdown" + mod_pick_name = "lockdown" + description = "Take control of the airlock, blast door and fire control networks, locking them down. Caution! This command also electrifies all airlocks." + cost = 20 + one_time = 1 + + power_type = /mob/living/silicon/ai/proc/lockdown + +/mob/living/silicon/ai/proc/lockdown() + set category = "Malfunction" + set name = "Initiate Hostile Lockdown" + + if(src.stat == 2) + src <<"You cannot begin a lockdown because you are dead!" + return + + if(malf_cooldown) + return + + var/obj/machinery/door/airlock/AL + for(var/obj/machinery/door/D in portals) + spawn() + if(istype(D, /obj/machinery/door/airlock)) + AL = D + if(AL.canAIControl() && !AL.stat) //Must be powered and have working AI wire. + AL.locked = 0 //For airlocks that were bolted open. + AL.safe = 0 //DOOR CRUSH + AL.close() + AL.locked = 1 //Bolt it! + AL.lights = 0 //Stealth bolt for a classic AI door trap. + AL.secondsElectrified = -1 //Shock it! + else if(!D.stat) //So that only powered doors are closed. + D.close() //Close ALL the doors! + + var/obj/machinery/computer/communications/C = locate() in machines + if(C) + C.post_status("alert", "lockdown") + + src.verbs += /mob/living/silicon/ai/proc/disablelockdown + src << "Lockdown Initiated." + malf_cooldown = 1 + spawn(30) + malf_cooldown = 0 + +/mob/living/silicon/ai/proc/disablelockdown() + set category = "Malfunction" + set name = "Disable Lockdown" + + if(src.stat == 2) + src <<"You cannot disable lockdown because you are dead!" + return + if(malf_cooldown) + return + + var/obj/machinery/door/airlock/AL + for(var/obj/machinery/door/D in portals) + spawn() + if(istype(D, /obj/machinery/door/airlock)) + AL = D + if(AL.canAIControl() && !AL.stat) //Must be powered and have working AI wire. + AL.locked = 0 + AL.secondsElectrified = 0 + AL.open() + AL.safe = 1 + AL.lights = 1 //Essentially reset the airlock to normal. + else if(!D.stat) //Opens only powered doors. + D.open() //Open everything! + + src << "Lockdown Lifted." + malf_cooldown = 1 + spawn(30) + malf_cooldown = 0 + /datum/AI_Module/large/disable_rcd module_name = "RCD disable" mod_pick_name = "rcd" diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 352231c2116..eab30d6f2f5 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -27,6 +27,7 @@ explosion_resistance = 0 update_freelook_sight() air_update_turf(1) + portals += src return @@ -34,6 +35,7 @@ density = 0 air_update_turf(1) update_freelook_sight() + portals -= src ..() return diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 8036721f0cc..f32dba73748 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -39,6 +39,7 @@ var/list/ai_list = list() var/control_disabled = 0 // Set to 1 to stop AI from interacting via Click() var/malfhacking = 0 // More or less a copy of the above var, so that malf AIs can hack and still get new cyborgs -- NeoFite + var/malf_cooldown = 0 //Cooldown var for malf modules var/obj/machinery/power/apc/malfhack = null var/explosive = 0 //does the AI explode when it dies?