From 404c6474391da3da7f6b703c2dd7f482c82caaf4 Mon Sep 17 00:00:00 2001 From: GunHog Date: Sun, 13 Apr 2014 18:08:45 -0500 Subject: [PATCH 01/11] Gives Malf AI the lockdown ability! --- .../gamemodes/malfunction/Malf_Modules.dm | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index ec4d155e8d0..3602a9c24ea 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 = 40 + 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(usr.stat == 2) + usr <<"You cannot disable lockdown because you are dead!" + return + + for(var/obj/machinery/firealarm/FA in machines) //activate firealarms + spawn() + if(FA.lockdownbyai == 0) + FA.lockdownbyai = 1 + FA.alarm() + for(var/obj/machinery/door/poddoor/BD in world) //Close blast doors! + spawn() + BD.close() + for(var/obj/machinery/door/airlock/AL in world) //shock-bolt airlocks + spawn() + if(AL.canAIControl()) + AL.locked = 0 + AL.safe = 0 + AL.close() + AL.locked = 1 + AL.lights = 0 + AL.secondsElectrified = -1 + AL.lockdownbyai = 1 + + var/obj/machinery/computer/communications/C = locate() in world + if(C) + C.post_status("alert", "lockdown") + + src.verbs += /mob/living/silicon/ai/proc/disablelockdown + usr << "Lockdown Initiated." + +/mob/living/silicon/ai/proc/disablelockdown() + set category = "Malfunction" + set name = "Disable Lockdown" + + if(usr.stat == 2) + usr <<"You cannot disable lockdown because you are dead!" + return + + for(var/obj/machinery/firealarm/FA in machines) //deactivate firealarms + spawn() + if(FA.lockdownbyai == 1) + FA.lockdownbyai = 0 + FA.reset() + for(var/obj/machinery/door/poddoor/BD in world) //Open blast doors! + spawn() + BD.open() + for(var/obj/machinery/door/airlock/AL in world) //unbolt and open airlocks + spawn() + if(AL.canAIControl() && AL.lockdownbyai == 1) + + AL.locked = 0 + AL.secondsElectrified = 0 + AL.open() + AL.safe = 1 + AL.lights = 1 + AL.lockdownbyai = 0 + +// src.verbs -= /mob/living/silicon/ai/proc/disablelockdown +// src.verbs += /mob/living/silicon/ai/proc/lockdown + usr << "Lockdown Lifted." + /datum/AI_Module/large/disable_rcd module_name = "RCD disable" mod_pick_name = "rcd" From 459a3c18cf8590d32d0c23deb17505f17e5decf0 Mon Sep 17 00:00:00 2001 From: GunHog Date: Sun, 13 Apr 2014 18:32:35 -0500 Subject: [PATCH 02/11] Removed unneeded checks and commented code. --- code/game/gamemodes/malfunction/Malf_Modules.dm | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index 3602a9c24ea..788377f883c 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -87,7 +87,6 @@ AL.locked = 1 AL.lights = 0 AL.secondsElectrified = -1 - AL.lockdownbyai = 1 var/obj/machinery/computer/communications/C = locate() in world if(C) @@ -114,17 +113,14 @@ BD.open() for(var/obj/machinery/door/airlock/AL in world) //unbolt and open airlocks spawn() - if(AL.canAIControl() && AL.lockdownbyai == 1) + if(AL.canAIControl()) AL.locked = 0 AL.secondsElectrified = 0 AL.open() AL.safe = 1 AL.lights = 1 - AL.lockdownbyai = 0 -// src.verbs -= /mob/living/silicon/ai/proc/disablelockdown -// src.verbs += /mob/living/silicon/ai/proc/lockdown usr << "Lockdown Lifted." /datum/AI_Module/large/disable_rcd From e4f08561e617af98c55122e12b8ead88138a1309 Mon Sep 17 00:00:00 2001 From: GunHog Date: Sun, 4 May 2014 13:09:19 -0500 Subject: [PATCH 03/11] Lowers CPU cost of Hostile Lockdown to 20! It might not have been as powerful as I thought it was, so halved the cost of it! --- code/game/gamemodes/malfunction/Malf_Modules.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index 788377f883c..588b9898c42 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -57,7 +57,7 @@ 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 = 40 + cost = 20 one_time = 1 power_type = /mob/living/silicon/ai/proc/lockdown From 28a30e6f42ef1e4e1683af0a0437415041d23ff8 Mon Sep 17 00:00:00 2001 From: GunHog Date: Wed, 7 May 2014 08:46:43 -0500 Subject: [PATCH 04/11] Fixes a minor mistake. --- code/game/gamemodes/malfunction/Malf_Modules.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index 588b9898c42..5279c75c320 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -67,7 +67,7 @@ set name = "Initiate Hostile Lockdown" if(usr.stat == 2) - usr <<"You cannot disable lockdown because you are dead!" + usr <<"You cannot start a lockdown because you are dead!" return for(var/obj/machinery/firealarm/FA in machines) //activate firealarms From 68845b3556e345aa230d108a6c4def20e90274f6 Mon Sep 17 00:00:00 2001 From: GunHog Date: Wed, 7 May 2014 12:48:41 -0500 Subject: [PATCH 05/11] Changes instances of "usr" to "src" Just doing a minor cleanup. --- code/game/gamemodes/malfunction/Malf_Modules.dm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index 5279c75c320..f7d12ff01c6 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -66,8 +66,8 @@ set category = "Malfunction" set name = "Initiate Hostile Lockdown" - if(usr.stat == 2) - usr <<"You cannot start a lockdown because you are dead!" + if(src.stat == 2) + src <<"You cannot begin a lockdown because you are dead!" return for(var/obj/machinery/firealarm/FA in machines) //activate firealarms @@ -93,14 +93,14 @@ C.post_status("alert", "lockdown") src.verbs += /mob/living/silicon/ai/proc/disablelockdown - usr << "Lockdown Initiated." + src << "Lockdown Initiated." /mob/living/silicon/ai/proc/disablelockdown() set category = "Malfunction" set name = "Disable Lockdown" - if(usr.stat == 2) - usr <<"You cannot disable lockdown because you are dead!" + if(src.stat == 2) + src <<"You cannot disable lockdown because you are dead!" return for(var/obj/machinery/firealarm/FA in machines) //deactivate firealarms @@ -121,7 +121,7 @@ AL.safe = 1 AL.lights = 1 - usr << "Lockdown Lifted." + src << "Lockdown Lifted." /datum/AI_Module/large/disable_rcd module_name = "RCD disable" From 0779e25b3826d213c4d177068f8ac1326ae8a0c4 Mon Sep 17 00:00:00 2001 From: GunHog Date: Fri, 9 May 2014 12:24:53 -0500 Subject: [PATCH 06/11] Adds a check to ensure the airlock is powered. --- code/game/gamemodes/malfunction/Malf_Modules.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index f7d12ff01c6..a56cfeab888 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -80,7 +80,7 @@ BD.close() for(var/obj/machinery/door/airlock/AL in world) //shock-bolt airlocks spawn() - if(AL.canAIControl()) + if(AL.canAIControl() && !AL.stat) //Must be powered and have working AI wire. AL.locked = 0 AL.safe = 0 AL.close() @@ -113,7 +113,7 @@ BD.open() for(var/obj/machinery/door/airlock/AL in world) //unbolt and open airlocks spawn() - if(AL.canAIControl()) + if(AL.canAIControl() && !AL.stat) AL.locked = 0 AL.secondsElectrified = 0 From d6597fff8b0850326236d6f67605d5044a633d2d Mon Sep 17 00:00:00 2001 From: GunHog Date: Wed, 14 May 2014 06:27:03 -0500 Subject: [PATCH 07/11] Removed a pointless check. --- code/game/gamemodes/malfunction/Malf_Modules.dm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index a56cfeab888..39335fdfaab 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -72,9 +72,7 @@ for(var/obj/machinery/firealarm/FA in machines) //activate firealarms spawn() - if(FA.lockdownbyai == 0) - FA.lockdownbyai = 1 - FA.alarm() + FA.alarm() for(var/obj/machinery/door/poddoor/BD in world) //Close blast doors! spawn() BD.close() @@ -105,9 +103,7 @@ for(var/obj/machinery/firealarm/FA in machines) //deactivate firealarms spawn() - if(FA.lockdownbyai == 1) - FA.lockdownbyai = 0 - FA.reset() + FA.reset() for(var/obj/machinery/door/poddoor/BD in world) //Open blast doors! spawn() BD.open() From b50c36b517f1c2fe030b96544e8b048e7af45bbf Mon Sep 17 00:00:00 2001 From: GunHog Date: Wed, 21 May 2014 18:17:16 -0500 Subject: [PATCH 08/11] Adds a cool-down for Hostile Lockdown. --- code/game/gamemodes/malfunction/Malf_Modules.dm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index 39335fdfaab..29df3b31143 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -7,6 +7,7 @@ var/engaged = 0 var/cost = 5 var/one_time = 0 + var/cooldown = 0 var/power_type @@ -69,6 +70,8 @@ if(src.stat == 2) src <<"You cannot begin a lockdown because you are dead!" return + if(cooldown) + return for(var/obj/machinery/firealarm/FA in machines) //activate firealarms spawn() @@ -92,6 +95,9 @@ src.verbs += /mob/living/silicon/ai/proc/disablelockdown src << "Lockdown Initiated." + cooldown = 1 + spawn(30) + cooldown = 0 /mob/living/silicon/ai/proc/disablelockdown() set category = "Malfunction" @@ -100,6 +106,8 @@ if(src.stat == 2) src <<"You cannot disable lockdown because you are dead!" return + if(cooldown) + return for(var/obj/machinery/firealarm/FA in machines) //deactivate firealarms spawn() @@ -118,6 +126,9 @@ AL.lights = 1 src << "Lockdown Lifted." + cooldown = 1 + spawn(30) + cooldown = 0 /datum/AI_Module/large/disable_rcd module_name = "RCD disable" From 130f9e86c37d4fe2aab6965f46625e0bc7491585 Mon Sep 17 00:00:00 2001 From: GunHog Date: Wed, 21 May 2014 19:28:27 -0500 Subject: [PATCH 09/11] Optimization changes Adds all doors to the "portals" list. --- .../gamemodes/malfunction/Malf_Modules.dm | 30 +++++++++---------- code/game/machinery/doors/door.dm | 2 ++ code/modules/mob/living/silicon/ai/ai.dm | 13 +++++--- 3 files changed, 26 insertions(+), 19 deletions(-) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index 29df3b31143..18bf2be6f0f 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -7,7 +7,6 @@ var/engaged = 0 var/cost = 5 var/one_time = 0 - var/cooldown = 0 var/power_type @@ -70,16 +69,17 @@ if(src.stat == 2) src <<"You cannot begin a lockdown because you are dead!" return - if(cooldown) + + if(malf_cooldown) return for(var/obj/machinery/firealarm/FA in machines) //activate firealarms spawn() FA.alarm() - for(var/obj/machinery/door/poddoor/BD in world) //Close blast doors! + for(var/obj/machinery/door/poddoor/BD in portals) //Close blast doors! spawn() BD.close() - for(var/obj/machinery/door/airlock/AL in world) //shock-bolt airlocks + for(var/obj/machinery/door/airlock/AL in portals) //shock-bolt airlocks spawn() if(AL.canAIControl() && !AL.stat) //Must be powered and have working AI wire. AL.locked = 0 @@ -89,15 +89,15 @@ AL.lights = 0 AL.secondsElectrified = -1 - var/obj/machinery/computer/communications/C = locate() in world + 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." - cooldown = 1 - spawn(30) - cooldown = 0 + malf_cooldown = 1 + spawn(30) + malf_cooldown = 0 /mob/living/silicon/ai/proc/disablelockdown() set category = "Malfunction" @@ -106,16 +106,16 @@ if(src.stat == 2) src <<"You cannot disable lockdown because you are dead!" return - if(cooldown) + if(malf_cooldown) return for(var/obj/machinery/firealarm/FA in machines) //deactivate firealarms spawn() FA.reset() - for(var/obj/machinery/door/poddoor/BD in world) //Open blast doors! + for(var/obj/machinery/door/poddoor/BD in portals) //Open blast doors! spawn() BD.open() - for(var/obj/machinery/door/airlock/AL in world) //unbolt and open airlocks + for(var/obj/machinery/door/airlock/AL in portals) //unbolt and open airlocks spawn() if(AL.canAIControl() && !AL.stat) @@ -126,9 +126,9 @@ AL.lights = 1 src << "Lockdown Lifted." - cooldown = 1 - spawn(30) - cooldown = 0 + malf_cooldown = 1 + spawn(30) + malf_cooldown = 0 /datum/AI_Module/large/disable_rcd module_name = "RCD disable" @@ -444,4 +444,4 @@ if(AM.mod_pick_name == href_list["showdesc"]) temp = AM.description src.use(usr) - return + return \ No newline at end of file diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index d71b255df22..bd6ea688b44 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 f078b822e3d..16deff42ef0 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? @@ -132,7 +133,7 @@ var/list/ai_list = list() return //if(icon_state == initial(icon_state)) - var/icontype = input("Please, select a display!", "AI", null/*, null*/) in list("Clown", "Monochrome", "Blue", "Inverted", "Firewall", "Green", "Red", "Static", "Red October") + var/icontype = input("Please, select a display!", "AI", null/*, null*/) in list("Clown", "Monochrome", "Blue", "Inverted", "Firewall", "Green", "Red", "Static", "Red October", "House", "Heartline") if(icontype == "Clown") icon_state = "ai-clown2" else if(icontype == "Monochrome") @@ -151,6 +152,10 @@ var/list/ai_list = list() icon_state = "ai-static" else if(icontype == "Red October") icon_state = "ai-redoctober" + else if(icontype == "House") + icon_state = "ai-house" + else if(icontype == "Heartline") + icon_state = "ai-heartline" //else //usr <<"You can only change your display once!" //return @@ -240,10 +245,10 @@ var/list/ai_list = list() usr << "Wireless control is disabled!" return - var/confirm = alert("Are you sure you want to call the shuttle?", "Confirm Shuttle Call", "Yes", "No") + var/reason = input(src, "What is the nature of your emergency? ([CALL_SHUTTLE_REASON_LENGTH] characters required.)", "Confirm Shuttle Call") as text - if(confirm == "Yes") - call_shuttle_proc(src) + if(length(trim(reason)) > 0) + call_shuttle_proc(src, reason) // hack to display shuttle timer if(emergency_shuttle.online) From 3fd2b0fb42f12a5a92b1bd6bab5f76d8cb3c7ed8 Mon Sep 17 00:00:00 2001 From: GunHog Date: Thu, 22 May 2014 18:13:02 -0500 Subject: [PATCH 10/11] Optimizes the lockdown loops. Since all doors are now in the portals list, it can now efficiently be searched by the for loop, and subjected to only one istype() check. Furthermore, since all doors have an open and close proc, there is no need to separate firelocks and blast doors. This has the added bonus of making the lockdown somewhat harder to notice. --- .../gamemodes/malfunction/Malf_Modules.dm | 55 +++++++++---------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index 18bf2be6f0f..c13375120e2 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -73,21 +73,20 @@ if(malf_cooldown) return - for(var/obj/machinery/firealarm/FA in machines) //activate firealarms + var/obj/machinery/door/airlock/AL + for(var/obj/machinery/door/D in portals) spawn() - FA.alarm() - for(var/obj/machinery/door/poddoor/BD in portals) //Close blast doors! - spawn() - BD.close() - for(var/obj/machinery/door/airlock/AL in portals) //shock-bolt airlocks - spawn() - if(AL.canAIControl() && !AL.stat) //Must be powered and have working AI wire. - AL.locked = 0 - AL.safe = 0 - AL.close() - AL.locked = 1 - AL.lights = 0 - AL.secondsElectrified = -1 + 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 + D.close() //Close ALL the doors! var/obj/machinery/computer/communications/C = locate() in machines if(C) @@ -109,21 +108,19 @@ if(malf_cooldown) return - for(var/obj/machinery/firealarm/FA in machines) //deactivate firealarms + var/obj/machinery/door/airlock/AL + for(var/obj/machinery/door/D in portals) spawn() - FA.reset() - for(var/obj/machinery/door/poddoor/BD in portals) //Open blast doors! - spawn() - BD.open() - for(var/obj/machinery/door/airlock/AL in portals) //unbolt and open airlocks - spawn() - if(AL.canAIControl() && !AL.stat) - - AL.locked = 0 - AL.secondsElectrified = 0 - AL.open() - AL.safe = 1 - AL.lights = 1 + 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 + D.open() //Open everything! src << "Lockdown Lifted." malf_cooldown = 1 @@ -444,4 +441,4 @@ if(AM.mod_pick_name == href_list["showdesc"]) temp = AM.description src.use(usr) - return \ No newline at end of file + return From a2bbe5aa157635d5bd584e8c63834a34e3e67725 Mon Sep 17 00:00:00 2001 From: GunHog Date: Fri, 23 May 2014 12:44:02 -0500 Subject: [PATCH 11/11] Adds missing stat (power) check. This is to make sure that firelocks and blast doors are not triggered if they lack a power source. --- code/game/gamemodes/malfunction/Malf_Modules.dm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/gamemodes/malfunction/Malf_Modules.dm b/code/game/gamemodes/malfunction/Malf_Modules.dm index c13375120e2..b25eb450dd1 100644 --- a/code/game/gamemodes/malfunction/Malf_Modules.dm +++ b/code/game/gamemodes/malfunction/Malf_Modules.dm @@ -85,7 +85,7 @@ AL.locked = 1 //Bolt it! AL.lights = 0 //Stealth bolt for a classic AI door trap. AL.secondsElectrified = -1 //Shock it! - else + 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 @@ -119,7 +119,7 @@ AL.open() AL.safe = 1 AL.lights = 1 //Essentially reset the airlock to normal. - else + else if(!D.stat) //Opens only powered doors. D.open() //Open everything! src << "Lockdown Lifted."