Files
Paradise/code/modules/mob/camera/eye/hologram_eye.dm
T
1ecbe34444 Fixes #28022: mecha/AI/hologram bugs from #25078 (#28026)
* Fixes #28022: mecha/AI/hologram bugs from #25078

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.

* Update code/_onclick/ai_onclick.dm

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

---------

Signed-off-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: Burzah <116982774+Burzah@users.noreply.github.com>
Co-authored-by: Luc <89928798+lewcc@users.noreply.github.com>
2025-01-26 13:59:15 +00:00

53 lines
1.9 KiB
Plaintext

/mob/camera/eye/hologram
name = "Inactive Hologram Eye"
ai_detector_visible = FALSE
acceleration = FALSE
var/obj/machinery/hologram/holopad/holopad
/mob/camera/eye/hologram/Initialize(mapload, owner_name, camera_origin, mob/living/user)
..()
holopad = camera_origin
set_loc(holopad)
/mob/camera/eye/hologram/rename_camera(new_name)
name = "Hologram ([new_name])"
/// Hologram movement copies the delays and diagonal delays of regular mob movement
/// for crew, and for AI unless fast holograms are enabled
/mob/camera/eye/hologram/relaymove(mob/user, direct)
var/mob/living/silicon/ai/ai = user
if(istype(ai) && ai.fast_holograms)
return ..()
var/turf/new_location = get_turf(get_step(src, direct))
if(new_location.z != z || get_dist(new_location, src) > 1)
return
var/base_delay = GLOB.configuration.movement.base_run_speed
var/diag_delay = base_delay * SQRT_2
var/delay = (direct & (direct - 1)) ? diag_delay : base_delay
user.client.move_delay = debounced_move(normalized_delay_speed(delay))
user.last_movement = world.time
set_loc(new_location)
/mob/camera/eye/hologram/proc/debounced_move(delay_speed)
var/old_move_delay = user.client.move_delay
if(old_move_delay + world.tick_lag > world.time)
return old_move_delay + delay_speed
else
return world.time + delay_speed
/mob/camera/eye/hologram/proc/normalized_delay_speed(delay_speed)
return TICKS2DS(-round(-(DS2TICKS(delay_speed))))
/// Requires the cameranet to be validated.
/mob/camera/eye/hologram/validate_active_cameranet()
..(TRUE)
/// Moves the associated hologram, and the previously controlled object (probably an AI eye), to the new location.
/mob/camera/eye/hologram/set_loc(T)
. = ..()
var/turf/new_location = get_turf(T)
holopad.move_hologram(user, new_location)
var/mob/camera/eye/previous_eye = user_previous_remote_control
if(istype(previous_eye))
previous_eye.set_loc(new_location)