From cc12a2f08b55a3cd7fe78297a9d00a24a9726c65 Mon Sep 17 00:00:00 2001 From: "noisomehollow@lycos.com" Date: Mon, 9 May 2011 20:50:39 +0000 Subject: [PATCH] Added a transfer_ai() proc to easily transfer AIs between objects, provided the mobile object has a flush variable. Probably fixed AI-ninja suit transfer. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@1559 316c924e-a436-60f5-8080-3fe189b3f50e --- code/defines/obj/clothing/suit.dm | 5 +- code/game/gamemodes/extra/ninja_equipment.dm | 99 +++------ code/game/gamemodes/extra/space_ninja.dm | 29 +-- code/game/machinery/computer/AIcore.dm | 209 +++++++++++++++++-- code/game/machinery/computer/aifixer.dm | 43 +--- code/game/objects/devices/aicard.dm | 25 +-- code/modules/mob/living/silicon/ai/ai.dm | 2 +- 7 files changed, 249 insertions(+), 163 deletions(-) diff --git a/code/defines/obj/clothing/suit.dm b/code/defines/obj/clothing/suit.dm index 6d7db7e2205..78caeba741b 100644 --- a/code/defines/obj/clothing/suit.dm +++ b/code/defines/obj/clothing/suit.dm @@ -371,11 +371,12 @@ item_state = "s-ninja_suit" allowed = list(/obj/item/weapon/gun,/obj/item/weapon/ammo,/obj/item/weapon/baton,/obj/item/weapon/handcuffs,/obj/item/weapon/tank/emergency_oxygen) radiation_protection = 0.75 - var/affecting = null + var/mob/living/carbon/affecting = null var/active = 0//Stealth off. var/kamikaze = 0//Kamikaze on or off. var/obj/item/weapon/cell/cell//Starts out with a high-capacity cell using new proc. - var/obj/item/device/aicard/aicard//For the build in AI card. + var/mob/living/silicon/AI = null//If there is an AI inside the suit. Paths to target. + var/flush = 0//If an AI purge is in progress. var/control = 1//If in control of the suit. var/initialize = 0//Suit starts off. var/spideros = 0//Mode of SpiderOS. This can change so I won't bother listing the modes here (0 is hub). Check ninja_equipment.dm for how it all works. diff --git a/code/game/gamemodes/extra/ninja_equipment.dm b/code/game/gamemodes/extra/ninja_equipment.dm index e9c9e8d9bd2..39cdbe0b3b4 100644 --- a/code/game/gamemodes/extra/ninja_equipment.dm +++ b/code/game/gamemodes/extra/ninja_equipment.dm @@ -24,57 +24,25 @@ ________________________________________________________________________________ reagents.add_reagent("radium", 120)//AI can inject radium directly. There should be at least 60 units left over after adrenaline boosting. reagents.add_reagent("nutriment", 80) cell = new/obj/item/weapon/cell/high//The suit should *always* have a battery because so many things rely on it. - aicard = new/obj/item/device/aicard cell.charge = 9000 /obj/item/clothing/suit/space/space_ninja/Del() - if(aicard.contents.len)//If there are AIs present when the ninja kicks the bucket. - killai(aicard) + if(AI)//If there are AIs present when the ninja kicks the bucket. + killai(AI) ..() return -/obj/item/clothing/suit/space/space_ninja/proc/killai(var/obj/item/device/aicard/A as obj) - for(var/mob/living/silicon/ai/AI in A)//In case intelicards are changes to house more than one AI. - AI << "\red Self-destruct protocol dete-- *bzzzzz*" - AI.death()//Kill - AI.ghostize()//Turn into ghost - del(AI) +/obj/item/clothing/suit/space/space_ninja/proc/killai(var/mob/living/silicon/ai/A as mob) + A << "\red Self-destruct protocol dete-- *bzzzzz*" + A.death()//Kill + A.ghostize()//Turn into ghost + del(AI) return /obj/item/clothing/suit/space/space_ninja/attackby(var/obj/item/device/aicard/aicard_temp as obj, U as mob)//When the suit is attacked by an AI card. if(istype(aicard_temp, /obj/item/device/aicard))//If it's actually an AI card. if(control) - if(initialize&&U==affecting)//If the suit is initialized and the actor is the user. - - var/mob/living/silicon/ai/A_T = locate() in aicard_temp//Determine if there is an AI on target card. Saves time when checking later. - var/mob/living/silicon/ai/A = locate() in aicard//Deterine if there is an AI on the installed card. - - if(A)//If the installed AI card is not empty. - if(A_T)//If there is an AI on the target card. - U << "\red ERROR: \black [A_T.name] already installed. Remove [A_T.name] to install a new one." - else - if(aicard.flush)//If the installed card is purging. - U << "\red ERROR: \black [A.name] is purging. Please wait until the process is finished." - else - A.loc = aicard_temp//Throw them into the target card. Since they are already on a card, transfer is easy. - aicard_temp.name = "inteliCard - [A.name]" - aicard_temp.icon_state = "aicard-full" - A << "You have been uploaded to a mobile storage device." - U << "\blue SUCCESS: \black [A.name] ([rand(1000,9999)].exe) removed from host and stored within local memory." - - else//If the installed AI card is empty. - if(A_T&&A_T.stat!=2)//If there is an AI on the target card and it's not DED. - if(aicard_temp.flush)//If the target card is purging. - U << "\red ERROR: \black [A_T.name] is wiping. You cannot install this AI until it is repaired." - else - A_T.loc = aicard//Throw them into the installed card. - aicard_temp.icon_state = "aicard" - aicard_temp.name = "inteliCard" - aicard_temp.overlays = null - A_T << "You have been uploaded to a mobile storage device." - U << "\blue SUCCESS: \black [A_T.name] ([rand(1000,9999)].exe) removed from local memory and installed to host." - else if(A_T.stat==2)//If the target AI is dead. Else just got to return since nothing would happen if both are empty. - U << "\red ERROR: \black [A_T.name] is inactive. Unable to install." + aicard_temp.transfer_ai("NINJASUIT","AICARD",src,U) else U << "\red ERROR: \black Remote access channel disabled." return @@ -262,8 +230,8 @@ ________________________________________________________________________________ U << "\red #2#" spawn(30) U << "\red #1#: G00DBYE" - if(aicard.contents.len) - killai(aicard) + if(AI) + killai(AI) U.gib() return U << "\blue Disconnecting neural-net interface...\greenSuccess\blue." @@ -326,7 +294,7 @@ ________________________________________________________________________________ dat += "

Available Functions:

" dat += "