Ghost follow and teleport fixes (#36611)

* begin code cutdown to analyse problem

* moves this here

* puts it here, plus cleanup

* forgot these

* moves this here

* feedback and cutdown

* missed a spot

* more correct

* fixes this

* removes outdated info

* makes this get_area() not called until after the turf checks, so if it fails here doing this isn't needed
This commit is contained in:
SECBATON GRIFFON
2024-06-10 13:22:07 +01:00
committed by GitHub
parent 417fb89ccf
commit 5d5fe2985e
21 changed files with 86 additions and 98 deletions

View File

@@ -413,13 +413,13 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
/mob/dead/observer/proc/manual_follow(var/atom/movable/target)
if(target)
var/turf/targetloc = get_turf(target)
if(targetloc && targetloc.holy && (!invisibility || islegacycultist(src)))
to_chat(usr, "<span class='warning'>You cannot follow a mob standing on holy grounds!</span>")
return
var/area/targetarea = get_area(target)
if(targetarea && targetarea.anti_ethereal && !isAdminGhost(usr))
to_chat(usr, "<span class='sinister'>You can sense a sinister force surrounding that mob, your spooky body itself refuses to follow it.</span>")
return
if(targetloc && targetloc.holy && (!invisibility || islegacycultist(src)))
to_chat(usr, "<span class='warning'>You cannot follow a mob standing on holy grounds!</span>")
return
if(target != src)
if(locked_to)
if(locked_to == target) //Trying to follow same target, don't do anything
@@ -453,43 +453,54 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(istype(A))
A.reenter_corpse()
//BEGIN TELEPORT HREF CODE
if(usr != src)
return
..()
if(href_list["follow"])
var/target = locate(href_list["follow"])
if(target)
if(isAI(target))
var/mob/living/silicon/ai/M = target
target = M.eyeobj
manual_follow(target)
//BEGIN TELEPORT HREF CODE
/datum/subsystem/mob/Topic(href, href_list)
if(istype(usr,/mob/dead/observer))
var/mob/dead/observer/O = usr
if(href_list["follow"])
var/target = locate(href_list["follow"])
if(target)
if(isAI(target))
var/mob/living/silicon/ai/M = target
if(!istype(M.loc,/obj/item/device/aicard))
target = M.eyeobj
O.manual_follow(target)
else
to_chat(O, "That mob doesn't seem to exist anymore.")
return
if (href_list["jump"])
var/mob/target = locate(href_list["jump"])
var/mob/A = usr;
to_chat(A, "Teleporting to [target]...")
if(target && target != usr)
var/turf/pos = get_turf(A)
var/turf/T=get_turf(target)
if(T != pos)
if(!T)
to_chat(A, "<span class='warning'>Target not in a turf.</span>")
return
if(locked_to)
manual_stop_follow(locked_to)
forceMove(T)
if (href_list["jump"])
var/target = locate(href_list["jump"])
if(target && target != usr)
to_chat(O, "Teleporting to [target]...")
var/turf/pos = get_turf(O)
var/turf/T=get_turf(target)
if(T != pos)
if(!T)
to_chat(O, "<span class='warning'>Target not in a turf.</span>")
return
if(O.locked_to)
O.manual_stop_follow(O.locked_to)
O.forceMove(T)
else
to_chat(O, "That thing doesn't seem to exist anymore, or is you.")
return
if(href_list["jumptoarenacood"])
var/datum/bomberman_arena/targetarena = locate(href_list["targetarena"])
if(targetarena)
if(locked_to)
manual_stop_follow(locked_to)
usr.forceMove(targetarena.center)
to_chat(usr, "Remember to enable darkness to be able to see the spawns. Click on a green spawn between rounds to register on it.")
else
to_chat(usr, "That arena doesn't seem to exist anymore.")
if(href_list["targetarena"])
var/datum/bomberman_arena/targetarena = locate(href_list["targetarena"])
if(targetarena)
if(O.locked_to)
O.manual_stop_follow(O.locked_to)
O.forceMove(targetarena.center)
to_chat(O, "Click on a green spawn between rounds to register on it.")
else
to_chat(O, "That arena doesn't seem to exist anymore.")
return
return ..()
//END TELEPORT HREF CODE
@@ -532,7 +543,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if (get_dist(source_turf, src) <= world.view) // If this isn't true, we can't be in view, so no need for costlier proc.
if (source_turf in view(src))
rendered_speech = "<B>[rendered_speech]</B>"
to_chat(src, "<a href='?src=\ref[src];follow=\ref[source]'>(Follow)</a> [rendered_speech]")
to_chat(src, "[formatFollow(source)] [rendered_speech]")
/mob/dead/observer/hasHUD(var/hud_kind)
switch(hud_kind)

View File

@@ -54,4 +54,4 @@
say_testing(src, "/mob/dead/observer/Hear(): CHAT_GHOSTRADIO is disabled, blocking. ([client.prefs.toggles] & [CHAT_GHOSTRADIO]) = [client.prefs.toggles & CHAT_GHOSTRADIO]")
return
to_chat(src, "<a href='?src=\ref[src];follow=\ref[source]'>(Follow)</a> [rendered_speech]")
to_chat(src, "[formatFollow(source)] [rendered_speech]")