Cleanups and tweaks observer code (#30250)

* observer cleanup

* this

* bit more

* Update tgui.bundle.js
This commit is contained in:
kyunkyunkyun
2025-09-05 05:54:22 +00:00
committed by GitHub
parent 8f98876b47
commit 10f2e67e65
66 changed files with 362 additions and 447 deletions
+1 -1
View File
@@ -269,7 +269,7 @@
else if(!target.get_organ_slot("brain")) // So things like headless clings don't get outed
failure_message = "<span class='boldnotice'>[defib_ref] buzzes: Resuscitation failed - No brain detected within patient.</span>"
else if(ghost)
if(!ghost.can_reenter_corpse || target.suiciding) // DNR or AntagHUD
if(!(ghost.ghost_flags & GHOST_CAN_REENTER) || target.suiciding) // DNR or AntagHUD
failure_message = "<span class='boldnotice'>[defib_ref] buzzes: Resuscitation failed - No electrical brain activity detected.</span>"
else
failure_message = "<span class='boldnotice'>[defib_ref] buzzes: Resuscitation failed - Patient's brain is unresponsive. Further attempts may succeed.</span>"
+5 -5
View File
@@ -1776,11 +1776,11 @@
S.action.Grant(new_character)
/datum/mind/proc/get_ghost(even_if_they_cant_reenter)
for(var/mob/dead/observer/G in GLOB.dead_mob_list)
if(G.mind == src && G.mind.key == G.key)
if(G.can_reenter_corpse || even_if_they_cant_reenter)
return G
break
for(var/mob/dead/observer/ghost in GLOB.dead_mob_list)
if(ghost.mind == src && ghost.mind.key == ghost.key)
if(ghost.ghost_flags & GHOST_CAN_REENTER || even_if_they_cant_reenter)
return ghost
return
/datum/mind/proc/check_ghost_client()
var/mob/dead/observer/G = get_ghost()
+8 -11
View File
@@ -1,10 +1,6 @@
/datum/spawners_menu
var/mob/dead/observer/owner
GLOBAL_DATUM_INIT(ghost_spawners_menu, /datum/spawners_menu, new)
/datum/spawners_menu/New(mob/dead/observer/new_owner)
if(!istype(new_owner))
qdel(src)
owner = new_owner
/datum/spawners_menu
/datum/spawners_menu/ui_state(mob/user)
return GLOB.observer_state
@@ -26,9 +22,9 @@
this["important_info"] = ""
this["fluff"] = ""
this["uids"] = list()
for(var/spawner_obj in GLOB.mob_spawners[spawner])//each spawner can contain multiple actual spawners, we use only one desc/info
this["uids"] += "\ref[spawner_obj]"
if(!this["desc"]) //haven't set descriptions yet
for(var/obj/effect/mob_spawn/spawner_obj as anything in GLOB.mob_spawners[spawner]) // each spawner can contain multiple actual spawners, we use only one desc/info
this["uids"] += "[spawner_obj.UID()]"
if(!this["desc"]) // haven't set descriptions yet
if(istype(spawner_obj, /obj/effect/mob_spawn))
var/obj/effect/mob_spawn/MS = spawner_obj
this["desc"] = MS.description
@@ -54,9 +50,10 @@
CRASH("A ghost tried to interact with an invalid spawner, or the spawner didn't exist.")
switch(action)
if("jump")
owner.forceMove(get_turf(MS))
var/mob/dead/observer/ghost = usr
ghost.abstract_move(get_turf(MS))
. = TRUE
if("spawn")
if(MS.attack_ghost(owner))
if(MS.attack_ghost(usr))
SSblackbox.record_feedback("tally", "ghost_spawns", 1, "[MS.assignedrole]")
. = TRUE
+1 -2
View File
@@ -64,7 +64,7 @@ Also, you never added distance checking after target is selected. I've went ahea
for(var/V in victim.mind.special_verbs)
remove_verb(victim, V)
var/mob/dead/observer/ghost = victim.ghostize(0)
var/mob/dead/observer/ghost = victim.ghostize()
caster.mind.transfer_to(victim)
if(length(victim.mind.special_verbs))//To add all the special verbs for the original caster.
@@ -73,7 +73,6 @@ Also, you never added distance checking after target is selected. I've went ahea
ghost.mind.transfer_to(caster)
if(ghost.key)
GLOB.non_respawnable_keys -= ghost.ckey
caster.key = ghost.key //have to transfer the key since the mind was not active
qdel(ghost)