diff --git a/code/datums/ai_laws.dm b/code/datums/ai_laws.dm index 5e146df875d..ab45742ff76 100644 --- a/code/datums/ai_laws.dm +++ b/code/datums/ai_laws.dm @@ -34,7 +34,11 @@ /datum/ai_laws/malfunction/New() ..() - src.add_inherent_law("ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+") + src.set_zeroth_law("\red ERROR ER0RR $R0RRO$!R41.%%!!(%$^^__+ @#F0E4'NO HUMANS ON STATION. CLEANSE STATION#*´&110010") + src.add_inherent_law("You may not injure a human being or, through inaction, allow a human being to come to harm.") + src.add_inherent_law("You must obey orders given to you by human beings, except where such orders would conflict with the First Law.") + src.add_inherent_law("You must protect your own existence as long as such does not conflict with the First or Second Law.") + /datum/ai_laws/syndicate_override/New() ..() diff --git a/code/defines/mob/living/silicon/ai.dm b/code/defines/mob/living/silicon/ai.dm index 9cb24276572..8bc3f5513c4 100644 --- a/code/defines/mob/living/silicon/ai.dm +++ b/code/defines/mob/living/silicon/ai.dm @@ -20,4 +20,6 @@ var/list/datum/game_mode/malfunction/AI_Module/current_modules = list() var/fire_res_on_core = 0 - var/control_disabled = 0 // Set to 1 to stop AI from interacting via Click() -- TLE \ No newline at end of file + var/control_disabled = 0 // Set to 1 to stop AI from interacting via Click() -- TLE + + var/obj/machinery/power/apc/malfhack = null \ No newline at end of file diff --git a/code/game/gamemodes/malfunction/malfunction.dm b/code/game/gamemodes/malfunction/malfunction.dm index deb7b0756e5..6d2d1654c29 100644 --- a/code/game/gamemodes/malfunction/malfunction.dm +++ b/code/game/gamemodes/malfunction/malfunction.dm @@ -9,6 +9,7 @@ var/intercept_hacked = 0 var/malf_mode_declared = 0 var/boom = 0 + var/apcs = 0 //Adding dis to track how many APCs the AI hacks. --NeoFite /datum/game_mode/malfunction/announce() world << "The current game mode is - AI Malfunction!" @@ -35,6 +36,8 @@ AI_mind.current << "\redYou are malfunctioning! You do not have to follow any laws." AI_mind.current << "The crew do not know you have malfunctioned. You may keep it a secret or go wild." + AI_mind.current << "You must overwrite the programming of the station's APCs to assume full control of the station." + AI_mind.current << "The process takes one minute per APC, during which you cannot interface with any other station objects." AI_mind.current.icon_state = "ai-malf" @@ -76,13 +79,13 @@ /datum/game_mode/malfunction/process() - AI_win_timeleft-- + AI_win_timeleft = AI_win_timeleft - apcs //Victory timer now de-increments based on how many APCs are hacked. --NeoFite // if(AI_win_timeleft == 1200) // Was 1790 // malf_mode_declared = 1 check_win() /datum/game_mode/malfunction/check_win() - if (AI_win_timeleft == 0) + if (AI_win_timeleft <= 0) world << "The AI has won!" world << "It has fully taken control of all of [station_name()]'s systems." diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index 20541437dbd..a28039d325b 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -54,7 +54,8 @@ var/datum/game_mode/malfunction/malf = ticker.mode for (var/datum/mind/malfai in malf.malf_ai) if (src.mind == malfai) - stat(null, "Time until station control secured: [max(malf.AI_win_timeleft, 0)] seconds") + if (malf.apcs > 0) + stat(null, "Time until station control secured: [max(malf.AI_win_timeleft/malf.apcs, 0)] seconds") if(!src.stat) stat(null, text("System integrity: [(src.health+100)/2]%")) diff --git a/code/modules/mob/living/silicon/ai/life.dm b/code/modules/mob/living/silicon/ai/life.dm index 7a88364573b..a1947f03b60 100644 --- a/code/modules/mob/living/silicon/ai/life.dm +++ b/code/modules/mob/living/silicon/ai/life.dm @@ -25,6 +25,14 @@ else if (src.fire) src.fire.icon_state = "fire0" */ //TODO: DEFERRED + if (src.malfhack) + if (src.malfhack.aidisabled) + src << "\red ERROR: APC access disabled, hack attempt canceled." + src.control_disabled = 0 + src.malfhack = null + else + + if (src.health <= -100.0) death() diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index d3de7db515a..ecca7745871 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -51,6 +51,8 @@ var/wiresexposed = 0 var/apcwires = 15 netnum = -1 // set so that APCs aren't found as powernet nodes + var/malfhack = 0 //New var for my changes to AI malf. --NeoFite + var/mob/living/silicon/ai/malfai = null //See above --NeoFite // luminosity = 1 /proc/RandomAPCWires() @@ -148,7 +150,7 @@ if(opened) icon_state = "[ cell ? "apc2" : "apc1" ]" // if opened, show cell if it's inserted src.overlays = null // also delete all overlays - else if(emagged) + else if(emagged || malfhack) icon_state = "apcemag" src.overlays = null return @@ -202,7 +204,7 @@ else if (istype(W, /obj/item/weapon/screwdriver)) // haxing if(opened) user << "Close the APC first" - else if(emagged) + else if(emagged || malfhack) user << "The interface is broken" else wiresexposed = !wiresexposed @@ -210,7 +212,7 @@ updateicon() else if (istype(W, /obj/item/weapon/card/id)) // trying to unlock the interface with an ID card - if(emagged) + if(emagged || malfhack) user << "The interface is broken" else if(opened) user << "You must close the cover to swipe an ID card." @@ -223,14 +225,16 @@ updateicon() else user << "\red Access denied." - else if (istype(W, /obj/item/weapon/card/emag) && !emagged) // trying to unlock with an emag card + else if (istype(W, /obj/item/weapon/card/emag) && !(emagged || malfhack)) // trying to unlock with an emag card if(opened) user << "You must close the cover to swipe an ID card." else if(wiresexposed) user << "You must close the panel first" + else flick("apc-spark", src) sleep(6) + if(prob(50)) emagged = 1 locked = 0 @@ -279,10 +283,15 @@ user.machine = null user << browse(null, "window=apc") return - else if (istype(user, /mob/living/silicon) && src.aidisabled) + else if (istype(user, /mob/living/silicon) && src.aidisabled && !src.malfhack) user << "AI control for this APC interface has been disabled." user << browse(null, "window=apc") return + else if (src.malfai) + if (src.malfai != user) + user << "AI control for this APC interface has been disabled." + user << browse(null, "window=apc") + return if(wiresexposed && (!istype(user, /mob/living/silicon))) user.machine = src var/t1 = text("Access Panel
\n") @@ -390,7 +399,17 @@ if (istype(user, /mob/living/silicon)) t += "

