From fccd45e2792800cbad237b8d1003383df458081a Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Fri, 7 Oct 2016 18:01:56 -0400 Subject: [PATCH 1/5] what is a define --- code/game/objects/structures/ai_core.dm | 96 +++++++++++------------- code/modules/mob/living/silicon/ai/ai.dm | 58 +++++++------- 2 files changed, 73 insertions(+), 81 deletions(-) diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index e1bcccebac1..be7b970ff3c 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -1,3 +1,10 @@ +#define UNANCHORED_CORE 0 +#define ANCHORED_CORE 1 +#define CIRCUIT_CORE 2 +#define SCREWED_CORE 3 +#define CABLED_CORE 4 +#define GLASS_CORE 5 + /obj/structure/AIcore density = 1 anchored = 0 @@ -15,14 +22,14 @@ /obj/structure/AIcore/attackby(obj/item/P, mob/user, params) switch(state) - if(0) + if(UNANCHORED_CORE) 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 + state = ANCHORED_CORE return if(istype(P, /obj/item/weapon/weldingtool)) var/obj/item/weapon/weldingtool/WT = P @@ -32,48 +39,51 @@ 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 + 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(ANCHORED_CORE) 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 + state = UNANCHORED_CORE return - if(istype(P, /obj/item/weapon/circuitboard/aicore) && !circuit) + if(istype(P, /obj/item/weapon/circuitboard/aicore)) 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" + state = CIRCUIT_CORE circuit = P - P.loc = src + P.forceMove(src) return - if(istype(P, /obj/item/weapon/screwdriver) && circuit) + if(CIRCUIT_CORE) + if(istype(P, /obj/item/weapon/screwdriver)) playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You screw the circuit board into place." - state = 2 + state = SCREWED_CORE icon_state = "2" return - if(istype(P, /obj/item/weapon/crowbar) && circuit) + if(istype(P, /obj/item/weapon/crowbar)) playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) user << "You remove the circuit board." - state = 1 + state = ANCHORED_CORE icon_state = "0" - circuit.loc = loc + circuit.forceMove(loc) circuit = null return - if(2) + if(SCREWED_CORE) if(istype(P, /obj/item/weapon/screwdriver) && circuit) playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) user << "You unfasten the circuit board." - state = 1 + state = CIRCUIT_CORE icon_state = "1" return if(istype(P, /obj/item/stack/cable_coil)) @@ -81,23 +91,22 @@ 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" + if(do_after(user, 20, target = src) && C.get_amount() >= 5 && state == SCREWED_CORE) + C.use(5) + user << "You add cables to the frame." + state = CABLED_CORE + icon_state = "3" else user << "You need five lengths of cable to wire the AI core!" return - if(3) + if(CABLED_CORE) 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 + state = SCREWED_CORE icon_state = "2" var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( loc ) A.amount = 5 @@ -108,12 +117,11 @@ 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" + if(do_after(user, 20, target = src) && G.get_amount() >= 2 && state == CABLED_CORE) + G.use(2) + user << "You put in the glass panel." + state = GLASS_CORE + icon_state = "4" else user << "You need two sheets of reinforced glass to insert them into the AI core!" return @@ -136,15 +144,7 @@ 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) + if((config) && (!config.allow_ai) || jobban_isbanned(M.brainmob, "AI") || M.hacked || M.clockwork) user << "This MMI does not seem to fit!" return @@ -171,12 +171,12 @@ icon_state = "3" return - if(4) + if(GLASS_CORE) 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) + state = CABLED_CORE + if(brain) icon_state = "3b" else icon_state = "3" @@ -197,7 +197,7 @@ 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. + state = GLASS_CORE /obj/structure/AIcore/deactivated/attackby(obj/item/A, mob/user, params) if(istype(A, /obj/item/device/aicard))//Is it? @@ -205,16 +205,10 @@ 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 + "You start to [anchored ? "unfasten [src] from" : "fasten [src] to"] the floor...") + if(do_after(user, 20, target = src)) + user << "You [anchored ? "unfasten [src] from" : "fasten [src] to"] the floor." + anchored = !anchored else return ..() diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm index d778554cc8d..df81f069e87 100644 --- a/code/modules/mob/living/silicon/ai/ai.dm +++ b/code/modules/mob/living/silicon/ai/ai.dm @@ -18,6 +18,7 @@ var/list/ai_list = list() icon_state = "ai" anchored = 1 density = 1 + canmove = 0 status_flags = CANSTUN|CANPUSH a_intent = "harm" //so we always get pushed instead of trying to swap force_compose = 1 //This ensures that the AI always composes it's own hear message. Needed for hrefs and job display. @@ -80,12 +81,34 @@ var/list/ai_list = list() /mob/living/silicon/ai/New(loc, datum/ai_laws/L, obj/item/device/mmi/B, safety = 0) ..() + 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." + + 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" + rename_self("ai") name = real_name - anchored = 1 - canmove = 0 - density = 1 - loc = loc holo_icon = getHologramIcon(icon('icons/mob/AI.dmi',"holo1")) @@ -116,31 +139,6 @@ var/list/ai_list = list() /mob/living/silicon/ai/proc/toggle_camera_light, /mob/living/silicon/ai/proc/botcall,\ /mob/living/silicon/ai/proc/control_integrated_radio, /mob/living/silicon/ai/proc/set_automatic_say_channel) - 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." - - 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" ai_list += src shuttle_caller_list += src @@ -333,7 +331,7 @@ var/list/ai_list = list() return //won't work if dead anchored = !anchored // Toggles the anchor - src << "[anchored ? "You are now anchored." : "You are now unanchored."]" + src << "You are now [anchored ? "" : "un"]anchored." // the message in the [] will change depending whether or not the AI is anchored /mob/living/silicon/ai/update_canmove() //If the AI dies, mobs won't go through it anymore From fe2d77b43f7293851ae85c52afde2787011175e8 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Fri, 7 Oct 2016 18:11:00 -0400 Subject: [PATCH 2/5] everything involved in this is awful --- code/game/objects/structures/ai_core.dm | 316 ++++++++++++------------ 1 file changed, 152 insertions(+), 164 deletions(-) diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index be7b970ff3c..42ee8013831 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -1,9 +1,8 @@ -#define UNANCHORED_CORE 0 -#define ANCHORED_CORE 1 -#define CIRCUIT_CORE 2 -#define SCREWED_CORE 3 -#define CABLED_CORE 4 -#define GLASS_CORE 5 +#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 @@ -21,175 +20,171 @@ laws.set_laws_config() /obj/structure/AIcore/attackby(obj/item/P, mob/user, params) - switch(state) - if(UNANCHORED_CORE) - 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 = ANCHORED_CORE + 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 ? "unfasten [src] from" : "fasten [src] to"] the floor...") + if(do_after(user, 20, target = src)) + user << "You [anchored ? "unfasten [src] from" : "fasten [src] to"] the floor." + anchored = !anchored + return + if(!anchored) + if(istype(P, /obj/item/weapon/weldingtool)) + if(state != EMPTY_CORE) + user << "The core must be empty to deconstruct it!" 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!" + 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 - 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)) + user << "You deconstruct the frame." + new /obj/item/stack/sheet/plasteel( loc, 4) + qdel(src) + return + else + switch(state) + if(EMPTY_CORE) + if(istype(P, /obj/item/weapon/circuitboard/aicore)) + if(!user.drop_item()) return - user << "You deconstruct the frame." - new /obj/item/stack/sheet/plasteel( loc, 4) - qdel(src) - return - if(ANCHORED_CORE) - 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 = UNANCHORED_CORE - return - if(istype(P, /obj/item/weapon/circuitboard/aicore)) - 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" - state = CIRCUIT_CORE - circuit = P - P.forceMove(src) - return - if(CIRCUIT_CORE) - if(istype(P, /obj/item/weapon/screwdriver)) - playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) - user << "You screw the circuit board into place." - state = SCREWED_CORE - icon_state = "2" - return - if(istype(P, /obj/item/weapon/crowbar)) - playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) - user << "You remove the circuit board." - state = ANCHORED_CORE - icon_state = "0" - circuit.forceMove(loc) - circuit = null - return - if(SCREWED_CORE) - if(istype(P, /obj/item/weapon/screwdriver) && circuit) - playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) - user << "You unfasten the circuit board." - state = CIRCUIT_CORE - 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) && C.get_amount() >= 5 && state == SCREWED_CORE) - C.use(5) - user << "You add cables to the frame." - state = CABLED_CORE - icon_state = "3" - 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!" - else - playsound(loc, 'sound/items/Wirecutter.ogg', 50, 1) - user << "You remove the cables." + user << "You place the circuit board inside the frame." + icon_state = "1" + state = CIRCUIT_CORE + circuit = P + P.forceMove(src) + return + if(CIRCUIT_CORE) + if(istype(P, /obj/item/weapon/screwdriver)) + playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) + user << "You screw the circuit board into place." state = SCREWED_CORE 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) && G.get_amount() >= 2 && state == CABLED_CORE) - G.use(2) - user << "You put in the glass panel." - state = GLASS_CORE - 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!" + if(istype(P, /obj/item/weapon/crowbar)) + playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) + user << "You remove the circuit board." + state = EMPTY_CORE + icon_state = "0" + circuit.forceMove(loc) + circuit = null + return + if(SCREWED_CORE) + if(istype(P, /obj/item/weapon/screwdriver) && circuit) + playsound(loc, 'sound/items/Screwdriver.ogg', 50, 1) + user << "You unfasten the circuit board." + state = CIRCUIT_CORE + 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) && C.get_amount() >= 5 && state == SCREWED_CORE) + C.use(5) + user << "You add cables to the frame." + state = CABLED_CORE + icon_state = "3" + 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!" + else + playsound(loc, 'sound/items/Wirecutter.ogg', 50, 1) + user << "You remove the cables." + state = SCREWED_CORE + icon_state = "2" + var/obj/item/stack/cable_coil/A = new /obj/item/stack/cable_coil( loc ) + A.amount = 5 return - if(!M.brainmob.client) - user << "Sticking an inactive brain into the frame would sort of defeat the purpose." + 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) && G.get_amount() >= 2 && state == CABLED_CORE) + G.use(2) + user << "You put in the glass panel." + state = GLASS_CORE + icon_state = "4" + else + user << "You need two sheets of reinforced glass to insert them into the AI core!" return - if((config) && (!config.allow_ai) || jobban_isbanned(M.brainmob, "AI") || M.hacked || M.clockwork) - user << "This MMI does not seem to fit!" + if(istype(P, /obj/item/weapon/aiModule)) + var/obj/item/weapon/aiModule/module = P + module.install(laws, user) return - if(!M.brainmob.mind) - user << "This MMI is mindless!" - 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(!user.drop_item()) - return + if(!M.brainmob.client) + user << "Sticking an inactive brain into the frame would sort of defeat the purpose." + return - ticker.mode.remove_antag_for_borging(M.brainmob.mind) - remove_servant_of_ratvar(M, TRUE) - M.loc = src - brain = M - user << "Added a brain." - icon_state = "3b" - return + if((config) && (!config.allow_ai) || jobban_isbanned(M.brainmob, "AI") || M.hacked || M.clockwork) + user << "This MMI does not seem to fit!" + 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(!M.brainmob.mind) + user << "This MMI is mindless!" + return - if(GLASS_CORE) - if(istype(P, /obj/item/weapon/crowbar)) - playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) - user << "You remove the glass panel." - state = CABLED_CORE - if(brain) + if(!user.drop_item()) + return + + ticker.mode.remove_antag_for_borging(M.brainmob.mind) + remove_servant_of_ratvar(M, TRUE) + M.loc = src + brain = M + user << "Added a brain." icon_state = "3b" - else - icon_state = "3" - new /obj/item/stack/sheet/rglass(loc, 2) - return + 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 + 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(GLASS_CORE) + if(istype(P, /obj/item/weapon/crowbar)) + playsound(loc, 'sound/items/Crowbar.ogg', 50, 1) + user << "You remove the glass panel." + state = CABLED_CORE + 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 @@ -200,15 +195,8 @@ state = GLASS_CORE /obj/structure/AIcore/deactivated/attackby(obj/item/A, mob/user, params) - if(istype(A, /obj/item/device/aicard))//Is it? + if(istype(A, /obj/item/device/aicard) && state == GLASS_CORE) 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 ? "unfasten [src] from" : "fasten [src] to"] the floor...") - if(do_after(user, 20, target = src)) - user << "You [anchored ? "unfasten [src] from" : "fasten [src] to"] the floor." - anchored = !anchored else return ..() From 8dbe5907e40ef67b59f452421191e65713310c73 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Fri, 7 Oct 2016 18:44:49 -0400 Subject: [PATCH 3/5] i'm a good coder this is fine --- code/game/objects/structures/ai_core.dm | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index 42ee8013831..369d5d3196b 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -20,11 +20,11 @@ laws.set_laws_config() /obj/structure/AIcore/attackby(obj/item/P, mob/user, params) - if(istype(A, /obj/item/weapon/wrench)) + if(istype(P, /obj/item/weapon/wrench)) playsound(loc, 'sound/items/Ratchet.ogg', 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, target = src)) + if(do_after(user, 20/P.toolspeed, target = src)) user << "You [anchored ? "unfasten [src] from" : "fasten [src] to"] the floor." anchored = !anchored return @@ -39,9 +39,7 @@ 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 + if(do_after(user, 20/P.toolspeed, target = src) && state != EMPTY_CORE && src && WT && WT.remove_fuel(0, user)) user << "You deconstruct the frame." new /obj/item/stack/sheet/plasteel( loc, 4) qdel(src) From 176a6fc4042aadddf836c26f58367941f7901cf7 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Sun, 9 Oct 2016 18:44:47 -0400 Subject: [PATCH 4/5] I'm not actually sure how long that bug existed? --- code/game/objects/structures/ai_core.dm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index 256f347c6cb..378aa3daf7b 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -95,8 +95,7 @@ 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) && C.get_amount() >= 5 && state == SCREWED_CORE) - C.use(5) + 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" @@ -121,8 +120,7 @@ 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) && G.get_amount() >= 2 && state == CABLED_CORE) - G.use(2) + 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" @@ -135,7 +133,7 @@ module.install(laws, user) return - if(istype(P, /obj/item/device/mmi)) + 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!" @@ -161,7 +159,7 @@ ticker.mode.remove_antag_for_borging(M.brainmob.mind) remove_servant_of_ratvar(M, TRUE) - M.loc = src + M.forceMove(src) brain = M user << "Added a brain." icon_state = "3b" From c96fa7e2dd57aa8576b04e9d35dc7c5c55f96172 Mon Sep 17 00:00:00 2001 From: Joan Lung Date: Tue, 11 Oct 2016 10:25:07 -0400 Subject: [PATCH 5/5] jump... --- code/game/objects/structures/ai_core.dm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm index 378aa3daf7b..946fbeaabf8 100644 --- a/code/game/objects/structures/ai_core.dm +++ b/code/game/objects/structures/ai_core.dm @@ -50,10 +50,9 @@ 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) && state != EMPTY_CORE && src && WT && WT.remove_fuel(0, user)) + if(do_after(user, 20/P.toolspeed, target = src) && src && state == EMPTY_CORE && WT && WT.remove_fuel(0, user)) user << "You deconstruct the frame." - new /obj/item/stack/sheet/plasteel( loc, 4) - qdel(src) + deconstruct(TRUE) return else switch(state) @@ -227,7 +226,7 @@ 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) +/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."