mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 08:37:43 +01:00
First pass at a qdel() garbage collection system for tgstation
Works pretty well. If it can't GC something, it'll just del() it and be done. Speed is amazing, holy shit. New procs you should be aware of: qdel(atom/movable) - sets up an object for garbage collection. Call this rather than del(atom/movable). atom/movable/Destroy() - called right before the object is GC'd, so it still has a loc. Also called if the object is del()'d. new controller - garbage.dm has all the details on this. Basically it nulls all references on GC'd objects and force del() them if necessary. Generally speaking, objects should use Destroy() for behavior prior to deletion rather than Del(). You should also always call the parent so the object gets the right gc_destroyed var set. ISSUES: Tries to GC mobs atm. This actually works for new players, not so much for humans/monkies/simple_animals/anything. I'm guessing it needs to clear out their mind and HUD and maybe other things. Gibbing is really bugged. It works, but the overlays just sit there for awhile and ugh. I'm very tempted just to del() mob/living and mob/camera and call it a day. qdel() equipment doesn't unequip the item. Pipes don't generally GC correctly. Debugging suggests they get referenced in many pipenets and that isn't cleared properly. However some do work fine. Need assistance here. Bots don't GC, probably in the radio controller. Lots of other shit doesn't GC but it's hard to find them because of the pipe spam. I think I'm calling Destroy() twice by accident.
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
sleep(22)
|
||||
//animation = null
|
||||
var/mob/living/carbon/monkey/O = new /mob/living/carbon/monkey( loc )
|
||||
del(animation)
|
||||
qdel(animation)
|
||||
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
updateappearance(O)
|
||||
. = O
|
||||
if ( !(tr_flags & TR_KEEPSRC) ) //flag should be used if monkeyize() is called inside another proc of src so that one does not crash
|
||||
del(src)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@
|
||||
var/mob/living/carbon/human/O = new( loc )
|
||||
for(var/obj/item/C in O.loc)
|
||||
O.equip_to_appropriate_slot(C)
|
||||
del(animation)
|
||||
qdel(animation)
|
||||
|
||||
|
||||
O.gender = (deconstruct_block(getblock(dna.uni_identity, DNA_GENDER_BLOCK), 2)-1) ? FEMALE : MALE
|
||||
@@ -176,7 +176,7 @@
|
||||
updateappearance(O)
|
||||
. = O
|
||||
if ( !(tr_flags & TR_KEEPSRC) ) //don't delete src yet if it's needed to finish calling proc
|
||||
del(src)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
/mob/new_player/AIize()
|
||||
@@ -187,7 +187,7 @@
|
||||
if (notransform)
|
||||
return
|
||||
for(var/t in organs)
|
||||
del(t)
|
||||
qdel(t)
|
||||
|
||||
return ..()
|
||||
|
||||
@@ -259,7 +259,7 @@
|
||||
|
||||
O.rename_self("ai",1)
|
||||
. = O
|
||||
del(src)
|
||||
qdel(src)
|
||||
return
|
||||
|
||||
|
||||
@@ -269,7 +269,7 @@
|
||||
return
|
||||
for(var/obj/item/W in src)
|
||||
if(delete_items)
|
||||
del(W)
|
||||
qdel(W)
|
||||
else
|
||||
unEquip(W)
|
||||
regenerate_icons()
|
||||
@@ -278,7 +278,7 @@
|
||||
icon = null
|
||||
invisibility = 101
|
||||
for(var/t in organs)
|
||||
del(t)
|
||||
qdel(t)
|
||||
|
||||
var/mob/living/silicon/robot/O = new /mob/living/silicon/robot( loc )
|
||||
|
||||
@@ -306,7 +306,7 @@
|
||||
O.mmi.transfer_identity(src)//Does not transfer key/client.
|
||||
|
||||
. = O
|
||||
del(src)
|
||||
qdel(src)
|
||||
|
||||
//human -> alien
|
||||
/mob/living/carbon/human/proc/Alienize()
|
||||
@@ -320,7 +320,7 @@
|
||||
icon = null
|
||||
invisibility = 101
|
||||
for(var/t in organs)
|
||||
del(t)
|
||||
qdel(t)
|
||||
|
||||
var/alien_caste = pick("Hunter","Sentinel","Drone")
|
||||
var/mob/living/carbon/alien/humanoid/new_xeno
|
||||
@@ -337,7 +337,7 @@
|
||||
|
||||
new_xeno << "<B>You are now an alien.</B>"
|
||||
. = new_xeno
|
||||
del(src)
|
||||
qdel(src)
|
||||
|
||||
/mob/living/carbon/human/proc/slimeize(reproduce as num)
|
||||
if (notransform)
|
||||
@@ -350,7 +350,7 @@
|
||||
icon = null
|
||||
invisibility = 101
|
||||
for(var/t in organs)
|
||||
del(t)
|
||||
qdel(t)
|
||||
|
||||
var/mob/living/carbon/slime/new_slime
|
||||
if(reproduce)
|
||||
@@ -369,7 +369,7 @@
|
||||
|
||||
new_slime << "<B>You are now a slime. Skreee!</B>"
|
||||
. = new_slime
|
||||
del(src)
|
||||
qdel(src)
|
||||
|
||||
/mob/living/carbon/human/proc/Blobize()
|
||||
if (notransform)
|
||||
@@ -397,7 +397,7 @@
|
||||
icon = null
|
||||
invisibility = 101
|
||||
for(var/t in organs) //this really should not be necessary
|
||||
del(t)
|
||||
qdel(t)
|
||||
|
||||
var/mob/living/simple_animal/corgi/new_corgi = new /mob/living/simple_animal/corgi (loc)
|
||||
new_corgi.a_intent = "harm"
|
||||
@@ -405,7 +405,7 @@
|
||||
|
||||
new_corgi << "<B>You are now a Corgi. Yap Yap!</B>"
|
||||
. = new_corgi
|
||||
del(src)
|
||||
qdel(src)
|
||||
|
||||
/mob/living/carbon/human/Animalize()
|
||||
|
||||
@@ -428,7 +428,7 @@
|
||||
invisibility = 101
|
||||
|
||||
for(var/t in organs)
|
||||
del(t)
|
||||
qdel(t)
|
||||
|
||||
var/mob/new_mob = new mobpath(src.loc)
|
||||
|
||||
@@ -438,7 +438,7 @@
|
||||
|
||||
new_mob << "You suddenly feel more... animalistic."
|
||||
. = new_mob
|
||||
del(src)
|
||||
qdel(src)
|
||||
|
||||
/mob/proc/Animalize()
|
||||
|
||||
@@ -456,7 +456,7 @@
|
||||
new_mob << "You feel more... animalistic"
|
||||
|
||||
. = new_mob
|
||||
del(src)
|
||||
qdel(src)
|
||||
|
||||
/* Certain mob types have problems and should not be allowed to be controlled by players.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user