mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 10:21:11 +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
|
explosion_block = 1
|
||||||
|
|
||||||
holomap_draw_override = HOLOMAP_DRAW_FULL
|
holomap_draw_override = HOLOMAP_DRAW_FULL
|
||||||
var/mob/living/peeper = null
|
var/list/mob/living/peepers
|
||||||
|
|
||||||
/turf/simulated/wall/initialize()
|
/turf/simulated/wall/initialize()
|
||||||
..()
|
..()
|
||||||
@@ -167,12 +167,17 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
if(bullet_marks)
|
if(bullet_marks)
|
||||||
peeper = user
|
if(user in peepers)
|
||||||
peeper.client.perspective = EYE_PERSPECTIVE
|
reset_view(user, FALSE)
|
||||||
peeper.client.eye = src
|
else
|
||||||
peeper.visible_message("<span class='notice'>[peeper] leans in and looks through \the [src].</span>", \
|
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>")
|
"<span class='notice'>You lean in and look through \the [src].</span>")
|
||||||
src.add_fingerprint(peeper)
|
user.register_event(/event/moved, src, nameof(src::reset_view()))
|
||||||
|
src.add_fingerprint(user)
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
user.visible_message("<span class='notice'>[user] pushes \the [src].</span>", \
|
user.visible_message("<span class='notice'>[user] pushes \the [src].</span>", \
|
||||||
@@ -181,11 +186,20 @@
|
|||||||
src.add_fingerprint(user)
|
src.add_fingerprint(user)
|
||||||
return ..()
|
return ..()
|
||||||
|
|
||||||
/turf/simulated/wall/proc/reset_view()
|
/turf/simulated/wall/proc/reset_view(atom/movable/mover, var/adjacency_check = TRUE)
|
||||||
if(!peeper)
|
var/list/mob/living/mobs2reset
|
||||||
|
if(isliving(mover) && (mover in peepers))
|
||||||
|
if(adjacency_check && Adjacent(mover))
|
||||||
return
|
return
|
||||||
peeper.client.eye = peeper.client.mob
|
mobs2reset = list(mover)
|
||||||
peeper.client.perspective = MOB_PERSPECTIVE
|
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)
|
/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
|
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)
|
if(T != loc)
|
||||||
handle_hookchain(Dir)
|
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(.)
|
if(.)
|
||||||
for(var/obj/item/weapon/gun/G in targeted_by) //Handle moving out of the gunner's view.
|
for(var/obj/item/weapon/gun/G in targeted_by) //Handle moving out of the gunner's view.
|
||||||
var/mob/living/M = G.loc
|
var/mob/living/M = G.loc
|
||||||
|
|||||||
@@ -907,7 +907,7 @@ Use this proc preferably at the end of an equipment loadout
|
|||||||
//END HUMAN
|
//END HUMAN
|
||||||
/mob/proc/reset_view(atom/A)
|
/mob/proc/reset_view(atom/A)
|
||||||
if (client)
|
if (client)
|
||||||
if (istype(A, /atom/movable))
|
if (A)
|
||||||
client.perspective = EYE_PERSPECTIVE
|
client.perspective = EYE_PERSPECTIVE
|
||||||
client.eye = A
|
client.eye = A
|
||||||
else
|
else
|
||||||
@@ -1843,6 +1843,8 @@ Use this proc preferably at the end of an equipment loadout
|
|||||||
return 1
|
return 1
|
||||||
if(istype(client_eye,/obj/item/projectile/rocket/nikita))
|
if(istype(client_eye,/obj/item/projectile/rocket/nikita))
|
||||||
return 1
|
return 1
|
||||||
|
if(istype(client_eye,/turf/simulated/wall) && Adjacent(client_eye))
|
||||||
|
return 1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
/mob/proc/html_mob_check()
|
/mob/proc/html_mob_check()
|
||||||
|
|||||||
Reference in New Issue
Block a user