More Destroy()s, better implementation

- Re-implements Destroy() for SMES units. This time moves relevant (de)construction code all the way up to obj/machinery/. This should fix any potential GC issues with deconstruction of component-based machines.
- Implements Destroy() for breaker boxes.
- Fixes SMES units lacking disconnect_terminal(), causing GC errors.
This commit is contained in:
Atlantis
2015-06-06 11:04:41 +02:00
parent b16bf61d03
commit 8a5a969002
5 changed files with 25 additions and 8 deletions
+9
View File
@@ -123,6 +123,15 @@ Class Procs:
/obj/machinery/Destroy()
machines -= src
if(component_parts)
for(var/atom/A in component_parts)
if(A.loc == src) // If the components are inside the machine, delete them.
qdel(A)
else // Otherwise we assume they were dropped to the ground during deconstruction, and were not removed from the component_parts list by deconstruction code.
component_parts -= A
if(contents) // The same for contents.
for(var/atom/A in contents)
qdel(A)
..()
/obj/machinery/process()//If you dont use process or power why are you here
+5
View File
@@ -19,6 +19,11 @@
var/RCon_tag = "NO_TAG"
var/update_locked = 0
/obj/machinery/power/breakerbox/Destroy()
..()
for(var/obj/nano_module/rcon/R in world)
R.FindDevices()
/obj/machinery/power/breakerbox/activated
icon_state = "bbox_on"
+2
View File
@@ -17,6 +17,8 @@
/obj/machinery/power/Destroy()
disconnect_from_network()
disconnect_terminal()
..()
///////////////////////////////
+5 -3
View File
@@ -84,10 +84,12 @@
return
/obj/machinery/power/smes/Destroy()
/obj/machinery/power/smes/disconnect_terminal()
if(terminal)
disconnect_terminal()
..()
terminal.master = null
terminal = null
return 1
return 0
/obj/machinery/power/smes/update_icon()
overlays.Cut()
+4 -5
View File
@@ -76,12 +76,10 @@
should_be_mapped = 1
/obj/machinery/power/smes/buildable/Destroy()
..()
qdel(wires)
if(component_parts)
for(var/atom/A in component_parts)
qdel(A)
return ..()
for(var/obj/nano_module/rcon/R in world)
R.FindDevices()
// Proc: process()
@@ -354,6 +352,7 @@
if(I.reliability != 100 && crit_fail)
I.crit_fail = 1
I.loc = src.loc
component_parts -= I
qdel(src)
return