mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Fix destroys() not calling parent, tweak qdel to use one loop only.
This commit is contained in:
@@ -62,8 +62,6 @@ obj/machinery/atmospherics/binary
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
Destroy()
|
Destroy()
|
||||||
loc = null
|
|
||||||
|
|
||||||
if(node1)
|
if(node1)
|
||||||
node1.disconnect(src)
|
node1.disconnect(src)
|
||||||
del(network1)
|
del(network1)
|
||||||
|
|||||||
@@ -77,8 +77,6 @@
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
Destroy()
|
Destroy()
|
||||||
loc = null
|
|
||||||
|
|
||||||
if(connected_device)
|
if(connected_device)
|
||||||
connected_device.disconnect()
|
connected_device.disconnect()
|
||||||
|
|
||||||
|
|||||||
@@ -73,8 +73,6 @@ obj/machinery/atmospherics/trinary
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
Destroy()
|
Destroy()
|
||||||
loc = null
|
|
||||||
|
|
||||||
if(node1)
|
if(node1)
|
||||||
node1.disconnect(src)
|
node1.disconnect(src)
|
||||||
del(network1)
|
del(network1)
|
||||||
|
|||||||
@@ -99,8 +99,6 @@ obj/machinery/atmospherics/tvalve
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
Destroy()
|
Destroy()
|
||||||
loc = null
|
|
||||||
|
|
||||||
if(node1)
|
if(node1)
|
||||||
node1.disconnect(src)
|
node1.disconnect(src)
|
||||||
del(network_node1)
|
del(network_node1)
|
||||||
|
|||||||
@@ -43,8 +43,6 @@
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
Destroy()
|
Destroy()
|
||||||
loc = null
|
|
||||||
|
|
||||||
if(node)
|
if(node)
|
||||||
node.disconnect(src)
|
node.disconnect(src)
|
||||||
del(network)
|
del(network)
|
||||||
|
|||||||
@@ -78,8 +78,6 @@ obj/machinery/atmospherics/valve
|
|||||||
return null
|
return null
|
||||||
|
|
||||||
Destroy()
|
Destroy()
|
||||||
loc = null
|
|
||||||
|
|
||||||
if(node1)
|
if(node1)
|
||||||
node1.disconnect(src)
|
node1.disconnect(src)
|
||||||
del(network_node1)
|
del(network_node1)
|
||||||
|
|||||||
@@ -153,8 +153,6 @@ atom/movable/Destroy()
|
|||||||
if(loc:lighting_lumcount > 1)
|
if(loc:lighting_lumcount > 1)
|
||||||
UpdateAffectingLights()
|
UpdateAffectingLights()
|
||||||
|
|
||||||
areaMaster = null
|
|
||||||
loc = null
|
|
||||||
..()
|
..()
|
||||||
|
|
||||||
//Sets our luminosity.
|
//Sets our luminosity.
|
||||||
|
|||||||
@@ -1,120 +1,58 @@
|
|||||||
#define GC_COLLECTIONS_PER_TICK 250 // Was 100.
|
#define GC_COLLECTIONS_PER_TICK 250 // Was 100.
|
||||||
#define GC_COLLECTION_TIMEOUT 100 // 10s.
|
#define GC_COLLECTION_TIMEOUT 100 // 10s.
|
||||||
#define GC_FORCE_DEL_PER_TICK 15
|
#define GC_FORCE_DEL_PER_TICK 20
|
||||||
|
|
||||||
var/global/datum/controller/garbage_collector/garbage
|
var/global/datum/controller/garbage_collector/garbage
|
||||||
|
|
||||||
var/global/list/uncollectable_vars=list(
|
|
||||||
"alpha",
|
|
||||||
"bestF",
|
|
||||||
"bounds",
|
|
||||||
"bound_height",
|
|
||||||
"bound_width",
|
|
||||||
"ckey",
|
|
||||||
"color",
|
|
||||||
"contents",
|
|
||||||
"gender",
|
|
||||||
"group",
|
|
||||||
"key",
|
|
||||||
//"loc",
|
|
||||||
"locs",
|
|
||||||
"luminosity",
|
|
||||||
"parent",
|
|
||||||
"parent_type",
|
|
||||||
"step_size",
|
|
||||||
"glide_size",
|
|
||||||
"gc_destroyed",
|
|
||||||
"step_x",
|
|
||||||
"step_y",
|
|
||||||
"step_z",
|
|
||||||
"tag",
|
|
||||||
"thermal_conductivity",
|
|
||||||
"type",
|
|
||||||
"vars",
|
|
||||||
"verbs",
|
|
||||||
"x",
|
|
||||||
"y",
|
|
||||||
"z",
|
|
||||||
)
|
|
||||||
|
|
||||||
/datum/controller/garbage_collector
|
/datum/controller/garbage_collector
|
||||||
var/list/queue = list()
|
var/list/queue = list()
|
||||||
var/list/destroyed = list()
|
|
||||||
var/waiting = 0
|
|
||||||
var/del_everything = 1
|
var/del_everything = 1
|
||||||
var/dels = 0
|
|
||||||
|
|
||||||
/datum/controller/garbage_collector/proc/Pop()
|
// To let them know how hardworking am I :^).
|
||||||
var/atom/A = queue[1]
|
var/dels_count = 0
|
||||||
|
var/hard_dels = 0
|
||||||
if (isnull(A))
|
|
||||||
var/loopcheck = 0
|
|
||||||
|
|
||||||
while (queue.Remove(null))
|
|
||||||
loopcheck++
|
|
||||||
|
|
||||||
if (loopcheck > 50)
|
|
||||||
break
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
if (del_everything)
|
|
||||||
del A
|
|
||||||
return
|
|
||||||
|
|
||||||
if (!istype(A,/atom/movable))
|
|
||||||
testing("GC given a [A.type].")
|
|
||||||
del A
|
|
||||||
return
|
|
||||||
|
|
||||||
for (var/vname in A.vars)
|
|
||||||
if (!issaved(A.vars[vname]))
|
|
||||||
continue
|
|
||||||
|
|
||||||
if (vname in uncollectable_vars)
|
|
||||||
continue
|
|
||||||
|
|
||||||
//testing("Unsetting [vname] in [A.type]!")
|
|
||||||
A.vars[vname] = null
|
|
||||||
|
|
||||||
destroyed.Add("\ref[A]")
|
|
||||||
queue.Remove(A)
|
|
||||||
|
|
||||||
/datum/controller/garbage_collector/proc/process()
|
/datum/controller/garbage_collector/proc/process()
|
||||||
dels = 0
|
var/dels = 0
|
||||||
|
var/queue_size = min(queue.len, GC_COLLECTIONS_PER_TICK)
|
||||||
|
|
||||||
for (var/i = 0, ++i <= min(waiting, GC_COLLECTIONS_PER_TICK))
|
for (var/i = 0, ++i <= queue_size)
|
||||||
if (waiting--)
|
var/atom/movable/A = locate(queue[1])
|
||||||
Pop()
|
|
||||||
|
|
||||||
for (var/i = 0, ++i <= min(destroyed.len, GC_COLLECTIONS_PER_TICK))
|
if (A && A.gc_destroyed)
|
||||||
var/refID = destroyed[1]
|
if (++dels <= GC_FORCE_DEL_PER_TICK)
|
||||||
var/atom/A = locate(refID)
|
break
|
||||||
|
|
||||||
|
WARNING("gc process force delete [A.type]")
|
||||||
|
|
||||||
if (A && A.gc_destroyed && A.gc_destroyed >= world.timeofday - GC_COLLECTION_TIMEOUT)
|
|
||||||
// Something's still referring to the qdel'd object. Kill it.
|
// Something's still referring to the qdel'd object. Kill it.
|
||||||
del A
|
del A
|
||||||
dels++
|
hard_dels++
|
||||||
|
|
||||||
destroyed.Remove(refID)
|
queue.Cut(1, 2)
|
||||||
|
dels_count++
|
||||||
|
|
||||||
/datum/controller/garbage_collector/proc/AddTrash(const/atom/A)
|
#undef GC_FORCE_DEL_PER_TICK
|
||||||
|
#undef GC_COLLECTION_TIMEOUT
|
||||||
|
#undef GC_COLLECTIONS_PER_TICK
|
||||||
|
|
||||||
|
/datum/controller/garbage_collector/proc/AddTrash(const/atom/movable/A)
|
||||||
if (isnull(A))
|
if (isnull(A))
|
||||||
return
|
return
|
||||||
|
|
||||||
if (del_everything)
|
if (del_everything)
|
||||||
del A
|
del A
|
||||||
dels++
|
hard_dels++
|
||||||
|
dels_count++
|
||||||
return
|
return
|
||||||
|
|
||||||
queue.Add(A)
|
queue.Add(A)
|
||||||
waiting++
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* NEVER USE THIS FOR ANYTHING OTHER THAN /atom.
|
* NEVER USE THIS FOR ANYTHING OTHER THAN /atom/movable and derived types.
|
||||||
*/
|
*/
|
||||||
/proc/qdel(const/atom/A)
|
/proc/qdel(const/atom/movable/A)
|
||||||
if (isnull(A)) // Two possibilities, proc is called with null arg or object is gced normally.
|
if (isnull(A))
|
||||||
return
|
return
|
||||||
|
|
||||||
if (isnull(garbage))
|
if (isnull(garbage))
|
||||||
@@ -122,9 +60,10 @@ var/global/list/uncollectable_vars=list(
|
|||||||
return
|
return
|
||||||
|
|
||||||
if (!istype(A))
|
if (!istype(A))
|
||||||
WARNING("qdel() passed object of type [A.type]. qdel() can only handle /atom types.")
|
WARNING("qdel() passed object of type [A.type]. qdel() can only handle /atom/movable derived types.")
|
||||||
del A
|
del A
|
||||||
garbage.dels++
|
garbage.hard_dels++
|
||||||
|
garbage.dels_count++
|
||||||
return
|
return
|
||||||
|
|
||||||
// Let our friend know they're about to get fucked up.
|
// Let our friend know they're about to get fucked up.
|
||||||
|
|||||||
@@ -27,9 +27,6 @@
|
|||||||
//Detective Work, used for the duplicate data points kept in the scanners
|
//Detective Work, used for the duplicate data points kept in the scanners
|
||||||
var/list/original_atom
|
var/list/original_atom
|
||||||
|
|
||||||
// Garbage collection
|
|
||||||
var/gc_destroyed=null
|
|
||||||
|
|
||||||
/atom/proc/throw_impact(atom/hit_atom, var/speed)
|
/atom/proc/throw_impact(atom/hit_atom, var/speed)
|
||||||
if(istype(hit_atom,/mob/living))
|
if(istype(hit_atom,/mob/living))
|
||||||
var/mob/living/M = hit_atom
|
var/mob/living/M = hit_atom
|
||||||
@@ -68,10 +65,6 @@
|
|||||||
warning("Type [type] does not inherit /atom/New(). Please ensure ..() is called, or that the type at least adds to type_instances\[type\].")
|
warning("Type [type] does not inherit /atom/New(). Please ensure ..() is called, or that the type at least adds to type_instances\[type\].")
|
||||||
|
|
||||||
/atom/Del()
|
/atom/Del()
|
||||||
// Pass to Destroy().
|
|
||||||
if(!gc_destroyed)
|
|
||||||
Destroy()
|
|
||||||
|
|
||||||
// Only call when we're actually deleted.
|
// Only call when we're actually deleted.
|
||||||
DeleteFromProfiler()
|
DeleteFromProfiler()
|
||||||
|
|
||||||
@@ -80,13 +73,6 @@
|
|||||||
/atom/New()
|
/atom/New()
|
||||||
AddToProfiler()
|
AddToProfiler()
|
||||||
|
|
||||||
|
|
||||||
// Like Del(), but for qdel.
|
|
||||||
// Called BEFORE qdel moves shit.
|
|
||||||
/atom/proc/Destroy()
|
|
||||||
gc_destroyed = world.timeofday
|
|
||||||
invisibility = 101
|
|
||||||
|
|
||||||
/atom/proc/assume_air(datum/gas_mixture/giver)
|
/atom/proc/assume_air(datum/gas_mixture/giver)
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
var/area/areaMaster
|
var/area/areaMaster
|
||||||
|
|
||||||
|
// Garbage collection (qdel).
|
||||||
|
var/gc_destroyed
|
||||||
|
|
||||||
/atom/movable/Move()
|
/atom/movable/Move()
|
||||||
var/atom/A = src.loc
|
var/atom/A = src.loc
|
||||||
. = ..()
|
. = ..()
|
||||||
@@ -186,9 +189,24 @@
|
|||||||
return src.master.attack_hand(a, b, c)
|
return src.master.attack_hand(a, b, c)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
/atom/movable/Del()
|
||||||
|
// Pass to Destroy().
|
||||||
|
if (isnull(gc_destroyed))
|
||||||
|
Destroy()
|
||||||
|
|
||||||
|
..()
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Like Del(), but for qdel.
|
||||||
|
* Called BEFORE qdel moves shit.
|
||||||
|
*/
|
||||||
|
/atom/movable/proc/Destroy()
|
||||||
|
gc_destroyed = world.timeofday
|
||||||
|
areaMaster = null
|
||||||
|
loc = null
|
||||||
|
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
// SINGULOTH PULL REFACTOR
|
// SINGULOTH PULL REFACTOR
|
||||||
/////////////////////////////
|
/////////////////////////////
|
||||||
/atom/movable/proc/canSingulothPull(var/obj/machinery/singularity/singulo)
|
/atom/movable/proc/canSingulothPull(var/obj/machinery/singularity/singulo)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
del(overmind)
|
del(overmind)
|
||||||
processing_objects.Remove(src)
|
processing_objects.Remove(src)
|
||||||
..()
|
..()
|
||||||
return
|
|
||||||
|
|
||||||
fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
fire_act(datum/gas_mixture/air, exposed_temperature, exposed_volume)
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -18,7 +18,6 @@
|
|||||||
blob_nodes -= src
|
blob_nodes -= src
|
||||||
processing_objects.Remove(src)
|
processing_objects.Remove(src)
|
||||||
..()
|
..()
|
||||||
return
|
|
||||||
|
|
||||||
Life()
|
Life()
|
||||||
for(var/i = 1; i < 8; i += i)
|
for(var/i = 1; i < 8; i += i)
|
||||||
|
|||||||
@@ -26,8 +26,6 @@
|
|||||||
/obj/effect/blob/Destroy()
|
/obj/effect/blob/Destroy()
|
||||||
blobs -= src
|
blobs -= src
|
||||||
..()
|
..()
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
/obj/effect/blob/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
/obj/effect/blob/CanPass(atom/movable/mover, turf/target, height=0, air_group=0)
|
||||||
if(air_group || (height==0)) return 1
|
if(air_group || (height==0)) return 1
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ ________________________________________________________________________________
|
|||||||
del(hologram.i_attached)//Delete it and the attached image.
|
del(hologram.i_attached)//Delete it and the attached image.
|
||||||
del(hologram)
|
del(hologram)
|
||||||
..()
|
..()
|
||||||
return
|
|
||||||
|
|
||||||
//Simply deletes all the attachments and self, killing all related procs.
|
//Simply deletes all the attachments and self, killing all related procs.
|
||||||
/obj/item/clothing/suit/space/space_ninja/proc/terminate()
|
/obj/item/clothing/suit/space/space_ninja/proc/terminate()
|
||||||
|
|||||||
@@ -22,4 +22,6 @@ obj/structure/meteorhit(obj/O as obj)
|
|||||||
|
|
||||||
/obj/structure/Destroy()
|
/obj/structure/Destroy()
|
||||||
if(hascall(src, "unbuckle"))
|
if(hascall(src, "unbuckle"))
|
||||||
src:unbuckle()
|
src:unbuckle()
|
||||||
|
|
||||||
|
..()
|
||||||
@@ -100,7 +100,7 @@
|
|||||||
|
|
||||||
..()*/
|
..()*/
|
||||||
|
|
||||||
/turf/simulated/wall/Destroy()
|
/turf/simulated/wall/Del()
|
||||||
|
|
||||||
var/temploc = src.loc
|
var/temploc = src.loc
|
||||||
|
|
||||||
|
|||||||
@@ -421,7 +421,7 @@
|
|||||||
ReplaceWithLattice()
|
ReplaceWithLattice()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
/turf/simulated/wall/Destroy()
|
/turf/simulated/wall/Del()
|
||||||
for(var/obj/effect/E in src) if(E.name == "Wallrot") del E
|
for(var/obj/effect/E in src) if(E.name == "Wallrot") del E
|
||||||
..()
|
..()
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,8 @@
|
|||||||
A.a_right = null
|
A.a_right = null
|
||||||
src.holder = null
|
src.holder = null
|
||||||
|
|
||||||
|
..()
|
||||||
|
|
||||||
pulsed(var/radio = 0)
|
pulsed(var/radio = 0)
|
||||||
if(holder && (wires & WIRE_RECEIVE))
|
if(holder && (wires & WIRE_RECEIVE))
|
||||||
activate()
|
activate()
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ var/list/artifact_spawn = list() // Runtime fix for geometry loading before cont
|
|||||||
var/datum/artifact_find/artifact_find
|
var/datum/artifact_find/artifact_find
|
||||||
var/scan_state = null //Holder for the image we display when we're pinged by a mining scanner
|
var/scan_state = null //Holder for the image we display when we're pinged by a mining scanner
|
||||||
|
|
||||||
/turf/unsimulated/mineral/Destroy()
|
|
||||||
return
|
|
||||||
|
|
||||||
/turf/unsimulated/mineral/New()
|
/turf/unsimulated/mineral/New()
|
||||||
. = ..()
|
. = ..()
|
||||||
MineralSpread()
|
MineralSpread()
|
||||||
@@ -669,9 +666,6 @@ var/list/artifact_spawn = list() // Runtime fix for geometry loading before cont
|
|||||||
"Phazon" = 10
|
"Phazon" = 10
|
||||||
)
|
)
|
||||||
|
|
||||||
/turf/unsimulated/mineral/random/Destroy()
|
|
||||||
return
|
|
||||||
|
|
||||||
/turf/unsimulated/mineral/uranium
|
/turf/unsimulated/mineral/uranium
|
||||||
name = "Uranium deposit"
|
name = "Uranium deposit"
|
||||||
icon_state = "rock_Uranium"
|
icon_state = "rock_Uranium"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
if(ticker)
|
if(ticker)
|
||||||
cameranet.updateVisibility(src)
|
cameranet.updateVisibility(src)
|
||||||
|
|
||||||
/turf/simulated/Destroy()
|
/turf/simulated/Del()
|
||||||
visibilityChanged()
|
visibilityChanged()
|
||||||
..()
|
..()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user