From d4e29ae4ee8ab4f0d49fb668f8a1686429ca0ed5 Mon Sep 17 00:00:00 2001
From: mikomyazaki <47489928+mikomyazaki@users.noreply.github.com>
Date: Wed, 16 Feb 2022 18:46:53 +0000
Subject: [PATCH] Pointing decals now delete themselves properly (#13198)
---
code/modules/mob/living/living.dm | 23 +++++----------------
code/modules/mob/mob.dm | 33 ++++++++++++++++---------------
html/changelogs/pointing_bug.yml | 6 ++++++
3 files changed, 28 insertions(+), 34 deletions(-)
create mode 100644 html/changelogs/pointing_bug.yml
diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm
index 27ecece7d59..2b411ed85b6 100644
--- a/code/modules/mob/living/living.dm
+++ b/code/modules/mob/living/living.dm
@@ -10,29 +10,16 @@
//mob verbs are faster than object verbs. See above.
var/mob/living/next_point_time = 0
-/mob/living/pointed(atom/movable/A as mob|obj|turf in view())
- if(!isturf(src.loc) || !(A in range(world.view, get_turf(src))))
- return FALSE
+/mob/living/pointed(atom/A as mob|obj|turf in view())
if(src.stat || !src.canmove || src.restrained())
return FALSE
if(src.status_flags & FAKEDEATH)
return FALSE
- if(next_point_time >= world.time)
- return FALSE
+
+ . = ..()
- next_point_time = world.time + 25
- face_atom(A)
- if(isturf(A))
- if(pointing_effect)
- QDEL_NULL(pointing_effect)
- pointing_effect = new /obj/effect/decal/point(A)
- pointing_effect.invisibility = invisibility
- addtimer(CALLBACK(GLOBAL_PROC, /proc/qdel, pointing_effect), 2 SECONDS)
- else
- A.add_filter("pointglow", 1, list(type = "drop_shadow", x = 0, y = -1, offset = 1, size = 1, color = "#F00"))
- addtimer(CALLBACK(A, /atom/movable.proc/remove_filter, "pointglow"), 2 SECONDS)
- visible_message("\The [src] points to \the [A].")
- return TRUE
+ if(.)
+ visible_message("\The [src] points to \the [A].")
/*one proc, four uses
swapping: if it's 1, the mobs are trying to switch, if 0, non-passive is pushing passive
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index f204258b51a..14689b72af0 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -333,26 +333,27 @@
set name = "Point To"
set category = "Object"
- if(!src || !isturf(src.loc) || !(A in range(world.view, get_turf(src))))
- return 0
- if(istype(A, /obj/effect/decal/point) || pointing_effect)
- return 0
-
- var/tile = get_turf(A)
- if (!tile)
- return 0
-
- pointing_effect = new /obj/effect/decal/point(tile)
- pointing_effect.invisibility = invisibility
- addtimer(CALLBACK(.proc/end_pointing_effect), 2 SECONDS)
+ if(!isturf(src.loc) || !(A in range(world.view, get_turf(src))))
+ return FALSE
+ if(next_point_time >= world.time)
+ return FALSE
+ next_point_time = world.time + 25
face_atom(A)
- return 1
+ if(isturf(A))
+ if(pointing_effect)
+ end_pointing_effect()
+ pointing_effect = new /obj/effect/decal/point(A)
+ pointing_effect.invisibility = invisibility
+ addtimer(CALLBACK(src, .proc/end_pointing_effect, pointing_effect), 2 SECONDS)
+ else
+ var/atom/movable/M = A
+ M.add_filter("pointglow", 1, list(type = "drop_shadow", x = 0, y = -1, offset = 1, size = 1, color = "#F00"))
+ addtimer(CALLBACK(M, /atom/movable.proc/remove_filter, "pointglow"), 2 SECONDS)
+ return TRUE
/mob/proc/end_pointing_effect()
- if(pointing_effect)
- qdel(pointing_effect)
- pointing_effect = null
+ QDEL_NULL(pointing_effect)
/mob/verb/mode()
set name = "Activate Held Object"
diff --git a/html/changelogs/pointing_bug.yml b/html/changelogs/pointing_bug.yml
new file mode 100644
index 00000000000..b16ac62cf8e
--- /dev/null
+++ b/html/changelogs/pointing_bug.yml
@@ -0,0 +1,6 @@
+author: mikomyazaki
+
+delete-after: True
+
+changes:
+ - bugfix: "Pointing arrows should now delete themselves properly."
\ No newline at end of file