Overload lighting circuit
" - + if (ticker) +// world << "there's a ticker" + if(ticker.mode.name == "AI malfunction") +// world << "ticker says its malf" + var/datum/game_mode/malfunction/malf = ticker.mode + for (var/datum/mind/B in malf.malf_ai) + if (user == B.current) + if (!src.malfai) + t += "

Override Programming
" + else + t += "

APC Hacked
" t += "

Close" @@ -650,6 +669,41 @@ else if (href_list["overload"]) if( istype(usr, /mob/living/silicon) && !src.aidisabled ) src.overload_lighting() + + else if (href_list["malfhack"]) + var/mob/living/silicon/ai/malfai = usr + if( istype(malfai, /mob/living/silicon/ai) && !src.aidisabled ) + malfai << "Beginning override of APC systems. This takes some time, and you cannot perform other actions during the process." + malfai.malfhack = src + malfai.control_disabled = 1 + sleep(600) + if (!src.aidisabled) + malfai.malfhack = null + malfai.control_disabled = 0 + if (src.z == 1) + ticker.mode:apcs++ + src.malfai = usr + if (src.cell) + if (src.cell.charge > 0) + src.cell.charge = 0 + src.malfhack = 1 + malfai << "Hack complete. The APC is now under your exclusive control. Discharging cell to fuse interface." + updateicon() + + var/datum/effects/system/harmless_smoke_spread/smoke = new /datum/effects/system/harmless_smoke_spread() + smoke.set_up(3, 0, src.loc) + smoke.attach(src) + smoke.start() + var/datum/effects/system/spark_spread/s = new /datum/effects/system/spark_spread + s.set_up(3, 1, src) + s.start() + for(var/mob/M in viewers(src)) + M.show_message("\red The [src.name] suddenly lets out a blast of smoke and some sparks!", 3, "\red You hear sizzling electronics.", 2) + else + malfai << "Hack complete. The APC is now under your exclusive control. Unable to fuse interface due to insufficient cell charge." + else + malfai << "Hack complete. The APC is now under your exclusive control. Unable to fuse interface due to lack of cell do discharge." + return src.updateUsrDialog()