Skip to content

Commit

Permalink
Fixes #28022: mecha/AI/hologram bugs from #25078
Browse files Browse the repository at this point in the history
PR #25078 introduced a few bugs related to AI eyes, mechs, and
holograms. This change fixes those bugs. Now, entering a mech with an
active hologram eye will first release that eye before granting control
of the mech. Double clicking on a turf as an AI while in a mech will no
longer unstick the camera from the mech. When exiting a mech, the AI
will now properly refocus on its core instead of on the spot that it
first entered the mech. AI holograms no longer receive normal audio
near their holopads, receiving only holopad-relayed speech now instead.
AIs will no longer be able to activate a holopad while occupying a mech.
  • Loading branch information
asciodev committed Jan 18, 2025
1 parent b1fa5f9 commit 59021cf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/_onclick/ai_onclick.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
return

if(control_disabled || stat) return
if(ismecha(loc)) return

if(ismob(A))
ai_actual_track(A, TRUE)
Expand Down
2 changes: 2 additions & 0 deletions code/game/machinery/hologram.dm
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ GLOBAL_LIST_EMPTY(holopads)
return
if(istype(robot))
interact(robot)
if(ismecha(ai.loc)) // AIs must exit mechs before activating holopads.
return
/*There are pretty much only three ways to interact here.
I don't need to check for client since they're clicking on an object.
This may change in the future but for now will suffice.*/
Expand Down
5 changes: 5 additions & 0 deletions code/game/mecha/mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,10 @@

//Hack and From Card interactions share some code, so leave that here for both to use.
/obj/mecha/proc/ai_enter_mech(mob/living/silicon/ai/AI, interaction)
var/mob/camera/eye/hologram/hologram_eye = AI.remote_control
if(istype(hologram_eye))
hologram_eye.release_control()
qdel(hologram_eye)
AI.aiRestorePowerRoutine = 0
AI.forceMove(src)
occupant = AI
Expand Down Expand Up @@ -1315,6 +1319,7 @@
RemoveActions(occupant, 1)
mob_container = AI
newloc = get_turf(AI.linked_core)
AI.eyeobj?.set_loc(newloc)
qdel(AI.linked_core)
else
return
Expand Down
1 change: 0 additions & 1 deletion code/modules/mob/camera/eye/hologram_eye.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name = "Inactive Hologram Eye"
ai_detector_visible = FALSE
acceleration = FALSE
relay_speech = TRUE
var/obj/machinery/hologram/holopad/holopad

/mob/camera/eye/hologram/Initialize(mapload, owner_name, camera_origin, mob/living/user)
Expand Down

0 comments on commit 59021cf

Please sign in to comment.