Skip to content

Commit

Permalink
Merge pull request tgstation#9792 from GunHog/AI_STOLE_MY_BIKE
Browse files Browse the repository at this point in the history
Malf AI module changes + Mechs for normal AIs!
  • Loading branch information
RemieRichards committed Jun 20, 2015
2 parents ee1e307 + a921431 commit c79963f
Show file tree
Hide file tree
Showing 12 changed files with 296 additions and 219 deletions.
7 changes: 6 additions & 1 deletion code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,9 @@
#define FUZZY_CHANCE_LOW 50
#define CHANCE_TALK 15
#define MAXCOIL 30
#define RESIZE_DEFAULT_SIZE 1
#define RESIZE_DEFAULT_SIZE 1

//transfer_ai() defines. Main proc in ai_core.dm
#define AI_TRANS_TO_CARD 1 //Downloading AI to InteliCard.
#define AI_TRANS_FROM_CARD 2 //Uploading AI from InteliCard
#define AI_MECH_HACK 3 //Malfunctioning AI hijacking mecha
9 changes: 6 additions & 3 deletions code/_onclick/ai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@
CtrlShiftClickOn(A)
return
if(modifiers["middle"])
MiddleClickOn(A)
if(controlled_mech) //Are we piloting a mech? Placed here so the modifiers are not overridden.
controlled_mech.click_action(A, src) //Override AI normal click behavior.
return

return
if(modifiers["shift"])
ShiftClickOn(A)
Expand Down Expand Up @@ -116,7 +119,7 @@
return
/atom/proc/AICtrlShiftClick()
return

/* Airlocks */
/obj/machinery/door/airlock/AICtrlClick() // Bolts doors
if(emagged)
Expand Down Expand Up @@ -152,7 +155,7 @@
else
Topic("aiDisable=11", list("aiDisable"="11"), 1)
return

/* APC */
/obj/machinery/power/apc/AICtrlClick() // turns off/on APCs.
toggle_breaker()
Expand Down
2 changes: 1 addition & 1 deletion code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ var/datum/global_hud/global_hud = new()
else if(isdrone(mymob))
drone_hud(ui_style)

if(istype(mymob.loc,/obj/mecha))
if(istype(mymob.loc,/obj/mecha) && ishuman(mymob))
show_hud(HUD_STYLE_REDUCED)

//Version denotes which style should be displayed. blank or 0 means "next version"
Expand Down
59 changes: 34 additions & 25 deletions code/game/gamemodes/malfunction/Malf_Modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
/datum/AI_Module/large/upgrade_turrets
module_name = "AI Turret upgrade"
mod_pick_name = "turret"
description = "Improves the firing speed and health of all AI turrets. This effect is permanent."
description = "Improves the power and health of all AI turrets. This effect is permanent."
cost = 50
one_time = 1

Expand All @@ -55,14 +55,15 @@
for(var/obj/machinery/porta_turret/turret in machines)
if(turret.ai) //Make sure only the AI's turrets are affected.
turret.health += 30
turret.shot_delay = 10 //Standard portable turret delay is 15.
turret.eprojectile = /obj/item/projectile/beam/heavylaser //Once you see it, you will know what it means to FEAR.
turret.eshot_sound = 'sound/weapons/lasercannonfire.ogg'
src << "<span class='notice'>Turrets upgraded.</span>"

/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
description = "Overload the airlock, blast door and fire control networks, locking them down. Caution! This command also electrifies all airlocks. The networks will automatically reset after 90 seconds."
cost = 30
one_time = 1

power_type = /mob/living/silicon/ai/proc/lockdown
Expand All @@ -74,9 +75,6 @@
if(!canUseTopic())
return

if(malf_cooldown)
return

var/obj/machinery/door/airlock/AL
for(var/obj/machinery/door/D in airlocks)
if(D.z != ZLEVEL_STATION && D.z != ZLEVEL_MINING)
Expand All @@ -88,8 +86,7 @@
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.bolt() //Bolt it!
AL.secondsElectrified = -1 //Shock it!
else if(!D.stat) //So that only powered doors are closed.
D.close() //Close ALL the doors!
Expand All @@ -98,39 +95,30 @@
if(C)
C.post_status("alert", "lockdown")

