Files
Bubberstation/code/modules/pai/hud.dm
SkyratBot d314979746 [MIRROR] Fix PAI health scanning [MDB IGNORE] (#25673)
* 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

🆑 Melbert
fix: Fixes PAI health scan software
/🆑

---------

Co-authored-by: Zephyr <12817816+ZephyrTFA@ users.noreply.github.com>

* Fix PAI health scanning

---------

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: Zephyr <12817816+ZephyrTFA@ users.noreply.github.com>
2023-12-17 10:03:05 -05:00

274 lines
6.7 KiB
Plaintext

#define PAI_MISSING_SOFTWARE_MESSAGE span_warning("You must download the required software to use this.")
/atom/movable/screen/pai
icon = 'icons/hud/screen_pai.dmi'
var/required_software
/atom/movable/screen/pai/Click()
if(isobserver(usr) || usr.incapacitated())
return FALSE
var/mob/living/silicon/pai/user = usr
if(required_software && !user.installed_software.Find(required_software))
to_chat(user, PAI_MISSING_SOFTWARE_MESSAGE)
return FALSE
return TRUE
/atom/movable/screen/pai/software
name = "Software Interface"
icon_state = "pai"
/atom/movable/screen/pai/software/Click()
if(!..())
return
var/mob/living/silicon/pai/pAI = usr
pAI.ui_interact(pAI)
/atom/movable/screen/pai/shell
name = "Toggle Holoform"
icon_state = "pai_holoform"
/atom/movable/screen/pai/shell/Click()
if(!..())
return
var/mob/living/silicon/pai/pAI = usr
if(pAI.holoform)
pAI.fold_in(0)
else
pAI.fold_out()
/atom/movable/screen/pai/chassis
name = "Holochassis Appearance Composite"
icon_state = "pai_chassis"
/atom/movable/screen/pai/chassis/Click()
if(!..())
return
var/mob/living/silicon/pai/pAI = usr
pAI.choose_chassis()
/atom/movable/screen/pai/rest
name = "Rest"
icon_state = "pai_rest"
/atom/movable/screen/pai/rest/Click()
if(!..())
return
var/mob/living/silicon/pai/pAI = usr
pAI.toggle_resting()
/atom/movable/screen/pai/light
name = "Toggle Integrated Lights"
icon_state = "light"
/atom/movable/screen/pai/light/Click()
if(!..())
return
var/mob/living/silicon/pai/pAI = usr
pAI.toggle_integrated_light()
/atom/movable/screen/pai/newscaster
name = "pAI Newscaster"
icon_state = "newscaster"
required_software = "Newscaster"
/atom/movable/screen/pai/newscaster/Click()
if(!..())
return
var/mob/living/silicon/pai/pAI = usr
pAI.newscaster.ui_interact(usr)
/atom/movable/screen/pai/host_monitor
name = "Host Health Scan"
icon_state = "host_monitor"
required_software = "Host Scan"
/atom/movable/screen/pai/host_monitor/Click(location, control, params)
. = ..()
if(!.)
return
var/mob/living/silicon/pai/pAI = usr
var/list/modifiers = params2list(params)
if(LAZYACCESS(modifiers, LEFT_CLICK))
pAI.host_scan(PAI_SCAN_TARGET)
return TRUE
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"
required_software = "Crew Manifest"
/atom/movable/screen/pai/crew_manifest/Click()
if(!..())
return
var/mob/living/silicon/pai/pAI = usr
pAI.ai_roster()
/atom/movable/screen/pai/state_laws
name = "State Laws"
icon_state = "state_laws"
/atom/movable/screen/pai/state_laws/Click()
if(!..())
return
var/mob/living/silicon/pai/pAI = usr
pAI.checklaws()
/atom/movable/screen/pai/modpc
name = "Messenger"
icon_state = "pda_send"
required_software = "Digital Messenger"
var/mob/living/silicon/pai/pAI
/atom/movable/screen/pai/modpc/Click()
. = ..()
if(!.) // this works for some reason.
return
pAI.modularInterface?.interact(pAI)
/atom/movable/screen/pai/internal_gps
name = "Internal GPS"
icon_state = "internal_gps"
required_software = "Internal GPS"
/atom/movable/screen/pai/internal_gps/Click()
. = ..()
if(!.)
return
var/mob/living/silicon/pai/pAI = usr
if(!pAI.internal_gps)
pAI.internal_gps = new(pAI)
pAI.internal_gps.attack_self(pAI)
/atom/movable/screen/pai/image_take
name = "Take Image"
icon_state = "take_picture"
required_software = "Photography Module"
/atom/movable/screen/pai/image_take/Click()
. = ..()
if(!.)
return
var/mob/living/silicon/pai/pAI = usr
pAI.aicamera.toggle_camera_mode(usr)
/atom/movable/screen/pai/image_view
name = "View Images"
icon_state = "view_images"
required_software = "Photography Module"
/atom/movable/screen/pai/image_view/Click()
if(!..())
return
var/mob/living/silicon/pai/pAI = usr
pAI.aicamera.viewpictures(usr)
/atom/movable/screen/pai/radio
name = "radio"
icon = 'icons/hud/screen_cyborg.dmi'
icon_state = "radio"
/atom/movable/screen/pai/radio/Click()
if(!..())
return
var/mob/living/silicon/pai/pAI = usr
pAI.radio.interact(usr)
/datum/hud/pai/New(mob/living/silicon/pai/owner)
..()
var/atom/movable/screen/using
// Software menu
using = new /atom/movable/screen/pai/software(null, src)
using.screen_loc = ui_pai_software
static_inventory += using
// Holoform
using = new /atom/movable/screen/pai/shell(null, src)
using.screen_loc = ui_pai_shell
static_inventory += using
// Chassis Select Menu
using = new /atom/movable/screen/pai/chassis(null, src)
using.screen_loc = ui_pai_chassis
static_inventory += using
// Rest
using = new /atom/movable/screen/pai/rest(null, src)
using.screen_loc = ui_pai_rest
static_inventory += using
// Integrated Light
using = new /atom/movable/screen/pai/light(null, src)
using.screen_loc = ui_pai_light
static_inventory += using
// Newscaster
using = new /atom/movable/screen/pai/newscaster(null, src)
using.screen_loc = ui_pai_newscaster
static_inventory += using
// Language menu
using = new /atom/movable/screen/language_menu(null, src)
using.screen_loc = ui_pai_language_menu
static_inventory += using
// Navigation
using = new /atom/movable/screen/navigate(null, src)
using.screen_loc = ui_pai_navigate_menu
static_inventory += using
// Host Monitor
using = new /atom/movable/screen/pai/host_monitor(null, src)
using.screen_loc = ui_pai_host_monitor
static_inventory += using
// Crew Manifest
using = new /atom/movable/screen/pai/crew_manifest(null, src)
using.screen_loc = ui_pai_crew_manifest
static_inventory += using
// Laws
using = new /atom/movable/screen/pai/state_laws(null, src)
using.screen_loc = ui_pai_state_laws
static_inventory += using
// Modular Interface
using = new /atom/movable/screen/pai/modpc(null, src)
using.screen_loc = ui_pai_mod_int
static_inventory += using
var/atom/movable/screen/pai/modpc/tablet_button = using
tablet_button.pAI = mymob
// Internal GPS
using = new /atom/movable/screen/pai/internal_gps(null, src)
using.screen_loc = ui_pai_internal_gps
static_inventory += using
// Take image
using = new /atom/movable/screen/pai/image_take(null, src)
using.screen_loc = ui_pai_take_picture
static_inventory += using
// View images
using = new /atom/movable/screen/pai/image_view(null, src)
using.screen_loc = ui_pai_view_images
static_inventory += using
// Radio
using = new /atom/movable/screen/pai/radio(null, src)
using.screen_loc = ui_pai_radio
static_inventory += using
update_software_buttons()
/datum/hud/pai/proc/update_software_buttons()
var/mob/living/silicon/pai/owner = mymob
for(var/atom/movable/screen/pai/button in static_inventory)
if(button.required_software)
button.color = owner.installed_software.Find(button.required_software) ? null : "#808080"
#undef PAI_MISSING_SOFTWARE_MESSAGE