/obj/structure/AIcore density = 1 anchored = 0 name = "\improper AI core" icon = 'icons/mob/AI.dmi' icon_state = "0" var/state = 0 var/datum/ai_laws/laws = new() var/obj/item/weapon/circuitboard/circuit = null var/obj/item/device/mmi/brain = null /obj/structure/AIcore/New() ..() laws.set_laws_config() /obj/structure/AIcore/attackby(obj/item/P, mob/user, params) switch(state) if(0) if(istype(P, /obj/item/weapon/wrench)) playsound(loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You start wrenching the frame into place..." if(do_after(user, 20/P.toolspeed, target = src)) user << "You wrench the frame into place." anchored = 1 state = 1 return if(istype(P, /obj/item/weapon/weldingtool)) var/obj/item/weapon/weldingtool/WT = P if(!WT.isOn()) user << "The welder must be on for this task!" return playsound(loc, 'sound/items/Welder.ogg', 50, 1) user << "You start to deconstruct the frame..." if(do_after(user, 20/P.toolspeed, target = src)) if(!src || !WT.remove_fuel(0, user)) return user << "You deconstruct the frame." new /obj/item/stack/sheet/plasteel( loc, 4) qdel(src) return if(1) if(istype(P, /obj/item/weapon/wrench)) playsound(loc, 'sound/items/Ratchet.ogg', 50, 1) user << "You start to unfasten the frame..." if(do_after(user, 20/P.toolspeed, target = src)) user << "You unfasten the frame." anchored = 0 state = 0 return if(istype(P, /obj/item/weapon/circuitboard/aicore) && !circuit) if(!user.drop_item()) return playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1) user << "You place the circuit board inside the frame." icon_state = "1" circuit = P P.loc = src return if(istype(P, /obj/item/weapon/screwdriver) && circuit) playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You screw the circuit board into place." state = 2 icon_state = "2" return if(istype(P, /obj/item/weapon/crowbar) && circuit) playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) user << "You remove the circuit board." state = 1 icon_state = "0" circuit.loc = loc circuit = null return if(2) if(istype(P, /obj/item/weapon/screwdriver) && circuit) playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You unfasten the circuit board." state = 1 icon_state = "1" return if(istype(P, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/C = P if(C.get_amount() >= 5) playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1) user << "You start to add cables to the frame..." if(do_after(user, 20, target = src)) if (C.get_amount() >= 5 && state == 2) C.use(5) user << "You add cables to the frame." state = 3 icon_state = "3" else user << "You need five lengths of cable to wire the AI core!" return if(3) if(istype(P, /obj/item/weapon/wirecutters)) if (brain) user << "Get that brain out of there first!" else playsound(loc, 'sound/items/Wirecutter.ogg', 50, 1) user << "You remove the cables." state = 2 icon_state = "2" var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( loc ) A.amount = 5 return if(istype(P, /obj/item/stack/sheet/rglass)) var/obj/item/stack/sheet/rglass/G = P if(G.get_amount() >= 2) playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1) user << "You start to put in the glass panel..." if(do_after(user, 20, target = src)) if (G.get_amount() >= 2 && state == 3) G.use(2) user << "You put in the glass panel." state = 4 icon_state = "4" else user << "You need two sheets of reinforced glass to insert them into the AI core!" return if(istype(P, /obj/item/weapon/aiModule)) var/obj/item/weapon/aiModule/module = P module.install(laws, user) return if(istype(P, /obj/item/device/mmi)) var/obj/item/device/mmi/M = P if(!M.brainmob) user << "Sticking an empty MMI into the frame would sort of defeat the purpose!" return if(M.brainmob.stat == DEAD) user << "Sticking a dead brain into the frame would sort of defeat the purpose!" return if(!M.brainmob.client) user << "Sticking an inactive brain into the frame would sort of defeat the purpose." return if((config) && (!config.allow_ai)) user << "This MMI does not seem to fit!" return if(jobban_isbanned(M.brainmob, "AI")) user << "This MMI does not seem to fit!" return if(M.hacked || M.clockwork) user << "This MMI does not seem to fit!" return if(!M.brainmob.mind) user << "This MMI is mindless!" return if(!user.drop_item()) return ticker.mode.remove_antag_for_borging(M.brainmob.mind) M.loc = src brain = M user << "Added a brain." icon_state = "3b" return if(istype(P, /obj/item/weapon/crowbar) && brain) playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) user << "You remove the brain." brain.loc = loc brain = null icon_state = "3" return if(4) if(istype(P, /obj/item/weapon/crowbar)) playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) user << "You remove the glass panel." state = 3 if (brain) icon_state = "3b" else icon_state = "3" new /obj/item/stack/sheet/rglass(loc, 2) return if(istype(P, /obj/item/weapon/screwdriver)) playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You connect the monitor." new /mob/living/silicon/ai (loc, laws, brain) feedback_inc("cyborg_ais_created",1) qdel(src) return return ..() /obj/structure/AIcore/deactivated name = "inactive AI" icon = 'icons/mob/AI.dmi' icon_state = "ai-empty" anchored = 1 state = 20//So it doesn't interact based on the above. Not really necessary. /obj/structure/AIcore/deactivated/attackby(obj/item/A, mob/user, params) if(istype(A, /obj/item/device/aicard))//Is it? A.transfer_ai("INACTIVE","AICARD",src,user) else if(istype(A, /obj/item/weapon/wrench)) playsound(loc, 'sound/items/Ratchet.ogg', 50, 1) user.visible_message("[user] [anchored ? "fastens" : "unfastens"] [src].", \ "You start to [anchored ? "fasten [src] to" : "unfasten [src] from"] the floor...") switch(anchored) if(0) if(do_after(user, 20, target = src)) user << "You fasten the core into place." anchored = 1 if(1) if(do_after(user, 20, target = src)) user << "You unfasten the core." anchored = 0 else return ..() /* This is a good place for AI-related object verbs so I'm sticking it here. If adding stuff to this, don't forget that an AI need to cancel_camera() whenever it physically moves to a different location. That prevents a few funky behaviors. */ //The type of interaction, the player performing the operation, the AI itself, and the card object, if any. atom/proc/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/device/aicard/card) if(istype(card)) if(card.flush) user << "ERROR: AI flush is in progress, cannot execute transfer protocol." return 0 return 1 /obj/structure/AIcore/deactivated/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/device/aicard/card) if(!..()) return //Transferring a carded AI to a core. if(interaction == AI_TRANS_FROM_CARD) AI.control_disabled = 0 AI.radio_enabled = 1 AI.forceMove(loc) // to replace the terminal. AI << "You have been uploaded to a stationary terminal. Remote device connection restored." user << "Transfer successful: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed." card.AI = null qdel(src) else //If for some reason you use an empty card on an empty AI terminal. user << "There is no AI loaded on this terminal!" /obj/item/weapon/circuitboard/aicore name = "circuit board (AI core)" origin_tech = "programming=3"