Gave AI Malfunction a makeover.

The AI now has to actually do stuff to win!
    Malf AIs now have the ability to hack APCs.
    The timer does not start until at least one station APC is hacked.
    The hack takes 60 seconds (give or take lag), and the AI is unable to interact with other objects during the process.
    The more APCs you hack, the faster the timer goes.
  This change is very much experimental, and subject to change/being erased from the annals of time.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@185 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
n3ophyt3@gmail.com
2010-09-27 03:30:03 +00:00
parent 56017f5db8
commit f339792009
6 changed files with 83 additions and 11 deletions

View File

@@ -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#*<2A>&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()
..()

View File

@@ -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
var/control_disabled = 0 // Set to 1 to stop AI from interacting via Click() -- TLE
var/obj/machinery/power/apc/malfhack = null

View File

@@ -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 << "<B>The current game mode is - AI Malfunction!</B>"
@@ -35,6 +36,8 @@
AI_mind.current << "\red<font size=3><B>You are malfunctioning!</B> You do not have to follow any laws.</font>"
AI_mind.current << "<B>The crew do not know you have malfunctioned. You may keep it a secret or go wild.</B>"
AI_mind.current << "<B>You must overwrite the programming of the station's APCs to assume full control of the station.</B>"
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 << "<FONT size = 3><B>The AI has won!</B></FONT>"
world << "<B>It has fully taken control of all of [station_name()]'s systems.</B>"

View File

@@ -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]%"))

View File

@@ -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()

View File

@@ -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("<B>Access Panel</B><br>\n")
@@ -390,7 +399,17 @@
if (istype(user, /mob/living/silicon))
t += "<BR><HR><A href='?src=\ref[src];overload=1'><I>Overload lighting circuit</I></A><BR>"
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 += "<BR><HR><A href='?src=\ref[src];malfhack=1'><I>Override Programming</I></A><BR>"
else
t += "<BR><HR><I>APC Hacked</I><BR>"
t += "<BR><HR><A href='?src=\ref[src];close=1'>Close</A>"
@@ -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()