Updates AI mech control messages (#90565)

## About The Pull Request

Prettifies the messages displayed to the AI when taking over the mechs,
slightly altering the calculation steps.

<details>
<summary>Normal AI</summary>

No beacons installed:

![image](https://github.com/user-attachments/assets/6436f69a-ecbe-43c0-b9cc-219c75eefec2)

Tracking beacon only:

![image](https://github.com/user-attachments/assets/8fb2a3ad-33ed-47d6-a347-249cccd731f5)

AI Control beacon installed:

![image](https://github.com/user-attachments/assets/69194b84-78da-4dbc-a053-b47479ba9cdf)

AI Control beacon installed (cabin occupied):

![image](https://github.com/user-attachments/assets/a119e4f4-2657-430a-ae61-714cffcb0631)

Taking control:

![image](https://github.com/user-attachments/assets/29118bd9-b8c2-4e42-bcf8-8f5ce0b0b434)
</details>

<details>
<summary>Malf AI</summary>

No beacons installed:

![image](https://github.com/user-attachments/assets/002800bc-888e-4c27-afe1-ec0e3d56ccf5)

Any beacon installed:

![image](https://github.com/user-attachments/assets/7f212a8a-c620-48ee-a933-6501a3599f50)

Taking control:

![image](https://github.com/user-attachments/assets/84bb0b19-cad3-4bc2-ae63-6b126508230f)
</details>

## Why It's Good For The Game

It looked really nasty for something so epic

## Changelog

🆑
qol: Improved chat messages when controlling a mech as an AI
/🆑
This commit is contained in:
mcbalaam
2025-04-16 18:05:00 -07:00
committed by GitHub
parent c2f499c1b3
commit 484f482ec6
2 changed files with 54 additions and 32 deletions
@@ -1,29 +1,41 @@
/obj/vehicle/sealed/mecha/attack_ai(mob/living/silicon/ai/user)
if(!isAI(user))
return
//Allows the Malf to scan a mech's status and loadout, helping it to decide if it is a worthy chariot.
if(user.can_dominate_mechs)
examine(user) //Get diagnostic information!
for(var/obj/item/mecha_parts/mecha_tracking/B in trackers)
to_chat(user, span_danger("Warning: Tracking Beacon detected. Enter at your own risk. Beacon Data:"))
to_chat(user, "[B.get_mecha_info()]")
break
//Nothing like a big, red link to make the player feel powerful!
to_chat(user, "<a href='byond://?src=[REF(user)];ai_take_control=[REF(src)]'>[span_userdanger("ASSUME DIRECT CONTROL?")]</a><br>")
return
examine(user)
if(length(return_occupants()) >= max_occupants)
to_chat(user, span_warning("This exosuit has a pilot and cannot be controlled."))
return
var/can_control_mech = FALSE
for(var/obj/item/mecha_parts/mecha_tracking/ai_control/A in trackers)
can_control_mech = TRUE
to_chat(user, "[span_notice("[icon2html(src, user)] Status of [name]:")]\n[A.get_mecha_info()]")
var/obj/item/mecha_parts/mecha_tracking/data_tracker = null
var/obj/item/mecha_parts/mecha_tracking/ai_control/control_tracker = null
var/list/output = list()
for(var/obj/item/mecha_parts/mecha_tracking/A in trackers)
data_tracker = A
break
if(!can_control_mech)
to_chat(user, span_warning("You cannot control exosuits without AI control beacons installed."))
for(var/obj/item/mecha_parts/mecha_tracking/ai_control/B in trackers)
control_tracker = B
break
if(!data_tracker)
to_chat(user, span_warning("You cannot interface this exosuit without tracking beacons installed."))
return
to_chat(user, "<a href='byond://?src=[REF(user)];ai_take_control=[REF(src)]'>[span_boldnotice("Take control of exosuit?")]</a><br>")
if(data_tracker || user.can_dominate_mechs)
output += span_notice("[icon2html(src, user)] [name] Exosuit Status Report\n")
output += data_tracker.get_mecha_info()
if(user.can_dominate_mechs)
if(data_tracker)
output += span_danger("\nWarning: Tracking detected. Enter at your own risk.")
if(user.can_dominate_mechs)
output += "\n<a href='byond://?src=[REF(user)];ai_take_control=[REF(src)]'>[span_warning("\[INITIALIZE CONTROL OVERRIDE\]")]</a>"
else if(!control_tracker)
output += span_warning("\n\[UNABLE TO CONTROL - NO AI TRACKING BEACONS INSTALLED\]")
else if(length(return_occupants()) >= max_occupants)
output += span_warning("\n\[UNABLE TO CONTROL - OCCUPIED\]")
else
output += "\n<a href='byond://?src=[REF(user)];ai_take_control=[REF(src)]'>[span_boldnotice("\[TAKE DIRECT CONTROL\]")]</a>"
to_chat(user, boxed_message(jointext(output, "\n")))
/obj/vehicle/sealed/mecha/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/aicard/card)
. = ..()
@@ -105,6 +117,13 @@
AI.controlled_equipment = src
AI.remote_control = src
add_occupant(AI)
to_chat(AI, AI.can_dominate_mechs ? span_greenannounce("Takeover of [name] complete! You are now loaded onto the onboard computer. Do not attempt to leave the station sector!") :\
span_notice("You have been uploaded to a mech's onboard computer."))
to_chat(AI, "<span class='reallybig boldnotice'>Use Middle-Mouse or the action button in your HUD to toggle equipment safety. Clicks with safety enabled will pass AI commands.</span>")
var/list/output = list()
output += span_bold("You have been uploaded to the exosuits onboard computer.\n")
output += "• Press the middle mouse button or the action button on your HUD panel to toggle equipment safety."
output += "• Clicks with safety enabled will pass AI commands as usual."
if(AI.can_dominate_mechs)
output += "• [span_warning("Do not attempt to leave the station sector.")]"
to_chat(AI, boxed_message(jointext(output, "\n")))
@@ -93,18 +93,21 @@
if(!chassis)
return FALSE
var/list/output = list()
var/cell_charge = chassis.get_charge()
var/answer = {"<b>Name:</b> [chassis.name]<br>
<b>Integrity:</b> [round((chassis.get_integrity()/chassis.max_integrity * 100), 0.01)]%<br>
<b>Cell Charge:</b> [isnull(cell_charge) ? "Not Found":"[chassis.cell.percent()]%"]<br>
<b>Cabin Pressure:</b> [(chassis.mecha_flags & IS_ENCLOSED) ? "[round(chassis.return_pressure(), 0.01)] kPa" : "Not Sealed"]<br>
<b>Pilot:</b> [english_list(chassis.return_drivers(), nothing_text = "None")]<br>
<b>Location:</b> [get_area_name(chassis, TRUE) || "Unknown"]"}
output += "[span_bold("Name:")] [chassis.name]"
output += "[span_bold("Integrity:")] [round((chassis.get_integrity()/chassis.max_integrity * 100), 0.01)]%"
output += "[span_bold("Cell Charge:")] [isnull(cell_charge) ? "Not Found":"[chassis.cell.percent()]%"]"
output += "[span_bold("Cabin Pressure:")] [(chassis.mecha_flags & IS_ENCLOSED) ? "[round(chassis.return_pressure(), 0.01)] kPa" : "Not Sealed"]"
output += "[span_bold("Pilot:")] [english_list(chassis.return_drivers(), nothing_text = "None")]"
output += "[span_bold("Current Location:")] [get_area_name(chassis, TRUE) || "Unknown"]"
if(istype(chassis, /obj/vehicle/sealed/mecha/ripley))
var/obj/item/mecha_parts/mecha_equipment/ejector/cargo_holder = locate(/obj/item/mecha_parts/mecha_equipment/ejector) in chassis.equip_by_category[MECHA_UTILITY]
answer += "<br><b>Used Cargo Space:</b> [round((cargo_holder.contents.len / cargo_holder.cargo_capacity * 100), 0.01)]%"
output += "[span_bold("Used Cargo Space:")] [round((cargo_holder.contents.len / cargo_holder.cargo_capacity * 100), 0.01)]%"
return answer
return jointext(output, "\n")
/obj/item/mecha_parts/mecha_tracking/emp_act(severity)
. = ..()