Files
Paradise/code/_onclick/hud/ai_hud.dm
T
93ed0f096d Refactors AI / camera eyes and slows holopad holograms to walk speed (#25078)
* Refactor/deduplicate camera eye code

Camera Eyes previously had duplicated logic across several files. This
change uncooks the spaghetti. Additionally, half-baked support for TG's
multicam feature has been removed, as it was not functional or in use.

* lets ff now

* Camera Eye refactor fixes and finishing touches

This change completes a refactor of AI eyes, which were previously used
by xenobio consoles, syndicate and abductor camera consoles, shuttle
docking computers, holograms, and, of course, the AI. Duplicated logic
has been extracted to an abstract base mob, /mob/camera/eye, from which
new types for each of the above now derive.

Functionality is largely the same, with only a few minor cosmetic
differences (i.e. camera eyes are now appropriately named given their
type and user), as well as a quality-of-life enhancement for holograms,
slowing their movement speed to base run speed to prevent users from
accidentally zooming out of calls.

* Camera eye refactor: Fix AI acceleration toggle

The acceleration toggle was broken in the camera eye refactor, as
previously the boolean was stored on the AI rather than its eye. This
change fixes that.

* Camera eye refactor: Fix syndicate cam visibility

With the camera eye refactor, the syndicate advanced camera consoles
lost the ability to view maintenance tunnels and other areas without
active cameras, seeing static in their place instead (as all other
cameras do). This change reinstates the original behavior.

* Camera eye refactor: Convert spaces to tabs

* Camera eye refactor: Fix CRLF

* Apply suggestions from code review

General minor code quality improvements suggested by GDNgit

Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>

* Apply suggestions from code review

Rename parameter names to avoid src accesses, remove an ambiguous and
unused mob_define and holopad range variable from a previous WIP, change
the for loop in /mob/camera/eye/relaymove to a for-to loop, and change
the chat message warning, sent when an AI Eye is created on an AI that
already has one, to a stack trace

* Adds toggle to AI commands for fast holograms

* Refactor ripped Hologram Eye relaymove

Previously, the relaymove proc for hologram eyes was redundant and
nearly impossible to read. It has been separated out into a few
different named procs, and has had its use of `spawn` removed.

* Remove unnecessary src access

* Fix bug involving shuttle placement outlines

The camera eye refactor that this commit is a part of introduced a bug
that prevented shuttle placement outlines from showing up on first use
of the shuttle console. This change fixes that bug.

* Unrevert some changes from #26306 lost in merge

* Remove erroneous free xray vision on advanced cams

* Autodoc camera acceleration vars

* Remove redundant null var initialization per code review

Co-authored-by: Drsmail <60036448+Drsmail@users.noreply.github.com>
Signed-off-by: asciodev <81930475+asciodev@users.noreply.github.com>

* Changed variables to camel_case, autodocs, cleanup

Changed a number of camera eye-related variables to camel_case style,
added appropriate autodoc comments, as per code review. Also removed an
unused cameranet function, modified the call signature of a cameranet
function to be more semantic, and changed a qdel-on-initialize in camera
eyes to return INITIALIZE_HINT_QDEL instead.

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>

* Remove stray qdel(src) per code review

Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
Signed-off-by: asciodev <81930475+asciodev@users.noreply.github.com>

---------

Signed-off-by: asciodev <81930475+asciodev@users.noreply.github.com>
Co-authored-by: GDN <96800819+GDNgit@users.noreply.github.com>
Co-authored-by: Drsmail <60036448+Drsmail@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
2025-01-17 18:22:43 +00:00

255 lines
5.9 KiB
Plaintext

/atom/movable/screen/ai
icon = 'icons/mob/screen_ai.dmi'
/atom/movable/screen/ai/Click()
if(isobserver(usr) || usr.incapacitated())
return TRUE
/atom/movable/screen/ai/aicore
name = "AI core"
icon_state = "ai_core"
/atom/movable/screen/ai/aicore/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.view_core()
/atom/movable/screen/ai/camera_list
name = "Show Camera List"
icon_state = "camera"
/atom/movable/screen/ai/camera_list/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
var/camera = tgui_input_list(AI, "Choose which camera you want to view", "Cameras", AI.get_camera_list())
AI.ai_camera_list(camera)
/atom/movable/screen/ai/camera_track
name = "Track With Camera"
icon_state = "track"
/atom/movable/screen/ai/camera_track/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
var/target_name = tgui_input_list(AI, "Choose a target you want to track", "Tracking", AI.trackable_mobs())
if(target_name)
AI.ai_camera_track(target_name)
/atom/movable/screen/ai/camera_light
name = "Toggle Camera Light"
icon_state = "camera_light"
/atom/movable/screen/ai/camera_light/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.toggle_camera_light()
/atom/movable/screen/ai/crew_monitor
name = "Crew Monitoring Console"
icon_state = "crew_monitor"
/atom/movable/screen/ai/crew_monitor/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.subsystem_crew_monitor()
/atom/movable/screen/ai/crew_manifest
name = "Crew Manifest"
icon_state = "manifest"
/atom/movable/screen/ai/crew_manifest/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.ai_roster()
/atom/movable/screen/ai/alerts
name = "Show Alerts"
icon_state = "alerts"
/atom/movable/screen/ai/alerts/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.ai_alerts()
/atom/movable/screen/ai/announcement
name = "Make Announcement"
icon_state = "announcement"
/atom/movable/screen/ai/announcement/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.announcement()
/atom/movable/screen/ai/call_shuttle
name = "Call Emergency Shuttle"
icon_state = "call_shuttle"
/atom/movable/screen/ai/call_shuttle/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.ai_call_shuttle()
/atom/movable/screen/ai/state_laws
name = "Law Manager"
icon_state = "state_laws"
/atom/movable/screen/ai/state_laws/Click()
if(..())
return
if(is_ai(usr))
var/mob/living/silicon/ai/AI = usr
AI.subsystem_law_manager()
/atom/movable/screen/ai/pda_msg_send
name = "PDA - Send Message"
icon_state = "pda_send"
/atom/movable/screen/ai/pda_msg_send/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.aiPDA.cmd_send_pdamesg()
/atom/movable/screen/ai/pda_msg_show
name = "PDA - Show Message Log"
icon_state = "pda_receive"
/atom/movable/screen/ai/pda_msg_show/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.aiPDA.cmd_show_message_log()
/atom/movable/screen/ai/image_take
name = "Take Image"
icon_state = "take_picture"
/atom/movable/screen/ai/image_take/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.aiCamera.toggle_camera_mode()
/atom/movable/screen/ai/image_view
name = "View Images"
icon_state = "view_images"
/atom/movable/screen/ai/image_view/Click()
if(..())
return
var/mob/living/silicon/ai/AI = usr
AI.aiCamera.viewpictures()
/atom/movable/screen/ai/sensors
name = "Toggle Sensor Augmentation"
icon_state = "ai_sensor"
/atom/movable/screen/ai/sensors/Click()
if(..())
return
if(is_ai(usr))
var/mob/living/silicon/ai/AI = usr
AI.sensor_mode()
else if(isrobot(usr))
var/mob/living/silicon/robot/borg = usr
borg.sensor_mode()
/datum/hud/ai/New(mob/owner)
..()
var/atom/movable/screen/using
using = new /atom/movable/screen/language_menu
using.screen_loc = ui_borg_lanugage_menu
static_inventory += using
//AI core
using = new /atom/movable/screen/ai/aicore()
using.screen_loc = ui_ai_core
static_inventory += using
//Camera list
using = new /atom/movable/screen/ai/camera_list()
using.screen_loc = ui_ai_camera_list
static_inventory += using
//Track
using = new /atom/movable/screen/ai/camera_track()
using.screen_loc = ui_ai_track_with_camera
static_inventory += using
//Camera light
using = new /atom/movable/screen/ai/camera_light()
using.screen_loc = ui_ai_camera_light
static_inventory += using
//Crew Monitorting
using = new /atom/movable/screen/ai/crew_monitor()
using.screen_loc = ui_ai_crew_monitor
static_inventory += using
//Crew Manifest
using = new /atom/movable/screen/ai/crew_manifest()
using.screen_loc = ui_ai_crew_manifest
static_inventory += using
//Alerts
using = new /atom/movable/screen/ai/alerts()
using.screen_loc = ui_ai_alerts
static_inventory += using
//Announcement
using = new /atom/movable/screen/ai/announcement()
using.screen_loc = ui_ai_announcement
static_inventory += using
//Shuttle
using = new /atom/movable/screen/ai/call_shuttle()
using.screen_loc = ui_ai_shuttle
static_inventory += using
//Laws
using = new /atom/movable/screen/ai/state_laws()
using.screen_loc = ui_ai_state_laws
static_inventory += using
//PDA message
using = new /atom/movable/screen/ai/pda_msg_send()
using.screen_loc = ui_ai_pda_send
static_inventory += using
//PDA log
using = new /atom/movable/screen/ai/pda_msg_show()
using.screen_loc = ui_ai_pda_log
static_inventory += using
//Take image
using = new /atom/movable/screen/ai/image_take()
using.screen_loc = ui_ai_take_picture
static_inventory += using
//View images
using = new /atom/movable/screen/ai/image_view()
using.screen_loc = ui_ai_view_images
static_inventory += using
//Medical/Security sensors
using = new /atom/movable/screen/ai/sensors()
using.screen_loc = ui_ai_sensor
static_inventory += using
//Intent
using = new /atom/movable/screen/act_intent/robot/ai()
using.icon_state = mymob.a_intent
static_inventory += using
action_intent = using