diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm
index df553dd1924..bfc9dc7a257 100644
--- a/code/__HELPERS/unsorted.dm
+++ b/code/__HELPERS/unsorted.dm
@@ -259,7 +259,7 @@ Turf and target are separate in case you want to teleport some distance from a t
for(var/mob/living/silicon/ai/A in GLOB.alive_mob_list)
if(A.stat == DEAD)
continue
- if(A.control_disabled == 1)
+ if(A.control_disabled)
continue
if(check_mind)
if(!A.mind)
diff --git a/code/game/machinery/computer/aifixer.dm b/code/game/machinery/computer/aifixer.dm
index 26d36823ab6..0604b3ab3a6 100644
--- a/code/game/machinery/computer/aifixer.dm
+++ b/code/game/machinery/computer/aifixer.dm
@@ -129,8 +129,8 @@
return
AI.forceMove(src)
occupier = AI
- AI.control_disabled = 1
- AI.radio_enabled = 0
+ AI.control_disabled = TRUE
+ AI.radio_enabled = FALSE
to_chat(AI, "You have been uploaded to a stationary terminal. Sadly, there is no remote access from here.")
to_chat(user, "Transfer successful: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed.")
card.AI = null
diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm
index 9b3b5d5d8b1..c142269a81d 100644
--- a/code/game/mecha/mecha.dm
+++ b/code/game/mecha/mecha.dm
@@ -688,8 +688,8 @@
to_chat(user, "No AI detected in the [name] onboard computer.")
return
AI.ai_restore_power()//So the AI initially has power.
- AI.control_disabled = 1
- AI.radio_enabled = 0
+ AI.control_disabled = TRUE
+ AI.radio_enabled = FALSE
AI.disconnect_shell()
RemoveActions(AI, TRUE)
occupant = null
@@ -723,8 +723,8 @@
if(occupant || dna_lock) //Normal AIs cannot steal mechs!
to_chat(user, "Access denied. [name] is [occupant ? "currently occupied" : "secured with a DNA lock"].")
return
- AI.control_disabled = 0
- AI.radio_enabled = 1
+ AI.control_disabled = FALSE
+ AI.radio_enabled = TRUE
to_chat(user, "Transfer successful: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed.")
card.AI = null
ai_enter_mech(AI, interaction)
diff --git a/code/game/objects/structures/ai_core.dm b/code/game/objects/structures/ai_core.dm
index adbe338485f..fd71fb26aee 100644
--- a/code/game/objects/structures/ai_core.dm
+++ b/code/game/objects/structures/ai_core.dm
@@ -6,10 +6,10 @@
icon_state = "0"
desc = "The framework for an artificial intelligence core."
max_integrity = 500
- var/state = 0
+ var/state = EMPTY_CORE
var/datum/ai_laws/laws
- var/obj/item/circuitboard/circuit = null
- var/obj/item/mmi/brain = null
+ var/obj/item/circuitboard/aicore/circuit
+ var/obj/item/mmi/brain
var/can_deconstruct = TRUE
/obj/structure/AIcore/Initialize()
@@ -17,6 +17,17 @@
laws = new
laws.set_laws_config()
+/obj/structure/AIcore/handle_atom_del(atom/A)
+ if(A == circuit)
+ circuit = null
+ if((state != GLASS_CORE) && (state != AI_READY_CORE))
+ state = EMPTY_CORE
+ update_icon()
+ if(A == brain)
+ brain = null
+ . = ..()
+
+
/obj/structure/AIcore/Destroy()
if(circuit)
qdel(circuit)
@@ -307,16 +318,16 @@ That prevents a few funky behaviors.
if(istype(card))
if(card.flush)
to_chat(user, "ERROR: AI flush is in progress, cannot execute transfer protocol.")
- return 0
- return 1
+ return FALSE
+ return TRUE
/obj/structure/AIcore/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/aicard/card)
if(state != AI_READY_CORE || !..())
return
//Transferring a carded AI to a core.
if(interaction == AI_TRANS_FROM_CARD)
- AI.control_disabled = 0
- AI.radio_enabled = 1
+ AI.control_disabled = FALSE
+ AI.radio_enabled = TRUE
AI.forceMove(loc) // to replace the terminal.
to_chat(AI, "You have been uploaded to a stationary terminal. Remote device connection restored.")
to_chat(user, "Transfer successful: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed.")
diff --git a/code/modules/mob/living/silicon/ai/ai.dm b/code/modules/mob/living/silicon/ai/ai.dm
index 1bf46f6cc15..0688d8f99d4 100644
--- a/code/modules/mob/living/silicon/ai/ai.dm
+++ b/code/modules/mob/living/silicon/ai/ai.dm
@@ -424,14 +424,14 @@
to_chat(src, "Error: Your last call bot command is still processing, please wait for the bot to finish calculating a route.")
return
Bot = locate(href_list["callbot"]) in GLOB.alive_mob_list
- if(!Bot || Bot.remote_disabled || src.control_disabled)
+ if(!Bot || Bot.remote_disabled || control_disabled)
return //True if there is no bot found, the bot is manually emagged, or the AI is carded with wireless off.
waypoint_mode = 1
to_chat(src, "Set your waypoint by clicking on a valid location free of obstructions.")
return
if(href_list["interface"]) //Remotely connect to a bot!
Bot = locate(href_list["interface"]) in GLOB.alive_mob_list
- if(!Bot || Bot.remote_disabled || src.control_disabled)
+ if(!Bot || Bot.remote_disabled || control_disabled)
return
Bot.attack_ai(src)
if(href_list["botrefresh"]) //Refreshes the bot control panel.
@@ -810,8 +810,8 @@
ShutOffDoomsdayDevice()
new /obj/structure/AIcore/deactivated(loc)//Spawns a deactivated terminal at AI location.
ai_restore_power()//So the AI initially has power.
- control_disabled = 1//Can't control things remotely if you're stuck in a card!
- radio_enabled = 0 //No talking on the built-in radio for you either!
+ control_disabled = TRUE //Can't control things remotely if you're stuck in a card!
+ radio_enabled = FALSE //No talking on the built-in radio for you either!
forceMove(card)
card.AI = src
to_chat(src, "You have been downloaded to a mobile storage device. Remote device connection severed.")