src.verbs += /mob/living/silicon/ai/proc/disablelockdown
src << "<span class='warning'>Lockdown Initiated.</span>"
malf_cooldown = 1
spawn(30)
malf_cooldown = 0
verbs -= /mob/living/silicon/ai/proc/lockdown
minor_announce("Hostile runtime detected in door controllers. Isolation Lockdown protocols are now in effect. Please remain calm.","Network Alert:", 1)
src << "<span class = 'warning'>Lockdown Initiated. Network reset in 90 seconds.</span>"
spawn(900) //90 Seconds.
disablelockdown() //Reset the lockdown after 90 seconds.

/mob/living/silicon/ai/proc/disablelockdown()
set category = "Malfunction"
set name = "Disable Lockdown"

if(!canUseTopic())
return
if(malf_cooldown)
return

var/obj/machinery/door/airlock/AL
for(var/obj/machinery/door/D in airlocks)
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.unbolt()
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 << "<span class='notice'>Lockdown Lifted.</span>"
malf_cooldown = 1
spawn(30)
malf_cooldown = 0
minor_announce("Automatic system reboot complete. Have a secure day.","Network reset:")

/datum/AI_Module/large/disable_rcd
module_name = "RCD disable"
Expand All @@ -157,6 +145,27 @@
src << "<span class='warning>RCD-disabling pulse emitted.</span>"
else src << "<span class='notice'>Out of uses.</span>"

/datum/AI_Module/large/mecha_domination
module_name = "Viral Mech Domination"
mod_pick_name = "mechjack"
description = "Hack into a mech's onboard computer, shunting all processes into it and ejecting any occupants. Once uploaded to the mech, it is impossible to leave.\
Do not allow the mech to leave the station's vicinity or allow it to be destroyed."
cost = 30
one_time = 1

power_type = /mob/living/silicon/ai/proc/mech_takeover

/mob/living/silicon/ai/proc/mech_takeover()
set name = "Compile Mecha Virus"
set category = "Malfunction"
set desc = "Target a mech by clicking it. Click the appropriate command when ready."
if(stat)
return
can_dominate_mechs = 1 //Yep. This is all it does. Honk!
src << "Virus package compiled. Select a target mech at any time. <b>You must remain on the station at all times. Loss of signal will result in total system lockout.</b>"
verbs -= /mob/living/silicon/ai/proc/mech_takeover


/datum/AI_Module/large/break_fire_alarms
module_name = "Thermal Sensor Override"
mod_pick_name = "burnpigs"
Expand Down
40 changes: 28 additions & 12 deletions code/game/machinery/computer/aifixer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,8 @@
else
user << "<span class='warning'>The screws on [name]'s screen won't budge and it emits a warning beep.</span>"
return

if(istype(I, /obj/item/device/aicard))
var/obj/item/device/aicard/AIcard = I
if(stat & (NOPOWER|BROKEN))
if(occupier)
AIcard.transfer_ai("AIFIXER","AICARD",src,user)
overlays.Cut()
return
user << "This terminal isn't functioning right now, get it working!"
return
AIcard.transfer_ai("AIFIXER","AICARD",src,user)
else
..()
return

/obj/machinery/computer/aifixer/attack_hand(var/mob/user as mob)
if(..())
Expand Down Expand Up @@ -132,3 +120,31 @@
overlays += "ai-fixer-404"
else
overlays += "ai-fixer-empty"

/obj/machinery/computer/aifixer/transfer_ai(var/interaction, var/mob/user, var/mob/living/silicon/ai/AI, var/obj/item/device/aicard/card)
if(!..())
return
//Downloading AI from card to terminal.
if(interaction == AI_TRANS_FROM_CARD)
if(stat & (NOPOWER|BROKEN))
user << "[src] is offline and cannot take an AI at this time!"
return
AI.loc = src
occupier = AI
AI.control_disabled = 1
AI.radio_enabled = 0
AI << "You have been uploaded to a stationary terminal. Sadly, there is no remote access from here."
user << "<span class='boldnotice'>Transfer successful</span>: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed."
update_icon()

else //Uploading AI from terminal to card
if(occupier && !active)
occupier << "You have been downloaded to a mobile storage device. Still no remote access."
user << "<span class='boldnotice'>Transfer successful</span>: [occupier.name] ([rand(1000,9999)].exe) removed from host terminal and stored within local memory."
occupier.loc = card
occupier = null
update_icon()
else if (active)
user << "<span class='boldannounce'>ERROR</span>: Reconstruction in progress."
else if (!occupier)
user << "<span class='boldannounce'>ERROR</span>: Unable to locate artificial intelligence."
Loading

0 comments on commit c79963f

Please sign in to comment.