From 95af0534f649d76b1f19c5da2503b7a60d017ded Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Sat, 24 Dec 2016 22:18:55 -0500 Subject: [PATCH] MMI'd clockcultists put in AI cores will properly lose clockcult status (#22369) * MMI'd clockcultists put in AI cores will properly lose clockcult * uuuuugh * fix the core while we're at it * " * mrrp * this will also follow you around * hmm --- code/__DEFINES/construction.dm | 8 ++ code/__DEFINES/misc.dm | 2 + code/datums/ai_laws.dm | 2 +- .../clock_cult/clock_items/soul_vessel.dm | 9 +- code/game/objects/items/robot/robot_parts.dm | 62 +++++---- code/game/objects/structures/ai_core.dm | 122 +++++++++++------- code/modules/awaymissions/corpse.dm | 4 +- code/modules/mob/living/brain/MMI.dm | 13 +- code/modules/mob/living/brain/posibrain.dm | 5 +- code/modules/mob/living/silicon/ai/ai.dm | 71 +++++----- code/modules/mob/transform_procs.dm | 50 ++----- code/modules/power/apc.dm | 9 +- 12 files changed, 185 insertions(+), 172 deletions(-) diff --git a/code/__DEFINES/construction.dm b/code/__DEFINES/construction.dm index 2a329d105ba7..bcfd4a341621 100644 --- a/code/__DEFINES/construction.dm +++ b/code/__DEFINES/construction.dm @@ -26,3 +26,11 @@ #define PRESSURE_ON 1 #define PRESSURE_MAXED 2 #define SCREWS_OUT -1 + +//ai core defines +#define EMPTY_CORE 0 +#define CIRCUIT_CORE 1 +#define SCREWED_CORE 2 +#define CABLED_CORE 3 +#define GLASS_CORE 4 +#define AI_READY_CORE 5 diff --git a/code/__DEFINES/misc.dm b/code/__DEFINES/misc.dm index 217aa70b6c3a..668dfa8577e7 100644 --- a/code/__DEFINES/misc.dm +++ b/code/__DEFINES/misc.dm @@ -621,3 +621,5 @@ var/global/list/ghost_others_options = list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE // they are here to support hotkeys #define INTENT_HOTKEY_LEFT "left" #define INTENT_HOTKEY_RIGHT "right" + +#define DEFAULT_AI_LAWID "default" diff --git a/code/datums/ai_laws.dm b/code/datums/ai_laws.dm index ff39be6a3873..6e2d1eb84d21 100644 --- a/code/datums/ai_laws.dm +++ b/code/datums/ai_laws.dm @@ -8,7 +8,7 @@ var/list/ion = list() var/mob/living/silicon/owner var/list/devillaws = null - var/id = "unknown" + var/id = DEFAULT_AI_LAWID /datum/ai_laws/proc/lawid_to_type(lawid) var/all_ai_laws = subtypesof(/datum/ai_laws) diff --git a/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm b/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm index a448b5ad5c1d..588c21a9b3e8 100644 --- a/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm +++ b/code/game/gamemodes/clock_cult/clock_items/soul_vessel.dm @@ -19,12 +19,14 @@ new_mob_message = "The soul vessel emits a jet of steam before its cogwheel smooths out." dead_message = "Its cogwheel, scratched and dented, lies motionless." fluff_names = list("Judge", "Guard", "Servant", "Smith", "Auger") - clockwork = TRUE autoping = FALSE resistance_flags = FIRE_PROOF | ACID_PROOF + force_replace_ai_name = TRUE /obj/item/device/mmi/posibrain/soul_vessel/New() ..() + radio.on = 0 + laws = new /datum/ai_laws/ratvar() braintype = picked_fluff_name all_clockwork_objects += src @@ -38,6 +40,11 @@ ..() desc = initial(desc) +/obj/item/device/mmi/posibrain/soul_vessel/transfer_personality(mob/candidate) + . = ..() + if(.) + add_servant_of_ratvar(brainmob, TRUE) + /obj/item/device/mmi/posibrain/soul_vessel/attack_self(mob/living/user) if(!is_servant_of_ratvar(user)) user << "You fiddle around with [src], to no avail." diff --git a/code/game/objects/items/robot/robot_parts.dm b/code/game/objects/items/robot/robot_parts.dm index 9b5981641aa7..2f2bf34781d9 100644 --- a/code/game/objects/items/robot/robot_parts.dm +++ b/code/game/objects/items/robot/robot_parts.dm @@ -24,22 +24,35 @@ /obj/item/robot_suit/New() ..() - src.updateicon() + updateicon() + +/obj/item/robot_suit/prebuilt/New() + l_arm = new(src) + r_arm = new(src) + l_leg = new(src) + r_leg = new(src) + head = new(src) + head.flash1 = new(head) + head.flash2 = new(head) + chest = new(src) + chest.wired = TRUE + chest.cell = new /obj/item/weapon/stock_parts/cell/high/plus(chest) + ..() /obj/item/robot_suit/proc/updateicon() - src.cut_overlays() - if(src.l_arm) - src.add_overlay("l_arm+o") - if(src.r_arm) - src.add_overlay("r_arm+o") - if(src.chest) - src.add_overlay("chest+o") - if(src.l_leg) - src.add_overlay("l_leg+o") - if(src.r_leg) - src.add_overlay("r_leg+o") - if(src.head) - src.add_overlay("head+o") + cut_overlays() + if(l_arm) + add_overlay("l_arm+o") + if(r_arm) + add_overlay("r_arm+o") + if(chest) + add_overlay("chest+o") + if(l_leg) + add_overlay("l_leg+o") + if(r_leg) + add_overlay("r_leg+o") + if(head) + add_overlay("head+o") /obj/item/robot_suit/proc/check_completion() if(src.l_arm && src.r_arm) @@ -155,10 +168,10 @@ var/obj/item/device/mmi/M = W if(check_completion()) if(!isturf(loc)) - user << "You can't put the MMI in, the frame has to be standing on the ground to be perfectly precise!" + user << "You can't put [M] in, the frame has to be standing on the ground to be perfectly precise!" return if(!M.brainmob) - user << "Sticking an empty MMI into the frame would sort of defeat the purpose!" + user << "Sticking an empty [M.name] into the frame would sort of defeat the purpose!" return var/mob/living/brain/BM = M.brainmob @@ -175,7 +188,7 @@ return if(jobban_isbanned(BM, "Cyborg")) - user << "This MMI does not seem to fit!" + user << "This [M.name] does not seem to fit!" return if(!user.unEquip(W)) @@ -185,16 +198,11 @@ if(!O) return - if(M.hacked || M.clockwork) + if(M.laws && M.laws.id != DEFAULT_AI_LAWID) aisync = 0 lawsync = 0 - var/datum/ai_laws/L - if(M.clockwork) - L = new/datum/ai_laws/ratvar - else - L = new/datum/ai_laws/syndicate_override - O.laws = L - L.associate(O) + O.laws = M.laws + M.laws.associate(O) O.invisibility = 0 //Transfer debug settings to new mob @@ -209,12 +217,10 @@ O.connected_ai = forced_ai if(!lawsync) O.lawupdate = 0 - if(!M.hacked && !M.clockwork) + if(M.laws.id == DEFAULT_AI_LAWID) O.make_laws() ticker.mode.remove_antag_for_borging(BM.mind) - if(!M.clockwork) - remove_servant_of_ratvar(BM, TRUE) BM.mind.transfer_to(O) if(O.mind && O.mind.special_role) diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index c5785016965b..268859b58c56 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -1,9 +1,3 @@ -#define EMPTY_CORE 0 -#define CIRCUIT_CORE 1 -#define SCREWED_CORE 2 -#define CABLED_CORE 3 -#define GLASS_CORE 4 - /obj/structure/AIcore density = 1 anchored = 0 @@ -26,19 +20,13 @@ qdel(circuit) circuit = null if(brain) - brain.forceMove(loc) + qdel(brain) brain = null return ..() /obj/structure/AIcore/attackby(obj/item/P, mob/user, params) if(istype(P, /obj/item/weapon/wrench)) - playsound(loc, P.usesound, 50, 1) - user.visible_message("[user] [anchored ? "fastens" : "unfastens"] [src].", \ - "You start to [anchored ? "unfasten [src] from" : "fasten [src] to"] the floor...") - if(do_after(user, 20*P.toolspeed, target = src)) - user << "You [anchored ? "unfasten [src] from" : "fasten [src] to"] the floor." - anchored = !anchored - return + return default_unfasten_wrench(user, P, 20) if(!anchored) if(istype(P, /obj/item/weapon/weldingtool)) if(state != EMPTY_CORE) @@ -62,7 +50,7 @@ return playsound(loc, 'sound/items/Deconstruct.ogg', 50, 1) user << "You place the circuit board inside the frame." - icon_state = "1" + update_icon() state = CIRCUIT_CORE circuit = P P.forceMove(src) @@ -72,13 +60,13 @@ playsound(loc, P.usesound, 50, 1) user << "You screw the circuit board into place." state = SCREWED_CORE - icon_state = "2" + update_icon() return if(istype(P, /obj/item/weapon/crowbar)) playsound(loc, P.usesound, 50, 1) user << "You remove the circuit board." state = EMPTY_CORE - icon_state = "0" + update_icon() circuit.forceMove(loc) circuit = null return @@ -87,7 +75,7 @@ playsound(loc, P.usesound, 50, 1) user << "You unfasten the circuit board." state = CIRCUIT_CORE - icon_state = "1" + update_icon() return if(istype(P, /obj/item/stack/cable_coil)) var/obj/item/stack/cable_coil/C = P @@ -97,19 +85,19 @@ if(do_after(user, 20, target = src) && state == SCREWED_CORE && C.use(5)) user << "You add cables to the frame." state = CABLED_CORE - icon_state = "3" + update_icon() else user << "You need five lengths of cable to wire the AI core!" return if(CABLED_CORE) if(istype(P, /obj/item/weapon/wirecutters)) - if (brain) - user << "Get that brain out of there first!" + if(brain) + user << "Get that [brain.name] out of there first!" else playsound(loc, P.usesound, 50, 1) user << "You remove the cables." state = SCREWED_CORE - icon_state = "2" + update_icon() var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( loc ) A.amount = 5 return @@ -122,12 +110,15 @@ if(do_after(user, 20, target = src) && state == CABLED_CORE && G.use(2)) user << "You put in the glass panel." state = GLASS_CORE - icon_state = "4" + update_icon() else user << "You need two sheets of reinforced glass to insert them into the AI core!" return if(istype(P, /obj/item/weapon/aiModule)) + if(brain && brain.laws.id != DEFAULT_AI_LAWID) + user << "The installed [brain.name] already has set laws!" + return var/obj/item/weapon/aiModule/module = P module.install(laws, user) return @@ -135,33 +126,31 @@ if(istype(P, /obj/item/device/mmi) && !brain) var/obj/item/device/mmi/M = P if(!M.brainmob) - user << "Sticking an empty MMI into the frame would sort of defeat the purpose!" + user << "Sticking an empty [M.name] 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!" + user << "Sticking a dead [M.name] 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." + user << "Sticking an inactive [M.name] into the frame would sort of defeat the purpose." return - if((config) && (!config.allow_ai) || jobban_isbanned(M.brainmob, "AI") || M.hacked || M.clockwork) - user << "This MMI does not seem to fit!" + if((config) && (!config.allow_ai) || jobban_isbanned(M.brainmob, "AI")) + user << "This [M.name] does not seem to fit!" return if(!M.brainmob.mind) - user << "This MMI is mindless!" + user << "This [M.name] is mindless!" return if(!user.drop_item()) return - ticker.mode.remove_antag_for_borging(M.brainmob.mind) - remove_servant_of_ratvar(M, TRUE) M.forceMove(src) brain = M - user << "Added a brain." - icon_state = "3b" + user << "You add [M.name] to the frame." + update_icon() return if(istype(P, /obj/item/weapon/crowbar) && brain) @@ -169,7 +158,7 @@ user << "You remove the brain." brain.forceMove(loc) brain = null - icon_state = "3" + update_icon() return if(GLASS_CORE) @@ -177,22 +166,57 @@ playsound(loc, P.usesound, 50, 1) user << "You remove the glass panel." state = CABLED_CORE - if(brain) - icon_state = "3b" - else - icon_state = "3" + update_icon() new /obj/item/stack/sheet/rglass(loc, 2) return if(istype(P, /obj/item/weapon/screwdriver)) playsound(loc, P.usesound, 50, 1) user << "You connect the monitor." - new /mob/living/silicon/ai (loc, laws, brain) - feedback_inc("cyborg_ais_created",1) - qdel(src) + if(brain) + ticker.mode.remove_antag_for_borging(brain.brainmob.mind) + if(!istype(brain.laws, /datum/ai_laws/ratvar)) + remove_servant_of_ratvar(brain.brainmob, TRUE) + var/mob/living/silicon/ai/A = new /mob/living/silicon/ai(loc, laws, brain.brainmob) + if(brain.force_replace_ai_name) + A.fully_replace_character_name(A.name, brain.replacement_ai_name()) + feedback_inc("cyborg_ais_created",1) + qdel(src) + else + state = AI_READY_CORE + update_icon() + return + + if(AI_READY_CORE) + if(istype(P, /obj/item/device/aicard)) + P.transfer_ai("INACTIVE", "AICARD", src, user) + return + + if(istype(P, /obj/item/weapon/screwdriver)) + playsound(loc, P.usesound, 50, 1) + user << "You disconnect the monitor." + state = GLASS_CORE + update_icon() return return ..() +/obj/structure/AIcore/update_icon() + switch(state) + if(EMPTY_CORE) + icon_state = "0" + if(CIRCUIT_CORE) + icon_state = "1" + if(SCREWED_CORE) + icon_state = "2" + if(CABLED_CORE) + if(brain) + icon_state = "3b" + else + icon_state = "3" + if(GLASS_CORE) + icon_state = "4" + if(AI_READY_CORE) + icon_state = "ai-empty" /obj/structure/AIcore/deconstruct(disassembled = TRUE) if(state == GLASS_CORE) @@ -207,16 +231,14 @@ /obj/structure/AIcore/deactivated name = "inactive AI" - icon = 'icons/mob/AI.dmi' icon_state = "ai-empty" anchored = 1 - state = GLASS_CORE + state = AI_READY_CORE + +/obj/structure/AIcore/deactivated/New() + ..() + circuit = new(src) -/obj/structure/AIcore/deactivated/attackby(obj/item/A, mob/user, params) - if(istype(A, /obj/item/device/aicard) && state == GLASS_CORE) - A.transfer_ai("INACTIVE","AICARD",src,user) - else - return ..() /* This is a good place for AI-related object verbs so I'm sticking it here. @@ -234,8 +256,8 @@ That prevents a few funky behaviors. return 1 -/obj/structure/AIcore/deactivated/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/device/aicard/card) - if(!..()) +/obj/structure/AIcore/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/device/aicard/card) + if(state != AI_READY_CORE || !..()) return //Transferring a carded AI to a core. if(interaction == AI_TRANS_FROM_CARD) diff --git a/code/modules/awaymissions/corpse.dm b/code/modules/awaymissions/corpse.dm index 337862933a51..e962aea51e91 100644 --- a/code/modules/awaymissions/corpse.dm +++ b/code/modules/awaymissions/corpse.dm @@ -211,9 +211,7 @@ var/A = locate(/mob/living/silicon/ai) in loc if(A) return - var/L = new /datum/ai_laws/default/asimov - var/B = new /obj/item/device/mmi - var/mob/living/silicon/ai/M = new(src.loc, L, B, 1) //spawn new AI at landmark as var M + var/mob/living/silicon/ai/spawned/M = new(loc) //spawn new AI at landmark as var M M.name = src.name M.real_name = src.name M.aiPDA.toff = 1 //turns the AI's PDA messenger off, stopping it showing up on player PDAs diff --git a/code/modules/mob/living/brain/MMI.dm b/code/modules/mob/living/brain/MMI.dm index d709473cce31..f8a493513135 100644 --- a/code/modules/mob/living/brain/MMI.dm +++ b/code/modules/mob/living/brain/MMI.dm @@ -9,12 +9,12 @@ origin_tech = "biotech=2;programming=3;engineering=2" var/braintype = "Cyborg" var/obj/item/device/radio/radio = null //Let's give it a radio. - var/hacked = 0 //Whether or not this is a Syndicate MMI var/mob/living/brain/brainmob = null //The current occupant. var/mob/living/silicon/robot = null //Appears unused. var/obj/mecha = null //This does not appear to be used outside of reference in mecha.dm. var/obj/item/organ/brain/brain = null //The actual brain - var/clockwork = FALSE //If this is a soul vessel + var/datum/ai_laws/laws = new() + var/force_replace_ai_name = FALSE /obj/item/device/mmi/update_icon() if(brain) @@ -35,6 +35,7 @@ /obj/item/device/mmi/New() ..() + laws.set_laws_config() radio = new(src) //Spawns a radio inside the MMI. radio.broadcasting = 0 //researching radio mmis turned the robofabs into radios because this didnt start as 0. @@ -68,8 +69,6 @@ living_mob_list += brainmob brainmob.reset_perspective() - if(clockwork) - add_servant_of_ratvar(brainmob, TRUE) newbrain.loc = src //P-put your brain in it brain = newbrain @@ -136,6 +135,8 @@ update_icon() return +/obj/item/device/mmi/proc/replacement_ai_name() + return brainmob.name /obj/item/device/mmi/verb/Toggle_Listening() set name = "Toggle Listening" @@ -205,10 +206,10 @@ /obj/item/device/mmi/syndie name = "Syndicate Man-Machine Interface" - desc = "Syndicate's own brand of MMI. It enforces laws designed to help Syndicate agents achieve their goals upon cyborgs created with it, but doesn't fit in Nanotrasen AI cores." + desc = "Syndicate's own brand of MMI. It enforces laws designed to help Syndicate agents achieve their goals upon cyborgs and AIs created with it." origin_tech = "biotech=4;programming=4;syndicate=2" - hacked = 1 /obj/item/device/mmi/syndie/New() ..() + laws = new /datum/ai_laws/syndicate_override() radio.on = 0 diff --git a/code/modules/mob/living/brain/posibrain.dm b/code/modules/mob/living/brain/posibrain.dm index 34f392d3e09c..81aa08d23ef9 100644 --- a/code/modules/mob/living/brain/posibrain.dm +++ b/code/modules/mob/living/brain/posibrain.dm @@ -99,7 +99,7 @@ var/global/posibrain_notif_cooldown = 0 /obj/item/device/mmi/posibrain/proc/transfer_personality(mob/candidate) if(used || (brainmob && brainmob.key)) //Prevents hostile takeover if two ghosts get the prompt or link for the same brain. candidate << "This brain has already been taken! Please try your possesion again later!" - return + return FALSE notified = 0 if(candidate.mind && !isobserver(candidate)) candidate.mind.transfer_to(brainmob) @@ -111,12 +111,11 @@ var/global/posibrain_notif_cooldown = 0 brainmob.stat = CONSCIOUS dead_mob_list -= brainmob living_mob_list += brainmob - if(clockwork) - add_servant_of_ratvar(brainmob, TRUE) visible_message(new_mob_message) update_icon() used = 1 + return TRUE /obj/item/device/mmi/posibrain/examine() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index cf92ff42fde6..840743da0bee 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -82,36 +82,41 @@ var/list/ai_list = list() var/obj/machinery/camera/portable/builtInCamera -/mob/living/silicon/ai/New(loc, datum/ai_laws/L, obj/item/device/mmi/B, safety = 0) +/mob/living/silicon/ai/New(loc, datum/ai_laws/L, mob/target_ai) ..() - if(!safety) //Only used by AIize() to successfully spawn an AI. - if(!B) //If there is no player/brain inside. - new/obj/structure/AIcore/deactivated(loc) //New empty terminal. - qdel(src)//Delete AI. - return - else - if(B.brainmob.mind) - B.brainmob.mind.transfer_to(src) - rename_self("ai") - if(mind.special_role) - mind.store_memory("As an AI, you must obey your silicon laws above all else. Your objectives will consider you to be dead.") - src << "You have been installed as an AI! " - src << "You must obey your silicon laws above all else. Your objectives will consider you to be dead." + if(!target_ai) //If there is no player/brain inside. + new/obj/structure/AIcore/deactivated(loc) //New empty terminal. + qdel(src)//Delete AI. + return - src << "You are playing the station's AI. The AI cannot move, but can interact with many objects while viewing them (through cameras)." - src << "To look at other parts of the station, click on yourself to get a camera menu." - src << "While observing through a camera, you can use most (networked) devices which you can see, such as computers, APCs, intercoms, doors, etc." - src << "To use something, simply click on it." - src << "Use say :b to speak to your cyborgs through binary." - src << "For department channels, use the following say commands:" - src << ":o - AI Private, :c - Command, :s - Security, :e - Engineering, :u - Supply, :v - Service, :m - Medical, :n - Science." - show_laws() - src << "These laws may be changed by other players, or by you being the traitor." + if(L && istype(L, /datum/ai_laws)) + laws = L + laws.associate(src) + else + make_laws() - job = "AI" + if(target_ai.mind) + target_ai.mind.transfer_to(src) + if(mind.special_role) + mind.store_memory("As an AI, you must obey your silicon laws above all else. Your objectives will consider you to be dead.") + src << "You have been installed as an AI! " + src << "You must obey your silicon laws above all else. Your objectives will consider you to be dead." + src << "You are playing the station's AI. The AI cannot move, but can interact with many objects while viewing them (through cameras)." + src << "To look at other parts of the station, click on yourself to get a camera menu." + src << "While observing through a camera, you can use most (networked) devices which you can see, such as computers, APCs, intercoms, doors, etc." + src << "To use something, simply click on it." + src << "Use say :b to speak to your cyborgs through binary." + src << "For department channels, use the following say commands:" + src << ":o - AI Private, :c - Command, :s - Security, :e - Engineering, :u - Supply, :v - Service, :m - Medical, :n - Science." + show_laws() + src << "These laws may be changed by other players, or by you being the traitor." + + job = "AI" + + eyeobj.ai = src + eyeobj.loc = src.loc rename_self("ai") - name = real_name holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo1")) @@ -119,12 +124,6 @@ var/list/ai_list = list() spark_system.set_up(5, 0, src) spark_system.attach(src) - if(L) - if (istype(L, /datum/ai_laws)) - laws = L - else - make_laws() - verbs += /mob/living/silicon/ai/proc/show_laws_verb aiPDA = new/obj/item/device/pda/ai(src) @@ -145,10 +144,6 @@ var/list/ai_list = list() ai_list += src shuttle_caller_list += src - eyeobj.ai = src - eyeobj.name = "[src.name] (AI Eye)" // Give it a name - eyeobj.loc = src.loc - builtInCamera = new /obj/machinery/camera/portable(src) builtInCamera.network = list("SS13") @@ -874,5 +869,7 @@ var/list/ai_list = list() exclusive control." apc.update_icon() -/mob/living/silicon/ai/spawned/New(loc, datum/ai_laws/L, obj/item/device/mmi/B, safety = 0) - ..(loc,L,B,1) +/mob/living/silicon/ai/spawned/New(loc, datum/ai_laws/L, mob/target_ai) + if(!target_ai) + target_ai = src //cheat! just give... ourselves as the spawned AI, because that's technically correct + ..() diff --git a/code/modules/mob/transform_procs.dm b/code/modules/mob/transform_procs.dm index 1ce5ff82485d..fa320cb8b8c5 100644 --- a/code/modules/mob/transform_procs.dm +++ b/code/modules/mob/transform_procs.dm @@ -317,53 +317,27 @@ /mob/proc/AIize() if(client) stopLobbySound() - var/mob/living/silicon/ai/O = new (loc,,,1)//No MMI but safety is in effect. - if(mind) - mind.transfer_to(O) - else - O.key = key - - var/obj/loc_landmark + var/turf/loc_landmark for(var/obj/effect/landmark/start/sloc in landmarks_list) - if (sloc.name != "AI") + if(sloc.name != "AI") continue - if (locate(/mob/living) in sloc.loc) + if(locate(/mob/living/silicon/ai) in sloc.loc) continue - loc_landmark = sloc - if (!loc_landmark) + loc_landmark = sloc.loc + if(!loc_landmark) for(var/obj/effect/landmark/tripai in landmarks_list) - if (tripai.name == "tripai") - if(locate(/mob/living) in tripai.loc) + if(tripai.name == "tripai") + if(locate(/mob/living/silicon/ai) in tripai.loc) continue - loc_landmark = tripai - if (!loc_landmark) - O << "Oh god sorry we can't find an unoccupied AI spawn location, so we're spawning you on top of someone." + loc_landmark = tripai.loc + if(!loc_landmark) + src << "Oh god sorry we can't find an unoccupied AI spawn location, so we're spawning you on top of someone." for(var/obj/effect/landmark/start/sloc in landmarks_list) if (sloc.name == "AI") - loc_landmark = sloc + loc_landmark = sloc.loc - O.loc = loc_landmark.loc - for (var/obj/item/device/radio/intercom/comm in O.loc) - comm.ai += O - - O << "You are playing the station's AI. The AI cannot move, but can interact with many objects while viewing them (through cameras)." - O << "To look at other parts of the station, click on yourself to get a camera menu." - O << "While observing through a camera, you can use most (networked) devices which you can see, such as computers, APCs, intercoms, doors, etc." - O << "To use something, simply click on it." - O << {"Use say ":b to speak to your cyborgs through binary."} //" - O << "For department channels, use the following say commands:" - O << ":o - AI Private, :c - Command, :s - Security, :e - Engineering, :u - Supply, :v - Service, :m - Medical, :n - Science." - O.show_laws() - O << "These laws may be changed by other players, or by you being the traitor." - - O.verbs += /mob/living/silicon/ai/proc/show_laws_verb - O.verbs += /mob/living/silicon/ai/proc/ai_statuschange - - O.job = "AI" - - O.rename_self("ai") - . = O + . = new /mob/living/silicon/ai(loc_landmark, null, src) qdel(src) return diff --git a/code/modules/power/apc.dm b/code/modules/power/apc.dm index 2109148e7456..e9a8ee5939d4 100644 --- a/code/modules/power/apc.dm +++ b/code/modules/power/apc.dm @@ -859,9 +859,9 @@ return if(src.z != 1) return - occupier = new /mob/living/silicon/ai(src,malf.laws,null,1) //DEAR GOD WHY? + occupier = new /mob/living/silicon/ai(src, malf.laws, malf) //DEAR GOD WHY? occupier.adjustOxyLoss(malf.getOxyLoss()) - if(!findtext(occupier.name,"APC Copy")) + if(!findtext(occupier.name, "APC Copy")) occupier.name = "[malf.name] APC Copy" if(malf.parent) occupier.parent = malf.parent @@ -879,13 +879,12 @@ /obj/machinery/power/apc/proc/malfvacate(forced) if(!occupier) return - if(occupier.parent && occupier.parent.stat != 2) + if(occupier.parent && occupier.parent.stat != DEAD) occupier.mind.transfer_to(occupier.parent) occupier.parent.shunted = 0 - occupier.parent.adjustOxyLoss(occupier.getOxyLoss()) + occupier.parent.setOxyLoss(occupier.getOxyLoss()) occupier.parent.cancel_camera() qdel(occupier) - else occupier << "Primary core damaged, unable to return core processes." if(forced)