diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index ab6faceaded..2f3aefaf544 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -25,7 +25,7 @@ explosion_block = 1 holomap_draw_override = HOLOMAP_DRAW_FULL - var/mob/living/peeper = null + var/list/mob/living/peepers /turf/simulated/wall/initialize() ..() @@ -167,12 +167,17 @@ return if(bullet_marks) - peeper = user - peeper.client.perspective = EYE_PERSPECTIVE - peeper.client.eye = src - peeper.visible_message("[peeper] leans in and looks through \the [src].", \ - "You lean in and look through \the [src].") - src.add_fingerprint(peeper) + if(user in peepers) + reset_view(user, FALSE) + else + if(!peepers) + peepers = list() + peepers += user + user.reset_view(src) + user.visible_message("[user] leans in and looks through \the [src].", \ + "You lean in and look through \the [src].") + user.register_event(/event/moved, src, nameof(src::reset_view())) + src.add_fingerprint(user) return ..() user.visible_message("[user] pushes \the [src].", \ @@ -181,11 +186,20 @@ src.add_fingerprint(user) return ..() -/turf/simulated/wall/proc/reset_view() - if(!peeper) - return - peeper.client.eye = peeper.client.mob - peeper.client.perspective = MOB_PERSPECTIVE +/turf/simulated/wall/proc/reset_view(atom/movable/mover, var/adjacency_check = TRUE) + var/list/mob/living/mobs2reset + if(isliving(mover) && (mover in peepers)) + if(adjacency_check && Adjacent(mover)) + return + mobs2reset = list(mover) + else if(!mover) + mobs2reset = peepers.Copy() + for(var/mob/living/L in mobs2reset) + L.reset_view() + L.visible_message("[L] stops looking through \the [src].", \ + "You stop looking through \the [src].") + L.unregister_event(/event/moved, src, nameof(src::reset_view())) + peepers -= L /turf/simulated/wall/proc/attack_rotting(mob/user as mob) if(istype(src, /turf/simulated/wall/r_wall)) //I wish I didn't have to do typechecks diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 43af01a45ab..1020f16b685 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -749,13 +749,6 @@ Thanks. if(T != loc) handle_hookchain(Dir) - if(client && client.eye && istype(client.eye,/turf/simulated/wall)) - var/turf/simulated/wall/W = client.eye - if (!Adjacent(W)) - client.eye = src - client.perspective = MOB_PERSPECTIVE - W.peeper = null - if(.) for(var/obj/item/weapon/gun/G in targeted_by) //Handle moving out of the gunner's view. var/mob/living/M = G.loc diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index 95afac7099f..841086e98c0 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -907,7 +907,7 @@ Use this proc preferably at the end of an equipment loadout //END HUMAN /mob/proc/reset_view(atom/A) if (client) - if (istype(A, /atom/movable)) + if (A) client.perspective = EYE_PERSPECTIVE client.eye = A else @@ -1843,6 +1843,8 @@ Use this proc preferably at the end of an equipment loadout return 1 if(istype(client_eye,/obj/item/projectile/rocket/nikita)) return 1 + if(istype(client_eye,/turf/simulated/wall) && Adjacent(client_eye)) + return 1 return 0 /mob/proc/html_mob_check()