Look up/down hotkeys and quality of life. (#20355)

- You can now look down open spaces by shift clicking/examining them
when they're next to you.
- You can now look up open spaces by clicking the HUD element at the top
right.
- Fixed inconsistencies with the camera getting stuck while looking up
or down. It should now be much more fluid.

---------

Co-authored-by: Matt Atlas <liermattia@gmail.com>
This commit is contained in:
Matt Atlas
2025-01-28 17:47:50 +00:00
committed by GitHub
co-authored by Matt Atlas
parent 7539d21711
commit 99ed2bf2f3
7 changed files with 94 additions and 22 deletions
+10 -11
View File
@@ -788,38 +788,36 @@
simulated = FALSE
anchored = TRUE
mouse_opacity = FALSE
/// The mob that this observer belongs to.
var/mob/living/owner
var/tile_shifted = FALSE
/// The physical open-space turf we are watching.
var/turf/target_turf
/atom/movable/z_observer/Initialize(mapload, var/mob/living/user, var/tile_shift = FALSE)
/atom/movable/z_observer/Initialize(mapload, var/mob/living/user, var/turf/given_turf)
. = ..()
owner = user
if(tile_shift)
var/turf/T = get_step(owner, owner.dir)
forceMove(T)
tile_shifted = TRUE
target_turf = given_turf
follow()
RegisterSignal(owner, COMSIG_MOVABLE_MOVED, PROC_REF(follow))
/atom/movable/z_observer/proc/follow()
/atom/movable/z_observer/z_up/follow()
forceMove(get_step(owner, UP))
forceMove(get_step(target_turf, UP))
if(isturf(src.loc))
var/turf/T = src.loc
if(T && TURF_IS_MIMICING(T))
if((T && TURF_IS_MIMICING(T)) && (get_turf(owner) == get_step(src, DOWN)))
return
owner.reset_view(null)
owner.z_eye = null
qdel(src)
/atom/movable/z_observer/z_down/follow()
var/turf/down_step = get_step(tile_shifted ? src : owner, DOWN)
var/turf/down_step = get_step(target_turf, DOWN)
/// If we move down more than 1 step, don't move down again.
if((GET_Z(owner) - down_step.z) < 2)
forceMove(down_step)
var/turf/T = get_turf(tile_shifted ? get_step(owner, owner.dir) : owner)
if(T && TURF_IS_MIMICING(T))
if(owner.Adjacent(target_turf) && (owner.dir == get_dir(owner, target_turf)))
return
owner.reset_view(null)
owner.z_eye = null
@@ -828,6 +826,7 @@
/atom/movable/z_observer/Destroy()
UnregisterSignal(owner, COMSIG_MOVABLE_MOVED)
owner = null
target_turf = null
. = ..()
/atom/movable/z_observer/can_fall()
+7 -1
View File
@@ -209,6 +209,13 @@
for(var/obj/O in src)
O.hide(0)
/turf/simulated/open/examine(mob/user, distance, is_adjacent, infix, suffix, show_extended)
. = ..()
if(isliving(user))
var/mob/living/looker = user
if(looker.Adjacent(src) && !looker.incapacitated())
looker.look_down_open_space(src)
/turf/simulated/open/get_examine_text(mob/user, distance, is_adjacent, infix, suffix)
. = ..()
if(distance <= 2)
@@ -259,7 +266,6 @@
return
/turf/simulated/open/attack_hand(var/mob/user)
if(ishuman(user) && user.a_intent == I_GRAB)
var/mob/living/carbon/human/H = user
var/turf/T = get_turf(H)