From 6346e3fec7ce78f00e04e7f327b93b2668f09c35 Mon Sep 17 00:00:00 2001 From: Iajret Creature <122297233+Steals-The-PRs@users.noreply.github.com> Date: Sun, 17 Dec 2023 20:08:36 +0300 Subject: [PATCH] [MIRROR] Fix PAI health scanning [MDB IGNORE] (#25673) (#1159) * Fix PAI health scanning (#80373) ## About The Pull Request Fixes #80370 Rather than just using the global `healthscan` proc, PAIs created a health analyzer in their contents and called `attack` directly, despite the fact that all health analyzer `attack` does is call the global proc - [ ] I tested this pr ## Changelog :cl: Melbert fix: Fixes PAI health scan software /:cl: --------- * Fix PAI health scanning --------- Co-authored-by: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com> Co-authored-by: Zephyr <12817816+ZephyrTFA@ users.noreply.github.com> --- code/modules/pai/hud.dm | 1 + code/modules/pai/pai.dm | 5 ---- code/modules/pai/software.dm | 47 +++++++++++++++++------------------- 3 files changed, 23 insertions(+), 30 deletions(-) diff --git a/code/modules/pai/hud.dm b/code/modules/pai/hud.dm index 523d57d17b3..1a71b5235b6 100644 --- a/code/modules/pai/hud.dm +++ b/code/modules/pai/hud.dm @@ -94,6 +94,7 @@ if(LAZYACCESS(modifiers, RIGHT_CLICK)) pAI.host_scan(PAI_SCAN_MASTER) return TRUE + /atom/movable/screen/pai/crew_manifest name = "Crew Manifest" icon_state = "manifest" diff --git a/code/modules/pai/pai.dm b/code/modules/pai/pai.dm index da7684794bb..832718f0b17 100644 --- a/code/modules/pai/pai.dm +++ b/code/modules/pai/pai.dm @@ -71,8 +71,6 @@ // Onboard Items /// Atmospheric analyzer var/obj/item/analyzer/atmos_analyzer - /// Health analyzer - var/obj/item/healthanalyzer/host_scan /// GPS var/obj/item/gps/pai/internal_gps /// Music Synthesizer @@ -153,7 +151,6 @@ /mob/living/silicon/pai/Destroy() QDEL_NULL(atmos_analyzer) QDEL_NULL(hacking_cable) - QDEL_NULL(host_scan) QDEL_NULL(instrument) QDEL_NULL(internal_gps) QDEL_NULL(newscaster) @@ -185,8 +182,6 @@ atmos_analyzer = null else if(gone == aicamera) aicamera = null - else if(gone == host_scan) - host_scan = null else if(gone == internal_gps) internal_gps = null else if(gone == instrument) diff --git a/code/modules/pai/software.dm b/code/modules/pai/software.dm index 103056a5535..9876df5a264 100644 --- a/code/modules/pai/software.dm +++ b/code/modules/pai/software.dm @@ -38,7 +38,7 @@ return TRUE // Software related ui actions if(available_software[action] && !installed_software.Find(action)) - balloon_alert(usr, "software unavailable") + balloon_alert(ui.user, "software unavailable!") return FALSE switch(action) if("Atmospheric Sensor") @@ -116,8 +116,6 @@ atmos_analyzer = new(src) if("Digital Messenger") create_modularInterface() - if("Host Scan") - host_scan = new(src) if("Internal GPS") internal_gps = new(src) if("Music Synthesizer") @@ -193,28 +191,27 @@ * @returns {boolean} - TRUE if the scan was successful, FALSE otherwise. */ /mob/living/silicon/pai/proc/host_scan(mode) - if(isnull(mode)) - return FALSE - if(mode == PAI_SCAN_TARGET) - var/mob/living/target = get_holder() - if(!target || !isliving(target)) - balloon_alert(src, "not being carried") - return FALSE - host_scan.attack(target, src) - return TRUE - if(mode == PAI_SCAN_MASTER) - if(!master_ref) - balloon_alert(src, "no master detected") - return FALSE - var/mob/living/resolved_master = find_master() - if(!resolved_master) - balloon_alert(src, "cannot locate master") - return FALSE - if(!is_valid_z_level(get_turf(src), get_turf(resolved_master))) - balloon_alert(src, "master out of range") - return FALSE - host_scan.attack(resolved_master, src) - return TRUE + switch(mode) + if(PAI_SCAN_TARGET) + var/mob/living/target = get_holder() + if(!isliving(target)) + balloon_alert(src, "not being carried!") + return FALSE + healthscan(src, target) + return TRUE + + if(PAI_SCAN_MASTER) + var/mob/living/resolved_master = find_master() + if(isnull(resolved_master)) + balloon_alert(src, "no master detected!") + return FALSE + if(!is_valid_z_level(get_turf(src), get_turf(resolved_master))) + balloon_alert(src, "master out of range!") + return FALSE + healthscan(src, resolved_master) + return TRUE + + stack_trace("Invalid mode passed to host scan: [mode || "null"]") return FALSE /**