From 484f482ec66eafc70dc1bea3be3b2ce504bc3c40 Mon Sep 17 00:00:00 2001 From: mcbalaam <104003807+mcbalaam@users.noreply.github.com> Date: Thu, 17 Apr 2025 08:05:00 +0700 Subject: [PATCH] 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.
Normal AI 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)
Malf AI 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)
## Why It's Good For The Game It looked really nasty for something so epic ## Changelog :cl: qol: Improved chat messages when controlling a mech as an AI /:cl: --- .../vehicles/mecha/mecha_ai_interaction.dm | 67 ++++++++++++------- .../vehicles/mecha/mecha_control_console.dm | 19 +++--- 2 files changed, 54 insertions(+), 32 deletions(-) diff --git a/code/modules/vehicles/mecha/mecha_ai_interaction.dm b/code/modules/vehicles/mecha/mecha_ai_interaction.dm index 9457357840c..e518c8eaddc 100644 --- a/code/modules/vehicles/mecha/mecha_ai_interaction.dm +++ b/code/modules/vehicles/mecha/mecha_ai_interaction.dm @@ -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, "[span_userdanger("ASSUME DIRECT CONTROL?")]
") - 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, "[span_boldnotice("Take control of exosuit?")]
") + + 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[span_warning("\[INITIALIZE CONTROL OVERRIDE\]")]" + 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[span_boldnotice("\[TAKE DIRECT CONTROL\]")]" + + 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, "Use Middle-Mouse or the action button in your HUD to toggle equipment safety. Clicks with safety enabled will pass AI commands.") + + 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"))) diff --git a/code/modules/vehicles/mecha/mecha_control_console.dm b/code/modules/vehicles/mecha/mecha_control_console.dm index a9dbca0e07d..51797f28f23 100644 --- a/code/modules/vehicles/mecha/mecha_control_console.dm +++ b/code/modules/vehicles/mecha/mecha_control_console.dm @@ -93,18 +93,21 @@ if(!chassis) return FALSE + var/list/output = list() + var/cell_charge = chassis.get_charge() - var/answer = {"Name: [chassis.name]
- Integrity: [round((chassis.get_integrity()/chassis.max_integrity * 100), 0.01)]%
- Cell Charge: [isnull(cell_charge) ? "Not Found":"[chassis.cell.percent()]%"]
- Cabin Pressure: [(chassis.mecha_flags & IS_ENCLOSED) ? "[round(chassis.return_pressure(), 0.01)] kPa" : "Not Sealed"]
- Pilot: [english_list(chassis.return_drivers(), nothing_text = "None")]
- Location: [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 += "
Used Cargo Space: [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) . = ..()