Skip to content

Commit

Permalink
[MIRROR] Fix PAI health scanning [MDB IGNORE] (#25673) (#1159)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: MrMelbert <[email protected]>
Co-authored-by: Zephyr <12817816+ZephyrTFA@ users.noreply.github.com>
  • Loading branch information
4 people authored Dec 17, 2023
1 parent 23a5712 commit 6346e3f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 30 deletions.
1 change: 1 addition & 0 deletions code/modules/pai/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 0 additions & 5 deletions code/modules/pai/pai.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
47 changes: 22 additions & 25 deletions code/modules/pai/software.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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

/**
Expand Down

0 comments on commit 6346e3f

Please sign in to comment.