mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-09 16:14:13 +00:00
Wall peeping fixes (#36202)
* Fixes mobs not being able to keep their view inside wall peepholes * redundant * now makes this work properly again after removing redundant code * now this supports multiple peepers * adjacency check * don't check adjacency if manually stopping the look through * readable --------- Co-authored-by: SECBATON-GRIFFON <kanef9x@protonmail.com> Co-authored-by: SECBATON-GRIFFON <>
This commit is contained in:
@@ -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("<span class='notice'>[peeper] leans in and looks through \the [src].</span>", \
|
||||
"<span class='notice'>You lean in and look through \the [src].</span>")
|
||||
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("<span class='notice'>[user] leans in and looks through \the [src].</span>", \
|
||||
"<span class='notice'>You lean in and look through \the [src].</span>")
|
||||
user.register_event(/event/moved, src, nameof(src::reset_view()))
|
||||
src.add_fingerprint(user)
|
||||
return ..()
|
||||
|
||||
user.visible_message("<span class='notice'>[user] pushes \the [src].</span>", \
|
||||
@@ -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("<span class='notice'>[L] stops looking through \the [src].</span>", \
|
||||
"<span class='notice'>You stop looking through \the [src].</span>")
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user