Makes playable mobs GC better by reworking how GLOB.respawnable_list works (#17217)

This commit is contained in:
Farie82
2021-12-13 09:22:08 +01:00
committed by GitHub
parent 1df1f05323
commit 60647dc4c0
10 changed files with 21 additions and 17 deletions
+1 -1
View File
@@ -27,7 +27,7 @@
var/obj/vent = pick_n_take(vents)
var/mob/C = pick_n_take(candidates)
if(C)
GLOB.respawnable_list -= C.client
C.remove_from_respawnable_list()
var/mob/living/carbon/alien/larva/new_xeno = new(vent.loc)
new_xeno.amount_grown += (0.75 * new_xeno.max_grown) //event spawned larva start off almost ready to evolve.
new_xeno.key = C.key
+1 -1
View File
@@ -47,7 +47,7 @@ GLOBAL_LIST_INIT(unused_trade_stations, list("sol"))
var/mob/C = pick_n_take(candidates)
spawn_count--
if(C)
GLOB.respawnable_list -= C.client
C.remove_from_respawnable_list()
var/mob/living/carbon/human/M = new /mob/living/carbon/human(picked_loc)
M.ckey = C.ckey // must be before equipOutfit, or that will runtime due to lack of mind
M.equipOutfit(/datum/outfit/admin/sol_trader)
+1 -1
View File
@@ -6,4 +6,4 @@
if(GLOB.non_respawnable_keys[ckey])
can_reenter_corpse = 0
GLOB.respawnable_list -= src
remove_from_respawnable_list()
+2 -2
View File
@@ -164,9 +164,9 @@ Works together with spawning an observer, noted above.
flags &= ~GHOST_CAN_REENTER
var/mob/dead/observer/ghost = new(src, flags) //Transfer safety to observer spawning proc.
ghost.timeofdeath = src.timeofdeath //BS12 EDIT
GLOB.respawnable_list -= src
remove_from_respawnable_list()
if(ghost.can_reenter_corpse)
GLOB.respawnable_list += ghost
ghost.add_to_respawnable_list()
else
GLOB.non_respawnable_keys[ckey] = 1
ghost.key = key
+2 -2
View File
@@ -51,7 +51,7 @@
brainmob.forceMove(src)
brainmob.stat = CONSCIOUS
brainmob.see_invisible = initial(brainmob.see_invisible)
GLOB.respawnable_list -= brainmob
brainmob.remove_from_respawnable_list()
GLOB.dead_mob_list -= brainmob//Update dem lists
GLOB.alive_mob_list += brainmob
@@ -161,7 +161,7 @@
brainmob.container = null//Reset brainmob mmi var.
brainmob.forceMove(held_brain) //Throw mob into brain.
GLOB.respawnable_list += brainmob
brainmob.add_to_respawnable_list()
GLOB.alive_mob_list -= brainmob//Get outta here
held_brain.brainmob = brainmob//Set the brain to use the brainmob
held_brain.brainmob.cancel_camera()
+1 -1
View File
@@ -85,7 +85,7 @@
GLOB.dead_mob_list += src
if(mind)
mind.store_memory("Time of death: [station_time_timestamp("hh:mm:ss", timeofdeath)]", 0)
GLOB.respawnable_list += src
add_to_respawnable_list()
if(mind.name && !isbrain(src)) // !isbrain() is to stop it from being called twice
var/turf/T = get_turf(src)
+1 -1
View File
@@ -54,7 +54,7 @@
GLOB.dead_mob_list -= src
GLOB.alive_mob_list += src
if(mind)
GLOB.respawnable_list -= src
remove_from_respawnable_list()
timeofdeath = null
if(updating)
update_canmove()
+10 -6
View File
@@ -1095,6 +1095,14 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
/mob/proc/activate_hand(selhand)
return
/mob/proc/add_to_respawnable_list()
GLOB.respawnable_list += src
RegisterSignal(src, COMSIG_PARENT_QDELETING, .proc/remove_from_respawnable_list)
/mob/proc/remove_from_respawnable_list()
GLOB.respawnable_list -= src
UnregisterSignal(src, COMSIG_PARENT_QDELETING)
/mob/dead/observer/verb/respawn()
set name = "Respawn as NPC"
set category = "Ghost"
@@ -1115,17 +1123,13 @@ GLOBAL_LIST_INIT(slot_equipment_priority, list( \
var/picked = input("Please select an NPC to respawn as", "Respawn as NPC") as null|anything in creatures
switch(picked)
if("Mouse")
GLOB.respawnable_list -= usr
remove_from_respawnable_list()
become_mouse()
spawn(5)
GLOB.respawnable_list += usr
else
var/mob/living/NPC = picked
if(istype(NPC) && !NPC.key)
GLOB.respawnable_list -= usr
remove_from_respawnable_list()
NPC.key = key
spawn(5)
GLOB.respawnable_list += usr
else
to_chat(usr, "You are not dead or you have given up your right to be respawned!")
return
+1 -1
View File
@@ -194,7 +194,7 @@
observer.name = observer.real_name
observer.key = key
QDEL_NULL(mind)
GLOB.respawnable_list += observer
observer.add_to_respawnable_list()
qdel(src)
return TRUE
return FALSE
+1 -1
View File
@@ -69,7 +69,7 @@ GLOBAL_DATUM_INIT(ghost_hud_panel, /datum/ui_module/ghost_hud_panel, new)
ghost.has_enabled_antagHUD = TRUE
ghost.can_reenter_corpse = FALSE
GLOB.respawnable_list -= ghost
ghost.remove_from_respawnable_list()
ghost.antagHUD = TRUE
for(var/datum/atom_hud/antag/H in GLOB.huds)