Pointing decals now delete themselves properly (#13198)

This commit is contained in:
mikomyazaki
2022-02-16 18:46:53 +00:00
committed by GitHub
parent a5c6edc22e
commit d4e29ae4ee
3 changed files with 28 additions and 34 deletions
+5 -18
View File
@@ -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("<b>\The [src]</b> points to \the [A].")
return TRUE
if(.)
visible_message("<b>\The [src]</b> 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
+17 -16
View File
@@ -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"
+6
View File
@@ -0,0 +1,6 @@
author: mikomyazaki
delete-after: True
changes:
- bugfix: "Pointing arrows should now delete themselves properly."