diff --git a/code/game/mecha/equipment/tools/mining_tools.dm b/code/game/mecha/equipment/tools/mining_tools.dm
index 3ac2e54f7ed..61151f086f3 100644
--- a/code/game/mecha/equipment/tools/mining_tools.dm
+++ b/code/game/mecha/equipment/tools/mining_tools.dm
@@ -112,6 +112,7 @@
var/scanning = 0
/obj/item/mecha_parts/mecha_equipment/mining_scanner/New()
+ ..()
START_PROCESSING(SSobj, src)
/obj/item/mecha_parts/mecha_equipment/mining_scanner/attach(obj/mecha/M)
diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm
index 84010473806..9ec72374407 100644
--- a/code/game/mecha/mecha.dm
+++ b/code/game/mecha/mecha.dm
@@ -663,9 +663,11 @@
AI.ai_restore_power()//So the AI initially has power.
AI.control_disabled = 1
AI.radio_enabled = 0
+ AI.disconnect_shell()
+ RemoveActions(AI, TRUE)
+ occupant = null
AI.forceMove(card)
card.AI = AI
- occupant = null
AI.controlled_mech = null
AI.remote_control = null
icon_state = initial(icon_state)+"-open"
@@ -686,10 +688,12 @@
if(!AI)
to_chat(user, "There is no AI currently installed on this device.")
return
- else if(AI.stat || !AI.client)
+ if(AI.deployed_shell) //Recall AI if shelled so it can be checked for a client
+ AI.disconnect_shell()
+ if(AI.stat || !AI.client)
to_chat(user, "[AI.name] is currently unresponsive, and cannot be uploaded.")
return
- else if(occupant || dna_lock) //Normal AIs cannot steal mechs!
+ 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
@@ -715,7 +719,10 @@
to_chat(AI, "[AI.can_dominate_mechs ? "Takeover of [name] complete! You are now loaded onto the onboard computer. Do not attempt to leave the station sector!" \
: "You have been uploaded to a mech's onboard computer."]")
to_chat(AI, "Use Middle-Mouse to activate mech functions and equipment. Click normally for AI interactions.")
- GrantActions(AI, !AI.can_dominate_mechs)
+ if(interaction == AI_TRANS_FROM_CARD)
+ GrantActions(AI, FALSE) //No eject/return to core action for AI uploaded by card
+ else
+ GrantActions(AI, !AI.can_dominate_mechs)
//An actual AI (simple_animal mecha pilot) entering the mech
diff --git a/code/game/mecha/mecha_actions.dm b/code/game/mecha/mecha_actions.dm
index 3a3d979537c..65fa8b49b9e 100644
--- a/code/game/mecha/mecha_actions.dm
+++ b/code/game/mecha/mecha_actions.dm
@@ -25,7 +25,8 @@
var/obj/mecha/chassis
/datum/action/innate/mecha/Grant(mob/living/L, obj/mecha/M)
- chassis = M
+ if(M)
+ chassis = M
..()
/datum/action/innate/mecha/Destroy()
diff --git a/code/game/mecha/mecha_control_console.dm b/code/game/mecha/mecha_control_console.dm
index 97b3cd959b4..bbafd46dd24 100644
--- a/code/game/mecha/mecha_control_console.dm
+++ b/code/game/mecha/mecha_control_console.dm
@@ -75,13 +75,13 @@
return 0
var/obj/mecha/M = src.loc
var/cell_charge = M.get_charge()
- var/answer = {"Name: [M.name]
- Integrity: [M.obj_integrity/M.max_integrity*100]%
- Cell charge: [isnull(cell_charge)?"Not found":"[M.cell.percent()]%"]
- Airtank: [M.return_pressure()]kPa
- Pilot: [M.occupant||"None"]
- Location: [get_area(M)||"Unknown"]
- Active equipment: [M.selected||"None"]
"}
+ var/answer = {"Name: [M.name]
+Integrity: [M.obj_integrity/M.max_integrity*100]%
+Cell charge: [isnull(cell_charge)?"Not found":"[M.cell.percent()]%"]
+Airtank: [M.return_pressure()]kPa
+Pilot: [M.occupant||"None"]
+Location: [get_area(M)||"Unknown"]
+Active equipment: [M.selected||"None"] "}
if(istype(M, /obj/mecha/working/ripley))
var/obj/mecha/working/ripley/RM = M
answer += "Used cargo space: [RM.cargo.len/RM.cargo_capacity*100]%
"